Skip to content

Prepare jsii for automatic publishing #225

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

Merged
merged 1 commit into from
Sep 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/