Skip to content

Commit aac5508

Browse files
devversionandrewseguin
authored andcommitted
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
1 parent 1254353 commit aac5508

File tree

2 files changed

+44
-36
lines changed

2 files changed

+44
-36
lines changed

build-config.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ const package = require('./package.json');
99
/** Current version of the project*/
1010
const buildVersion = package.version;
1111

12-
/** Required Angular version for the project. */
13-
const angularVersion = package.dependencies['@angular/core'];
12+
/**
13+
* Required Angular version for all Angular Material packages. This version will be used
14+
* as the peer dependency version for Angular in all release packages.
15+
*/
16+
const angularVersion = '^5.0.0';
1417

1518
/** License that will be placed inside of all created bundles. */
1619
const buildLicense = `/**

tools/gulp/tasks/publish.ts

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ export const releasePackages = [
1919
/** Parse command-line arguments for release task. */
2020
const argv = minimist(process.argv.slice(3));
2121

22+
task('publish', sequenceTask(
23+
':publish:whoami',
24+
':publish:build-releases',
25+
'validate-release:check-bundles',
26+
':publish',
27+
':publish:logout',
28+
));
29+
2230
/** Task that builds all releases that will be published. */
2331
task(':publish:build-releases', sequenceTask(
2432
'clean',
@@ -33,6 +41,37 @@ task(':publish:whoami', execTask('npm', ['whoami'], {
3341

3442
task(':publish:logout', execTask('npm', ['logout']));
3543

44+
task(':publish', async () => {
45+
const label = argv['tag'];
46+
const version = buildConfig.projectVersion;
47+
const currentDir = process.cwd();
48+
49+
console.log('');
50+
if (!label) {
51+
console.log(grey('> You can use a label with --tag=labelName.\n'));
52+
console.log(green(`Publishing version "${version}" using the latest tag...`));
53+
} else {
54+
console.log(yellow(`Publishing version "${version}" using the ${label} tag...`));
55+
}
56+
console.log('');
57+
58+
if (releasePackages.length > 1) {
59+
console.warn(red('Warning: Multiple packages will be released if proceeding.'));
60+
console.warn(red('Warning: Packages to be released: ', releasePackages.join(', ')));
61+
console.log();
62+
}
63+
64+
console.log(yellow('> Make sure to check the "angularVersion" in the build config.'));
65+
console.log(yellow('> The version in the config defines the peer dependency of Angular.'));
66+
console.log();
67+
68+
// Iterate over every declared release package and publish it on NPM.
69+
for (const packageName of releasePackages) {
70+
await _execNpmPublish(label, packageName);
71+
}
72+
73+
process.chdir(currentDir);
74+
});
3675

3776
function _execNpmPublish(label: string, packageName: string): Promise<{}> | undefined {
3877
const packageDir = join(buildConfig.outputDir, 'releases', packageName);
@@ -83,37 +122,3 @@ function _execNpmPublish(label: string, packageName: string): Promise<{}> | unde
83122
});
84123
});
85124
}
86-
87-
task(':publish', async () => {
88-
const label = argv['tag'];
89-
const currentDir = process.cwd();
90-
91-
console.log('');
92-
if (!label) {
93-
console.log(yellow('You can use a label with --tag=labelName.'));
94-
console.log(yellow('Publishing using the latest tag.'));
95-
} else {
96-
console.log(yellow(`Publishing using the ${label} tag.`));
97-
}
98-
console.log('');
99-
100-
if (releasePackages.length > 1) {
101-
console.warn(red('Warning: Multiple packages will be released if proceeding.'));
102-
console.warn(red('Warning: Packages to be released: ', releasePackages.join(', ')));
103-
}
104-
105-
// Iterate over every declared release package and publish it on NPM.
106-
for (const packageName of releasePackages) {
107-
await _execNpmPublish(label, packageName);
108-
}
109-
110-
process.chdir(currentDir);
111-
});
112-
113-
task('publish', sequenceTask(
114-
':publish:whoami',
115-
':publish:build-releases',
116-
'validate-release:check-bundles',
117-
':publish',
118-
':publish:logout',
119-
));

0 commit comments

Comments
 (0)