Skip to content

Commit cdf0837

Browse files
committed
Remove grunt-ts dependency.
Compile code using tsconfig.json files and plain tsc invocations. Call those using grunt-shell.
1 parent a546a19 commit cdf0837

File tree

8 files changed

+112
-68
lines changed

8 files changed

+112
-68
lines changed

gruntfile.js

Lines changed: 8 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -321,59 +321,6 @@ module.exports = function(grunt) {
321321
dest: "<%= grunt.option('path') %>/node_modules/tns-core-modules/",
322322
}
323323
},
324-
ts: {
325-
build: {
326-
tsconfig: {
327-
tsconfig: 'tsconfig.json',
328-
passThrough: true,
329-
},
330-
outDir: localCfg.outDir,
331-
dest: localCfg.outDir,
332-
options: tsOptions
333-
},
334-
buildNodeTests: {
335-
src: [
336-
'tns-core-modules/js-libs/easysax/**/*.ts',
337-
'tns-core-modules/module.d.ts',
338-
'tns-core-modules/xml/**/*.ts',
339-
'tns-core-modules/lib.core.d.ts',
340-
'tns-core-modules/lib.dom.d.ts',
341-
'tns-core-modules/es-collections.d.ts',
342-
'tns-core-modules/declarations.d.ts',
343-
'tns-core-modules/es6-promise.d.ts',
344-
'node-tests/**/*.ts'
345-
],
346-
outDir: localCfg.outDir,
347-
dest: localCfg.outDir,
348-
options: tsOptions
349-
},
350-
buildDts: {
351-
src: [
352-
'tns-core-modules/**/*.d.ts',
353-
'!org.nativescript.widgets.d.ts',
354-
'!**/*.android.d.ts',
355-
'!**/node_modules/**/*',
356-
'!**/platforms/**/*',
357-
'!bin/**/*',
358-
'!**/references.d.ts',
359-
'!tns-core-modules/references.d.ts',
360-
'!tns-core-modules/android17.d.ts',
361-
'!tns-core-modules/ios/**/*',
362-
'!tns-core-modules/org.nativescript.widgets.d.ts',
363-
],
364-
outDir: localCfg.outDir,
365-
dest: localCfg.outDir,
366-
options: tsOptions
367-
},
368-
testCombinedDts: {
369-
src: [
370-
path.join(localCfg.outTnsCoreModules, 'tns-core-modules.d.ts'),
371-
],
372-
outDir: localCfg.outDir,
373-
dest: localCfg.outDir,
374-
options: Object.assign({}, tsOptions, { noLib: false })
375-
}
376-
},
377324
tslint: {
378325
build: {
379326
files: {
@@ -400,6 +347,10 @@ module.exports = function(grunt) {
400347
callback: assignGitSHA
401348
}
402349
},
350+
compileAll: "npm run compile-all",
351+
compileNodeTests: "npm run compile-node-tests",
352+
compileCheckBaseDts: "npm run compile-check-base-dts",
353+
compileCheckCombinedDts: "npm run compile-check-combined-dts",
403354
},
404355
simplemocha: {
405356
node: {
@@ -431,7 +382,6 @@ module.exports = function(grunt) {
431382

432383
grunt.loadNpmTasks("grunt-contrib-clean");
433384
grunt.loadNpmTasks("grunt-contrib-copy");
434-
grunt.loadNpmTasks("grunt-ts");
435385
grunt.loadNpmTasks("grunt-tslint");
436386
grunt.loadNpmTasks("grunt-exec");
437387
grunt.loadNpmTasks("grunt-shell");
@@ -446,8 +396,8 @@ module.exports = function(grunt) {
446396
]);
447397

448398
grunt.registerTask("compile-ts", [
449-
"ts:buildDts",
450-
"ts:build",
399+
"shell:compileCheckBaseDts",
400+
"shell:compileAll",
451401
"clean:typeScriptLeftovers",
452402
"copy:childPackageFiles"
453403
]);
@@ -508,12 +458,12 @@ module.exports = function(grunt) {
508458
"copy:definitionFiles",
509459
"copy:jsLibs",
510460
"generate-tns-core-modules-dts",
511-
"ts:testCombinedDts",
461+
"shell:compileCheckCombinedDts",
512462
]);
513463

514464
grunt.registerTask("node-tests", [
515465
"clean:nodeTests",
516-
"ts:buildNodeTests",
466+
"shell:compileNodeTests",
517467
"copy:childPackageFiles",
518468
"copy:jsLibs",
519469
"env:nodeTests",

node-tests/test-angular-xml.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import {assert} from "chai";
2-
import * as xmlModule from "xml";
3-
var xml: typeof xmlModule = require("../tns-core-modules/xml");
2+
//TODO: use a path mapping to the "xml" module after upgrading to TS 2.1
3+
var xml = require("../tns-core-modules/xml");
44

55
describe("angular xml parser", () => {
66
let last_element = null;
77
let last_attrs = null;
88
let parser = null;
99

1010
beforeEach(() => {
11-
parser = new xml.XmlParser(function (event: xmlModule.ParserEvent) {
11+
parser = new xml.XmlParser(function (event) {
1212
switch (event.eventType) {
1313
case xml.ParserEventType.StartElement:
1414
last_element = event.elementName;

node-tests/test-xml.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {assert} from "chai";
2-
import * as xmlModule from "xml";
3-
var xml: typeof xmlModule = require("../tns-core-modules/xml");
2+
//TODO: use a path mapping to the "xml" module after upgrading to TS 2.1
3+
var xml = require("../tns-core-modules/xml");
44

55
describe("xml parser", () => {
66
let last_element = null;
@@ -9,7 +9,7 @@ describe("xml parser", () => {
99
let parser = null;
1010

1111
beforeEach(() => {
12-
parser = new xml.XmlParser(function (event: xmlModule.ParserEvent) {
12+
parser = new xml.XmlParser(function (event) {
1313
switch (event.eventType) {
1414
case xml.ParserEventType.StartElement:
1515
last_element = event.elementName;

package.json

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,10 @@
1616
"grunt-env": "0.4.4",
1717
"grunt-exec": "1.0.1",
1818
"grunt-mkdir": "1.0.0",
19-
"grunt-multi-dest": "1.0.0",
2019
"grunt-shell": "2.1.0",
2120
"grunt-simple-mocha": "0.4.1",
22-
"grunt-ts": "5.3.2",
2321
"grunt-tslint": "4.0.0",
2422
"grunt-typedoc": "0.2.4",
25-
"grunt-untar": "0.0.1",
2623
"http-server": "^0.9.0",
2724
"markdown-snippet-injector": "0.1.1",
2825
"mocha": "2.2.5",
@@ -36,6 +33,10 @@
3633
"scripts": {
3734
"setup": "npm run dev-link-tns-platform-declarations && npm run dev-link-tns-core-modules && npm run dev-link-tests && npm run dev-link-apps",
3835
"tsc": "tsc",
36+
"compile-all": "tsc -p tsconfig.json --outDir bin/dist",
37+
"compile-check-base-dts": "tsc -p tsconfig.base-dts.json",
38+
"compile-node-tests": "tsc -p tsconfig.node-tests.json --outDir bin/dist/node-tests",
39+
"compile-check-combined-dts": "tsc -p tsconfig.combined-dts.json",
3940
"tsc-w": "tsc --skipLibCheck -w",
4041
"dev-tsc-tns-platform-declarations": "tsc -p tns-platform-declarations",
4142
"dev-tsc-tests": "tsc -p tests",

tsconfig.base-dts.json

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
{
2+
"compilerOptions": {
3+
"noEmit": true,
4+
"noEmitOnError": true,
5+
"noEmitHelpers": true,
6+
"target": "es5",
7+
"module": "commonjs",
8+
"declaration": false,
9+
"noImplicitAny": false,
10+
"noImplicitUseStrict": true,
11+
"experimentalDecorators": true,
12+
"sourceMap": true,
13+
"jsx": "react",
14+
"reactNamespace": "UIBuilder",
15+
"lib": [
16+
"es2016"
17+
]
18+
},
19+
"include": [
20+
"tns-core-modules/**/*.d.ts"
21+
],
22+
"exclude": [
23+
"tns-platform-declarations/node_modules/",
24+
"tns-platform-declarations/package/",
25+
"tns-core-modules/node_modules/",
26+
"tns-core-modules/package/",
27+
"tests/node_modules",
28+
"tests/package/",
29+
"tests/platforms",
30+
"apps/node_modules",
31+
"apps/package/",
32+
"apps/platforms",
33+
"node_modules/",
34+
"package/",
35+
"bin",
36+
"build",
37+
"Deploy",
38+
"out",
39+
"obj",
40+
"tns-platform-declarations/references.d.ts",
41+
"tns-core-modules/references.d.ts",
42+
"tns-platform-declarations/ios/objc-x86_64/",
43+
"tns-platform-declarations/android/"
44+
]
45+
}

tsconfig.combined-dts.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"noEmit": true,
4+
"noEmitOnError": true,
5+
"noEmitHelpers": true,
6+
"target": "es5",
7+
"module": "commonjs",
8+
"declaration": false,
9+
"noImplicitAny": false,
10+
"noImplicitUseStrict": true,
11+
"experimentalDecorators": true,
12+
"sourceMap": true,
13+
"jsx": "react",
14+
"reactNamespace": "UIBuilder"
15+
},
16+
"include": [
17+
"bin/dist/tns-core-modules/tns-core-modules.d.ts"
18+
]
19+
}

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"declaration": false,
88
"noImplicitAny": false,
99
"noImplicitUseStrict": true,
10+
"removeComments": true,
1011
"experimentalDecorators": true,
1112
"diagnostics": true,
1213
"sourceMap": true,
@@ -38,4 +39,4 @@
3839
"tns-core-modules/references.d.ts",
3940
"tns-platform-declarations/ios/objc-x86_64/"
4041
]
41-
}
42+
}

tsconfig.node-tests.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"compilerOptions": {
3+
"noEmitOnError": true,
4+
"noEmitHelpers": true,
5+
"target": "es5",
6+
"module": "commonjs",
7+
"declaration": false,
8+
"noImplicitAny": false,
9+
"noImplicitUseStrict": true,
10+
"experimentalDecorators": true,
11+
"sourceMap": true,
12+
"jsx": "react",
13+
"reactNamespace": "UIBuilder",
14+
"lib": [
15+
"es2016"
16+
]
17+
},
18+
"include": [
19+
"tns-core-modules/js-libs/easysax/**/*.ts",
20+
"tns-core-modules/module.d.ts",
21+
"tns-core-modules/lib.core.d.ts",
22+
"tns-core-modules/lib.dom.d.ts",
23+
"tns-core-modules/es-collections.d.ts",
24+
"tns-core-modules/declarations.d.ts",
25+
"tns-core-modules/es6-promise.d.ts",
26+
"node-tests/**/*.ts"
27+
]
28+
}

0 commit comments

Comments
 (0)