Skip to content

Commit 15d044d

Browse files
committed
fixing build
1 parent cc3dea8 commit 15d044d

File tree

6 files changed

+83
-15
lines changed

6 files changed

+83
-15
lines changed

demo/package.json

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -38,22 +38,19 @@
3838
"webpack-bundle-analyzer": "^2.8.2",
3939
"webpack-sources": "~1.0.1"
4040
},
41-
"build.plugin": "cd ../src && npm run build",
42-
"ci.tslint": "npm i && tslint --config '../tslint.json' 'app/**/*.ts' --exclude '**/node_modules/**'",
43-
"ns-bundle": "ns-bundle",
44-
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
45-
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
46-
"start-android-bundle": "npm run ns-bundle --android --run-app --uglify --snapshot",
47-
"start-ios-bundle": "npm run ns-bundle --ios --run-app --uglify",
48-
"build-android-bundle": "npm run ns-bundle --android --build-app --uglify --snapshot",
49-
"build-ios-bundle": "npm run ns-bundle --ios --build-app --uglify",
5041
"scripts": {
42+
"build.plugin": "cd ../src && npm run build",
43+
"ci.tslint":
44+
"npm i && tslint --config '../tslint.json' 'app/**/*.ts' --exclude '**/node_modules/**'",
5145
"ns-bundle": "ns-bundle",
5246
"publish-ios-bundle": "npm run ns-bundle --ios --publish-app",
53-
"generate-android-snapshot": "generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
54-
"start-android-bundle": "npm run ns-bundle --android --run-app",
55-
"start-ios-bundle": "npm run ns-bundle --ios --run-app",
56-
"build-android-bundle": "npm run ns-bundle --android --build-app",
57-
"build-ios-bundle": "npm run ns-bundle --ios --build-app"
47+
"generate-android-snapshot":
48+
"generate-android-snapshot --targetArchs arm,arm64,ia32 --install",
49+
"start-android-bundle":
50+
"npm run ns-bundle --android --run-app --uglify --snapshot",
51+
"start-ios-bundle": "npm run ns-bundle --ios --run-app --uglify",
52+
"build-android-bundle":
53+
"npm run ns-bundle --android --build-app --uglify --snapshot",
54+
"build-ios-bundle": "npm run ns-bundle --ios --build-app --uglify"
5855
}
5956
}

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: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "nativescript-publish",
3+
"version": "1.0.0",
4+
"description": "Publish helper",
5+
"devDependencies": {
6+
"ncp": "^2.0.0",
7+
"rimraf": "^2.5.0"
8+
}
9+
}

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

src/.npmignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,7 @@ screens/
99
node_modules/
1010

1111
*.ts
12-
!*.d.ts
12+
!*.d.ts
13+
*.map
14+
tsconfig.json
15+
references.d.ts

src/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,7 @@
113113
"prettier": "^1.4.4",
114114
"tns-core-modules": "^3.1.0",
115115
"tns-platform-declarations": "^3.1.0",
116+
"rimraf": "^2.5.0",
116117
"tslint": "^5.1.0",
117118
"typescript": "~2.3.0"
118119
}

0 commit comments

Comments
 (0)