Skip to content

Commit

Permalink
chore: prepare jsii for automatic publishing (#225)
Browse files Browse the repository at this point in the history
1. Remove the bundle stage. It is done now by the GitHub Releases publisher
2. Emit all files to dist/
3. Create a build.json with metadata for GH releases
4. Copy CHANGELOG.md to dist/ for GH release notes
  • Loading branch information
Elad Ben-Israel authored Sep 13, 2018
1 parent 3257223 commit 45fa858
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 30 deletions.
1 change: 0 additions & 1 deletion buildspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ phases:
post_build:
commands:
- "[ -f .BUILD_COMPLETED ] && /bin/bash ./pack.sh"
- "[ -f .BUILD_COMPLETED ] && /bin/bash ./bundle.sh"
artifacts:
files:
- "**/*"
Expand Down
25 changes: 0 additions & 25 deletions bundle.sh

This file was deleted.

25 changes: 21 additions & 4 deletions pack.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#!/bin/bash
# The purpose of this script is to prepare a "dist" directory
# according to the conventions of the Buildable pipeline, so
# that artifacts can be published to the various package managers
set -e
export PATH=$PWD/node_modules/.bin:$PATH

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

# run "npm run package" in all modules (which support it)
# this should emit a publishable to the "dist" directory of each module
Expand All @@ -13,6 +16,20 @@ lerna run package --stream
# collect all "dist" directories into "pack"
for dist in $(lerna exec "[ -d ./dist ] && echo \${PWD}/dist || true"); do
echo "collecting ${dist}..."
rsync -av ${dist}/ ${packdir}/
rsync -av ${dist}/ ${distdir}/
done

# create a build.json file with build metadata
version="$(node -e "console.log(require('./lerna.json').version)")"
cat > ${distdir}/build.json <<HERE
{
"name": "jsii",
"version": "${version}"
}
HERE

# copy CHANGELOG.md to dist/ for github releases
cp CHANGELOG.md ${distdir}/

# for posterity, print all files in dist
find dist/

0 comments on commit 45fa858

Please sign in to comment.