Skip to content
This repository was archived by the owner on Oct 22, 2018. It is now read-only.

Commit cf96525

Browse files
committed
Fix gitignore to include .js files required
1 parent a608ed9 commit cf96525

File tree

6 files changed

+618
-0
lines changed

6 files changed

+618
-0
lines changed

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ testem.log
3434
/typings
3535
yarn.lock
3636
*.js
37+
!symlink.js
38+
!karma.conf.js
39+
!protractor.conf.js
40+
!nativescript/gulpfile.js
41+
!nativescript/webpack.config.js
3742

3843
# e2e
3944
/e2e/*.js

karma.conf.js

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Karma configuration file, see link for more information
2+
// https://karma-runner.github.io/0.13/config/configuration-file.html
3+
4+
module.exports = function (config) {
5+
config.set({
6+
basePath: '',
7+
frameworks: ['jasmine', '@angular/cli'],
8+
plugins: [
9+
require('karma-jasmine'),
10+
require('karma-chrome-launcher'),
11+
require('karma-jasmine-html-reporter'),
12+
require('karma-coverage-istanbul-reporter'),
13+
require('@angular/cli/plugins/karma')
14+
],
15+
client:{
16+
clearContext: false // leave Jasmine Spec Runner output visible in browser
17+
},
18+
files: [
19+
{ pattern: './src/test.ts', watched: false }
20+
],
21+
preprocessors: {
22+
'./src/test.ts': ['@angular/cli']
23+
},
24+
mime: {
25+
'text/x-typescript': ['ts','tsx']
26+
},
27+
coverageIstanbulReporter: {
28+
reports: [ 'html', 'lcovonly' ],
29+
fixWebpackSourcePaths: true
30+
},
31+
angularCli: {
32+
environment: 'dev'
33+
},
34+
reporters: config.angularCli && config.angularCli.codeCoverage
35+
? ['progress', 'coverage-istanbul']
36+
: ['progress', 'kjhtml'],
37+
port: 9876,
38+
colors: true,
39+
logLevel: config.LOG_INFO,
40+
autoWatch: true,
41+
browsers: ['Chrome'],
42+
singleRun: false
43+
});
44+
};

nativescript/gulpfile.js

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
const gulp = require('gulp');
2+
const rename = require('gulp-rename');
3+
const replace = require('gulp-string-replace')
4+
const debug = require('gulp-debug');
5+
const del = require('del');
6+
7+
//Paths
8+
const SRC = 'src/';
9+
const DEST = 'app/';
10+
11+
function removeTns (path) {
12+
path.basename = path.basename.replace('.tns', '');
13+
}
14+
15+
function removePhone (path) {
16+
path.basename = path.basename.replace('.phone', '');
17+
}
18+
19+
gulp.task('clean.Dist', () => {
20+
return del([
21+
'app/**/*',
22+
'!**/vendor.ts',
23+
'!**/vendor-platform.android.ts',
24+
'!**/vendor-platform.ios.ts'
25+
]);
26+
});
27+
28+
gulp.task('resources.App_Resources', () => {
29+
return gulp.src(['App_Resources/**/*'], {follow: true})
30+
.pipe(gulp.dest(`${DEST}App_Resources`));
31+
});
32+
33+
gulp.task('resources.Assets', () => {
34+
return gulp.src([`${SRC}**/*`, `!${SRC}app/`, `!${SRC}test/`, '!**/*.spec.*', '!**/*.js', '!**/*.ts', '!**/*.scss', '!**/*.html'], {follow: true})
35+
// .pipe(debug({title: 'resources.Assets'}))
36+
.pipe(gulp.dest(DEST));
37+
});
38+
39+
gulp.task('project.Typescript', () => {
40+
return gulp.src([`${SRC}**/*.ts`, '!**/*.tns.*', '!**/*.spec.*'], {follow: true})
41+
// .pipe(debug({title: 'project.Typescript'}))
42+
.pipe(gulp.dest(DEST));
43+
});
44+
45+
gulp.task('project.Styles', () => {
46+
return gulp.src([`${SRC}**/*.scss`, '!**/*.tns.*'], {follow: true})
47+
.pipe(gulp.dest(DEST));
48+
});
49+
50+
gulp.task('tns.Typescript', () => {
51+
return gulp.src([`${SRC}**/*.tns.ts`], {follow: true})
52+
.pipe(rename(removeTns))
53+
// .pipe(debug({title: 'tns.Typescript'}))
54+
.pipe(gulp.dest(DEST, {overwrite: true}));
55+
});
56+
57+
gulp.task('tns.Templates', () => {
58+
return gulp.src([`${SRC}**/*.tns.html`, `${SRC}**/*.tns.ios.html`, `${SRC}**/*.tns.android.html`], {follow: true})
59+
.pipe(rename(removeTns))
60+
// .pipe(debug({title: 'tns.Templates'}))
61+
.pipe(gulp.dest(DEST, {overwrite: true}));
62+
});
63+
64+
gulp.task('tns.Styles', () => {
65+
return gulp.src([`${SRC}**/*.tns.scss`, `${SRC}**/*.tns.ios.scss`, `${SRC}**/*.tns.android.scss`], {follow: true})
66+
.pipe(rename(removeTns))
67+
// .pipe(debug({title: 'tns.Styles'}))
68+
.pipe(gulp.dest(DEST, {overwrite: true}));
69+
});
70+
71+
gulp.task('phone.Typescript', () => {
72+
return gulp.src([`${SRC}**/*.tns.phone.ts`], {follow: true})
73+
.pipe(rename(removeTns))
74+
.pipe(rename(removePhone))
75+
// .pipe(debug({title: 'phone.Typescript'}))
76+
.pipe(gulp.dest(DEST, {overwrite: true}));
77+
});
78+
79+
gulp.task('phone.Templates', () => {
80+
return gulp.src([`${SRC}**/*.tns.phone.html`, `${SRC}**/*.tns.ios.phone.html`, `${SRC}**/*.tns.android.phone.html`], {follow: true})
81+
.pipe(rename(removeTns))
82+
.pipe(rename(removePhone))
83+
// .pipe(debug({title: 'phone.Templates'}))
84+
.pipe(gulp.dest(DEST, {overwrite: true}));
85+
});
86+
87+
gulp.task('phone.Styles', () => {
88+
return gulp.src([`${SRC}**/*.tns.phone.scss`, `${SRC}**/*.tns.ios.phone.scss`, `${SRC}**/*.tns.android.phone.scss`], {follow: true})
89+
.pipe(rename(removeTns))
90+
.pipe(rename(removePhone))
91+
// .pipe(debug({title: 'phone.Styles'}))
92+
.pipe(gulp.dest(DEST, {overwrite: true}));
93+
});
94+
95+
gulp.task(
96+
'build.Default',
97+
gulp.series(
98+
'clean.Dist',
99+
'resources.App_Resources',
100+
'resources.Assets',
101+
'project.Typescript',
102+
'project.Styles',
103+
'tns.Templates',
104+
'tns.Styles',
105+
'tns.Typescript'
106+
)
107+
);
108+
109+
gulp.task(
110+
'build.Phone',
111+
gulp.series(
112+
'build.Default',
113+
'phone.Typescript',
114+
'phone.Templates',
115+
'phone.Styles'
116+
)
117+
);
118+
119+
/**
120+
* For non webpack builds, scss needs to be converted to css
121+
*/
122+
gulp.task('tns.ComponentStyles', () => {
123+
return gulp.src([`${DEST}/**/*.component.ts`], {follow: true})
124+
.pipe(replace('.scss\'', '.css\'', { logs: { enabled: false }}))
125+
// .pipe(debug({title: 'tns.ComponentStyles'}))
126+
.pipe(gulp.dest(DEST, {overwrite: true}));
127+
});
128+
129+
gulp.task(
130+
'build.cli.Default',
131+
gulp.series(
132+
'build.Default',
133+
'tns.ComponentStyles'
134+
)
135+
);
136+
137+
gulp.task(
138+
'build.cli.Phone',
139+
gulp.series(
140+
'build.Phone',
141+
'tns.ComponentStyles'
142+
)
143+
);
144+
145+
gulp.task('tns.Livesync', () => {
146+
return gulp.watch([`${SRC}**/*.tns.html`, `${SRC}/**/*.tns.scss`, `${SRC}/**/*.component.ts`])
147+
.on('change', (file) => {
148+
var outputDest = file.replace(SRC, DEST);
149+
outputDest = outputDest.substring(0, outputDest.lastIndexOf('/'));
150+
gulp.src([file])
151+
.pipe(rename(removeTns))
152+
.pipe(replace('.scss\'', '.css\'', { logs: { enabled: false }}))
153+
.pipe(debug({title: 'tns.Livesync'}))
154+
.pipe(gulp.dest(outputDest, {overwrite: true}));
155+
});
156+
});
157+
158+
gulp.task('tns.Livesync.Phone', () => {
159+
return gulp.watch([`${SRC}**/*.tns.phone.html`, `${SRC}/**/*.tns.phone.scss`, `${SRC}/**/*.component.ts`])
160+
.on('change', (file) => {
161+
var outputDest = file.replace(SRC, DEST);
162+
outputDest = outputDest.substring(0, outputDest.lastIndexOf('/'));
163+
gulp.src([file])
164+
.pipe(rename(removeTns))
165+
.pipe(rename(removePhone))
166+
.pipe(replace('.scss\'', '.css\'', { logs: { enabled: false }}))
167+
.pipe(debug({title: 'tns.Livesync.Phone'}))
168+
.pipe(gulp.dest(outputDest, {overwrite: true}));
169+
});
170+
});

0 commit comments

Comments
 (0)