aboutsummaryrefslogtreecommitdiffstats
path: root/packages/monorepo-scripts
diff options
context:
space:
mode:
authorfragosti <francesco.agosti93@gmail.com>2018-10-20 00:44:47 +0800
committerfragosti <francesco.agosti93@gmail.com>2018-10-20 00:44:47 +0800
commit100f446031e84c367f1d0852ef60fd04d4544b9f (patch)
treee0e2c6c896a7f0b4e738727f6baa8a30e5234695 /packages/monorepo-scripts
parent48f1e6057c878a948d21ed7d2214c7792c648f75 (diff)
parenteb3a4d2fabcab3c2423d5827aba2fcaffc348320 (diff)
downloaddexon-sol-tools-100f446031e84c367f1d0852ef60fd04d4544b9f.tar
dexon-sol-tools-100f446031e84c367f1d0852ef60fd04d4544b9f.tar.gz
dexon-sol-tools-100f446031e84c367f1d0852ef60fd04d4544b9f.tar.bz2
dexon-sol-tools-100f446031e84c367f1d0852ef60fd04d4544b9f.tar.lz
dexon-sol-tools-100f446031e84c367f1d0852ef60fd04d4544b9f.tar.xz
dexon-sol-tools-100f446031e84c367f1d0852ef60fd04d4544b9f.tar.zst
dexon-sol-tools-100f446031e84c367f1d0852ef60fd04d4544b9f.zip
Merge branch 'development' of https://github.com/0xProject/0x-monorepo into feature/instant/beta-render-et-al
Diffstat (limited to 'packages/monorepo-scripts')
-rw-r--r--packages/monorepo-scripts/src/prepublish_checks.ts2
-rw-r--r--packages/monorepo-scripts/src/publish.ts10
-rw-r--r--packages/monorepo-scripts/src/publish_release_notes.ts2
-rw-r--r--packages/monorepo-scripts/src/utils/github_release_utils.ts18
-rw-r--r--packages/monorepo-scripts/src/utils/utils.ts2
5 files changed, 17 insertions, 17 deletions
diff --git a/packages/monorepo-scripts/src/prepublish_checks.ts b/packages/monorepo-scripts/src/prepublish_checks.ts
index 683c26094..5f603ebc7 100644
--- a/packages/monorepo-scripts/src/prepublish_checks.ts
+++ b/packages/monorepo-scripts/src/prepublish_checks.ts
@@ -11,7 +11,7 @@ import { utils } from './utils/utils';
async function prepublishChecksAsync(): Promise<void> {
const shouldIncludePrivate = false;
- const updatedPublicPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
+ const updatedPublicPackages = await utils.getPackagesToPublishAsync(shouldIncludePrivate);
await checkCurrentVersionMatchesLatestPublishedNPMPackageAsync(updatedPublicPackages);
await checkChangelogFormatAsync(updatedPublicPackages);
diff --git a/packages/monorepo-scripts/src/publish.ts b/packages/monorepo-scripts/src/publish.ts
index b7131e69e..854a72b86 100644
--- a/packages/monorepo-scripts/src/publish.ts
+++ b/packages/monorepo-scripts/src/publish.ts
@@ -34,12 +34,12 @@ async function confirmAsync(message: string): Promise<void> {
(async () => {
// Fetch public, updated Lerna packages
const shouldIncludePrivate = true;
- const allUpdatedPackages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
- if (_.isEmpty(allUpdatedPackages)) {
+ const allPackagesToPublish = await utils.getPackagesToPublishAsync(shouldIncludePrivate);
+ if (_.isEmpty(allPackagesToPublish)) {
utils.log('No packages need publishing');
process.exit(0);
}
- const packagesWithDocs = getPackagesWithDocs(allUpdatedPackages);
+ const packagesWithDocs = getPackagesWithDocs(allPackagesToPublish);
if (!configs.IS_LOCAL_PUBLISH) {
await confirmAsync(
@@ -49,12 +49,12 @@ async function confirmAsync(message: string): Promise<void> {
}
// Update CHANGELOGs
- const updatedPublicPackages = _.filter(allUpdatedPackages, pkg => !pkg.packageJson.private);
+ const updatedPublicPackages = _.filter(allPackagesToPublish, pkg => !pkg.packageJson.private);
const updatedPublicPackageNames = _.map(updatedPublicPackages, pkg => pkg.packageJson.name);
utils.log(`Will update CHANGELOGs and publish: \n${updatedPublicPackageNames.join('\n')}\n`);
const packageToNextVersion = await updateChangeLogsAsync(updatedPublicPackages);
- const updatedPrivatePackages = _.filter(allUpdatedPackages, pkg => pkg.packageJson.private);
+ const updatedPrivatePackages = _.filter(allPackagesToPublish, pkg => pkg.packageJson.private);
_.each(updatedPrivatePackages, pkg => {
const currentVersion = pkg.packageJson.version;
const packageName = pkg.packageJson.name;
diff --git a/packages/monorepo-scripts/src/publish_release_notes.ts b/packages/monorepo-scripts/src/publish_release_notes.ts
index 297eb3d50..d2082521c 100644
--- a/packages/monorepo-scripts/src/publish_release_notes.ts
+++ b/packages/monorepo-scripts/src/publish_release_notes.ts
@@ -22,7 +22,7 @@ const args = yargs
let packages;
if (_.isUndefined(args.packages)) {
const shouldIncludePrivate = false;
- packages = await utils.getUpdatedPackagesAsync(shouldIncludePrivate);
+ packages = await utils.getPackagesToPublishAsync(shouldIncludePrivate);
} else {
const packageNames = args.packages.split(' ');
packages = await utils.getPackagesByNameAsync(packageNames);
diff --git a/packages/monorepo-scripts/src/utils/github_release_utils.ts b/packages/monorepo-scripts/src/utils/github_release_utils.ts
index 43c52ec2d..7434d397e 100644
--- a/packages/monorepo-scripts/src/utils/github_release_utils.ts
+++ b/packages/monorepo-scripts/src/utils/github_release_utils.ts
@@ -12,7 +12,7 @@ import { utils } from './utils';
const publishReleaseAsync = promisify(publishRelease);
// tslint:disable-next-line:completed-docs
-export async function publishReleaseNotesAsync(updatedPublishPackages: Package[], isDryRun: boolean): Promise<void> {
+export async function publishReleaseNotesAsync(packagesToPublish: Package[], isDryRun: boolean): Promise<void> {
// Git push a tag representing this publish (publish-{commit-hash}) (truncate hash)
const result = await execAsync('git log -n 1 --pretty=format:"%H"', { cwd: constants.monorepoRootPath });
const latestGitCommit = result.stdout;
@@ -40,12 +40,8 @@ export async function publishReleaseNotesAsync(updatedPublishPackages: Package[]
let assets: string[] = [];
let aggregateNotes = '';
- _.each(updatedPublishPackages, pkg => {
- const notes = getReleaseNotesForPackage(pkg.packageJson.name, pkg.packageJson.version);
- if (_.isEmpty(notes)) {
- return; // don't include it
- }
- aggregateNotes += `### ${pkg.packageJson.name}@${pkg.packageJson.version}\n${notes}\n\n`;
+ _.each(packagesToPublish, pkg => {
+ aggregateNotes += getReleaseNotesForPackage(pkg.packageJson.name);
const packageAssets = _.get(pkg.packageJson, 'config.postpublish.assets');
if (!_.isUndefined(packageAssets)) {
@@ -92,7 +88,7 @@ function adjustAssetPaths(assets: string[]): string[] {
return finalAssets;
}
-function getReleaseNotesForPackage(packageName: string, version: string): string {
+function getReleaseNotesForPackage(packageName: string): string {
const packageNameWithoutNamespace = packageName.replace('@0x/', '');
const changelogJSONPath = path.join(
constants.monorepoRootPath,
@@ -115,5 +111,9 @@ function getReleaseNotesForPackage(packageName: string, version: string): string
}
notes += `\n`;
});
- return notes;
+ if (_.isEmpty(notes)) {
+ return ''; // don't include it
+ }
+ const releaseNotesSection = `### ${packageName}@${latestLog.version}\n${notes}\n\n`;
+ return releaseNotesSection;
}
diff --git a/packages/monorepo-scripts/src/utils/utils.ts b/packages/monorepo-scripts/src/utils/utils.ts
index 5e2e877c7..44ff971e8 100644
--- a/packages/monorepo-scripts/src/utils/utils.ts
+++ b/packages/monorepo-scripts/src/utils/utils.ts
@@ -61,7 +61,7 @@ export const utils = {
});
return updatedPackages;
},
- async getUpdatedPackagesAsync(shouldIncludePrivate: boolean): Promise<Package[]> {
+ async getPackagesToPublishAsync(shouldIncludePrivate: boolean): Promise<Package[]> {
const updatedPublicPackages = await utils.getLernaUpdatedPackagesAsync(shouldIncludePrivate);
const updatedPackageNames = _.map(updatedPublicPackages, pkg => pkg.name);