Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: make NPM dist tag explicit for all packages #13109

Merged
merged 6 commits into from
Feb 17, 2021

Conversation

njlynch
Copy link
Contributor

@njlynch njlynch commented Feb 17, 2021

Currently, our NPM tag strategy is uniform across all packages. This mostly
works, but for V2 it makes sense for aws-cdk-lib to be published with a dist
tag of 'latest' while still publishing all of the other libraries as 'next'.

This change is the first supporting change to enable us to have different dist
tags for different packages.

  • Introduces a new pkglint rule that enforces that each package.json has a
    publishConfig and tag. For v1, this defaults to 'latest'; for v2 it will
    default to 'next'. These are the correct values, except for aws-cdk-lib,
    which will need to be manually changed to latest.
  • Removes the disttag element from release.json.
  • Changing check-api-compatibility to use the dist tags from the individual
    package.json files, rather than from release.json.

Files to look at (all others are package.json changes):

  • release.json
  • scripts/check-api-compatibility.sh
  • scripts/resolve-version-lib.js
  • scripts/script-tests/resolve-version.test.js
  • tools/pkglint/lib/rules.ts

Once this is approved, and merged up to V2, the change to flip the aws-cdk-lib
tag can be made. Finally, we will update our publishing infrastructure so these
new tags are respected.

related #13058


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Currently, our NPM tag strategy is uniform across all packages. This _mostly_
works, but for V2 it makes sense for `aws-cdk-lib` to be published with a dist
tag of 'latest' while still publishing all of the other libraries as 'next'.

This change is the first supporting change to enable us to have different dist
tags for different packages.
* Introduces a new pkglint rule that enforces that each package.json has a
  publishConfig and tag. For v1, this defaults to 'latest'; for v2 it will
  default to 'next'. These are the correct values, except for `aws-cdk-lib`,
  which will need to be manually changed to `latest`.
* Removes the disttag element from `release.json`.
* Changing `check-api-compatibility` to use the dist tags from  the individual
  `package.json` files, rather than from `release.json`.

Files to look at (all others are package.json changes):
* release.json
* scripts/check-api-compatibility.sh
* scripts/resolve-version-lib.js
* scripts/script-tests/resolve-version.test.js
* tools/pkglint/lib/rules.ts

Once this is approved, and merged up to V2, the change to flip the aws-cdk-lib
tag can be made. Finally, we will update our publishing infrastructure so these
new tags are respected.

related #13058
@njlynch njlynch requested review from eladb, nija-at and a team February 17, 2021 13:57
@njlynch njlynch self-assigned this Feb 17, 2021
@gitpod-io
Copy link

gitpod-io bot commented Feb 17, 2021

@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Feb 17, 2021
tools/pkglint/lib/rules.ts Show resolved Hide resolved
Comment on lines 58 to 67
if (!pkg.json.publishConfig?.tag) {
pkg.report({
ruleName: this.name,
message: 'publishConfig.tag is required',
fix: (() => {
const publishConfig = pkg.json.publishConfig ?? {};
publishConfig.tag = defaultPublishTag;
pkg.json.publishConfig = publishConfig;
}),
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we need special logic for aws-cdk-lib, i.e., latest instead of next?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could encode it here, but I was planning on just making the change in the aws-cdk-lib package itself. The auto-fix is here to automatically adjust packages where the tag is missing entirely, not encode the special one-off rule for the single exception (IMO).

Copy link
Contributor

@nija-at nija-at Feb 17, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to have all of the logic encoded here. We should also err/fix if the tag is incorrect, not just for missing.

scripts/check-api-compatibility.sh Show resolved Hide resolved
tools/pkglint/lib/rules.ts Show resolved Hide resolved
scripts/resolve-version-lib.js Show resolved Hide resolved
@njlynch njlynch requested a review from nija-at February 17, 2021 14:54
@nija-at
Copy link
Contributor

nija-at commented Feb 17, 2021

tools/pkglint/lib/rules.ts Outdated Show resolved Hide resolved
tools/pkglint/lib/rules.ts Outdated Show resolved Hide resolved
njlynch and others added 2 commits February 17, 2021 15:51
Co-authored-by: Niranjan Jayakar <nija@amazon.com>
Co-authored-by: Niranjan Jayakar <nija@amazon.com>
@mergify
Copy link
Contributor

mergify bot commented Feb 17, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify
Copy link
Contributor

mergify bot commented Feb 17, 2021

Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit d183af2 into master Feb 17, 2021
@mergify mergify bot deleted the njlynch/explicit-disttag branch February 17, 2021 16:55
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildProject89A8053A-LhjRyN9kxr8o
  • Commit ID: 3bff7ff
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

NovakGu pushed a commit to NovakGu/aws-cdk that referenced this pull request Feb 18, 2021
Currently, our NPM tag strategy is uniform across all packages. This _mostly_
works, but for V2 it makes sense for `aws-cdk-lib` to be published with a dist
tag of 'latest' while still publishing all of the other libraries as 'next'.

This change is the first supporting change to enable us to have different dist
tags for different packages.
* Introduces a new pkglint rule that enforces that each package.json has a
  publishConfig and tag. For v1, this defaults to 'latest'; for v2 it will
  default to 'next'. These are the correct values, except for `aws-cdk-lib`,
  which will need to be manually changed to `latest`.
* Removes the disttag element from `release.json`.
* Changing `check-api-compatibility` to use the dist tags from  the individual
  `package.json` files, rather than from `release.json`.

Files to look at (all others are package.json changes):
* release.json
* scripts/check-api-compatibility.sh
* scripts/resolve-version-lib.js
* scripts/script-tests/resolve-version.test.js
* tools/pkglint/lib/rules.ts

Once this is approved, and merged up to V2, the change to flip the aws-cdk-lib
tag can be made. Finally, we will update our publishing infrastructure so these
new tags are respected.

related aws#13058


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
eladb pushed a commit that referenced this pull request Feb 22, 2021
Currently, our NPM tag strategy is uniform across all packages. This _mostly_
works, but for V2 it makes sense for `aws-cdk-lib` to be published with a dist
tag of 'latest' while still publishing all of the other libraries as 'next'.

This change is the first supporting change to enable us to have different dist
tags for different packages.
* Introduces a new pkglint rule that enforces that each package.json has a
  publishConfig and tag. For v1, this defaults to 'latest'; for v2 it will
  default to 'next'. These are the correct values, except for `aws-cdk-lib`,
  which will need to be manually changed to `latest`.
* Removes the disttag element from `release.json`.
* Changing `check-api-compatibility` to use the dist tags from  the individual
  `package.json` files, rather than from `release.json`.

Files to look at (all others are package.json changes):
* release.json
* scripts/check-api-compatibility.sh
* scripts/resolve-version-lib.js
* scripts/script-tests/resolve-version.test.js
* tools/pkglint/lib/rules.ts

Once this is approved, and merged up to V2, the change to flip the aws-cdk-lib
tag can be made. Finally, we will update our publishing infrastructure so these
new tags are respected.

related #13058


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants