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: allow un-overwritable scripts and devDependencies in package.json #1207
Conversation
And pin the version of internal dependencies "@aws-sdk/*"
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
const pinDependencies = manifest => { | ||
const removeRangeVersion = ([name, version]) => | ||
name.indexOf("@aws-sdk/") === 0 | ||
? [name, version.replace("^", "")] | ||
: [name, version]; | ||
manifest.dependencies = Object.fromEntries( | ||
Object.entries(manifest.dependencies).map(removeRangeVersion) | ||
); | ||
manifest.devDependencies = Object.fromEntries( | ||
Object.entries(manifest.devDependencies).map(removeRangeVersion) | ||
); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: use functions all the way to avoid mutating manifest and having small functions
const filterAwsSdkDeps = (name) => name.indexOf("@aws-sdk/") === 0;
const removeCaretFromDepVersion = (version) => version.replace("^", "");
const getPinnedAwsSdkDeps = (deps) => ({
...deps,
...Object.entries(deps)
.filter(([name, version]) => filterAwsSdkDeps(name))
.reduce(
(acc, [name, version]) => ({
...acc,
[name]: removeCaretFromDepVersion(version),
}),
{}
),
});
const getManifestWithPinnedAwsSdkDeps = (manifest) => ({
...manifest,
dependencies: getPinnedAwsSdkDeps(manifest.dependencies),
devDependencies: getPinnedAwsSdkDeps(manifest.devDependencies),
});
Co-authored-by: Trivikram Kamat <16024985+trivikr@users.noreply.github.com>
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Merging to unblock #1218 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread. |
There are 2 changes with this PR:
If a client's package.json contains a local NPM
scripts
ordevDependencies
, they would be removed by codegen because these new entries don't exist package.json's template. This change avoids removing these entries.What is not changed: for the entries in
scripts
ordevDependencies
and exist in both newly generated client and existing client, the script prefers the ones in existing client.Temporarily pin the newly added internal dependencies version. We will review this before GA.(maybe re-introduce the range dependencies)
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.