Skip to content

Commit

Permalink
chore(individual-pkg-gen): set the alpha version in alpha module's pa…
Browse files Browse the repository at this point in the history
…ckage.json files if present (#16322)

This change sets the `version` key in each alpha module's `package.json` file to the alphaVersion that was created in this PR: #16043

And, also sets the version of each dependency on another alpha module to the same version. 

Depends on: #16321 

Part of: #15591 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
madeline-k authored Sep 2, 2021
1 parent defd242 commit 9c94563
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/individual-pkg-gen/copy-files-removing-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import * as awsCdkMigration from 'aws-cdk-migration';
import * as fs from 'fs-extra';
// eslint-disable-next-line @typescript-eslint/no-require-imports
const lerna_project = require('@lerna/project');
// eslint-disable-next-line @typescript-eslint/no-require-imports
const ver = require('../../scripts/resolve-version');

transformPackages();

Expand Down Expand Up @@ -98,6 +100,9 @@ function transformPackageJson(pkg: any, source: string, destination: string, alp
const pkgUnscopedName = `${pkg.name.substring('@aws-cdk/'.length)}`;

packageJson.name += '-alpha';
if (ver.alphaVersion) {
packageJson.version = ver.alphaVersion;
}
packageJson.repository.directory = `packages/individual-packages/${pkgUnscopedName}`;

// disable awslint (some rules are hard-coded to @aws-cdk/core)
Expand Down Expand Up @@ -160,7 +165,7 @@ function transformPackageJsonDependencies(packageJson: any, pkg: any, alphaPacka
break;
default:
if (alphaPackages[dependency]) {
alphaDependencies[alphaPackages[dependency]] = pkg.version;
alphaDependencies[alphaPackages[dependency]] = packageJson.version;
} else if (v1BundledDependencies.indexOf(dependency) !== -1) {
// ...other than third-party dependencies, which are in bundledDependencies
bundledDependencies[dependency] = packageJson.dependencies[dependency];
Expand All @@ -180,7 +185,7 @@ function transformPackageJsonDependencies(packageJson: any, pkg: any, alphaPacka
break;
default:
if (alphaPackages[v1DevDependency]) {
alphaDevDependencies[alphaPackages[v1DevDependency]] = pkg.version;
alphaDevDependencies[alphaPackages[v1DevDependency]] = packageJson.version;
} else if (!v1DevDependency.startsWith('@aws-cdk/')) {
devDependencies[v1DevDependency] = packageJson.devDependencies[v1DevDependency];
}
Expand Down

0 comments on commit 9c94563

Please sign in to comment.