Rename the files
3
.gitignore
vendored
@ -38,3 +38,6 @@ TestRunResult.txt
|
|||||||
tns-core-modules.base.d.ts
|
tns-core-modules.base.d.ts
|
||||||
tns-core-modules.d.ts
|
tns-core-modules.d.ts
|
||||||
tns-core-modules.es6.d.ts
|
tns-core-modules.es6.d.ts
|
||||||
|
|
||||||
|
tests/platforms/
|
||||||
|
tests/lib/
|
||||||
|
223
gruntfile.js
@ -1,6 +1,7 @@
|
|||||||
var tsconfig = require('./tsconfig.json');
|
var tsconfig = require('./tsconfig.json');
|
||||||
var shelljs = require("shelljs");
|
var shelljs = require("shelljs");
|
||||||
var path = require("path");
|
var path = require("path");
|
||||||
|
var fs=require("fs");
|
||||||
|
|
||||||
module.exports = function(grunt) {
|
module.exports = function(grunt) {
|
||||||
if (grunt.option('profile')) {
|
if (grunt.option('profile')) {
|
||||||
@ -14,9 +15,6 @@ module.exports = function(grunt) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var fs=require("fs");
|
|
||||||
var pathModule=require("path");
|
|
||||||
|
|
||||||
var tsLintOption = grunt.option('runtslint');
|
var tsLintOption = grunt.option('runtslint');
|
||||||
var skipTsLint = tsLintOption == 'false' || tsLintOption == false;
|
var skipTsLint = tsLintOption == 'false' || tsLintOption == false;
|
||||||
if (tsLintOption == null) {
|
if (tsLintOption == null) {
|
||||||
@ -122,38 +120,40 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
var getSubDirs = function(dir) {
|
var getSubDirs = function(dir) {
|
||||||
return shelljs.ls(dir).filter(function (subDir) {
|
return shelljs.ls(dir).filter(function (subDir) {
|
||||||
return shelljs.test('-d', pathModule.join(dir, subDir));
|
return shelljs.test('-d', path.join(dir, subDir));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
var getApps = function() {
|
var getApps = function() {
|
||||||
var allApps = getSubDirs(localCfg.srcAppsDir);
|
var allApps = getSubDirs(localCfg.srcAppsDir);
|
||||||
if (grunt.option('test-app-only')) {
|
if (grunt.option('test-app-only')) {
|
||||||
allApps = allApps.filter(function(appName) {
|
allApps = allApps.filter(function(app) {
|
||||||
return appName === 'tests';
|
return app === 'tests';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return allApps;
|
return allApps;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var outDir = tsconfig.compilerOptions.outDir || "./bin/dist";
|
||||||
var localCfg = {
|
var localCfg = {
|
||||||
srcDir: ".",
|
srcDir: ".",
|
||||||
srcAppsDir: "./apps",
|
srcAppsDir: "./apps",
|
||||||
srcAppsTests: "./apps/tests",
|
srcAppsTestsDir: "./tests/app",
|
||||||
packageJsonFilePath: "./package.json",
|
packageJsonFilePath: "./tns-core-modules/package.json",
|
||||||
outDir: "./bin/dist",
|
|
||||||
outArticlesDir: "./bin/dist/articles",
|
outArticlesDir: "./bin/dist/articles",
|
||||||
outModulesDir: tsconfig.compilerOptions.outDir || "./bin/dist/modules",
|
outDir: outDir,
|
||||||
|
outTnsCoreModules: path.join(outDir, "tns-core-modules"),
|
||||||
outAppsDir: "./bin/dist/apps",
|
outAppsDir: "./bin/dist/apps",
|
||||||
outTsAppsDir: "./bin/dist/ts-apps",
|
outAppsTestsDir: "./bin/dist/tests/app",
|
||||||
|
outTsAppsTestsDir: "./bin/dist/ts-tests/app",
|
||||||
|
outTsAppsDir: "./bin/dist/ts-apps/app",
|
||||||
outApiRefDir: "./bin/dist/apiref"
|
outApiRefDir: "./bin/dist/apiref"
|
||||||
};
|
};
|
||||||
|
|
||||||
var nodeTestEnv = JSON.parse(JSON.stringify(process.env));
|
var nodeTestEnv = JSON.parse(JSON.stringify(process.env));
|
||||||
nodeTestEnv.NODE_PATH = localCfg.outModulesDir;
|
nodeTestEnv.NODE_PATH = localCfg.outTnsCoreModules
|
||||||
|
|
||||||
localCfg.nodeTestsDir = pathModule.join(localCfg.outModulesDir, 'node-tests');
|
|
||||||
|
|
||||||
|
localCfg.nodeTestsDir = path.join(localCfg.outDir, 'node-tests');
|
||||||
|
|
||||||
localCfg.mainPackageContent = grunt.file.readJSON(localCfg.packageJsonFilePath);
|
localCfg.mainPackageContent = grunt.file.readJSON(localCfg.packageJsonFilePath);
|
||||||
localCfg.packageVersion = getPackageVersion(localCfg.packageJsonFilePath);
|
localCfg.packageVersion = getPackageVersion(localCfg.packageJsonFilePath);
|
||||||
@ -161,18 +161,20 @@ module.exports = function(grunt) {
|
|||||||
localCfg.typeScriptSrc = tsconfig.filesGlob;
|
localCfg.typeScriptSrc = tsconfig.filesGlob;
|
||||||
localCfg.defaultExcludes = localCfg.typeScriptSrc.filter(function(item) { return /^!/.test(item); });
|
localCfg.defaultExcludes = localCfg.typeScriptSrc.filter(function(item) { return /^!/.test(item); });
|
||||||
localCfg.typeScriptSrcForTsLint = localCfg.typeScriptSrc.concat([
|
localCfg.typeScriptSrcForTsLint = localCfg.typeScriptSrc.concat([
|
||||||
"!ios.d.ts",
|
"!tns-core-modules/ios.d.ts",
|
||||||
"!android17.d.ts",
|
"!tns-core-modules/android17.d.ts",
|
||||||
"!libjs.d.ts"
|
"!tns-core-modules/libjs.d.ts",
|
||||||
|
"!tests/node_modules/"
|
||||||
]);
|
]);
|
||||||
localCfg.srcTsdFiles = [
|
localCfg.srcTsdFiles = [
|
||||||
"**/*.d.ts",
|
"**/*.d.ts",
|
||||||
"!apps/**",
|
"!apps/**",
|
||||||
|
"!tests/**",
|
||||||
"!node-tests/**",
|
"!node-tests/**",
|
||||||
"!org.nativescript.widgets.d.ts",
|
"!tns-core-modules/org.nativescript.widgets.d.ts",
|
||||||
"!android17.d.ts",
|
"!tns-core-modules/android17.d.ts",
|
||||||
"!**/*.android.d.ts",
|
"!**/*.android.d.ts",
|
||||||
"!ios.d.ts",
|
"!tns-core-modules/ios.d.ts",
|
||||||
"!**/*.ios.d.ts"
|
"!**/*.ios.d.ts"
|
||||||
].concat(localCfg.defaultExcludes);
|
].concat(localCfg.defaultExcludes);
|
||||||
|
|
||||||
@ -181,9 +183,9 @@ module.exports = function(grunt) {
|
|||||||
tsOptions.removeComments = !grunt.option('leavecomments') || '';
|
tsOptions.removeComments = !grunt.option('leavecomments') || '';
|
||||||
tsOptions.compiler = "node_modules/typescript/bin/tsc";
|
tsOptions.compiler = "node_modules/typescript/bin/tsc";
|
||||||
tsOptions.failOnTypeErrors = true;
|
tsOptions.failOnTypeErrors = true;
|
||||||
tsOptions.outDir = localCfg.outModulesDir;
|
tsOptions.outDir = localCfg.outDir;
|
||||||
var removeCommentsArgument = tsOptions.removeComments ? " --removeComments" : "";
|
var removeCommentsArgument = tsOptions.removeComments ? " --removeComments" : "";
|
||||||
tsOptions.additionalFlags = "--outDir " + localCfg.outModulesDir + removeCommentsArgument;
|
tsOptions.additionalFlags = "--outDir " + localCfg.outDir + removeCommentsArgument;
|
||||||
|
|
||||||
grunt.initConfig({
|
grunt.initConfig({
|
||||||
localCfg : localCfg,
|
localCfg : localCfg,
|
||||||
@ -199,13 +201,13 @@ module.exports = function(grunt) {
|
|||||||
"_references.js",
|
"_references.js",
|
||||||
"**/*.map"
|
"**/*.map"
|
||||||
],
|
],
|
||||||
cwd: localCfg.outModulesDir
|
cwd: localCfg.outDir
|
||||||
},
|
},
|
||||||
nodeTests: {
|
nodeTests: {
|
||||||
src: localCfg.nodeTestsDir,
|
src: localCfg.nodeTestsDir,
|
||||||
},
|
},
|
||||||
builtModules: {
|
builtModules: {
|
||||||
src: localCfg.outModulesDir
|
src: localCfg.outDir
|
||||||
},
|
},
|
||||||
externalModules: {
|
externalModules: {
|
||||||
expand: true,
|
expand: true,
|
||||||
@ -214,9 +216,6 @@ module.exports = function(grunt) {
|
|||||||
force: true
|
force: true
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
readyAppFiles: {
|
|
||||||
src: [localCfg.outModulesDir + "/apps/**"]
|
|
||||||
},
|
|
||||||
articles: {
|
articles: {
|
||||||
src: [ localCfg.outArticlesDir ]
|
src: [ localCfg.outArticlesDir ]
|
||||||
},
|
},
|
||||||
@ -228,26 +227,26 @@ module.exports = function(grunt) {
|
|||||||
jsLibs: {
|
jsLibs: {
|
||||||
expand: true,
|
expand: true,
|
||||||
src: [
|
src: [
|
||||||
"js-libs/**/*.js",
|
"tns-core-modules/js-libs/**/*.js",
|
||||||
"fetch/**/*.js",
|
"tns-core-modules/fetch/**/*.js",
|
||||||
"css/**/*.js",
|
"tns-core-modules/css/**/*.js",
|
||||||
"css-value/**/*.js",
|
"tns-core-modules/css-value/**/*.js",
|
||||||
],
|
],
|
||||||
dest: localCfg.outModulesDir,
|
dest: localCfg.outDir,
|
||||||
cwd: localCfg.srcDir
|
cwd: localCfg.srcDir
|
||||||
},
|
},
|
||||||
articleMDs: {
|
articleMDs: {
|
||||||
expand: true,
|
expand: true,
|
||||||
src: [ "**/*.md" ],
|
src: [ "**/*.md" ],
|
||||||
dest: localCfg.outArticlesDir,
|
dest: localCfg.outArticlesDir,
|
||||||
cwd: localCfg.srcAppsTests
|
cwd: localCfg.srcAppsTestsDir
|
||||||
},
|
},
|
||||||
license: {
|
license: {
|
||||||
expand: true,
|
expand: true,
|
||||||
src: [
|
src: [
|
||||||
"./LICENSE",
|
"./LICENSE",
|
||||||
],
|
],
|
||||||
dest: "<%= localCfg.outModulesDir %>/",
|
dest: localCfg.outTnsCoreModules,
|
||||||
cwd: localCfg.srcDir
|
cwd: localCfg.srcDir
|
||||||
},
|
},
|
||||||
appLicense: {
|
appLicense: {
|
||||||
@ -269,7 +268,7 @@ module.exports = function(grunt) {
|
|||||||
"!ios.d.ts",
|
"!ios.d.ts",
|
||||||
"!**/*.ios.d.ts",
|
"!**/*.ios.d.ts",
|
||||||
].concat(localCfg.defaultExcludes),
|
].concat(localCfg.defaultExcludes),
|
||||||
dest: localCfg.outModulesDir + "/",
|
dest: localCfg.outDir + "/",
|
||||||
expand: true,
|
expand: true,
|
||||||
options: {
|
options: {
|
||||||
process: filterTypeScriptFiles
|
process: filterTypeScriptFiles
|
||||||
@ -278,7 +277,7 @@ module.exports = function(grunt) {
|
|||||||
modulesPackageDef: {
|
modulesPackageDef: {
|
||||||
expand: true,
|
expand: true,
|
||||||
src: localCfg.packageJsonFilePath,
|
src: localCfg.packageJsonFilePath,
|
||||||
dest: localCfg.outModulesDir + "/",
|
dest: localCfg.outDir + "/",
|
||||||
options: {
|
options: {
|
||||||
process: updateModulesPackageDef
|
process: updateModulesPackageDef
|
||||||
}
|
}
|
||||||
@ -303,7 +302,7 @@ module.exports = function(grunt) {
|
|||||||
"!node_modules/**/*.*",
|
"!node_modules/**/*.*",
|
||||||
"!" + localCfg.outDir + "/**/*.*"
|
"!" + localCfg.outDir + "/**/*.*"
|
||||||
],
|
],
|
||||||
dest: localCfg.outModulesDir + "/"
|
dest: localCfg.outDir + "/"
|
||||||
},
|
},
|
||||||
rawAppsFiles: {
|
rawAppsFiles: {
|
||||||
expand: true,
|
expand: true,
|
||||||
@ -317,14 +316,27 @@ module.exports = function(grunt) {
|
|||||||
cwd: localCfg.srcAppsDir,
|
cwd: localCfg.srcAppsDir,
|
||||||
dot: true
|
dot: true
|
||||||
},
|
},
|
||||||
|
rawTestsFiles: {
|
||||||
|
expand: true,
|
||||||
|
src: [
|
||||||
|
"**/*.*",
|
||||||
|
"**/*",
|
||||||
|
"!**/*.map",
|
||||||
|
"!**/*.ts"
|
||||||
|
],
|
||||||
|
dest: localCfg.outAppsTestsDir,
|
||||||
|
cwd: localCfg.srcAppsTestsDir,
|
||||||
|
dot: true
|
||||||
|
},
|
||||||
readyAppFiles: {
|
readyAppFiles: {
|
||||||
expand: true,
|
expand: true,
|
||||||
src: ["./**/*.*"],
|
src: ["./**/*.*"],
|
||||||
dest: localCfg.outAppsDir + "/",
|
dest: localCfg.outAppsDir + "/",
|
||||||
cwd: localCfg.outModulesDir + "/apps/",
|
cwd: localCfg.outDir + "/apps/",
|
||||||
options: {
|
// WARNING: Why not insert BOMs in .png files?
|
||||||
process: processAppFile
|
// options: {
|
||||||
}
|
// process: processAppFile
|
||||||
|
// }
|
||||||
},
|
},
|
||||||
readyTsAppFiles: {
|
readyTsAppFiles: {
|
||||||
expand: true,
|
expand: true,
|
||||||
@ -332,6 +344,12 @@ module.exports = function(grunt) {
|
|||||||
dest: localCfg.outTsAppsDir + "/",
|
dest: localCfg.outTsAppsDir + "/",
|
||||||
cwd: localCfg.srcAppsDir
|
cwd: localCfg.srcAppsDir
|
||||||
},
|
},
|
||||||
|
readyTsAppsTestsFiles: {
|
||||||
|
expand: true,
|
||||||
|
src: ["./**/*.*", "!./**/*.map"],
|
||||||
|
dest: localCfg.outTsAppsTestsDir + "/",
|
||||||
|
cwd: localCfg.srcAppsTestsDir
|
||||||
|
},
|
||||||
readyPackages: {
|
readyPackages: {
|
||||||
expand: true,
|
expand: true,
|
||||||
src: ["./**/*.tgz"],
|
src: ["./**/*.tgz"],
|
||||||
@ -348,7 +366,7 @@ module.exports = function(grunt) {
|
|||||||
'!node_modules/**/*',
|
'!node_modules/**/*',
|
||||||
'!node-tests/**/*',
|
'!node-tests/**/*',
|
||||||
],
|
],
|
||||||
cwd: localCfg.outModulesDir,
|
cwd: localCfg.outDir,
|
||||||
dest: "<%= grunt.option('path') %>/node_modules/tns-core-modules/",
|
dest: "<%= grunt.option('path') %>/node_modules/tns-core-modules/",
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -358,8 +376,8 @@ module.exports = function(grunt) {
|
|||||||
tsconfig: 'tsconfig.json',
|
tsconfig: 'tsconfig.json',
|
||||||
passThrough: true,
|
passThrough: true,
|
||||||
},
|
},
|
||||||
outDir: localCfg.outModulesDir,
|
outDir: localCfg.outDir,
|
||||||
dest: localCfg.outModulesDir,
|
dest: localCfg.outDir,
|
||||||
options: tsOptions
|
options: tsOptions
|
||||||
},
|
},
|
||||||
"build-inplace": {
|
"build-inplace": {
|
||||||
@ -373,14 +391,14 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
buildNodeTests: {
|
buildNodeTests: {
|
||||||
src: [
|
src: [
|
||||||
'js-libs/easysax/**/*.ts',
|
'tns-core-modules/js-libs/easysax/**/*.ts',
|
||||||
'module.d.ts',
|
'tns-core-modules/module.d.ts',
|
||||||
'xml/**/*.ts',
|
'tns-core-modules/xml/**/*.ts',
|
||||||
|
'tns-core-modules/es-collections.d.ts',
|
||||||
'node-tests/**/*.ts',
|
'node-tests/**/*.ts',
|
||||||
'es-collections.d.ts',
|
|
||||||
],
|
],
|
||||||
outDir: localCfg.outModulesDir,
|
outDir: localCfg.outDir,
|
||||||
dest: localCfg.outModulesDir,
|
dest: localCfg.outDir,
|
||||||
options: tsOptions
|
options: tsOptions
|
||||||
},
|
},
|
||||||
buildDts: {
|
buildDts: {
|
||||||
@ -389,21 +407,22 @@ module.exports = function(grunt) {
|
|||||||
'!org.nativescript.widgets.d.ts',
|
'!org.nativescript.widgets.d.ts',
|
||||||
'!**/*.android.d.ts',
|
'!**/*.android.d.ts',
|
||||||
'!node_modules/**/*',
|
'!node_modules/**/*',
|
||||||
|
'!tests/node_modules/**/*.*',
|
||||||
'!bin/**/*',
|
'!bin/**/*',
|
||||||
'!apps/**/*',
|
'!apps/**/*',
|
||||||
'!android17.d.ts',
|
'!android17.d.ts',
|
||||||
'!ios.d.ts',
|
'!ios.d.ts',
|
||||||
],
|
],
|
||||||
outDir: localCfg.outModulesDir,
|
outDir: localCfg.outDir,
|
||||||
dest: localCfg.outModulesDir,
|
dest: localCfg.outDir,
|
||||||
options: tsOptions
|
options: tsOptions
|
||||||
},
|
},
|
||||||
testCombinedDts: {
|
testCombinedDts: {
|
||||||
src: [
|
src: [
|
||||||
pathModule.join(localCfg.outModulesDir, 'tns-core-modules.d.ts'),
|
path.join(localCfg.outTnsCoreModules, 'tns-core-modules.d.ts'),
|
||||||
],
|
],
|
||||||
outDir: localCfg.outModulesDir,
|
outDir: localCfg.outDir,
|
||||||
dest: localCfg.outModulesDir,
|
dest: localCfg.outDir,
|
||||||
options: tsOptions
|
options: tsOptions
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -420,7 +439,7 @@ module.exports = function(grunt) {
|
|||||||
exec: {
|
exec: {
|
||||||
packModules: {
|
packModules: {
|
||||||
cmd: "npm pack",
|
cmd: "npm pack",
|
||||||
cwd: localCfg.outModulesDir + "/"
|
cwd: localCfg.outTnsCoreModules + "/"
|
||||||
},
|
},
|
||||||
packApp: {
|
packApp: {
|
||||||
cmd: "npm pack",
|
cmd: "npm pack",
|
||||||
@ -430,7 +449,7 @@ module.exports = function(grunt) {
|
|||||||
cmd: "grunt simplemocha:node"
|
cmd: "grunt simplemocha:node"
|
||||||
},
|
},
|
||||||
injectArticleSnippets: {
|
injectArticleSnippets: {
|
||||||
cmd: "node node_modules/markdown-snippet-injector/index.js --root=<%= localCfg.srcAppsTests %> --docsroot=<%= localCfg.outArticlesDir %>"
|
cmd: "node node_modules/markdown-snippet-injector/index.js --root=<%= localCfg.srcAppsTestsDir %> --docsroot=<%= localCfg.outArticlesDir %>"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
multidest: {
|
multidest: {
|
||||||
@ -440,9 +459,11 @@ module.exports = function(grunt) {
|
|||||||
var apps = getApps();
|
var apps = getApps();
|
||||||
var targetDirs = [];
|
var targetDirs = [];
|
||||||
apps.forEach(function(item){
|
apps.forEach(function(item){
|
||||||
targetDirs.push(pathModule.join(localCfg.outAppsDir, item));
|
targetDirs.push(path.join(localCfg.outAppsDir, item));
|
||||||
targetDirs.push(pathModule.join(localCfg.outTsAppsDir, item));
|
targetDirs.push(path.join(localCfg.outTsAppsDir, item));
|
||||||
});
|
});
|
||||||
|
targetDirs.push(localCfg.outAppsTestsDir);
|
||||||
|
targetDirs.push(localCfg.outTsAppsTestsDir);
|
||||||
return targetDirs;
|
return targetDirs;
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@ -462,7 +483,7 @@ module.exports = function(grunt) {
|
|||||||
},
|
},
|
||||||
env: {
|
env: {
|
||||||
nodeTests: {
|
nodeTests: {
|
||||||
NODE_PATH: localCfg.outModulesDir,
|
NODE_PATH: nodeTestEnv.NODE_PATH,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
typedoc: {
|
typedoc: {
|
||||||
@ -492,16 +513,16 @@ module.exports = function(grunt) {
|
|||||||
grunt.loadNpmTasks("grunt-simple-mocha");
|
grunt.loadNpmTasks("grunt-simple-mocha");
|
||||||
grunt.loadNpmTasks('grunt-typedoc');
|
grunt.loadNpmTasks('grunt-typedoc');
|
||||||
|
|
||||||
var cloneTasks = function(originalTasks, taskNameSuffix) {
|
var cloneTasks = function(originalTasks, app) {
|
||||||
var clonedTasks = [];
|
var clonedTasks = [];
|
||||||
for(var i=0; i<originalTasks.length; i++) {
|
for(var i=0; i<originalTasks.length; i++) {
|
||||||
var originalTask = originalTasks[i];
|
var originalTask = originalTasks[i];
|
||||||
|
|
||||||
var taskCfg = grunt.util._.clone(grunt.config(originalTask.name));
|
var taskCfg = grunt.util._.clone(grunt.config(originalTask.name));
|
||||||
var taskName = grunt.util._.clone(originalTask.name);
|
var taskName = grunt.util._.clone(originalTask.name);
|
||||||
taskName[1] = taskName[1] + "_" + taskNameSuffix;
|
taskName[1] = taskName[1] + "_" + app;
|
||||||
|
|
||||||
originalTask.specializeCfg(taskCfg, taskNameSuffix);
|
originalTask.specializeCfg(taskCfg, app);
|
||||||
|
|
||||||
clonedTasks.push({name: taskName, cfg: taskCfg});
|
clonedTasks.push({name: taskName, cfg: taskCfg});
|
||||||
}
|
}
|
||||||
@ -519,7 +540,7 @@ module.exports = function(grunt) {
|
|||||||
var dtsLines = dtsFiles.map(function(dtsFile) {
|
var dtsLines = dtsFiles.map(function(dtsFile) {
|
||||||
return '/// <reference path="' + dtsFile + '" />';
|
return '/// <reference path="' + dtsFile + '" />';
|
||||||
});
|
});
|
||||||
var combinedDtsPath = pathModule.join(outDir, outFile);
|
var combinedDtsPath = path.join(outDir, outFile);
|
||||||
grunt.file.write(combinedDtsPath, dtsLines.join('\n'));
|
grunt.file.write(combinedDtsPath, dtsLines.join('\n'));
|
||||||
}
|
}
|
||||||
function generateModulesDts(outDir) {
|
function generateModulesDts(outDir) {
|
||||||
@ -536,10 +557,11 @@ module.exports = function(grunt) {
|
|||||||
var es6Excludes = nonES6Files.map(function(file) {
|
var es6Excludes = nonES6Files.map(function(file) {
|
||||||
return '!' + file;
|
return '!' + file;
|
||||||
})
|
})
|
||||||
var dtsFiles = grunt.file.expand({cwd: outDir}, [
|
var dtsFiles = grunt.file.expand({cwd: localCfg.outTnsCoreModules }, [
|
||||||
"**/*.d.ts",
|
"**/*.d.ts",
|
||||||
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
|
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
|
||||||
"!apps/**",
|
"!apps/**",
|
||||||
|
"!tests/**",
|
||||||
"!ts-apps/**",
|
"!ts-apps/**",
|
||||||
"!node-tests/**",
|
"!node-tests/**",
|
||||||
"!org.nativescript.widgets.d.ts",
|
"!org.nativescript.widgets.d.ts",
|
||||||
@ -549,39 +571,55 @@ module.exports = function(grunt) {
|
|||||||
"!**/*.ios.d.ts",
|
"!**/*.ios.d.ts",
|
||||||
"!tns-core-modules.d.ts",
|
"!tns-core-modules.d.ts",
|
||||||
"!tns-core-modules.es6.d.ts",
|
"!tns-core-modules.es6.d.ts",
|
||||||
"!tns-core-modules.base.d.ts",
|
"!tns-core-modules.base.d.ts"
|
||||||
].concat(localCfg.defaultExcludes).concat(es6Excludes).concat(angularExcludes));
|
].concat(localCfg.defaultExcludes).concat(es6Excludes).concat(angularExcludes));
|
||||||
dtsFiles.sort();
|
dtsFiles.sort();
|
||||||
|
|
||||||
writeDtsFile(dtsFiles, outDir, 'tns-core-modules.base.d.ts');
|
writeDtsFile(dtsFiles, outDir, 'tns-core-modules/tns-core-modules.base.d.ts');
|
||||||
var es6Files = angularConflicts.concat(['tns-core-modules.base.d.ts']);
|
var es6Files = angularConflicts.concat(['tns-core-modules.base.d.ts']);
|
||||||
writeDtsFile(es6Files, outDir, 'tns-core-modules.es6.d.ts');
|
writeDtsFile(es6Files, outDir, 'tns-core-modules/tns-core-modules.es6.d.ts');
|
||||||
var allFiles = angularConflicts.concat(nonES6Files).concat(['tns-core-modules.base.d.ts']);
|
var allFiles = angularConflicts.concat(nonES6Files).concat(['tns-core-modules.base.d.ts']);
|
||||||
writeDtsFile(allFiles, outDir, 'tns-core-modules.d.ts');
|
writeDtsFile(allFiles, outDir, 'tns-core-modules/tns-core-modules.d.ts');
|
||||||
};
|
};
|
||||||
|
|
||||||
grunt.registerTask("processEachApp", function(outAppsDir, pkgAppNameSuffix){
|
grunt.registerTask("processTestsApp", function(outTestsAppDir, pkgAppNameSuffix) {
|
||||||
var allApps = getApps();
|
|
||||||
if (grunt.option('test-app-only')) {
|
|
||||||
allApps = allApps.filter(function(appName) {
|
|
||||||
return appName === 'tests';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
var tasks = [
|
var tasks = [
|
||||||
{
|
{
|
||||||
name: ["copy", "appPackageDef"],
|
name: ["copy", "appPackageDef"],
|
||||||
specializeCfg: function (cfg, currentAppName) {
|
specializeCfg: function (cfg, app) {
|
||||||
outAppDir = pathModule.join(outAppsDir, currentAppName);
|
cfg.src = path.join(outTestsAppDir, "package.json");
|
||||||
var pkgFilePath = pathModule.join(outAppDir, "package.json");
|
cfg.dest = outTestsAppDir;
|
||||||
cfg.src = pkgFilePath;
|
cfg.appName = "tests" + (pkgAppNameSuffix || "");
|
||||||
cfg.dest = outAppDir;
|
|
||||||
cfg.appName = currentAppName + (pkgAppNameSuffix || "");
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: ["exec", "packApp"],
|
name: ["exec", "packApp"],
|
||||||
specializeCfg: function(cfg, currentAppName) {
|
specializeCfg: function(cfg, app) {
|
||||||
cfg.cwd = pathModule.join(outAppsDir, currentAppName);
|
cfg.cwd = outTestsAppDir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
var clonedTasks = cloneTasks(tasks, "tests");
|
||||||
|
enqueueTasks(clonedTasks);
|
||||||
|
});
|
||||||
|
|
||||||
|
grunt.registerTask("processEachApp", function(outAppsDir, pkgAppNameSuffix){
|
||||||
|
var allApps = getApps();
|
||||||
|
var tasks = [
|
||||||
|
{
|
||||||
|
name: ["copy", "appPackageDef"],
|
||||||
|
specializeCfg: function (cfg, app) {
|
||||||
|
outAppDir = path.join(outAppsDir, app);
|
||||||
|
var pkgFilePath = path.join(outAppDir, "package.json");
|
||||||
|
cfg.src = pkgFilePath;
|
||||||
|
cfg.dest = outAppDir;
|
||||||
|
cfg.appName = app + (pkgAppNameSuffix || "");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: ["exec", "packApp"],
|
||||||
|
specializeCfg: function(cfg, app) {
|
||||||
|
cfg.cwd = path.join(outAppsDir, app);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
@ -598,6 +636,7 @@ module.exports = function(grunt) {
|
|||||||
|
|
||||||
grunt.registerTask("collect-apps-raw-files", [
|
grunt.registerTask("collect-apps-raw-files", [
|
||||||
"copy:rawAppsFiles",
|
"copy:rawAppsFiles",
|
||||||
|
"copy:rawTestsFiles",
|
||||||
"multidest:copyLicenseFiles"
|
"multidest:copyLicenseFiles"
|
||||||
]);
|
]);
|
||||||
|
|
||||||
@ -631,8 +670,7 @@ module.exports = function(grunt) {
|
|||||||
"copy:builtModules"
|
"copy:builtModules"
|
||||||
]);
|
]);
|
||||||
grunt.registerTask("distribute-apps-files", [
|
grunt.registerTask("distribute-apps-files", [
|
||||||
"copy:readyAppFiles",
|
"copy:readyAppFiles"
|
||||||
"clean:readyAppFiles"
|
|
||||||
]);
|
]);
|
||||||
grunt.registerTask("check-packagejson-boms", function() {
|
grunt.registerTask("check-packagejson-boms", function() {
|
||||||
function hasBOM(filepath) {
|
function hasBOM(filepath) {
|
||||||
@ -654,17 +692,18 @@ module.exports = function(grunt) {
|
|||||||
grunt.fail.fatal("\n" + errors.join("\n"));
|
grunt.fail.fatal("\n" + errors.join("\n"));
|
||||||
});
|
});
|
||||||
grunt.registerTask("distribute-ts-apps-files", [
|
grunt.registerTask("distribute-ts-apps-files", [
|
||||||
"copy:readyTsAppFiles"
|
"copy:readyTsAppFiles",
|
||||||
|
"copy:readyTsAppsTestsFiles"
|
||||||
]);
|
]);
|
||||||
grunt.registerTask("herdArticles", function() {
|
grunt.registerTask("herdArticles", function() {
|
||||||
var moveSinglesUp = function(dir) {
|
var moveSinglesUp = function(dir) {
|
||||||
var objs = fs.readdirSync(dir);
|
var objs = fs.readdirSync(dir);
|
||||||
for (var i=0; i<objs.length; i++) {
|
for (var i=0; i<objs.length; i++) {
|
||||||
var obj = objs[i];
|
var obj = objs[i];
|
||||||
var fullPath = pathModule.join(dir, obj);
|
var fullPath = path.join(dir, obj);
|
||||||
if (objs.length == 1) {
|
if (objs.length == 1) {
|
||||||
var parentDir = pathModule.dirname(dir);
|
var parentDir = path.dirname(dir);
|
||||||
var newPath = pathModule.join(parentDir, obj);
|
var newPath = path.join(parentDir, obj);
|
||||||
fs.renameSync(fullPath, newPath);
|
fs.renameSync(fullPath, newPath);
|
||||||
fs.rmdirSync(dir);
|
fs.rmdirSync(dir);
|
||||||
} else {
|
} else {
|
||||||
@ -680,7 +719,7 @@ module.exports = function(grunt) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
grunt.registerTask("generate-tns-core-modules-dev-dts", generateModulesDts.bind(null, "."));
|
grunt.registerTask("generate-tns-core-modules-dev-dts", generateModulesDts.bind(null, "."));
|
||||||
grunt.registerTask("generate-tns-core-modules-dts", generateModulesDts.bind(null, localCfg.outModulesDir));
|
grunt.registerTask("generate-tns-core-modules-dts", generateModulesDts.bind(null, localCfg.outDir));
|
||||||
//aliasing pack-modules for backwards compatibility
|
//aliasing pack-modules for backwards compatibility
|
||||||
grunt.registerTask("pack-modules", [
|
grunt.registerTask("pack-modules", [
|
||||||
"compile-modules",
|
"compile-modules",
|
||||||
@ -688,9 +727,11 @@ module.exports = function(grunt) {
|
|||||||
"exec:packModules"
|
"exec:packModules"
|
||||||
]);
|
]);
|
||||||
grunt.registerTask("pack-apps", [
|
grunt.registerTask("pack-apps", [
|
||||||
|
"processTestsApp:" + localCfg.outAppsTestsDir,
|
||||||
"processEachApp:" + localCfg.outAppsDir
|
"processEachApp:" + localCfg.outAppsDir
|
||||||
]);
|
]);
|
||||||
grunt.registerTask("pack-ts-apps", [
|
grunt.registerTask("pack-ts-apps", [
|
||||||
|
"processTestsApp:" + localCfg.outTsAppsTestsDir + ":-ts",
|
||||||
"processEachApp:" + localCfg.outTsAppsDir + ":-ts"
|
"processEachApp:" + localCfg.outTsAppsDir + ":-ts"
|
||||||
]);
|
]);
|
||||||
grunt.registerTask("get-ready-packages", [
|
grunt.registerTask("get-ready-packages", [
|
||||||
|
32
package.json
@ -1,26 +1,4 @@
|
|||||||
{
|
{
|
||||||
"name": "tns-core-modules",
|
|
||||||
"description": "Telerik NativeScript Core Modules",
|
|
||||||
"version": "2.1.0",
|
|
||||||
"homepage":"https://www.nativescript.org",
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "https://github.com/NativeScript/NativeScript"
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"**/*.d.ts",
|
|
||||||
"**/*.js",
|
|
||||||
"!android17.d.ts",
|
|
||||||
"!ios.d.ts",
|
|
||||||
"!bin/",
|
|
||||||
"!apps/",
|
|
||||||
"!build/",
|
|
||||||
"!node-tests/",
|
|
||||||
"!declarations.android.d.ts",
|
|
||||||
"!declarations.ios.d.ts",
|
|
||||||
"!gruntfile.js",
|
|
||||||
"!org.nativescript.widgets.d.ts"
|
|
||||||
],
|
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "3.2.0",
|
"chai": "3.2.0",
|
||||||
@ -43,15 +21,5 @@
|
|||||||
"time-grunt": "1.3.0",
|
"time-grunt": "1.3.0",
|
||||||
"tslint": "3.4.0",
|
"tslint": "3.4.0",
|
||||||
"typescript": "1.8.2"
|
"typescript": "1.8.2"
|
||||||
},
|
|
||||||
"typings": "tns-core-modules.d.ts",
|
|
||||||
"dependencies": {
|
|
||||||
"tns-core-modules-widgets": "next"
|
|
||||||
},
|
|
||||||
"nativescript": {
|
|
||||||
"platforms": {
|
|
||||||
"ios": "2.0.0",
|
|
||||||
"android": "2.0.0"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
40
tests/app/App_Resources/Android/AndroidManifest.xml
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
package="__PACKAGE__"
|
||||||
|
android:versionCode="1"
|
||||||
|
android:versionName="1.0">
|
||||||
|
|
||||||
|
<supports-screens
|
||||||
|
android:smallScreens="true"
|
||||||
|
android:normalScreens="true"
|
||||||
|
android:largeScreens="true"
|
||||||
|
android:xlargeScreens="true"/>
|
||||||
|
|
||||||
|
<uses-sdk
|
||||||
|
android:minSdkVersion="17"
|
||||||
|
android:targetSdkVersion="__APILEVEL__"/>
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
|
||||||
|
<uses-permission android:name="android.permission.INTERNET"/>
|
||||||
|
|
||||||
|
<application
|
||||||
|
android:name="com.tns.NativeScriptApplication"
|
||||||
|
android:allowBackup="true"
|
||||||
|
android:icon="@drawable/icon"
|
||||||
|
android:label="@string/app_name"
|
||||||
|
android:theme="@style/AppTheme" >
|
||||||
|
<activity
|
||||||
|
android:name="com.tns.NativeScriptActivity"
|
||||||
|
android:label="@string/title_activity_kimera"
|
||||||
|
android:configChanges="keyboardHidden|orientation|screenSize">
|
||||||
|
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MAIN" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.LAUNCHER" />
|
||||||
|
</intent-filter>
|
||||||
|
</activity>
|
||||||
|
<activity android:name="com.tns.ErrorReportActivity"/>
|
||||||
|
</application>
|
||||||
|
</manifest>
|
15
tests/app/App_Resources/Android/app.gradle
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// Add your native dependencies here:
|
||||||
|
|
||||||
|
// Uncomment to add recyclerview-v7 dependency
|
||||||
|
//dependencies {
|
||||||
|
// compile 'com.android.support:recyclerview-v7:+'
|
||||||
|
//}
|
||||||
|
|
||||||
|
android {
|
||||||
|
defaultConfig {
|
||||||
|
generatedDensities = []
|
||||||
|
}
|
||||||
|
aaptOptions {
|
||||||
|
additionalParameters "--no-version-vectors"
|
||||||
|
}
|
||||||
|
}
|
BIN
tests/app/App_Resources/Android/drawable-hdpi/icon.png
Executable file
After Width: | Height: | Size: 11 KiB |
BIN
tests/app/App_Resources/Android/drawable-ldpi/icon.png
Executable file
After Width: | Height: | Size: 6.0 KiB |
BIN
tests/app/App_Resources/Android/drawable-mdpi/icon.png
Executable file
After Width: | Height: | Size: 7.4 KiB |
After Width: | Height: | Size: 26 KiB |
BIN
tests/app/App_Resources/iOS/Default-568h@2x.png
Executable file
After Width: | Height: | Size: 62 KiB |
BIN
tests/app/App_Resources/iOS/Default-667h@2x.png
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
tests/app/App_Resources/iOS/Default-736h@3x.png
Normal file
After Width: | Height: | Size: 180 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape-568h@2x.png
Normal file
After Width: | Height: | Size: 63 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape-667h@2x.png
Normal file
After Width: | Height: | Size: 122 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape.png
Executable file
After Width: | Height: | Size: 61 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape@2x.png
Executable file
After Width: | Height: | Size: 187 KiB |
BIN
tests/app/App_Resources/iOS/Default-Landscape@3x.png
Normal file
After Width: | Height: | Size: 198 KiB |
BIN
tests/app/App_Resources/iOS/Default-Portrait.png
Executable file
After Width: | Height: | Size: 60 KiB |
BIN
tests/app/App_Resources/iOS/Default-Portrait@2x.png
Executable file
After Width: | Height: | Size: 182 KiB |
BIN
tests/app/App_Resources/iOS/Default.png
Executable file
After Width: | Height: | Size: 20 KiB |
BIN
tests/app/App_Resources/iOS/Default@2x.png
Executable file
After Width: | Height: | Size: 61 KiB |
BIN
tests/app/App_Resources/iOS/Icon-Small-50.png
Executable file
After Width: | Height: | Size: 31 KiB |
BIN
tests/app/App_Resources/iOS/Icon-Small-50@2x.png
Executable file
After Width: | Height: | Size: 36 KiB |
BIN
tests/app/App_Resources/iOS/Icon-Small.png
Executable file
After Width: | Height: | Size: 29 KiB |
BIN
tests/app/App_Resources/iOS/Icon-Small@2x.png
Executable file
After Width: | Height: | Size: 31 KiB |
71
tests/app/App_Resources/iOS/Info.plist
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>${PRODUCT_NAME}</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>${EXECUTABLE_NAME}</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>icon.png</string>
|
||||||
|
<key>CFBundleIcons</key>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundlePrimaryIcon</key>
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleIconFiles</key>
|
||||||
|
<array>
|
||||||
|
<string>icon-40</string>
|
||||||
|
<string>icon-60</string>
|
||||||
|
<string>icon-72</string>
|
||||||
|
<string>icon-76</string>
|
||||||
|
<string>Icon-Small</string>
|
||||||
|
<string>Icon-Small-50</string>
|
||||||
|
</array>
|
||||||
|
<key>UIPrerenderedIcon</key>
|
||||||
|
<false/>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>${PRODUCT_NAME}</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>LSRequiresIPhoneOS</key>
|
||||||
|
<true/>
|
||||||
|
<key>UILaunchStoryboardName</key>
|
||||||
|
<string>LaunchScreen</string>
|
||||||
|
<key>UIRequiresFullScreen</key>
|
||||||
|
<true/>
|
||||||
|
<key>UIRequiredDeviceCapabilities</key>
|
||||||
|
<array>
|
||||||
|
<string>armv7</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>UISupportedInterfaceOrientations~ipad</key>
|
||||||
|
<array>
|
||||||
|
<string>UIInterfaceOrientationPortrait</string>
|
||||||
|
<string>UIInterfaceOrientationPortraitUpsideDown</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeLeft</string>
|
||||||
|
<string>UIInterfaceOrientationLandscapeRight</string>
|
||||||
|
</array>
|
||||||
|
<key>NSAppTransportSecurity</key>
|
||||||
|
<dict>
|
||||||
|
<key>NSAllowsArbitraryLoads</key>
|
||||||
|
<true/>
|
||||||
|
</dict>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
5
tests/app/App_Resources/iOS/build.xcconfig
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// You can add custom settings here
|
||||||
|
// for example you can uncomment the following line to force distribution code signing
|
||||||
|
// CODE_SIGN_IDENTITY = iPhone Distribution
|
||||||
|
// ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||||
|
// ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = Brand Assets;
|
BIN
tests/app/App_Resources/iOS/icon-40.png
Executable file
After Width: | Height: | Size: 30 KiB |
BIN
tests/app/App_Resources/iOS/icon-40@2x.png
Executable file
After Width: | Height: | Size: 34 KiB |
BIN
tests/app/App_Resources/iOS/icon-60.png
Executable file
After Width: | Height: | Size: 32 KiB |
BIN
tests/app/App_Resources/iOS/icon-60@2x.png
Executable file
After Width: | Height: | Size: 39 KiB |
BIN
tests/app/App_Resources/iOS/icon-72.png
Executable file
After Width: | Height: | Size: 33 KiB |
BIN
tests/app/App_Resources/iOS/icon-72@2x.png
Executable file
After Width: | Height: | Size: 41 KiB |
BIN
tests/app/App_Resources/iOS/icon-76.png
Executable file
After Width: | Height: | Size: 33 KiB |
BIN
tests/app/App_Resources/iOS/icon-76@2x.png
Executable file
After Width: | Height: | Size: 43 KiB |
BIN
tests/app/App_Resources/iOS/icon.png
Executable file
After Width: | Height: | Size: 32 KiB |
BIN
tests/app/App_Resources/iOS/icon@2x.png
Executable file
After Width: | Height: | Size: 38 KiB |
2
tests/app/App_Resources/package.json
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
{ "name" : "app-resources",
|
||||||
|
"main" : "dummy.js" }
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |