Skip to content

Commit 45fa858

Browse files
author
Elad Ben-Israel
authored
chore: prepare jsii for automatic publishing (#225)
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
1 parent 3257223 commit 45fa858

File tree

3 files changed

+21
-30
lines changed

3 files changed

+21
-30
lines changed

buildspec.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ phases:
1313
post_build:
1414
commands:
1515
- "[ -f .BUILD_COMPLETED ] && /bin/bash ./pack.sh"
16-
- "[ -f .BUILD_COMPLETED ] && /bin/bash ./bundle.sh"
1716
artifacts:
1817
files:
1918
- "**/*"

bundle.sh

Lines changed: 0 additions & 25 deletions
This file was deleted.

pack.sh

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

5-
packdir="$PWD/pack"
6-
rm -fr ${packdir}
7-
mkdir -p ${packdir}
8+
distdir="$PWD/dist"
9+
rm -fr ${distdir}
10+
mkdir -p ${distdir}
811

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

22+
# create a build.json file with build metadata
23+
version="$(node -e "console.log(require('./lerna.json').version)")"
24+
cat > ${distdir}/build.json <<HERE
25+
{
26+
"name": "jsii",
27+
"version": "${version}"
28+
}
29+
HERE
30+
31+
# copy CHANGELOG.md to dist/ for github releases
32+
cp CHANGELOG.md ${distdir}/
33+
34+
# for posterity, print all files in dist
35+
find dist/

0 commit comments

Comments
 (0)