Remove grunt-ts dependency.

Compile code using tsconfig.json files and plain tsc invocations.
Call those using grunt-shell.
This commit is contained in:
Hristo Deshev
2017-02-09 17:20:11 +02:00
parent a546a19ab0
commit cdf08378b0
8 changed files with 112 additions and 68 deletions

View File

@ -321,59 +321,6 @@ module.exports = function(grunt) {
dest: "<%= grunt.option('path') %>/node_modules/tns-core-modules/",
}
},
ts: {
build: {
tsconfig: {
tsconfig: 'tsconfig.json',
passThrough: true,
},
outDir: localCfg.outDir,
dest: localCfg.outDir,
options: tsOptions
},
buildNodeTests: {
src: [
'tns-core-modules/js-libs/easysax/**/*.ts',
'tns-core-modules/module.d.ts',
'tns-core-modules/xml/**/*.ts',
'tns-core-modules/lib.core.d.ts',
'tns-core-modules/lib.dom.d.ts',
'tns-core-modules/es-collections.d.ts',
'tns-core-modules/declarations.d.ts',
'tns-core-modules/es6-promise.d.ts',
'node-tests/**/*.ts'
],
outDir: localCfg.outDir,
dest: localCfg.outDir,
options: tsOptions
},
buildDts: {
src: [
'tns-core-modules/**/*.d.ts',
'!org.nativescript.widgets.d.ts',
'!**/*.android.d.ts',
'!**/node_modules/**/*',
'!**/platforms/**/*',
'!bin/**/*',
'!**/references.d.ts',
'!tns-core-modules/references.d.ts',
'!tns-core-modules/android17.d.ts',
'!tns-core-modules/ios/**/*',
'!tns-core-modules/org.nativescript.widgets.d.ts',
],
outDir: localCfg.outDir,
dest: localCfg.outDir,
options: tsOptions
},
testCombinedDts: {
src: [
path.join(localCfg.outTnsCoreModules, 'tns-core-modules.d.ts'),
],
outDir: localCfg.outDir,
dest: localCfg.outDir,
options: Object.assign({}, tsOptions, { noLib: false })
}
},
tslint: {
build: {
files: {
@ -400,6 +347,10 @@ module.exports = function(grunt) {
callback: assignGitSHA
}
},
compileAll: "npm run compile-all",
compileNodeTests: "npm run compile-node-tests",
compileCheckBaseDts: "npm run compile-check-base-dts",
compileCheckCombinedDts: "npm run compile-check-combined-dts",
},
simplemocha: {
node: {
@ -431,7 +382,6 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-contrib-clean");
grunt.loadNpmTasks("grunt-contrib-copy");
grunt.loadNpmTasks("grunt-ts");
grunt.loadNpmTasks("grunt-tslint");
grunt.loadNpmTasks("grunt-exec");
grunt.loadNpmTasks("grunt-shell");
@ -446,8 +396,8 @@ module.exports = function(grunt) {
]);
grunt.registerTask("compile-ts", [
"ts:buildDts",
"ts:build",
"shell:compileCheckBaseDts",
"shell:compileAll",
"clean:typeScriptLeftovers",
"copy:childPackageFiles"
]);
@ -508,12 +458,12 @@ module.exports = function(grunt) {
"copy:definitionFiles",
"copy:jsLibs",
"generate-tns-core-modules-dts",
"ts:testCombinedDts",
"shell:compileCheckCombinedDts",
]);
grunt.registerTask("node-tests", [
"clean:nodeTests",
"ts:buildNodeTests",
"shell:compileNodeTests",
"copy:childPackageFiles",
"copy:jsLibs",
"env:nodeTests",

View File

@ -1,6 +1,6 @@
import {assert} from "chai";
import * as xmlModule from "xml";
var xml: typeof xmlModule = require("../tns-core-modules/xml");
//TODO: use a path mapping to the "xml" module after upgrading to TS 2.1
var xml = require("../tns-core-modules/xml");
describe("angular xml parser", () => {
let last_element = null;
@ -8,7 +8,7 @@ describe("angular xml parser", () => {
let parser = null;
beforeEach(() => {
parser = new xml.XmlParser(function (event: xmlModule.ParserEvent) {
parser = new xml.XmlParser(function (event) {
switch (event.eventType) {
case xml.ParserEventType.StartElement:
last_element = event.elementName;

View File

@ -1,6 +1,6 @@
import {assert} from "chai";
import * as xmlModule from "xml";
var xml: typeof xmlModule = require("../tns-core-modules/xml");
//TODO: use a path mapping to the "xml" module after upgrading to TS 2.1
var xml = require("../tns-core-modules/xml");
describe("xml parser", () => {
let last_element = null;
@ -9,7 +9,7 @@ describe("xml parser", () => {
let parser = null;
beforeEach(() => {
parser = new xml.XmlParser(function (event: xmlModule.ParserEvent) {
parser = new xml.XmlParser(function (event) {
switch (event.eventType) {
case xml.ParserEventType.StartElement:
last_element = event.elementName;

View File

@ -16,13 +16,10 @@
"grunt-env": "0.4.4",
"grunt-exec": "1.0.1",
"grunt-mkdir": "1.0.0",
"grunt-multi-dest": "1.0.0",
"grunt-shell": "2.1.0",
"grunt-simple-mocha": "0.4.1",
"grunt-ts": "5.3.2",
"grunt-tslint": "4.0.0",
"grunt-typedoc": "0.2.4",
"grunt-untar": "0.0.1",
"http-server": "^0.9.0",
"markdown-snippet-injector": "0.1.1",
"mocha": "2.2.5",
@ -36,6 +33,10 @@
"scripts": {
"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",
"tsc": "tsc",
"compile-all": "tsc -p tsconfig.json --outDir bin/dist",
"compile-check-base-dts": "tsc -p tsconfig.base-dts.json",
"compile-node-tests": "tsc -p tsconfig.node-tests.json --outDir bin/dist/node-tests",
"compile-check-combined-dts": "tsc -p tsconfig.combined-dts.json",
"tsc-w": "tsc --skipLibCheck -w",
"dev-tsc-tns-platform-declarations": "tsc -p tns-platform-declarations",
"dev-tsc-tests": "tsc -p tests",

45
tsconfig.base-dts.json Normal file
View File

@ -0,0 +1,45 @@
{
"compilerOptions": {
"noEmit": true,
"noEmitOnError": true,
"noEmitHelpers": true,
"target": "es5",
"module": "commonjs",
"declaration": false,
"noImplicitAny": false,
"noImplicitUseStrict": true,
"experimentalDecorators": true,
"sourceMap": true,
"jsx": "react",
"reactNamespace": "UIBuilder",
"lib": [
"es2016"
]
},
"include": [
"tns-core-modules/**/*.d.ts"
],
"exclude": [
"tns-platform-declarations/node_modules/",
"tns-platform-declarations/package/",
"tns-core-modules/node_modules/",
"tns-core-modules/package/",
"tests/node_modules",
"tests/package/",
"tests/platforms",
"apps/node_modules",
"apps/package/",
"apps/platforms",
"node_modules/",
"package/",
"bin",
"build",
"Deploy",
"out",
"obj",
"tns-platform-declarations/references.d.ts",
"tns-core-modules/references.d.ts",
"tns-platform-declarations/ios/objc-x86_64/",
"tns-platform-declarations/android/"
]
}

View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"noEmit": true,
"noEmitOnError": true,
"noEmitHelpers": true,
"target": "es5",
"module": "commonjs",
"declaration": false,
"noImplicitAny": false,
"noImplicitUseStrict": true,
"experimentalDecorators": true,
"sourceMap": true,
"jsx": "react",
"reactNamespace": "UIBuilder"
},
"include": [
"bin/dist/tns-core-modules/tns-core-modules.d.ts"
]
}

View File

@ -7,6 +7,7 @@
"declaration": false,
"noImplicitAny": false,
"noImplicitUseStrict": true,
"removeComments": true,
"experimentalDecorators": true,
"diagnostics": true,
"sourceMap": true,

28
tsconfig.node-tests.json Normal file
View File

@ -0,0 +1,28 @@
{
"compilerOptions": {
"noEmitOnError": true,
"noEmitHelpers": true,
"target": "es5",
"module": "commonjs",
"declaration": false,
"noImplicitAny": false,
"noImplicitUseStrict": true,
"experimentalDecorators": true,
"sourceMap": true,
"jsx": "react",
"reactNamespace": "UIBuilder",
"lib": [
"es2016"
]
},
"include": [
"tns-core-modules/js-libs/easysax/**/*.ts",
"tns-core-modules/module.d.ts",
"tns-core-modules/lib.core.d.ts",
"tns-core-modules/lib.dom.d.ts",
"tns-core-modules/es-collections.d.ts",
"tns-core-modules/declarations.d.ts",
"tns-core-modules/es6-promise.d.ts",
"node-tests/**/*.ts"
]
}