From 82bfbb95b347107870128acebe23f797c19f3867 Mon Sep 17 00:00:00 2001 From: Elad Ben-Israel Date: Thu, 31 May 2018 13:49:39 +0300 Subject: [PATCH] Initial take on bundle-beta --- .gitignore | 3 ++ buildspec.yaml | 9 +++++- bundle-beta.sh | 45 +++++++++++++++++++++++++++ examples/package.json | 1 + pack.sh | 10 ++++++ packages/aws-cdk-docs/package.json | 1 + packages/aws-cdk-java/package.json | 5 ++- packages/aws-cdk-toolkit/package.json | 9 ++---- 8 files changed, 73 insertions(+), 10 deletions(-) create mode 100755 bundle-beta.sh create mode 100755 pack.sh diff --git a/.gitignore b/.gitignore index fc30407b99926..4ec6404e3cd09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,5 @@ node_modules lerna-debug.log +dist +pack + diff --git a/buildspec.yaml b/buildspec.yaml index f116c87bdbd1c..b25e7adf5df3b 100644 --- a/buildspec.yaml +++ b/buildspec.yaml @@ -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 diff --git a/bundle-beta.sh b/bundle-beta.sh new file mode 100755 index 0000000000000..23f7ea5d533ad --- /dev/null +++ b/bundle-beta.sh @@ -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} diff --git a/examples/package.json b/examples/package.json index 57d8c4aa2941a..508dc3dbcca23 100644 --- a/examples/package.json +++ b/examples/package.json @@ -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", diff --git a/pack.sh b/pack.sh new file mode 100755 index 0000000000000..f126931e21092 --- /dev/null +++ b/pack.sh @@ -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}" diff --git a/packages/aws-cdk-docs/package.json b/packages/aws-cdk-docs/package.json index 269af57efc428..ebc8a51945f4d 100644 --- a/packages/aws-cdk-docs/package.json +++ b/packages/aws-cdk-docs/package.json @@ -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" diff --git a/packages/aws-cdk-java/package.json b/packages/aws-cdk-java/package.json index 40f015747de17..396d370ecb13a 100644 --- a/packages/aws-cdk-java/package.json +++ b/packages/aws-cdk-java/package.json @@ -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" @@ -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", diff --git a/packages/aws-cdk-toolkit/package.json b/packages/aws-cdk-toolkit/package.json index 3fa6f3a6fe4e0..366a4cfb23e8c 100644 --- a/packages/aws-cdk-toolkit/package.json +++ b/packages/aws-cdk-toolkit/package.json @@ -19,16 +19,15 @@ }, "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", @@ -36,14 +35,12 @@ "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" },