Skip to content

Commit e7729f3

Browse files
committed
chore: add missing files
1 parent 24a9a65 commit e7729f3

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-3
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ node_modules/
77
*.tns.json
88
*.metadata.json
99
*.log
10+
!*build-native.js
1011
!demo/karma.conf.js
1112
!demo/app/tests/*.js
1213
demo/platforms/
@@ -17,9 +18,11 @@ demo-vue/platforms/
1718
*.aar
1819
/src/*.tgz
1920
*.d.ts
21+
!*references.d.ts
2022
!*index.d.ts
2123
!*datetimepicker.d.ts
2224
!*date-picker-field.d.ts
2325
!*time-picker-field.d.ts
2426
/publish/package/*.tgz
25-
/publish/package/**/*
27+
/publish/package/**/*
28+
/publish/src/**/*

src/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@
3131
"clean": "npm run demo.reset && npx rimraf -- node_modules package-lock.json && npm i",
3232
"ci.tslint": "npm i && tslint '**/*.ts' --config '../tslint.json' --exclude '**/node_modules/**' --exclude '**/platforms/**'",
3333
"ngc": "ngc -p tsconfig.json",
34-
"prepare": "npm run ngc",
35-
"prepack": "npm run build.native"
34+
"prepack": "npm run ngc && npm run build.native"
3635
},
3736
"keywords": [
3837
"NativeScript",

src/references.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/// <reference path="./node_modules/tns-platform-declarations/ios.d.ts" />
2+
/// <reference path="./node_modules/tns-platform-declarations/android.d.ts" />

src/scripts/build-native.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
const { exec } = require('child_process');
2+
const semver = require('semver');
3+
4+
exec('tns --version', (err, stdout, stderr) => {
5+
if (err) {
6+
// node couldn't execute the command
7+
console.log(`tns --version err: ${err}`);
8+
return;
9+
}
10+
11+
const tnsVersion = semver.major(stdout);
12+
13+
// execute 'tns plugin build' for {N} version > 4. This command builds .aar in platforms/android folder.
14+
if (tnsVersion >= 4) {
15+
console.log(`executing 'tns plugin build'`);
16+
exec('tns plugin build', (err, stdout, stderr) => {
17+
if (err) {
18+
// node couldn't execute the command
19+
console.log(`${err}`);
20+
return;
21+
}
22+
});
23+
}
24+
});

0 commit comments

Comments
 (0)