Skip to content

Commit c229073

Browse files
committed
Add setup.sh and npm setup script
New setup script installs deps and clones gh-pages into dist/ for deployment.
1 parent dd6f618 commit c229073

2 files changed

Lines changed: 33 additions & 0 deletions

File tree

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"test:coverage": "NODE_ENV=test c8 mocha tests --test-reporter=spec",
1111
"test:coverage:ci": "NODE_ENV=test c8 mocha tests --test-reporter=spec --timeout=20000",
1212
"build": "npm run build:ts; npm run build:webpack",
13+
"setup": "sh scripts/setup.sh",
1314
"deploy": "bash scripts/deploy.sh",
1415
"build:ts": "tsc",
1516
"build:webpack": "webpack",

scripts/setup.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
# This script sets up the hds-lib-js build environment
4+
5+
# working dir fix
6+
scriptsFolder=$(cd $(dirname "$0"); pwd)
7+
cd $scriptsFolder/..
8+
9+
# check for well known prereqs that might be missing
10+
hash git 2>&- || { echo >&2 "I require git."; exit 1; }
11+
hash npm 2>&- || { echo >&2 "I require node and npm."; exit 1; }
12+
13+
echo "
14+
Installing Node modules from 'package.json' if necessary...
15+
"
16+
npm install
17+
18+
if [ ! -d dist/.git ]
19+
then
20+
echo "
21+
Setting up 'dist' folder for publishing to GitHub pages...
22+
"
23+
rm -rf dist
24+
git clone -b gh-pages git@github.com:healthdatasafe/hds-lib-js.git dist
25+
fi
26+
27+
echo "
28+
29+
30+
If no errors were listed above, the setup is complete.
31+
See the README for more info on writing and publishing.
32+
"

0 commit comments

Comments
 (0)