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

Commit e673824

Browse files
committed
feat(NativeScript 4): Let module support TNS 4
1 parent 3ee4322 commit e673824

23 files changed

Lines changed: 16969 additions & 12554 deletions

.gitignore

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ Thumbs.db
4141
/typings/
4242
/tsd_typings/
4343

44+
# demo lock files
45+
demo-angular/package-lock.json
46+
demo/package-lock.json
47+
4448
# Dist #
49+
src/platforms/android/nativescript_fabric.aar
50+
/publish/package
51+
/publish/src
4552
/dist
4653
/public/__build__/
4754
/src/*/__build__/
@@ -64,18 +71,20 @@ __build__/**
6471
!karma*.js
6572
!test-main.js
6673
src/lib
67-
src/platforms
6874
src/hooks
6975
src/node_modules
7076
src/*.js
7177
src/*.js.map
72-
src/*.d.ts
7378
src/*.metadata.json
7479
src/**/*.js
7580
src/**/*.js.map
7681
src/**/*.ngfactory.ts
82+
src/**/*.metadata.json
7783
target/
7884

85+
# publish, helper
86+
publish/node_modules/
87+
7988
# demo apps
8089
demo/node_modules/
8190
demo/hooks
@@ -91,8 +100,8 @@ demo-angular/app/tns_modules/
91100
demo-angular/report
92101

93102
# end2end app
94-
test/e2e/node_modules/
95-
test/e2e/hooks
96-
test/e2e/lib
97-
test/e2e/platforms
98-
test/e2e/app/tns_modules/
103+
src/test/e2e/node_modules/
104+
src/test/e2e/hooks
105+
src/test/e2e/lib
106+
src/test/e2e/platforms
107+
src/test/e2e/app/tns_modules/

Jenkinsfile

Lines changed: 59 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,57 +1,68 @@
11
properties properties: [
2-
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']],
3-
disableConcurrentBuilds()
2+
[$class: 'BuildDiscarderProperty', strategy: [$class: 'LogRotator', artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '30', numToKeepStr: '10']],
3+
disableConcurrentBuilds()
44
]
55

66
@Library('mare-build-library')
77
def nodeJS = new de.mare.ci.jenkins.NodeJS()
88

