-
Notifications
You must be signed in to change notification settings - Fork 248
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into aws-lambda-eventbridge
- Loading branch information
Showing
196 changed files
with
1,098 additions
and
84,320 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"skip": { "tag": true }, | ||
"skip": { "tag": true, "commit": true }, | ||
"packageFiles": [ { "filename": "source/lerna.json", "type": "json" } ], | ||
"bumpFiles": [ { "filename": "source/lerna.json", "type": "json" } ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/usr/bin/env node | ||
// It will make following updates to package.json | ||
// 1 - align the version in a package.json file to the version of the repo | ||
// 2 - Remove all entries starting with @aws-cdk/* and constructs from "dependencies": { ... } | ||
// 3 - Remove all entries starting with @aws-cdk/* and constructs from "peerDependencies": { ... }, Add { "aws-cdk-lib": "^2.0.0-rc.1", "constructs": "^10.0.0" } | ||
// 4 - Add { "aws-cdk-lib": "2.0.0-rc.1", "constructs": "^10.0.0" } to "devDependencies" | ||
const fs = require('fs'); | ||
|
||
const findVersion = process.argv[2]; | ||
const replaceVersion = process.argv[3]; | ||
|
||
// these versions need to be sourced from a config file | ||
const awsCdkLibVersion = '2.0.0-rc.16'; | ||
const constructsVersion = '10.0.0'; | ||
|
||
for (const file of process.argv.splice(4)) { | ||
const pkg = JSON.parse(fs.readFileSync(file).toString()); | ||
|
||
if (pkg.version !== findVersion && pkg.version !== replaceVersion) { | ||
throw new Error(`unexpected - all package.json files in this repo should have a version of ${findVersion} or ${replaceVersion}: ${file}`); | ||
} | ||
|
||
pkg.version = replaceVersion; | ||
|
||
pkg.dependencies = processDependencies(pkg.dependencies || { }, file); | ||
pkg.peerDependencies = processPeerDependencies(pkg.peerDependencies || { }, file); | ||
pkg.devDependencies = processDevDependencies(pkg.devDependencies || { }, file); | ||
|
||
console.error(`${file} => ${replaceVersion}`); | ||
fs.writeFileSync(file, JSON.stringify(pkg, undefined, 2)); | ||
|
||
} | ||
|
||
function processDependencies(section, file) { | ||
let newdependencies = {}; | ||
for (const [ name, version ] of Object.entries(section)) { | ||
// Remove all entries starting with @aws-cdk/* and constructs | ||
if (!name.startsWith('@aws-cdk/') && !name.startsWith('constructs')) { | ||
newdependencies[name] = version.replace(findVersion, replaceVersion); | ||
} | ||
} | ||
return newdependencies; | ||
} | ||
|
||
function processPeerDependencies(section, file) { | ||
let newdependencies = {}; | ||
for (const [ name, version ] of Object.entries(section)) { | ||
// Remove all entries starting with @aws-cdk/* and constructs | ||
if (!name.startsWith('@aws-cdk/') && !name.startsWith('constructs')) { | ||
newdependencies[name] = version.replace(findVersion, replaceVersion); | ||
} | ||
} | ||
newdependencies["aws-cdk-lib"] = `^${awsCdkLibVersion}`; | ||
newdependencies["constructs"] = `^${constructsVersion}`; | ||
return newdependencies; | ||
} | ||
|
||
function processDevDependencies(section, file) { | ||
let newdependencies = section; | ||
for (const [ name, version ] of Object.entries(newdependencies)) { | ||
// Remove all entries starting with @aws-cdk/* and constructs | ||
if (version === findVersion || version === '^' + findVersion) { | ||
newdependencies[name] = version.replace(findVersion, replaceVersion); | ||
} | ||
} | ||
// note: no ^ to make sure we test against the minimum version | ||
newdependencies["aws-cdk-lib"] = `${awsCdkLibVersion}`; | ||
newdependencies["constructs"] = `^${constructsVersion}`; | ||
return newdependencies; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
deployment_dir=$(cd $(dirname $0) && pwd) | ||
source_dir="$deployment_dir/../../source" | ||
|
||
cd $deployment_dir | ||
# Retrieve version numbers for marker and repo | ||
marker=$(node -p "require('./get-version-marker')") | ||
repoVersion=$(node -p "require('./get-version')") | ||
|
||
cd $source_dir/ | ||
|
||
# Align versions in ALL package.json with the one in lerna.json | ||
files=$(find . -name package.json |\ | ||
grep -v node_modules) | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "Updating ALL package.json for CDK v2" | ||
${deployment_dir}/align-version.js ${marker} ${repoVersion} ${files} | ||
else | ||
echo "Reverting back CDK v2 updatesfrom ALL package.json files" | ||
git checkout `find . -name package.json | grep -v node_modules` | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
deployment_dir=$(cd $(dirname $0) && pwd) | ||
source_dir="$deployment_dir/../source" | ||
dist_dir="$deployment_dir/dist" | ||
|
||
cd $source_dir/ | ||
export PATH=$(npm bin):$PATH | ||
export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}" | ||
|
||
cd $deployment_dir/ | ||
|
||
echo "------------------------------------------------------------------------------" | ||
echo "[Copy] CDK templates for all patterns into the deployment dir for CfnNagScan" | ||
echo "------------------------------------------------------------------------------" | ||
|
||
echo "mkdir -p $dist_dir" | ||
mkdir -p $dist_dir | ||
|
||
for subdir in $source_dir/patterns/\@aws-solutions-constructs/* ; do | ||
if [ -d "$subdir" -a `basename $subdir` != "node_modules" ]; then | ||
cd $subdir/test | ||
|
||
echo "Checking integ CFN templates in $subdir/test" | ||
cnt=`find . -name "*expected.json" -type f | wc -l` | ||
prefix=`basename $subdir` | ||
if [ "$prefix" != "core" ] | ||
then | ||
if [ "$cnt" -eq "0" ] | ||
then | ||
echo "************** [ERROR] ************* Did not find any integ CFN templates in $subdir; please add atleast one by writing an integ test case and running cdk-integ command to generate the CFN template for it" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
echo "Copying templates from $subdir/test" | ||
for i in `find . -name "*expected.json" -type f`; do | ||
prefix=`basename $subdir` | ||
suffix=`basename $i` | ||
cp $subdir/test/$i $dist_dir/$prefix-$suffix.template | ||
done | ||
cd $source_dir | ||
fi | ||
done | ||
|
||
echo "------------------------------------------------------------------------------" | ||
echo "[Copy] packages for all patterns into the deployment dir" | ||
echo "------------------------------------------------------------------------------" | ||
|
||
echo "mkdir -p $dist_dir" | ||
mkdir -p $dist_dir | ||
|
||
for dir in $(find $source_dir/patterns/\@aws-solutions-constructs/ -name dist | grep -v node_modules | grep -v coverage); do | ||
echo "Merging ${dir} into ${dist_dir}" >&2 | ||
rsync -a $dir/ ${dist_dir}/ | ||
done | ||
|
||
echo "------------------------------------------------------------------------------" | ||
echo "[Create] build.json file" | ||
echo "------------------------------------------------------------------------------" | ||
# Get commit hash from CodePipeline env variable CODEBUILD_RESOLVED_SOURCE_VERSION | ||
echo $deployment_dir | ||
version=$(node -p "require('$deployment_dir/get-version.js')") | ||
commit="${CODEBUILD_RESOLVED_SOURCE_VERSION:-}" | ||
|
||
cat > ${dist_dir}/build.json <<HERE | ||
{ | ||
"name": "aws-solutions-constructs", | ||
"version": "${version}", | ||
"commit": "${commit}" | ||
} | ||
HERE | ||
|
||
# copy CHANGELOG.md to dist/ for github releases | ||
changelog_file=$deployment_dir/../CHANGELOG.md | ||
cp ${changelog_file} ${dist_dir}/CHANGELOG.md | ||
|
||
echo "------------------------------------------------------------------------------" | ||
echo "[List] deployment/dist contents" | ||
echo "------------------------------------------------------------------------------" | ||
|
||
find $dist_dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
deployment_dir=$(cd $(dirname $0) && pwd) | ||
source_dir="$deployment_dir/../../source" | ||
|
||
echo "=============================================================================================" | ||
echo "aligning versions and updating package.json for CDK v2..." | ||
/bin/bash $deployment_dir/align-version.sh | ||
|
||
echo "=============================================================================================" | ||
echo "updating Import statements for CDK v2..." | ||
/bin/bash $deployment_dir/rewrite-imports.sh | ||
|
||
echo "=============================================================================================" | ||
echo "building cdk-integ-tools..." | ||
cd $source_dir/tools/cdk-integ-tools | ||
npm install | ||
npm run build | ||
npm link | ||
|
||
bail="--bail" | ||
runtarget="build+lint+test" | ||
cd $source_dir/ | ||
|
||
export PATH=$(npm bin):$PATH | ||
export NODE_OPTIONS="--max-old-space-size=4096 ${NODE_OPTIONS:-}" | ||
|
||
echo "=============================================================================================" | ||
echo "installing..." | ||
yarn install --frozen-lockfile | ||
|
||
echo "=============================================================================================" | ||
echo "building..." | ||
time lerna run $bail --stream $runtarget || fail | ||
|
||
echo "=============================================================================================" | ||
echo "packaging..." | ||
time lerna run --bail --stream jsii-pacmak || fail | ||
|
||
echo "=============================================================================================" | ||
echo "reverting back versions and updates to package.json for CDK v2..." | ||
/bin/bash $deployment_dir/align-version.sh revert | ||
|
||
echo "=============================================================================================" | ||
echo "reverting back Import statements for CDK v2..." | ||
/bin/bash $deployment_dir/rewrite-imports.sh revert |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/bin/bash | ||
# -------------------------------------------------------------------------------------------------- | ||
# | ||
# This script is intended to be used to bump the version of the CDK modules, update package.json, | ||
# package-lock.json, and create a commit. | ||
# | ||
# to start a version bump, run: | ||
# bump.sh <version | version Type> | ||
# | ||
# If a version is not provided, the 'minor' version will be bumped. | ||
# The version can be an explicit version _or_ one of: | ||
# 'major', 'minor', 'patch', 'premajor', 'preminor', 'prepatch', or 'prerelease'. | ||
# | ||
# -------------------------------------------------------------------------------------------------- | ||
set -euo pipefail | ||
version=${1:-prerelease} | ||
deployment_dir=$(cd $(dirname $0) && pwd) | ||
|
||
echo "Starting ${version} version bump" | ||
echo "Loading ${deployment_dir}/get-version" | ||
|
||
# Rename CHANGELOG.md | ||
echo "Rename CHANGELOG.md to CHANGELOG.md.bak" | ||
mv CHANGELOG.md CHANGELOG.md.bak | ||
echo "Rename CHANGELOG.v2.md to CHANGELOG.md" | ||
mv CHANGELOG.v2.md CHANGELOG.md | ||
|
||
# Rename lerna.json | ||
echo "Rename source/lerna.json to source/lerna.json.bak" | ||
mv source/lerna.json source/lerna.json.bak | ||
echo "Rename source/lerna.v2.json to source/lerna.json" | ||
mv source/lerna.v2.json source/lerna.json | ||
|
||
# `standard-release` will -- among other things -- create the changelog. | ||
# However, on the v2 branch, `conventional-changelog` (which `standard-release` uses) gets confused | ||
# and creates really muddled changelogs with both v1 and v2 releases intermingled, and lots of missing data. | ||
# A super HACK here is to locally remove all version tags that don't match this major version prior | ||
# to doing the bump, and then later fetching to restore those tags. | ||
git tag -d `git tag -l | grep -v '^v2.'` | ||
|
||
# Generate CHANGELOG and create a commit | ||
npx standard-version --release-as ${version} | ||
|
||
# fetch back the tags, and only the tags, removed locally above | ||
git fetch origin "refs/tags/*:refs/tags/*" | ||
|
||
# Restore CHANGELOG.md | ||
echo "Rename CHANGELOG.md to CHANGELOG.v2.md" | ||
mv CHANGELOG.md CHANGELOG.v2.md | ||
echo "Rename CHANGELOG.md.bak to CHANGELOG.md" | ||
mv CHANGELOG.md.bak CHANGELOG.md | ||
|
||
# Restore lerna.json | ||
echo "Rename source/lerna.json to source/lerna.v2.json" | ||
mv source/lerna.json source/lerna.v2.json | ||
echo "Rename source/lerna.json.bak to source/lerna.json" | ||
mv source/lerna.json.bak source/lerna.json | ||
|
||
# Disabled the autocommit of 'standard-version' due to faulty CHANGELOG.md updates during CDK v2 build | ||
# and hence need to run git add/commit commands outside of 'standard-version' | ||
repoVersion=$(node -p "require('${deployment_dir}/get-version')") | ||
echo "repoVersion=${repoVersion}" | ||
|
||
git add source/lerna.v2.json | ||
git add CHANGELOG.v2.md | ||
git commit -m "chore(release): ${repoVersion}" |
Oops, something went wrong.