Skip to content

Commit

Permalink
Initial take on bundle-beta
Browse files Browse the repository at this point in the history
  • Loading branch information
Elad Ben-Israel committed May 31, 2018
1 parent b340201 commit 82bfbb9
Show file tree
Hide file tree
Showing 8 changed files with 73 additions and 10 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
node_modules
lerna-debug.log
dist
pack

9 changes: 8 additions & 1 deletion buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,11 @@ phases:
build:
commands:
- /bin/bash ./build.sh

post_build:
commands:
- /bin/bash ./pack.sh
- /bin/bash ./bundle-beta.sh
artifacts:
files:
- "**/*"
base-directory: dist
45 changes: 45 additions & 0 deletions bundle-beta.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@

#!/bin/bash
# Creates our beta bundle for the CDK.
# Assume we have a bootstrapped and packaged repository
set -euo pipefail
root=$PWD

staging="$(mktemp -d)"
cd ${staging}

echo "Staging: ${staging}"

# Bundle structure
# ================
#
# + bin
# + docs
# + repo
# + npm
# + maven
# + node_modules
#

# Create a local npm repository
mkdir -p repo/npm
rsync -aL ${root}/pack/*.tgz repo/npm # cdk modules
rsync -aL ${root}/local-npm/*.tgz repo/npm # jsii modules

# Create a local maven repository
mkdir -p repo/maven
cp ${root}/packages/aws-cdk-java/target/*.jar repo/maven

# Deploy the docs website to docs/
rsync -a ${root}/packages/aws-cdk-docs/dist/docs/ ./docs

# Bootstrap a production-ready node_modules closure with all npm modules (jsii and CDK)
npm install --global-style --production --no-save repo/npm/*.tgz

# Symlink 'bin' to the root
ln -s node_modules/.bin bin

# Copy to ./dist
dist=${root}/dist
rm -fr ${dist}
rsync -av ${staging}/ ${dist}
1 change: 1 addition & 0 deletions examples/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "examples",
"version": "0.6.0",
"description": "A bunch of CDK examples",
"private": true,
"scripts": {
"prepare": "tsc && tslint -p . && pkglint",
"watch": "tsc -w",
Expand Down
10 changes: 10 additions & 0 deletions pack.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e
export PATH=$PWD/node_modules/.bin:$PATH

packdir="$PWD/pack"
rm -fr ${packdir}
mkdir -p ${packdir}

lerna ls | grep -v "private" | cut -d" " -f1 | xargs -n1 -I{} \
lerna exec --scope {} --stream -- "npm pack && mv *.tgz ${packdir}"
1 change: 1 addition & 0 deletions packages/aws-cdk-docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"description": "AWS CDK Documentation",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/awslabs/aws-cdk"
Expand Down
5 changes: 2 additions & 3 deletions packages/aws-cdk-java/package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "aws-cdk-java",
"private": true,
"version": "0.6.0",
"description": "The AWS CDK for Java",
"private": true,
"repository": {
"type": "git",
"url": "git://github.com/awslabs/aws-cdk"
Expand All @@ -11,8 +11,7 @@
"ignore": true
},
"scripts": {
"prepare": "/bin/bash ./generate.sh && mvn package",
"prepack": "mv target/*.jar ."
"prepare": "/bin/bash ./generate.sh && mvn package"
},
"author": {
"name": "Amazon Web Services",
Expand Down
9 changes: 3 additions & 6 deletions packages/aws-cdk-toolkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,31 +19,28 @@
},
"license": "Apache-2.0",
"devDependencies": {
"pkglint": "^0.6.0",
"@types/fs-extra": "^4.0.8",
"@types/request": "^2.0.6",
"@types/tough-cookie": "^2.3.2",
"@types/yamljs": "^0.2.0",
"@types/yargs": "^8.0.3",
"pkglint": "^0.6.0"
"@types/minimatch": "^3.0.3",
"@types/uuid": "^3.4.3"
},
"dependencies": {
"@types/minimatch": "^3.0.3",
"@types/uuid": "^3.4.3",
"aws-cdk": "^0.6.0",
"aws-cdk-cloudformation-diff": "^0.6.0",
"aws-cdk-cx-api": "^0.6.0",
"aws-cdk-resources": "^0.6.0",
"aws-cdk-util": "^0.6.0",
"aws-sdk": "^2.135.0",
"colors": "^1.2.1",
"file-cookie-store": "^0.2.1",
"fs-extra": "^4.0.2",
"json-diff": "^0.3.1",
"minimatch": ">=3.0",
"promptly": "^0.2.0",
"request": "^2.83.0",
"source-map-support": "^0.5.6",
"tough-cookie": "^2.3.3",
"yamljs": "^0.2.0",
"yargs": "^9.0.1"
},
Expand Down

0 comments on commit 82bfbb9

Please sign in to comment.