Skip to content

Commit

Permalink
fix: too strict peer dependency of angular (#9355)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
devversion authored and andrewseguin committed Jan 17, 2018
1 parent 1254353 commit aac5508
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 36 deletions.
7 changes: 5 additions & 2 deletions build-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = `/**
Expand Down
73 changes: 39 additions & 34 deletions tools/gulp/tasks/publish.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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);
Expand Down Expand Up @@ -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',
));

0 comments on commit aac5508

Please sign in to comment.