Merge pull request #1023 from NativeScript/tns-core-modules-dts

tns-core-modules + d.ts = ☺☺☺
This commit is contained in:
Hristo Deshev
2015-11-03 11:41:12 +02:00
4 changed files with 46 additions and 81 deletions

View File

@@ -3,10 +3,6 @@
"version": "2.2.1",
"description": "CSS parser / stringifier",
"main": "index",
"files": [
"index.js",
"lib"
],
"dependencies": {
"source-map": "^0.1.38",
"source-map-resolve": "^0.3.0",

View File

@@ -80,18 +80,6 @@ module.exports = function(grunt) {
packageObject.keywords = packageObject.keywords.concat(newKeywords);
};
var updateDefinitionsPackageDef = function(content, srcPath) {
return updatePackageDef(content, function(contentAsObject) {
contentAsObject.version = localCfg.packageVersion;
contentAsObject.name = "tns-definitions";
contentAsObject.description = "NativeScript Module definitions";
contentAsObject.license = "Apache-2.0";
if (localCfg.commitSHA) {
contentAsObject.repository.url += "/commit/" + localCfg.commitSHA;
}
});
};
var getCommitSha = function() {
if (process.env.GIT_COMMIT) {
return process.env.GIT_COMMIT;
@@ -142,11 +130,6 @@ module.exports = function(grunt) {
outModulesDir: "./bin/dist/modules",
outAppsDir: "./bin/dist/apps",
outTsAppsDir: "./bin/dist/ts-apps",
outDefinitionsDir: "./bin/dist/definitions",
excludedModules: [
"!./ui/slide-out/**/*.*"
]
};
var nodeTestEnv = JSON.parse(JSON.stringify(process.env));
@@ -162,15 +145,15 @@ module.exports = function(grunt) {
"!" + localCfg.outDir + "/**/*.*",
"!./node_modules/**/*.*",
"!./bin/**/*.*",
"!./build/**/*.*",
"!./Deploy/**/*.*",
"!./obj/**/*.*",
"!./out/**/*.*",
"!./.*/**/*.*"
"!./build/**/*.*",
"!./Deploy/**/*.*",
"!./obj/**/*.*",
"!./out/**/*.*",
"!./.*/**/*.*"
];
localCfg.typeScriptSrc = [
"./**/*.ts"
].concat(localCfg.defaultExcludes).concat(localCfg.excludedModules);
].concat(localCfg.defaultExcludes);
localCfg.typeScriptSrcForTsLint = localCfg.typeScriptSrc.concat([
"!./ios.d.ts",
"!./android17.d.ts",
@@ -217,12 +200,12 @@ module.exports = function(grunt) {
jsLibs: {
expand: true,
src: [
"./js-libs/**/*.js",
"./fetch/**/*.js",
"./css/**/*.js",
"./css-value/**/*.js",
"js-libs/**/*.js",
"fetch/**/*.js",
"css/**/*.js",
"css-value/**/*.js",
],
dest: "<%= localCfg.outModulesDir %>/",
dest: localCfg.outModulesDir,
cwd: localCfg.srcDir
},
license: {
@@ -242,11 +225,16 @@ module.exports = function(grunt) {
definitionFiles: {
src: [
localCfg.srcDir + "/**/*.d.ts",
pathModule.join(localCfg.srcDir, "LICENSE"),
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
"!" + localCfg.srcDir + "/apps/**"
].concat(localCfg.defaultExcludes).concat(localCfg.excludedModules),
dest: localCfg.outDefinitionsDir + "/",
"!" + localCfg.srcDir + "/apps/**",
"!" + localCfg.srcDir + "/node-tests/**",
"!" + localCfg.srcDir + "/org.nativescript.widgets.d.ts",
"!" + localCfg.srcDir + "/android17.d.ts",
"!" + localCfg.srcDir + "/**/*.android.d.ts",
"!" + localCfg.srcDir + "/ios.d.ts",
"!" + localCfg.srcDir + "/**/*.ios.d.ts",
].concat(localCfg.defaultExcludes),
dest: localCfg.outModulesDir + "/",
expand: true,
options: {
process: filterTypeScriptFiles
@@ -260,13 +248,6 @@ module.exports = function(grunt) {
process: updateModulesPackageDef
}
},
definitionsPackageDef: {
src: localCfg.packageJsonFilePath,
dest: localCfg.outDefinitionsDir + "/",
options: {
process: updateDefinitionsPackageDef
}
},
appPackageDef: {
expand: true,
flatten: true,
@@ -282,10 +263,10 @@ module.exports = function(grunt) {
localCfg.srcDir + "/**/package.json",
"!./package.json",
"!./Deploy/**/*.*",
"!./bin/**/*.*",
"!./Tests/**/*.*",
"!" + localCfg.outDir + "/**/*.*"
].concat(localCfg.excludedModules),
"!./bin/**/*.*",
"!./Tests/**/*.*",
"!" + localCfg.outDir + "/**/*.*"
],
dest: localCfg.outModulesDir + "/"
},
rawAppsFiles: {
@@ -352,6 +333,13 @@ module.exports = function(grunt) {
],
outDir: localCfg.outModulesDir,
options: tsOptions
},
testCombinedDts: {
src: [
pathModule.join(localCfg.outModulesDir, 'tns-core-modules.d.ts'),
],
outDir: localCfg.outModulesDir,
options: tsOptions
}
},
tslint: {
@@ -369,10 +357,6 @@ module.exports = function(grunt) {
cmd: "npm pack",
cwd: localCfg.outModulesDir + "/"
},
packDefinitions: {
cmd: "npm pack",
cwd: localCfg.outDefinitionsDir + "/"
},
packApp: {
cmd: "npm pack",
cwd: "__dummy__"
@@ -487,11 +471,6 @@ module.exports = function(grunt) {
"multidest:copyLicenseFiles"
]);
// Does nothing to avoid copying the same files twice. Instead,
// the distribute-definition-files tasks copies the d.ts files
// from the source root directly to the output folder.
grunt.registerTask("collect-definitions-raw-files", []);
grunt.registerTask("collect-modules-raw-files", [
"copy:jsLibs",
"copy:license"
@@ -512,11 +491,22 @@ module.exports = function(grunt) {
grunt.registerTask("distribute-ts-apps-files", [
"copy:readyTsAppFiles"
]);
grunt.registerTask("distribute-definition-files", [
"copy:definitionFiles"
]);
grunt.registerTask("generate-tns-core-modules-dts", function() {
var dtsFiles = grunt.file.expand({cwd: localCfg.outModulesDir}, ['**/*.d.ts']);
dtsFiles.sort()
var dtsLines = dtsFiles.map(function(dtsFile) {
return '/// <reference path="' + dtsFile + '" />';
});
var combinedDtsPath = pathModule.join(localCfg.outModulesDir, 'tns-core-modules.d.ts');
grunt.file.write(combinedDtsPath, dtsLines.join('\n'));
});
grunt.registerTask("pack-modules", [
"copy:modulesPackageDef",
"copy:definitionFiles",
"copy:jsLibs",
"generate-tns-core-modules-dts",
"ts:testCombinedDts",
"exec:packModules"
]);
grunt.registerTask("pack-apps", [
@@ -525,10 +515,6 @@ module.exports = function(grunt) {
grunt.registerTask("pack-ts-apps", [
"processEachApp:" + localCfg.outTsAppsDir + ":-ts"
]);
grunt.registerTask("pack-definitions", [
"copy:definitionsPackageDef",
"exec:packDefinitions"
]);
grunt.registerTask("get-ready-packages", [
"copy:readyPackages"
]);
@@ -538,7 +524,6 @@ module.exports = function(grunt) {
"pack-apps",
"pack-ts-apps",
"pack-definitions",
"get-ready-packages"
]));
@@ -547,13 +532,11 @@ module.exports = function(grunt) {
"shell:getGitSHA",
"collect-apps-raw-files",
"collect-definitions-raw-files",
"collect-modules-raw-files",
"compile-ts",
"distribute-apps-files",
"distribute-ts-apps-files",
"distribute-definition-files",
"pack-modules"
]));

View File

@@ -17,11 +17,6 @@
"email": "flash.vkv@gmail.com",
"url": "http://vflash.ru"
},
"files": [
"easysax.js",
"LICENSE",
"README.md"
],
"repository": {
"type": "git",
"url": "https://github.com/vflash/easysax"

View File

@@ -8,15 +8,6 @@
"esvalidate": "./bin/esvalidate.js"
},
"version": "2.0.0-dev",
"files": [
"bin",
"test/run.js",
"test/runner.js",
"test/test.js",
"test/compat.js",
"test/reflect.js",
"esprima.js"
],
"engines": {
"node": ">=0.4.0"
},
@@ -80,4 +71,4 @@
"benchmark": "node test/benchmarks.js",
"benchmark-quick": "node test/benchmarks.js quick"
}
}
}