-
Notifications
You must be signed in to change notification settings - Fork 0
/
npm-publish.sh
executable file
·49 lines (36 loc) · 1.27 KB
/
npm-publish.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# 1. copy into root npm package directory as npm-publish.sh
# 2. ensure script is executable
# $ cd path/to/npm-publish.sh
# $ chmod 755 npm-publish.sh
# 3. execute
# $ ./npm-publish.sh
# Run unit tests (if present)
# echo "Building application and running unit tests..."
# karma start --watch false --single-run
pwd=$(pwd)
echo "Removing $pwd/dist directory..."
rm -rf "$pwd/dist"
# Angular CLI aot
# echo "Removing $pwd/aot directory..."
# rm -rf "$pwd/aot"
# echo "Running AOT build script..."
# npm run build:aot
echo 'Updating git...'
git add . && git commit -m 'Publishing latest version to npm' && git push -f origin master
echo 'Updating npm package version patch...'
npm version patch
echo 'Checking for dist/ directory...'
[ -d ./dist ] || echo 'Creating dist/ directory...' && mkdir ./dist
echo 'Copying package.json to dist/...'
cp ./package.json ./dist/package.json
cp ./README.md ./dist/README.md
echo 'Copying bin/ to dist/ (excluding test contents)...';
rsync -av --exclude='bin/debug/' --exclude='bin/boilerplate/node_modules' ./bin ./dist
echo 'Changing directory into dist/...'
cd ./dist
echo 'Publishing to NPM...'
npm publish --access public
echo 'Publish successful.'
echo 'Updating global npm installation...'
npm install -g @stereograph/cli