From 0561bbb9d496bf13eabf1901543af048755ae3e3 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Fri, 12 Jan 2018 17:23:05 +0100 Subject: [PATCH] fix: too strict peer dependency of angular * Right now the `peerDependency` of Angular will be the one from the `package.json`. This means that upcoming minor versions of Angular cause peer dependency warnings within Yarn or NPM. Fixes #9328 --- build-config.js | 7 +++- tools/gulp/tasks/publish.ts | 73 ++++++++++++++++++++----------------- 2 files changed, 44 insertions(+), 36 deletions(-) diff --git a/build-config.js b/build-config.js index e47b125d381b..993c6854b219 100644 --- a/build-config.js +++ b/build-config.js @@ -9,8 +9,11 @@ const package = require('./package.json'); /** Current version of the project*/ const buildVersion = package.version; -/** Required Angular version for the project. */ -const angularVersion = package.dependencies['@angular/core']; +/** + * Required Angular version for all Angular Material packages. This version will be used + * as the peer dependency version for Angular in all release packages. + */ +const angularVersion = '^5.0.0'; /** License that will be placed inside of all created bundles. */ const buildLicense = `/** diff --git a/tools/gulp/tasks/publish.ts b/tools/gulp/tasks/publish.ts index 493d4483f657..700751e65d7d 100644 --- a/tools/gulp/tasks/publish.ts +++ b/tools/gulp/tasks/publish.ts @@ -19,6 +19,14 @@ export const releasePackages = [ /** Parse command-line arguments for release task. */ const argv = minimist(process.argv.slice(3)); +task('publish', sequenceTask( + ':publish:whoami', + ':publish:build-releases', + 'validate-release:check-bundles', + ':publish', + ':publish:logout', +)); + /** Task that builds all releases that will be published. */ task(':publish:build-releases', sequenceTask( 'clean', @@ -33,6 +41,37 @@ task(':publish:whoami', execTask('npm', ['whoami'], { task(':publish:logout', execTask('npm', ['logout'])); +task(':publish', async () => { + const label = argv['tag']; + const version = buildConfig.projectVersion; + const currentDir = process.cwd(); + + console.log(''); + if (!label) { + console.log(grey('> You can use a label with --tag=labelName.\n')); + console.log(green(`Publishing version "${version}" using the latest tag...`)); + } else { + console.log(yellow(`Publishing version "${version}" using the ${label} tag...`)); + } + console.log(''); + + if (releasePackages.length > 1) { + console.warn(red('Warning: Multiple packages will be released if proceeding.')); + console.warn(red('Warning: Packages to be released: ', releasePackages.join(', '))); + console.log(); + } + + console.log(yellow('> Make sure to check the "angularVersion" in the build config.')); + console.log(yellow('> The version in the config defines the peer dependency of Angular.')); + console.log(); + + // Iterate over every declared release package and publish it on NPM. + for (const packageName of releasePackages) { + await _execNpmPublish(label, packageName); + } + + process.chdir(currentDir); +}); function _execNpmPublish(label: string, packageName: string): Promise<{}> | undefined { const packageDir = join(buildConfig.outputDir, 'releases', packageName); @@ -83,37 +122,3 @@ function _execNpmPublish(label: string, packageName: string): Promise<{}> | unde }); }); } - -task(':publish', async () => { - const label = argv['tag']; - const currentDir = process.cwd(); - - console.log(''); - if (!label) { - console.log(yellow('You can use a label with --tag=labelName.')); - console.log(yellow('Publishing using the latest tag.')); - } else { - console.log(yellow(`Publishing using the ${label} tag.`)); - } - console.log(''); - - if (releasePackages.length > 1) { - console.warn(red('Warning: Multiple packages will be released if proceeding.')); - console.warn(red('Warning: Packages to be released: ', releasePackages.join(', '))); - } - - // Iterate over every declared release package and publish it on NPM. - for (const packageName of releasePackages) { - await _execNpmPublish(label, packageName); - } - - process.chdir(currentDir); -}); - -task('publish', sequenceTask( - ':publish:whoami', - ':publish:build-releases', - 'validate-release:check-bundles', - ':publish', - ':publish:logout', -));