mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
No more ambient modules for tns-core-modules/* subpackages.
- Use path mappings in tsconfig.json to resolve module typings - Only use ambient mobules for global API's - Move single-file modules to a subdir with the same name so that we can provide a hand-written typing next to it (via package.json) - Delete all mentions of tns-core-modules.d.ts - Delete reference d.ts assembly build steps. Not needed anymore. - HACK! Use a <reference> for global typings in application.d.ts to avoid publishing a separate @types/tns-core-modules package. - Rename declarations.d.ts to tns-core-modules.d.ts to preserve JS project mappings in references.d.ts (the only place we use those)
This commit is contained in:
committed by
Hristo Deshev
parent
1af8c6ca8e
commit
b45cbe929b
38
gruntfile.js
38
gruntfile.js
@@ -78,33 +78,6 @@ module.exports = function(grunt) {
|
||||
return localCfg.mainPackageContent.version + "-" + buildVersion;
|
||||
};
|
||||
|
||||
var writeDtsFile = function writeDtsFile(dtsFiles, outDir, outFile) {
|
||||
var dtsLines = dtsFiles.map(function(dtsFile) {
|
||||
return '/// <reference path="' + dtsFile + '" />';
|
||||
});
|
||||
var combinedDtsPath = path.join(outDir, outFile);
|
||||
grunt.file.write(combinedDtsPath, dtsLines.join('\n'));
|
||||
};
|
||||
|
||||
var generateModulesDts = function generateModulesDts(outDir, srcDir) {
|
||||
var dtsFiles = grunt.file.expand({cwd: srcDir }, [
|
||||
"**/*.d.ts",
|
||||
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
|
||||
"!docs-shims.d.ts",
|
||||
"!node-tests/**",
|
||||
"!org.nativescript.widgets.d.ts",
|
||||
"!android17.d.ts",
|
||||
"!**/*.android.d.ts",
|
||||
"!ios/**",
|
||||
"!**/*.ios.d.ts",
|
||||
"!tns-core-modules.d.ts",
|
||||
"!references.d.ts",
|
||||
].concat(localCfg.defaultExcludes));
|
||||
dtsFiles.sort();
|
||||
|
||||
writeDtsFile(dtsFiles, outDir, "tns-core-modules/tns-core-modules.d.ts");
|
||||
};
|
||||
|
||||
// Configure localCfg
|
||||
var outDir = "./bin/dist";
|
||||
var srcDir = ".";
|
||||
@@ -300,9 +273,8 @@ module.exports = function(grunt) {
|
||||
}
|
||||
},
|
||||
compileAll: "npm run compile-all",
|
||||
setupLinks: "npm run setup",
|
||||
compileNodeTests: "npm run compile-node-tests",
|
||||
compileCheckBaseDts: "npm run compile-check-base-dts",
|
||||
compileCheckCombinedDts: "npm run compile-check-combined-dts",
|
||||
tslint: "npm run tslint",
|
||||
},
|
||||
simplemocha: {
|
||||
@@ -348,7 +320,7 @@ module.exports = function(grunt) {
|
||||
]);
|
||||
|
||||
grunt.registerTask("compile-ts", [
|
||||
"shell:compileCheckBaseDts",
|
||||
"shell:setupLinks",
|
||||
"shell:compileAll",
|
||||
"clean:typeScriptLeftovers",
|
||||
"copy:childPackageFiles"
|
||||
@@ -388,10 +360,6 @@ module.exports = function(grunt) {
|
||||
});
|
||||
});
|
||||
|
||||
grunt.registerTask("generate-tns-core-modules-dev-dts", generateModulesDts.bind(null, ".", localCfg.srcTnsCoreModules));
|
||||
|
||||
grunt.registerTask("generate-tns-core-modules-dts", generateModulesDts.bind(null, localCfg.outDir, localCfg.outTnsCoreModules));
|
||||
|
||||
//aliasing pack-modules for backwards compatibility
|
||||
grunt.registerTask("pack-modules", [
|
||||
"compile-modules",
|
||||
@@ -409,8 +377,6 @@ module.exports = function(grunt) {
|
||||
"collect-modules-raw-files",
|
||||
"copy:definitionFiles",
|
||||
"copy:jsLibs",
|
||||
"generate-tns-core-modules-dts",
|
||||
"shell:compileCheckCombinedDts",
|
||||
]);
|
||||
|
||||
grunt.registerTask("node-tests", [
|
||||
|
||||
Reference in New Issue
Block a user