|
14 | 14 | * Read more here: https://yarnpkg.com/lang/en/docs/package-json/#toc-resolutions
|
15 | 15 | */
|
16 | 16 |
|
| 17 | +/** |
| 18 | + * Regular expression matching packages we would like to install snapshots for. |
| 19 | + * |
| 20 | + * Assumes that all matched packages will have corresponding snapshot Github |
| 21 | + * repositories under the Angular organization. |
| 22 | + * |
| 23 | + * Note that specific packages can be excluded in the `ignorePackages` array below. |
| 24 | + */ |
| 25 | +const targetPackageRegex = /^@(angular|angular-devkit|schematics)\//; |
| 26 | + |
17 | 27 | /** List of packages which should not be updated to a snapshot build. */
|
18 | 28 | const ignorePackages = [
|
19 | 29 | // Skip update for the shared dev-infra package. We do not want to update to a snapshot
|
@@ -41,15 +51,18 @@ const snapshotPackages = Object.keys({
|
41 | 51 | ...packageJson.dependencies,
|
42 | 52 | ...packageJson.devDependencies,
|
43 | 53 | }).filter(
|
44 |
| - packageName => packageName.startsWith('@angular/') && !ignorePackages.includes(packageName), |
| 54 | + packageName => targetPackageRegex.test(packageName) && !ignorePackages.includes(packageName), |
45 | 55 | );
|
46 | 56 |
|
47 | 57 | console.log('Setting up snapshot builds for:\n');
|
48 | 58 | console.log(` ${snapshotPackages.map(n => `${n}${packageSuffix}`).join('\n ')}\n`);
|
49 | 59 |
|
50 | 60 | // Setup the snapshot version for each Angular package specified in the "package.json" file.
|
51 | 61 | snapshotPackages.forEach(packageName => {
|
52 |
| - const buildsUrl = `github:angular/${packageName.split('/')[1]}-builds${tag ? `#${tag}` : ''}`; |
| 62 | + const parts = packageName.split('/'); |
| 63 | + const scopeName = parts[0].substring(1); |
| 64 | + const snapshotRepoPrefix = scopeName === 'angular' ? parts[1] : `${scopeName}-${parts[1]}`; |
| 65 | + const buildsUrl = `github:angular/${snapshotRepoPrefix}-builds${tag ? `#${tag}` : ''}`; |
53 | 66 |
|
54 | 67 | // Add resolutions for each package in the format "**/{PACKAGE}" so that all
|
55 | 68 | // nested versions of that specific Angular package will have the same version.
|
|
0 commit comments