Skip to content
This repository was archived by the owner on Apr 4, 2023. It is now read-only.

Commit ef15aba

Browse files
Added publish scripts
1 parent 892c17c commit ef15aba

File tree

6 files changed

+72
-0
lines changed

6 files changed

+72
-0
lines changed

publish/pack.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
SOURCE_DIR=../src;
4+
TO_SOURCE_DIR=src;
5+
PACK_DIR=package;
6+
ROOT_DIR=..;
7+
PUBLISH=--publish
8+
9+
install(){
10+
npm i
11+
}
12+
13+
pack() {
14+
15+
echo 'Clearing /src and /package...'
16+
node_modules/.bin/rimraf "$TO_SOURCE_DIR"
17+
node_modules/.bin/rimraf "$PACK_DIR"
18+
19+
# copy src
20+
echo 'Copying src...'
21+
node_modules/.bin/ncp "$SOURCE_DIR" "$TO_SOURCE_DIR"
22+
23+
# copy README & LICENSE to src
24+
echo 'Copying README and LICENSE to /src...'
25+
node_modules/.bin/ncp "$ROOT_DIR"/LICENSE "$TO_SOURCE_DIR"/LICENSE
26+
node_modules/.bin/ncp "$ROOT_DIR"/README.md "$TO_SOURCE_DIR"/README.md
27+
28+
# compile package and copy files required by npm
29+
echo 'Building /src...'
30+
cd "$TO_SOURCE_DIR"
31+
node_modules/.bin/tsc
32+
cd ..
33+
34+
echo 'Creating package...'
35+
# create package dir
36+
mkdir "$PACK_DIR"
37+
38+
# create the package
39+
cd "$PACK_DIR"
40+
npm pack ../"$TO_SOURCE_DIR"
41+
42+
# delete source directory used to create the package
43+
cd ..
44+
node_modules/.bin/rimraf "$TO_SOURCE_DIR"
45+
}
46+
47+
install && pack

publish/package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "nativescript-publish",
3+
"version": "1.0.0",
4+
"description": "Publish helper",
5+
"scripts": {
6+
"prepublish": "npm install --ignore-scripts && webpack --config scripts/webpack.config.js scripts/installer.js ../src/scripts/postinstall.js"
7+
},
8+
"devDependencies": {
9+
"ncp": "^2.0.0",
10+
"prompt-lite": "~0.1.0",
11+
"rimraf": "^2.5.0",
12+
"webpack": "~2.2.0"
13+
}
14+
}

publish/publish.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
PACK_DIR=package;
4+
5+
publish() {
6+
cd $PACK_DIR
7+
echo 'Publishing to npm...'
8+
# npm publish *.tgz
9+
}
10+
11+
./pack.sh && publish

0 commit comments

Comments
 (0)