fix: too strict peer dependency of angular (#9355)

* 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
This commit is contained in:
Paul Gschwendtner
2018-01-12 18:27:17 +01:00
committed by Andrew Seguin
parent cdbabf7366
commit 7187670d14
2 changed files with 44 additions and 36 deletions
+5 -2
View File
@@ -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 = `/**
+39 -34
View File
@@ -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',
));