9-
timeout(60) {
10-
node('nativescript') {
11-
def buildNumber = env.BUILD_NUMBER
12-
def branchName = env.BRANCH_NAME
13-
def workspace = env.WORKSPACE
14-
def buildUrl = env.BUILD_URL
15-
16-
// PRINT ENVIRONMENT TO JOB
17-
echo "workspace directory is $workspace"
18-
echo "build URL is $buildUrl"
19-
echo "build Number is $buildNumber"
20-
echo "branch name is $branchName"
21-
echo "PATH is $env.PATH"
22-
23-
try {
24-
stage('Checkout') {
25-
checkout scm
26-
}
27-
28-
dir('src') {
29-
stage('Build') {
30-
sh "npm run clean && npm run build"
31-
}
32-
33-
stage('Test') {
34-
sh "npm run test"
35-
junit 'target/junit-report/junitresults-*.xml'
36-
}
37-
}
38-
39-
stage('End2End Test') {
40-
sh "cd demo && npm run build.plugin && npm i && npm run build-ios-bundle && npm run build-android-bundle"
41-
sh "cd demo-angular && npm run build.plugin && npm i && npm run build-ios-bundle && npm run build-android-bundle"
42-
}
43-
44-
dir('src') {
45-
stage('Publish NPM snapshot') {
46-
sh "npm run build"
47-
nodeJS.publishSnapshot('.', buildNumber, branchName)
48-
}
49-
}
50-
51-
} catch (e) {
52-
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}): Error on build", to: 'github@martinreinhardt-online.de', body: "Please go to ${env.BUILD_URL}."
53-
throw e
54-
}
9+
timeout(150) {
10+
node('nativescript') {
11+
def buildNumber = env.BUILD_NUMBER
12+
def branchName = env.BRANCH_NAME
13+
def workspace = env.WORKSPACE
14+
def buildUrl = env.BUILD_URL
15+
16+
// PRINT ENVIRONMENT TO JOB
17+
echo "workspace directory is $workspace"
18+
echo "build URL is $buildUrl"
19+
echo "build Number is $buildNumber"
20+
echo "branch name is $branchName"
21+
echo "PATH is $env.PATH"
22+
23+
try {
24+
stage('Checkout') {
25+
checkout scm
26+
}
27+
28+
stage('Build') {
29+
sh "cd publish && npm run setup-dev-env"
30+
sh "cd demo && rm -rf hooks/ node_modules/ platforms/ && npm i"
31+
sh "cd demo-angular && rm -rf hooks/ node_modules/ platforms/ && npm i"
32+
}
33+
34+
stage('Webpack') {
35+
parallel demo: {
36+
sh "cd demo && npm run build-ios-bundle && npm run build-android-bundle"
37+
}, demoAngular: {
38+
sh "cd demo-angular && npm run build-ios-bundle && npm run build-android-bundle"
39+
},
40+
failFast: true
41+
}
42+
43+
stage('Test') {
44+
parallel unit:{
45+
sh "cd src && npm run test"
46+
}, iOS: {
47+
//sh "cd demo && npm run ci.ios.build && tns test ios --justlaunch --emulator"
48+
}, Android: {
49+
//sh "cd demo && npm run ci.android.build && tns test android --justlaunch --emulator"
50+
},
51+
failFast: true
52+
junit 'demo/target/junit-report/*.xml,src/target/junit-report/*.xml'
53+
}
54+
55+
stage('Publish NPM snapshot') {
56+
def packageJSON = readJSON file: './src/package.json';
57+
sh "cd publish/package && mv *.tgz nativescript-urlhandler_v${packageJSON.version}-build${buildNumber}.tgz"
58+
archiveArtifacts artifacts: 'publish/package/*.tgz'
59+
nodeJS.publishSnapshot('src', buildNumber, branchName)
60+
}
61+
62+
} catch (e) {
63+
mail subject: "${env.JOB_NAME} (${env.BUILD_NUMBER}): Error on build", to: 'github@martinreinhardt-online.de', body: "Please go to ${env.BUILD_URL}."
64+
throw e
5565
}
66+
}
5667
}
5768

demo-angular/karma.conf.js

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
module.exports = function(config) {
2+
config.set({
3+
4+
// base path that will be used to resolve all patterns (eg. files, exclude)
5+
basePath: '',
6+
7+
8+
// frameworks to use
9+
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
10+
frameworks: ['jasmine'],
11+
12+
13+
// list of files / patterns to load in the browser
14+
files: [
15+
'app/**/*.js',
16+
],
17+
18+
19+
// list of files to exclude
20+
exclude: [
21+
],
22+
23+
24+
// preprocess matching files before serving them to the browser
25+
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
26+
preprocessors: {
27+
},
28+
29+
30+
// test results reporter to use
31+
// possible values: 'dots', 'progress'
32+
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
33+
reporters: ['progress'],
34+
35+
36+
// web server port
37+
port: 9876,
38+
39+
40+
// enable / disable colors in the output (reporters and logs)
41+
colors: true,
42+
43+
44+
// level of logging
45+
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
46+
logLevel: config.LOG_INFO,
47+
48+
49+
// enable / disable watching file and executing tests whenever any file changes
50+
autoWatch: true,
51+
52+
53+
// start these browsers
54+
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
55+
browsers: [],
56+
57+
customLaunchers: {
58+
android: {
59+
base: 'NS',
60+
platform: 'android'
61+
},
62+
ios: {
63+
base: 'NS',
64+
platform: 'ios'
65+
},
66+
ios_simulator: {
67+
base: 'NS',
68+
platform: 'ios',
69+
arguments: ['--emulator']
70+
}
71+
},
72+
73+
// Continuous Integration mode
74+
// if true, Karma captures browsers, runs the tests and exits
75+
singleRun: false
76+
})
77+
}

0 commit comments

Comments
 (0)