aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--packages/monorepo-scripts/src/deps_versions.ts2
-rw-r--r--packages/monorepo-scripts/src/find_unused_dependencies.ts2
-rw-r--r--packages/monorepo-scripts/src/postpublish_utils.ts2
-rw-r--r--packages/monorepo-scripts/src/publish.ts62
-rw-r--r--packages/monorepo-scripts/src/remove_tags.ts4
-rw-r--r--packages/monorepo-scripts/src/test_installation.ts2
-rw-r--r--packages/monorepo-scripts/src/types.ts8
-rw-r--r--packages/monorepo-scripts/src/utils/changelog_utils.ts55
-rw-r--r--packages/monorepo-scripts/src/utils/utils.ts (renamed from packages/monorepo-scripts/src/utils.ts)4
9 files changed, 78 insertions, 63 deletions
diff --git a/packages/monorepo-scripts/src/deps_versions.ts b/packages/monorepo-scripts/src/deps_versions.ts
index 07292a160..f090d12e9 100644
--- a/packages/monorepo-scripts/src/deps_versions.ts
+++ b/packages/monorepo-scripts/src/deps_versions.ts
@@ -5,7 +5,7 @@ import * as fs from 'fs';
import { sync as globSync } from 'glob';
import * as _ from 'lodash';
-import { utils } from './utils';
+import { utils } from './utils/utils';
interface Dependencies {
[depName: string]: string;
diff --git a/packages/monorepo-scripts/src/find_unused_dependencies.ts b/packages/monorepo-scripts/src/find_unused_dependencies.ts
index df303f6ce..71e707224 100644
--- a/packages/monorepo-scripts/src/find_unused_dependencies.ts
+++ b/packages/monorepo-scripts/src/find_unused_dependencies.ts
@@ -7,7 +7,7 @@ import * as _ from 'lodash';
import { exec as execAsync } from 'promisify-child-process';
import { constants } from './constants';
-import { utils } from './utils';
+import { utils } from './utils/utils';
// For some reason, `depcheck` hangs on some packages. Add them here.
const IGNORE_PACKAGES = ['@0xproject/sol-compiler'];
diff --git a/packages/monorepo-scripts/src/postpublish_utils.ts b/packages/monorepo-scripts/src/postpublish_utils.ts
index f5785343d..dbbde894d 100644
--- a/packages/monorepo-scripts/src/postpublish_utils.ts
+++ b/packages/monorepo-scripts/src/postpublish_utils.ts
@@ -7,7 +7,7 @@ import * as publishRelease from 'publish-release';
import semverSort = require('semver-sort');
import { constants } from './constants';
-import { utils } from './utils';
+import { utils } from './utils/utils';
const publishReleaseAsync = promisify(publishRelease);
const generatedDocsDirectoryName = 'generated_docs';
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts
index 73106821a..022fe172e 100644
--- a/packages/monorepo-scripts/src/publish.ts
+++ b/packages/monorepo-scripts/src/publish.ts
@@ -13,14 +13,14 @@ import semverDiff = require('semver-diff');
import semverSort = require('semver-sort');
import { constants } from './constants';
-import { Changelog, Changes, PackageToVersionChange, SemVerIndex, UpdatedPackage } from './types';
-import { utils } from './utils';
+import { Changelog, PackageToVersionChange, SemVerIndex, VersionChangelog } from './types';
+import { changelogUtils } from './utils/changelog_utils';
+import { utils } from './utils/utils';
const DOC_GEN_COMMAND = 'docs:json';
const NPM_NAMESPACE = '@0xproject/';
const IS_DRY_RUN = process.env.IS_DRY_RUN === 'true';
const TODAYS_TIMESTAMP = moment().unix();
-const LERNA_EXECUTABLE = './node_modules/lerna/bin/lerna.js';
const semverNameToIndex: { [semver: string]: number } = {
patch: SemVerIndex.Patch,
minor: SemVerIndex.Minor,
@@ -118,7 +118,7 @@ async function checkPublishRequiredSetupAsync(): Promise<boolean> {
// check to see if logged into npm before publishing
try {
// HACK: for some reason on some setups, the `npm whoami` will not recognize a logged-in user
- // unless run with `sudo` (i.e Fabio's NVM setup) but is fine for others (Jacob's N setup).
+ // unless run with `sudo` (i.e Fabio's NVM setup) but is fine for others (Jacob's NVM setup).
await execAsync(`sudo npm whoami`);
} catch (err) {
utils.log('You must be logged into npm in the commandline to publish. Run `npm login` and try again.');
@@ -175,7 +175,7 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
const packageName = lernaPackage.package.name;
const changelogJSONPath = path.join(lernaPackage.location, 'CHANGELOG.json');
const changelogJSON = utils.getChangelogJSONOrCreateIfMissing(changelogJSONPath);
- let changelogs: Changelog[];
+ let changelogs: Changelog;
try {
changelogs = JSON.parse(changelogJSON);
} catch (err) {
@@ -185,11 +185,11 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
}
const currentVersion = lernaPackage.package.version;
- const shouldAddNewEntry = shouldAddNewChangelogEntry(currentVersion, changelogs);
+ const shouldAddNewEntry = changelogUtils.shouldAddNewChangelogEntry(currentVersion, changelogs);
if (shouldAddNewEntry) {
// Create a new entry for a patch version with generic changelog entry.
const nextPatchVersion = utils.getNextPatchVersion(currentVersion);
- const newChangelogEntry: Changelog = {
+ const newChangelogEntry: VersionChangelog = {
timestamp: TODAYS_TIMESTAMP,
version: nextPatchVersion,
changes: [
@@ -218,7 +218,7 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
await utils.prettifyAsync(changelogJSONPath, constants.monorepoRootPath);
utils.log(`${packageName}: Updated CHANGELOG.json`);
// Generate updated CHANGELOG.md
- const changelogMd = generateChangelogMd(changelogs);
+ const changelogMd = changelogUtils.generateChangelogMd(changelogs);
const changelogMdPath = path.join(lernaPackage.location, 'CHANGELOG.md');
fs.writeFileSync(changelogMdPath, changelogMd);
await utils.prettifyAsync(changelogMdPath, constants.monorepoRootPath);
@@ -231,7 +231,8 @@ async function updateChangeLogsAsync(updatedPublicLernaPackages: LernaPackage[])
async function lernaPublishAsync(packageToVersionChange: { [name: string]: string }): Promise<void> {
// HACK: Lerna publish does not provide a way to specify multiple package versions via
// flags so instead we need to interact with their interactive prompt interface.
- const child = spawn('lerna', ['publish', '--registry=https://registry.npmjs.org/'], {
+ const PACKAGE_REGISTRY = 'https://registry.npmjs.org/';
+ const child = spawn('lerna', ['publish', `--registry=${PACKAGE_REGISTRY}`], {
cwd: constants.monorepoRootPath,
});
let shouldPrintOutput = false;
@@ -279,46 +280,3 @@ function updateVersionNumberIfNeeded(currentVersion: string, proposedNextVersion
}
return proposedNextVersion;
}
-
-function shouldAddNewChangelogEntry(currentVersion: string, changelogs: Changelog[]): boolean {
- if (_.isEmpty(changelogs)) {
- return true;
- }
- const lastEntry = changelogs[0];
- const isLastEntryCurrentVersion = lastEntry.version === currentVersion;
- return isLastEntryCurrentVersion;
-}
-
-function generateChangelogMd(changelogs: Changelog[]): string {
- let changelogMd = `<!--
-This file is auto-generated using the monorepo-scripts package. Don't edit directly.
-Edit the package's CHANGELOG.json file only.
--->
-
-CHANGELOG
- `;
-
- _.each(changelogs, changelog => {
- if (_.isUndefined(changelog.timestamp)) {
- throw new Error(
- 'All CHANGELOG.json entries must be updated to include a timestamp before generating their MD version',
- );
- }
- const date = moment(`${changelog.timestamp}`, 'X').format('MMMM D, YYYY');
- const title = `\n## v${changelog.version} - _${date}_\n\n`;
- changelogMd += title;
-
- let changes = '';
- _.each(changelog.changes, change => {
- let line = ` * ${change.note}`;
- if (!_.isUndefined(change.pr)) {
- line += ` (#${change.pr})`;
- }
- line += '\n';
- changes += line;
- });
- changelogMd += `${changes}`;
- });
-
- return changelogMd;
-}
diff --git a/packages/monorepo-scripts/src/remove_tags.ts b/packages/monorepo-scripts/src/remove_tags.ts
index 6d09729c7..affdf2751 100644
--- a/packages/monorepo-scripts/src/remove_tags.ts
+++ b/packages/monorepo-scripts/src/remove_tags.ts
@@ -8,7 +8,7 @@ import semverSort = require('semver-sort');
import { constants } from './constants';
import { Changelog } from './types';
-import { utils } from './utils';
+import { utils } from './utils/utils';
(async () => {
const shouldIncludePrivate = true;
@@ -24,7 +24,7 @@ import { utils } from './utils';
let latestChangelogVersion: string;
if (!_.isUndefined(changelogJSONIfExists)) {
- let changelogs: Changelog[];
+ let changelogs: Changelog;
try {
changelogs = JSON.parse(changelogJSONIfExists);
} catch (err) {
diff --git a/packages/monorepo-scripts/src/test_installation.ts b/packages/monorepo-scripts/src/test_installation.ts
index e84221f9d..b67154667 100644
--- a/packages/monorepo-scripts/src/test_installation.ts
+++ b/packages/monorepo-scripts/src/test_installation.ts
@@ -7,7 +7,7 @@ import * as path from 'path';
import { exec as execAsync } from 'promisify-child-process';
import * as rimraf from 'rimraf';
-import { utils } from './utils';
+import { utils } from './utils/utils';
(async () => {
const monorepoRootPath = path.join(__dirname, '../../..');
diff --git a/packages/monorepo-scripts/src/types.ts b/packages/monorepo-scripts/src/types.ts
index 28d00d710..36fb923b3 100644
--- a/packages/monorepo-scripts/src/types.ts
+++ b/packages/monorepo-scripts/src/types.ts
@@ -4,15 +4,17 @@ export interface UpdatedPackage {
private: boolean;
}
-export interface Changes {
+export interface Change {
note: string;
pr?: number;
}
-export interface Changelog {
+export type Changelog = VersionChangelog[];
+
+export interface VersionChangelog {
timestamp?: number;
version: string;
- changes: Changes[];
+ changes: Change[];
}
export enum SemVerIndex {
diff --git a/packages/monorepo-scripts/src/utils/changelog_utils.ts b/packages/monorepo-scripts/src/utils/changelog_utils.ts
new file mode 100644
index 000000000..edfe65a80
--- /dev/null
+++ b/packages/monorepo-scripts/src/utils/changelog_utils.ts
@@ -0,0 +1,55 @@
+import * as _ from 'lodash';
+import * as moment from 'moment';
+
+import { Change, Changelog, VersionChangelog } from '../types';
+
+const CHANGELOG_MD_HEADER = `
+<!--
+This file is auto-generated using the monorepo-scripts package. Don't edit directly.
+Edit the package's CHANGELOG.json file only.
+-->
+
+CHANGELOG
+`;
+
+export const changelogUtils = {
+ getChangelogMdTitle(versionChangelog: VersionChangelog): string {
+ if (_.isUndefined(versionChangelog.timestamp)) {
+ throw new Error(
+ 'All CHANGELOG.json entries must be updated to include a timestamp before generating their MD version',
+ );
+ }
+ const date = moment(`${versionChangelog.timestamp}`, 'X').format('MMMM D, YYYY');
+ const title = `\n## v${versionChangelog.version} - _${date}_\n\n`;
+ return title;
+ },
+ getChangelogMdChange(change: Change): string {
+ let line = ` * ${change.note}`;
+ if (!_.isUndefined(change.pr)) {
+ line += ` (#${change.pr})`;
+ }
+ return line;
+ },
+ generateChangelogMd(changelog: Changelog): string {
+ let changelogMd = CHANGELOG_MD_HEADER;
+ _.each(changelog, versionChangelog => {
+ const title = changelogUtils.getChangelogMdTitle(versionChangelog);
+ changelogMd += title;
+ const changelogVersionLines = _.map(
+ versionChangelog.changes,
+ changelogUtils.getChangelogMdChange.bind(changelogUtils),
+ );
+ changelogMd += `${_.join(changelogVersionLines, '\n')}`;
+ });
+
+ return changelogMd;
+ },
+ shouldAddNewChangelogEntry(currentVersion: string, changelog: Changelog): boolean {
+ if (_.isEmpty(changelog)) {
+ return true;
+ }
+ const lastEntry = changelog[0];
+ const isLastEntryCurrentVersion = lastEntry.version === currentVersion;
+ return isLastEntryCurrentVersion;
+ },
+};
diff --git a/packages/monorepo-scripts/src/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts
index c2d92c86a..8f2a0bbaa 100644
--- a/packages/monorepo-scripts/src/utils.ts
+++ b/packages/monorepo-scripts/src/utils/utils.ts
@@ -3,8 +3,8 @@ import lernaGetPackages = require('lerna-get-packages');
import * as _ from 'lodash';
import { exec as execAsync, spawn } from 'promisify-child-process';
-import { constants } from './constants';
-import { UpdatedPackage } from './types';
+import { constants } from '../constants';
+import { UpdatedPackage } from '../types';
export const utils = {
log(...args: any[]): void {
73faa99ef'>- Update to 2.7Martin Wilke2012-05-253-10/+15 * Update mastersite, upstream moved into archive/Rene Ladan2012-05-101-0/+1 * Limit DOS2UNIX conversion to *.h and *.cpp files onlyMax Brazhnikov2012-05-091-1/+4 * Connect qtfmMax Brazhnikov2012-05-091-0/+1 * Add new port x11-fm/qtfm:Max Brazhnikov2012-05-0911-0/+426 * - Mark BROKEN: does not buildPav Lucistnik2012-05-031-0/+2 * - Chase x11-toolkits/fox16 shlib bumpPietro Cerutti2012-05-021-0/+1 * - Update to 0.8.1Marcus von Appen2012-04-293-22/+11 * - Update to 12.03.30.12Armin Pirkovitsch2012-04-253-5/+7 * - Add missing DEPENDS to avoid build warningsSteve Wills2012-04-241-1/+2 * Maintainer wishes to release this back to the wild.Mark Linimon2012-04-231-1/+1 * - New port: x11-fm/doublecmdJose Alonso Cardenas Marquez2012-04-197-0/+196 * This file should not have been committed.Chris Rees2012-04-191-1106/+0 * Rodent is a fast, small and powerful file manager for theChris Rees2012-04-196-0/+2279 * - Update to 1.32.5Pietro Cerutti2012-04-102-3/+3 * - Update to 0.19.13Dennis Herrmann2012-03-202-3/+3 * - Set Portscout flagsMartin Wilke2012-03-171-1/+3 * - Mark BROKEN: does not configurePav Lucistnik2012-03-091-0/+2 * Remove build dependencies on textproc/docbook-xml and textproc/docbook-xsl.Max Brazhnikov2012-03-071-2/+0 * Update to 0.9.10Kris Moore2012-02-293-3/+5 * - fix build by not compiling gnu/kfreebsd branchesPietro Cerutti2012-02-201-1/+10 * - Update to 11.12.25.15Martin Wilke2012-02-203-5/+10 * - Update devel/sdl12 to 1.2.15Marcus von Appen2012-02-181-0/+1 * - Bump PORTREVISION to chase the update of multimedia/libvpxAshish SHUKLA2012-02-162-1/+2 * - Update to 2.6.6Martin Wilke2012-01-293-4/+7 * Update to 1.3.0Emanuel Haupt2012-01-083-7/+8 * Upgrade to version 0.6.Jimmy Olgeni2011-12-243-6/+7 * Upgrade to version 2.11.Jimmy Olgeni2011-12-243-6/+5 * - Update to 1.2.8.14Sylvio Cesar Teixeira2011-12-092-3/+5 * - Fix build with clangPietro Cerutti2011-11-282-3/+15 * Remove trailing whitespaces.Emanuel Haupt2011-11-191-1/+1 * Unbreak the port by fixing the plist.Raphael Kubo da Costa2011-11-172-2/+7 * - Remove WITH_FBSD10_FIX, is no longer neededMartin Wilke2011-11-091-1/+0 * - Update to 0.19.12Dennis Herrmann2011-11-022-3/+3 * - Fix build on FreeBSD 10Martin Wilke2011-10-291-0/+1 * - x11-wm/xfce4-wm update to 4.8.2Martin Wilke2011-10-283-4/+7 * Consistify spelling of "Xfce", and some other projects while there.Rene Ladan2011-10-271-1/+1 * The vast majority of pkg-descr files had the following format when theyDoug Barton2011-10-241-3/+0 * Remove more tags from pkg-descr files fo the form:Doug Barton2011-10-242-5/+0 * Re-assign to the Xfce team.Rene Ladan2011-10-232-2/+2 * - Add LDFLAGS to CONFIGURE_ENV and MAKE_ENV (as it was done with LDFLAGS)Dmitry Marakasov2011-09-2414-29/+21 * Fix build with clang.Rene Ladan2011-09-131-0/+11 * Update to 0.9.9Kris Moore2011-09-033-4/+26 * - Update to 1.2.8.13Sylvio Cesar Teixeira2011-08-302-3/+3 * o Fix program version number: it displays 0.2.0.15 even though theMario Sergio Fujikawa Ferreira2011-08-281-0/+7 * - Mark BROKEN: incomplete plistPav Lucistnik2011-08-271-0/+2 * Chase libnotify, libproxy and webkit-gtk2 shlib changes, and fix build where ...Koop Mast2011-08-241-2/+2 * - Update to 11.2.20.13Sylvio Cesar Teixeira2011-08-203-3/+4 * - Update Krusader to 2.4.0-beta1 "Migration"Dima Panov2011-08-163-170/+10 * Remove USE_GNOME=gnometarget from ports. It has been a empty keyword sinceKoop Mast2011-08-123-3/+3 * - Support USE_TKEmanuel Haupt2011-08-113-14/+23 * Update to 0.0.10Emanuel Haupt2011-08-112-21/+16 * Remove WWW entries from unmaintained ports that return 404 or where the domainEmanuel Haupt2011-08-031-2/+0 * New port ultracopier version 0.2.0.16: An advanced file copierMario Sergio Fujikawa Ferreira2011-08-015-0/+63 * Remove INSTALLS_ICONS from kde ports.Koop Mast2011-07-301-1/+0 * update x11/libexo to 0.6.2Oliver Lehmann2011-07-271-0/+1 * - Update to 0.8.0Marcus von Appen2011-07-093-3/+4 * - Reassign to the heapThomas Abthorpe2011-07-051-1/+1 * Make port build with clang. While we're here add an additional distfileEmanuel Haupt2011-06-222-6/+31 * - Replace ../../authors in MASTER_SITE_SUBDIR with CPAN:CPANID macro.Andrej Zverev2011-06-201-1/+1 * - update to 1.32.4Pietro Cerutti2011-06-143-3/+39 * Remove obsolete patch, this will unbreak the build.Koop Mast2011-06-082-16/+13 * update thunar to 1.2.2Oliver Lehmann2011-06-073-24/+26 * update libexo to 0.6.1Oliver Lehmann2011-06-072-1/+2 * -Update to 0.7.2.Jeremy Messenger2011-06-054-9/+13 * - Update to 0.9.8Kris Moore2011-05-264-4/+26 * - Update to 1.2.8.11Sylvio Cesar Teixeira2011-05-142-4/+3 * Bump PORTREVISION after open-mofit updateMax Brazhnikov2011-05-021-1/+1 * remove expired ports from x11-fmBaptiste Daroussin2011-05-0223-599/+0 * - Update to 10.12.28.23Martin Wilke2011-03-259-122/+39 * - Update to 1.32.3Pietro Cerutti2011-03-243-9/+4 * - Get Rid MD5 supportMartin Wilke2011-03-1934-39/+0 * Deprecated since gnome1 is unsupported and deprecated, users please consider ...Baptiste Daroussin2011-03-171-0/+3 * - Chase x11-toolkits/fox16 shlib bumpPietro Cerutti2011-03-161-1/+1 * Deprecate two forgotten ports from previous categoryBaptiste Daroussin2011-03-121-0/+3 * Deprecate unmaintained ports from x11-fm where upstream disapear and/orBaptiste Daroussin2011-03-123-0/+9 * - Bump PORTREVISION to chase the update of libexifWen Heping2011-03-043-0/+3 * Thunar-VFS is the Virtual filesystem shipped with the thunar 1.0Oliver Lehmann2011-03-035-0/+233 * Welcome XFCE 4.8 to the portstree!Oliver Lehmann2011-03-033-427/+319 * - Update to 0.7.5Marcus von Appen2011-02-273-15/+15 * - Reassign ports to heapThomas Abthorpe2011-02-271-1/+1 * - Update to 1.2.8.10Sylvio Cesar Teixeira2011-02-103-7/+3 * - Bump PORTREVISION after x11-toolkits/fox16 shlib bumpPietro Cerutti2011-02-091-0/+1 * - Update to 0.19.9Dennis Herrmann2011-02-013-4/+7 * Heiner does not have time for FreeBSD anymore, reset MAINTAINERSHIPTilman Keskinoz2011-01-111-1/+1 * - Update to 0.19.8Dennis Herrmann2011-01-082-4/+3 * Remove expired ports:Renato Botelho2011-01-036-158/+0 * - Update to Krusader 2.3.0-beta1 "New Horizons" releaseDima Panov2010-12-303-5/+85 * Update to 2.32.2.1.Alexander Logvinov2010-12-302-3/+3 * - Update to 0.19.7Dennis Herrmann2010-12-252-4/+4 * - Update to 4.2Pav Lucistnik2010-12-173-7/+5 * - Update e17 applications suite to the recent snapshot.Stanislav Sedov2010-12-141-0/+4 * Update to 2.32.2.Koop Mast2010-12-122-3/+3 * Sync to new bsd.autotools.mkAde Lovett2010-12-046-6/+6 * - Update to version 0.7.4Marcus von Appen2010-12-022-4/+3 * - Update to 0.19.6Dennis Herrmann2010-11-262-4/+4 * Actualy remove the removed ports from the GNOME 2.32 commit mentioned in MOVED.Koop Mast2010-11-242-16/+0 * Presenting GNOME 2.32.1 for FreeBSD. The offical release notes for thisKoop Mast2010-11-203-9/+22 * - Update to 0.19.5Dennis Herrmann2010-11-182-4/+4 * - Update to 0.19.4Dennis Herrmann2010-10-292-4/+4 * - Update to 0.19.3Dennis Herrmann2010-10-182-4/+4 * Punt autoconf267->autoconf268Ade Lovett2010-10-161-1/+1 * - Update to 0.19.2Dennis Herrmann2010-10-072-5/+4 * Round one migration of ports from automake{19,110} to automake111Ade Lovett2010-10-061-1/+1 * - Update to 0.9.7Kris Moore2010-09-304-66/+25 * - Update to 0.8.5 [1]Lars Engels2010-09-303-7/+8 * - Update to 1.32.2Pietro Cerutti2010-09-235-41/+28 * Update to 2.6.5Max Brazhnikov2010-09-183-11/+14 * Autotools update. Read ports/UPDATING 20100915 for details.Ade Lovett2010-09-161-1/+2 * - Add missing perl5 virtual categoriesPhilip M. Gollucci2010-09-141-1/+1 * - Fix PLISTPietro Cerutti2010-08-251-0/+1 * - Update to 1.32.1Pietro Cerutti2010-08-248-16/+181 * Fix build with upcoming KDE 4.5Max Brazhnikov2010-08-211-0/+2 * - Update to 0.7.3Marcus von Appen2010-06-182-5/+4 * - Update to 1.2.8.6Sylvio Cesar Teixeira2010-06-083-5/+5 * LICENSE BSDDirk Meyer2010-06-041-0/+2 * update xfce to 4.6.2Oliver Lehmann2010-05-314-16/+58 * Bounce PORTREVISION for gettext-related ports. Have fun, ya'll.Ade Lovett2010-05-31