mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 11:01:21 +08:00
chore: remove grunt and clean-up (#7845)
* chore: remove grunt files and deps * chore: npm scripts cleanup * chore: more deps clean-up * chore: tsconfig clean-up * chore: remove unneed file * chore: move tsinfig.unit-tests * chore: add dist/ exclude
This commit is contained in:

committed by
GitHub

parent
beffc5736a
commit
82f2ccbdfb
2
.gitignore
vendored
2
.gitignore
vendored
@ -46,7 +46,6 @@ tsconfig.tns.json
|
|||||||
*.map
|
*.map
|
||||||
*.tgz
|
*.tgz
|
||||||
.baseDir.ts
|
.baseDir.ts
|
||||||
.sublime-grunt.cache
|
|
||||||
tscommand*.tmp.txt
|
tscommand*.tmp.txt
|
||||||
.tscache
|
.tscache
|
||||||
|
|
||||||
@ -55,7 +54,6 @@ tscommand*.tmp.txt
|
|||||||
# https://github.com/NativeScript/nativescript-dev-webpack/issues/932
|
# https://github.com/NativeScript/nativescript-dev-webpack/issues/932
|
||||||
!tns-core-modules/xml/xml.js
|
!tns-core-modules/xml/xml.js
|
||||||
!tests/hooks/**/*.*
|
!tests/hooks/**/*.*
|
||||||
!gruntfile.js
|
|
||||||
!js-libs/**/*.*
|
!js-libs/**/*.*
|
||||||
!css/**/*.*
|
!css/**/*.*
|
||||||
!css-value/**/*.*
|
!css-value/**/*.*
|
||||||
|
@ -124,7 +124,7 @@ If the commit reverts a previous commit, it should begin with `revert: `, follow
|
|||||||
### Type
|
### Type
|
||||||
Must be one of the following:
|
Must be one of the following:
|
||||||
|
|
||||||
* **build**: Changes that affect the build system or external dependencies (example scopes: npm, grunt)
|
* **build**: Changes that affect the build system or external dependencies (example scopes: npm)
|
||||||
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Jenkins)
|
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Jenkins)
|
||||||
* **docs**: Documentation only changes
|
* **docs**: Documentation only changes
|
||||||
* **feat**: A new feature
|
* **feat**: A new feature
|
||||||
|
@ -36,16 +36,6 @@ extract_snippets() {
|
|||||||
archive_dist_dir "snippets"
|
archive_dist_dir "snippets"
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_cookbook() {
|
|
||||||
COOKBOOK_DIR="$DIST_DIR/cookbook"
|
|
||||||
rm -rf "$COOKBOOK_DIR"
|
|
||||||
|
|
||||||
npm_install
|
|
||||||
grunt articles
|
|
||||||
mv "$DIST_DIR/articles" "$COOKBOOK_DIR"
|
|
||||||
archive_dist_dir "cookbook"
|
|
||||||
}
|
|
||||||
|
|
||||||
extract_apiref() {
|
extract_apiref() {
|
||||||
APIREF_DIR="$DIST_DIR/api-reference"
|
APIREF_DIR="$DIST_DIR/api-reference"
|
||||||
rm -rf "$APIREF_DIR"
|
rm -rf "$APIREF_DIR"
|
||||||
@ -62,6 +52,5 @@ mkdir -p "$TARGET_DIR"
|
|||||||
|
|
||||||
if [ "${BASH_SOURCE[0]}" == "$0" ] ; then
|
if [ "${BASH_SOURCE[0]}" == "$0" ] ; then
|
||||||
extract_snippets
|
extract_snippets
|
||||||
extract_cookbook
|
|
||||||
extract_apiref
|
extract_apiref
|
||||||
fi
|
fi
|
||||||
|
13
expect.exp
13
expect.exp
@ -1,13 +0,0 @@
|
|||||||
#! /usr/bin/expect
|
|
||||||
|
|
||||||
set cmd [lindex $argv 0];
|
|
||||||
set outfile [lindex $argv 1];
|
|
||||||
|
|
||||||
set timeout 1200
|
|
||||||
log_file -noappend $outfile
|
|
||||||
eval spawn $cmd
|
|
||||||
expect {
|
|
||||||
"Tests EOF!" { puts "Tests completed in time, EOF found." }
|
|
||||||
timeout { puts "Tests FAILED, timeout waiting tests EOF."; exit 1 }
|
|
||||||
}
|
|
||||||
send \003
|
|
464
gruntfile.js
464
gruntfile.js
@ -1,464 +0,0 @@
|
|||||||
var tsconfig = require('./tsconfig.json');
|
|
||||||
var shelljs = require("shelljs");
|
|
||||||
var path = require("path");
|
|
||||||
var fs = require("fs");
|
|
||||||
|
|
||||||
module.exports = function (grunt) {
|
|
||||||
if (grunt.option('profile')) {
|
|
||||||
grunt.log.writeln('Profiling all grunt tasks...');
|
|
||||||
require('time-grunt')(grunt);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grunt.cli.tasks.indexOf("testsapp") >= 0 || grunt.cli.tasks.indexOf("buildOnlyTestsApp") >= 0 || grunt.cli.tasks.indexOf("runOnlyTestsApp") >= 0) {
|
|
||||||
var tsTester = require("./build/run-testsapp.grunt.js");
|
|
||||||
tsTester.run(grunt);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var tsLintOption = grunt.option('runtslint');
|
|
||||||
var skipTsLint = tsLintOption == 'false' || tsLintOption == false;
|
|
||||||
if (tsLintOption == null) {
|
|
||||||
skipTsLint = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Custom Functions
|
|
||||||
var filterTypeScriptFiles = function (content, srcPath) {
|
|
||||||
var leadingPrivate = /^.*@private/ig;
|
|
||||||
if (leadingPrivate.test(content)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var blockCommentPrivate = /\/\*\*([^](?!\*\/))*@module([^](?!\*\/))*@private[^]*?\*\//g;
|
|
||||||
if (blockCommentPrivate.test(content)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
var processed = content;
|
|
||||||
processed = processed.replace(/\/\/[\/\s]*@private[^]*?\/\/[\/\s]*?@endprivate/gm, "");
|
|
||||||
return processed;
|
|
||||||
};
|
|
||||||
|
|
||||||
var updatePackageDef = function (content, update) {
|
|
||||||
var contentAsObject = JSON.parse(content);
|
|
||||||
update(contentAsObject);
|
|
||||||
return JSON.stringify(contentAsObject, null, "\t");
|
|
||||||
};
|
|
||||||
|
|
||||||
var updateModulesPackageDef = function (content, srcPath) {
|
|
||||||
console.log("Patch: " + srcPath);
|
|
||||||
return updatePackageDef(content, function (contentAsObject) {
|
|
||||||
contentAsObject.version = localCfg.packageVersion;
|
|
||||||
if (localCfg.commitSHA) {
|
|
||||||
contentAsObject.repository.url += "/commit/" + localCfg.commitSHA;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var updateAppPackageDef = function (content, srcPath) {
|
|
||||||
return updatePackageDef(content, function (contentAsObject) {
|
|
||||||
contentAsObject.version = localCfg.packageVersion;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
var getCommitSha = function () {
|
|
||||||
if (process.env.GIT_COMMIT) {
|
|
||||||
return process.env.GIT_COMMIT;
|
|
||||||
}
|
|
||||||
return "";
|
|
||||||
};
|
|
||||||
|
|
||||||
var assignGitSHA = function (err, stdout, stderr, cb) {
|
|
||||||
if (!localCfg.commitSHA) {
|
|
||||||
localCfg.commitSHA = stdout.replace("\n", "");
|
|
||||||
}
|
|
||||||
cb();
|
|
||||||
};
|
|
||||||
|
|
||||||
var getPackageVersion = function () {
|
|
||||||
var buildVersion = process.env.PACKAGE_VERSION;
|
|
||||||
if (!buildVersion) {
|
|
||||||
return localCfg.mainPackageContent.version;
|
|
||||||
}
|
|
||||||
return localCfg.mainPackageContent.version + "-" + buildVersion;
|
|
||||||
};
|
|
||||||
|
|
||||||
// Configure localCfg
|
|
||||||
var outDir = "./bin/dist";
|
|
||||||
var srcDir = ".";
|
|
||||||
var tnsCoreModulesDir = path.join(srcDir, "tns-core-modules");;
|
|
||||||
var srcAppDirs = ["tests/app", "apps/app"]; //Don't move the tests folder from index 0!
|
|
||||||
var localCfg = {
|
|
||||||
srcDir: srcDir,
|
|
||||||
srcTnsCoreModules: tnsCoreModulesDir,
|
|
||||||
packageJsonFilePath: path.join(tnsCoreModulesDir, "package.json"),
|
|
||||||
srcAppDirs: srcAppDirs,
|
|
||||||
srcTestsDir: srcAppDirs[0],
|
|
||||||
outDir: outDir,
|
|
||||||
outTnsCoreModules: path.join(outDir, "tns-core-modules"),
|
|
||||||
outArticlesDir: path.join(outDir, "articles"),
|
|
||||||
outApiRefDir: path.join(outDir, "apiref"),
|
|
||||||
};
|
|
||||||
|
|
||||||
var copyAppsSrc = [];
|
|
||||||
for (var i = 0; i < localCfg.srcAppDirs.length; i++) {
|
|
||||||
copyAppsSrc.push(localCfg.srcAppDirs[i] + "/**/*");
|
|
||||||
copyAppsSrc.push("!" + localCfg.srcAppDirs[i] + "/**/*.map");
|
|
||||||
copyAppsSrc.push("!" + localCfg.srcAppDirs[i] + "/**/*.ts");
|
|
||||||
}
|
|
||||||
|
|
||||||
var nodeTestEnv = JSON.parse(JSON.stringify(process.env));
|
|
||||||
nodeTestEnv.NODE_PATH = localCfg.outTnsCoreModules;
|
|
||||||
localCfg.nodeTestsDir = path.join(localCfg.outDir, 'unit-tests');
|
|
||||||
localCfg.mainPackageContent = grunt.file.readJSON(localCfg.packageJsonFilePath);
|
|
||||||
localCfg.packageVersion = getPackageVersion(localCfg.packageJsonFilePath);
|
|
||||||
localCfg.commitSHA = getCommitSha();
|
|
||||||
localCfg.typeScriptSrc = [
|
|
||||||
"**/*.ts",
|
|
||||||
"!**/node_modules/**/*.*",
|
|
||||||
"!**/platforms/**/*.*",
|
|
||||||
"!bin/**/*.*",
|
|
||||||
"!build/**/*.*",
|
|
||||||
"!Deploy/**/*.*",
|
|
||||||
"!out/**/*.*",
|
|
||||||
"!.*/**/*.*",
|
|
||||||
"!obj/**/*.*"
|
|
||||||
];
|
|
||||||
localCfg.defaultExcludes = localCfg.typeScriptSrc.filter(function (item) { return /^!/.test(item); });
|
|
||||||
localCfg.srcTsdFiles = [
|
|
||||||
"tns-core-modules/**/*.d.ts",
|
|
||||||
"!tns-core-modules/ios/**",
|
|
||||||
"!**/org.nativescript.widgets.d.ts",
|
|
||||||
"!**/android17.d.ts",
|
|
||||||
"!**/*.android.d.ts",
|
|
||||||
"!**/ios.d.ts",
|
|
||||||
"!**/*.ios.d.ts"
|
|
||||||
].concat(localCfg.defaultExcludes);
|
|
||||||
|
|
||||||
// Config
|
|
||||||
grunt.initConfig({
|
|
||||||
localCfg: localCfg,
|
|
||||||
pkg: grunt.file.readJSON('package.json'),
|
|
||||||
clean: {
|
|
||||||
build: {
|
|
||||||
src: [localCfg.outDir]
|
|
||||||
},
|
|
||||||
typeScriptLeftovers: {
|
|
||||||
expand: true,
|
|
||||||
src: [
|
|
||||||
".baseDir.*",
|
|
||||||
"_references.js",
|
|
||||||
"**/*.map"
|
|
||||||
],
|
|
||||||
cwd: localCfg.outDir
|
|
||||||
},
|
|
||||||
nodeTests: {
|
|
||||||
src: localCfg.nodeTestsDir,
|
|
||||||
},
|
|
||||||
builtModules: {
|
|
||||||
src: localCfg.outDir
|
|
||||||
},
|
|
||||||
externalModules: {
|
|
||||||
expand: true,
|
|
||||||
src: '<%= grunt.option("path") %>/node_modules/tns-core-modules/**/*',
|
|
||||||
options: {
|
|
||||||
force: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
articles: {
|
|
||||||
src: [localCfg.outArticlesDir]
|
|
||||||
},
|
|
||||||
"apiref": {
|
|
||||||
src: [localCfg.outApiRefDir]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
copy: {
|
|
||||||
jsLibs: {
|
|
||||||
expand: true,
|
|
||||||
src: [
|
|
||||||
"tns-core-modules/js-libs/**/*.js",
|
|
||||||
"tns-core-modules/fetch/**/*.js",
|
|
||||||
"tns-core-modules/css/**/*.js",
|
|
||||||
"tns-core-modules/css-value/**/*.js",
|
|
||||||
],
|
|
||||||
dest: localCfg.outDir,
|
|
||||||
cwd: localCfg.srcDir
|
|
||||||
},
|
|
||||||
articleMDs: {
|
|
||||||
expand: true,
|
|
||||||
src: ["**/*.md"],
|
|
||||||
dest: localCfg.outArticlesDir,
|
|
||||||
cwd: localCfg.srcTestsDir
|
|
||||||
},
|
|
||||||
license: {
|
|
||||||
expand: true,
|
|
||||||
src: [
|
|
||||||
"./LICENSE",
|
|
||||||
],
|
|
||||||
dest: localCfg.outTnsCoreModules,
|
|
||||||
cwd: localCfg.srcDir
|
|
||||||
},
|
|
||||||
definitionFiles: {
|
|
||||||
src: [
|
|
||||||
"**/*.d.ts",
|
|
||||||
//Exclude the d.ts files in the apps folder - these are part of the apps and are already packed there!
|
|
||||||
"!unit-tests/**",
|
|
||||||
"!org.nativescript.widgets.d.ts",
|
|
||||||
"!android17.d.ts",
|
|
||||||
"!**/*.android.d.ts",
|
|
||||||
"!ios.d.ts",
|
|
||||||
"!**/*.ios.d.ts"
|
|
||||||
].concat(localCfg.defaultExcludes),
|
|
||||||
dest: localCfg.outDir + "/",
|
|
||||||
expand: true,
|
|
||||||
options: {
|
|
||||||
process: filterTypeScriptFiles
|
|
||||||
}
|
|
||||||
},
|
|
||||||
modulesPackageDef: {
|
|
||||||
expand: true,
|
|
||||||
src: path.basename(localCfg.packageJsonFilePath),
|
|
||||||
cwd: path.dirname(localCfg.packageJsonFilePath),
|
|
||||||
dest: localCfg.outTnsCoreModules + "/",
|
|
||||||
options: {
|
|
||||||
process: updateModulesPackageDef
|
|
||||||
}
|
|
||||||
},
|
|
||||||
childPackageFiles: {
|
|
||||||
expand: true,
|
|
||||||
src: [
|
|
||||||
"**/package.json",
|
|
||||||
"!package.json",
|
|
||||||
"!bin/**/*.*",
|
|
||||||
"!**/node_modules/**/*.*",
|
|
||||||
"!**/platforms/**/*.*",
|
|
||||||
"!" + localCfg.outDir + "/**/*.*"
|
|
||||||
],
|
|
||||||
dest: localCfg.outDir + "/"
|
|
||||||
},
|
|
||||||
platformsFiles: {
|
|
||||||
expand: true,
|
|
||||||
src: "tns-core-modules/platforms/**/*",
|
|
||||||
dest: localCfg.outDir + "/"
|
|
||||||
},
|
|
||||||
apps: {
|
|
||||||
expand: true,
|
|
||||||
src: copyAppsSrc,
|
|
||||||
dest: localCfg.outDir,
|
|
||||||
dot: true
|
|
||||||
},
|
|
||||||
readyPackages: {
|
|
||||||
expand: true,
|
|
||||||
src: ["./**/*.tgz"],
|
|
||||||
dest: localCfg.outDir + "/",
|
|
||||||
cwd: localCfg.outDir,
|
|
||||||
flatten: true
|
|
||||||
},
|
|
||||||
builtModules: {
|
|
||||||
expand: true,
|
|
||||||
src: [
|
|
||||||
'**/*',
|
|
||||||
'!node_modules/**/*',
|
|
||||||
'!unit-tests/**/*',
|
|
||||||
],
|
|
||||||
cwd: localCfg.outDir,
|
|
||||||
dest: "<%= grunt.option('path') %>/node_modules/tns-core-modules/",
|
|
||||||
}
|
|
||||||
},
|
|
||||||
exec: {
|
|
||||||
copyReadme: {
|
|
||||||
cmd: `cp "README.md" ${localCfg.outTnsCoreModules}`,
|
|
||||||
cwd: process.cwd()
|
|
||||||
},
|
|
||||||
packModules: {
|
|
||||||
cmd: "npm pack",
|
|
||||||
cwd: localCfg.outTnsCoreModules + "/"
|
|
||||||
},
|
|
||||||
mochaNode: {
|
|
||||||
cmd: "grunt simplemocha:node"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
shell: {
|
|
||||||
getGitSHA: {
|
|
||||||
command: "git rev-parse HEAD",
|
|
||||||
options: {
|
|
||||||
callback: assignGitSHA
|
|
||||||
}
|
|
||||||
},
|
|
||||||
compileAll: "npm run compile-all",
|
|
||||||
runUnitTests: "npm run unit-test",
|
|
||||||
tslint: "npm run tslint",
|
|
||||||
},
|
|
||||||
simplemocha: {
|
|
||||||
node: {
|
|
||||||
src: localCfg.nodeTestsDir + '/**/*.js'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
env: {
|
|
||||||
nodeTests: {
|
|
||||||
NODE_PATH: nodeTestEnv.NODE_PATH,
|
|
||||||
}
|
|
||||||
},
|
|
||||||
typedoc: {
|
|
||||||
build: {
|
|
||||||
options: {
|
|
||||||
"module": 'commonjs',
|
|
||||||
"target": 'es5',
|
|
||||||
"out": '<%= grunt.option("out") || localCfg.outApiRefDir %>',
|
|
||||||
"theme": '<%= grunt.option("theme") || "./node_modules/nativescript-typedoc-theme" %>',
|
|
||||||
"name": 'NativeScript',
|
|
||||||
"includeDeclarations": undefined,
|
|
||||||
"experimentalDecorators": undefined,
|
|
||||||
"mode": "file",
|
|
||||||
"tsconfig": "tsconfig.typedoc.json"
|
|
||||||
},
|
|
||||||
src: "tns-core-modules/tns-core-modules.d.ts"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.loadNpmTasks("grunt-contrib-clean");
|
|
||||||
grunt.loadNpmTasks("grunt-contrib-copy");
|
|
||||||
grunt.loadNpmTasks("grunt-exec");
|
|
||||||
grunt.loadNpmTasks("grunt-shell");
|
|
||||||
grunt.loadNpmTasks("grunt-simple-mocha");
|
|
||||||
grunt.loadNpmTasks("grunt-env");
|
|
||||||
grunt.loadNpmTasks('grunt-typedoc');
|
|
||||||
|
|
||||||
// Register Tasks
|
|
||||||
grunt.registerTask("collect-modules-raw-files", [
|
|
||||||
"copy:jsLibs",
|
|
||||||
"copy:platformsFiles",
|
|
||||||
"copy:license"
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask("compile-ts", [
|
|
||||||
"shell:compileAll",
|
|
||||||
"clean:typeScriptLeftovers",
|
|
||||||
"copy:childPackageFiles"
|
|
||||||
]);
|
|
||||||
|
|
||||||
function validatePackageJsons(fileValidator, errorFormatter) {
|
|
||||||
var packageDescriptors = grunt.file.expand({}, [
|
|
||||||
'tns-core-modules/**/package.json',
|
|
||||||
'!tns-core-modules/node_modules/**/*'
|
|
||||||
]);
|
|
||||||
var errors = packageDescriptors.map(function (packagePath) {
|
|
||||||
if (fileValidator(packagePath)) {
|
|
||||||
return errorFormatter(packagePath);
|
|
||||||
} else {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}).filter(function (errorMessage) { return !!errorMessage; });
|
|
||||||
if (errors.length > 0)
|
|
||||||
grunt.fail.fatal("\n" + errors.join("\n"));
|
|
||||||
}
|
|
||||||
|
|
||||||
grunt.registerTask("check-packagejson-boms", function () {
|
|
||||||
validatePackageJsons(function (filepath) {
|
|
||||||
var buf = grunt.file.read(filepath, { encoding: null });
|
|
||||||
return (buf[0] === 0xEF && buf[1] === 0xBB && buf[2] === 0xBF);
|
|
||||||
}, function (filepath) {
|
|
||||||
return "File " + filepath + " contains a UTF-8 BOM.";
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.registerTask("check-packagejson-mains", function () {
|
|
||||||
validatePackageJsons(function (filepath) {
|
|
||||||
var packageData = grunt.file.readJSON(filepath);
|
|
||||||
return /\.js/i.test(packageData.main || "");
|
|
||||||
}, function (filepath) {
|
|
||||||
return "File " + filepath + " contains a broken main setting.";
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//aliasing pack-modules for backwards compatibility
|
|
||||||
grunt.registerTask("pack-modules", [
|
|
||||||
"compile-modules",
|
|
||||||
"run-unit-test",
|
|
||||||
"copy:modulesPackageDef",
|
|
||||||
"exec:copyReadme",
|
|
||||||
"exec:packModules"
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask("compile-modules", [
|
|
||||||
"clean:build",
|
|
||||||
"shell:getGitSHA",
|
|
||||||
"check-packagejson-boms",
|
|
||||||
"check-packagejson-mains",
|
|
||||||
"compile-ts",
|
|
||||||
"collect-modules-raw-files",
|
|
||||||
"copy:definitionFiles",
|
|
||||||
"copy:jsLibs",
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask("run-unit-test", [
|
|
||||||
"clean:nodeTests",
|
|
||||||
"shell:runUnitTests"
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask("apiref", [
|
|
||||||
"clean:apiref",
|
|
||||||
"typedoc:build"
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask("herdArticles", function () {
|
|
||||||
var moveSinglesUp = function (dir) {
|
|
||||||
var objs = fs.readdirSync(dir);
|
|
||||||
for (var i = 0; i < objs.length; i++) {
|
|
||||||
var obj = objs[i];
|
|
||||||
var fullPath = path.join(dir, obj);
|
|
||||||
if (objs.length == 1) {
|
|
||||||
var parentDir = path.dirname(dir);
|
|
||||||
var newPath = path.join(parentDir, obj);
|
|
||||||
fs.renameSync(fullPath, newPath);
|
|
||||||
fs.rmdirSync(dir);
|
|
||||||
} else {
|
|
||||||
var objStat = fs.statSync(fullPath);
|
|
||||||
if (objStat.isDirectory()) {
|
|
||||||
moveSinglesUp(fullPath);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
moveSinglesUp(localCfg.outArticlesDir);
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.registerTask("articles", [
|
|
||||||
"clean:articles",
|
|
||||||
"copy:articleMDs",
|
|
||||||
"herdArticles"
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask("docs", [
|
|
||||||
"apiref",
|
|
||||||
"articles"
|
|
||||||
]);
|
|
||||||
|
|
||||||
//alias just-build for backwards compatibility
|
|
||||||
grunt.registerTask("just-build", ["build-all"]);
|
|
||||||
|
|
||||||
grunt.registerTask("build-all", [
|
|
||||||
"pack-modules",
|
|
||||||
"copy:apps",
|
|
||||||
]);
|
|
||||||
|
|
||||||
grunt.registerTask("pack-apps", function () {
|
|
||||||
localCfg.srcAppDirs.forEach(function (srcAppDir) {
|
|
||||||
var outAppDir = path.join(localCfg.outDir, srcAppDir);
|
|
||||||
var packageJsonPath = path.join(outAppDir, "package.json");
|
|
||||||
var content = fs.readFileSync(packageJsonPath, "utf8");
|
|
||||||
var newContent = updateAppPackageDef(content);
|
|
||||||
fs.writeFileSync(packageJsonPath, newContent);
|
|
||||||
shelljs.exec("npm pack", { cwd: outAppDir });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
grunt.registerTask("get-ready-packages", ["copy:readyPackages"]);
|
|
||||||
|
|
||||||
grunt.registerTask("default", (skipTsLint ? [] : ["shell:tslint"]).concat([
|
|
||||||
"build-all",
|
|
||||||
"pack-apps",
|
|
||||||
"get-ready-packages"
|
|
||||||
]));
|
|
||||||
};
|
|
40
package.json
40
package.json
@ -12,20 +12,9 @@
|
|||||||
"@types/mocha": "^2.2.42",
|
"@types/mocha": "^2.2.42",
|
||||||
"@types/node": "~10.12.18",
|
"@types/node": "~10.12.18",
|
||||||
"chai": "^4.1.2",
|
"chai": "^4.1.2",
|
||||||
"concurrently": "^2.1.0",
|
|
||||||
"css": "^2.2.1",
|
"css": "^2.2.1",
|
||||||
"css-tree": "^1.0.0-alpha24",
|
"css-tree": "^1.0.0-alpha24",
|
||||||
"gonzales": "^1.0.7",
|
"gonzales": "^1.0.7",
|
||||||
"grunt": "1.0.1",
|
|
||||||
"grunt-contrib-clean": "1.0.0",
|
|
||||||
"grunt-contrib-copy": "git://github.com/NativeScript/grunt-contrib-copy.git#master",
|
|
||||||
"grunt-env": "0.4.4",
|
|
||||||
"grunt-exec": "1.0.1",
|
|
||||||
"grunt-mkdir": "1.0.0",
|
|
||||||
"grunt-shell": "2.1.0",
|
|
||||||
"grunt-simple-mocha": "0.4.1",
|
|
||||||
"grunt-ts": "6.0.0-beta.11",
|
|
||||||
"grunt-typedoc": "0.2.4",
|
|
||||||
"madge": "^2.2.0",
|
"madge": "^2.2.0",
|
||||||
"markdown-snippet-injector": "0.2.2",
|
"markdown-snippet-injector": "0.2.2",
|
||||||
"mocha": "^3.5.0",
|
"mocha": "^3.5.0",
|
||||||
@ -39,9 +28,7 @@
|
|||||||
"reduce-css-calc": "^2.1.6",
|
"reduce-css-calc": "^2.1.6",
|
||||||
"rimraf": "^2.5.0",
|
"rimraf": "^2.5.0",
|
||||||
"shady-css-parser": "^0.1.0",
|
"shady-css-parser": "^0.1.0",
|
||||||
"shelljs": "^0.7.0",
|
|
||||||
"source-map-support": "^0.4.17",
|
"source-map-support": "^0.4.17",
|
||||||
"time-grunt": "1.3.0",
|
|
||||||
"tslib": "1.10.0",
|
"tslib": "1.10.0",
|
||||||
"tslint": "^5.4.3",
|
"tslint": "^5.4.3",
|
||||||
"typedoc": "^0.13.0",
|
"typedoc": "^0.13.0",
|
||||||
@ -49,35 +36,20 @@
|
|||||||
"typescript": "^3.1.6"
|
"typescript": "^3.1.6"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"setup-widgets": "(cd tns-core-modules-widgets && sh build.sh) && npm run dev-link-tns-core-modules-widgets",
|
"tsc": "node --max_old_space_size=4096 ./node_modules/typescript/bin/tsc",
|
||||||
"tsc": "node --max_old_space_size=4096 ./node_modules/typescript/bin/tsc",
|
"tsc-w": "npm run tsc -- --skipLibCheck -w",
|
||||||
|
"tslint": "tslint --project tsconfig.tslint.json --config build/tslint.json",
|
||||||
"ci": "tsc && npm run tslint && npm run ci-apps && npm run ci-e2e && npm run ci-tests",
|
"ci": "tsc && npm run tslint && npm run ci-apps && npm run ci-e2e && npm run ci-tests",
|
||||||
"ci-apps": "cd apps && npm i ../tns-core-modules ../tns-platform-declarations --save",
|
"ci-apps": "cd apps && npm i ../tns-core-modules ../tns-platform-declarations --save",
|
||||||
"ci-e2e": "cd e2e && cd modal-navigation && npm i ../../tns-core-modules ../../tns-platform-declarations --save",
|
"ci-e2e": "cd e2e && cd modal-navigation && npm i ../../tns-core-modules ../../tns-platform-declarations --save",
|
||||||
"ci-tests": "cd tests && npm i ../tns-core-modules ../tns-platform-declarations --save",
|
"ci-tests": "cd tests && npm i ../tns-core-modules ../tns-platform-declarations --save",
|
||||||
"unit-test": "tsc -p tsconfig.unit-tests.json && mocha --opts unit-tests/mocha.opts",
|
"unit-test": "tsc -p unit-tests/tsconfig.json && mocha --opts unit-tests/mocha.opts",
|
||||||
"unit-test-watch": "mocha-typescript-watch -p tsconfig.unit-tests.json --opts unit-tests/mocha.opts",
|
"unit-test-watch": "mocha-typescript-watch -p unit-tests/tsconfig.json --opts unit-tests/mocha.opts",
|
||||||
"compile-all": "npm run tsc -- -p tsconfig.json --outDir bin/dist",
|
"setup-widgets": "(cd tns-core-modules-widgets && sh build.sh) && npm run dev-link-tns-core-modules-widgets",
|
||||||
"compile-modules": "npm run tsc -- -p tsconfig.modules.json",
|
|
||||||
"compile-check-base-dts": "npm run tsc -- -p tsconfig.base-dts.json",
|
|
||||||
"compile-unit-tests": "npm run tsc -- -p tsconfig.unit-tests.json --outDir bin/dist/unit-tests",
|
|
||||||
"compile-check-combined-dts": "npm run tsc -- -p tsconfig.combined-dts.json",
|
|
||||||
"tsc-w": "npm run tsc -- --skipLibCheck -w",
|
|
||||||
"dev-tsc-tns-platform-declarations": "npm run tsc -- -p tns-platform-declarations",
|
|
||||||
"dev-tsc-tests": "npm run tsc -- -p tests",
|
|
||||||
"dev-tsc-apps": "npm run tsc -- -p apps",
|
|
||||||
"dev-tsc-e2e": "npm run tsc -- -p e2e",
|
|
||||||
"dev-tsc-all": "npm run dev-tsc-tns-platform-declarations && npm run tsc && npm run dev-tsc-tests && npm run dev-tsc-apps && npm run dev-tsc-e2e",
|
|
||||||
"dev-link-tns-core-modules-widgets": "(cd tns-core-modules-widgets/dist/package && npm link) && (cd tns-core-modules && npm i ../tns-core-modules-widgets/dist/package --save)",
|
"dev-link-tns-core-modules-widgets": "(cd tns-core-modules-widgets/dist/package && npm link) && (cd tns-core-modules && npm i ../tns-core-modules-widgets/dist/package --save)",
|
||||||
"dev-declarations": "rm -rf tns-platform-declarations/ios/objc* && TNS_TYPESCRIPT_DECLARATIONS_PATH=$PWD/tns-platform-declarations/ios/objc tns build ios --path tests",
|
"dev-declarations": "rm -rf tns-platform-declarations/ios/objc* && TNS_TYPESCRIPT_DECLARATIONS_PATH=$PWD/tns-platform-declarations/ios/objc tns build ios --path tests",
|
||||||
"test": "npm run test-android && npm run test-ios",
|
|
||||||
"test-android": "tns run android --path tests --justlaunch --no-watch",
|
|
||||||
"test-ios": "tns run ios --path tests --justlaunch --no-watch",
|
|
||||||
"test-watch-android": "npm run pretest && concurrently --kill-others \"npm run tsc-w\" \"tns run android --path tests --watch\"",
|
|
||||||
"test-watch-ios": "npm run pretest && concurrently --kill-others \"npm run tsc-w\" \"tns run ios --path tests --watch\"",
|
|
||||||
"typedoc": "typedoc --tsconfig tsconfig.typedoc.json --out bin/dist/apiref --includeDeclarations --name NativeScript --theme ./node_modules/nativescript-typedoc-theme --excludeExternals --externalPattern \"**/+(tns-core-modules|module).d.ts\"",
|
"typedoc": "typedoc --tsconfig tsconfig.typedoc.json --out bin/dist/apiref --includeDeclarations --name NativeScript --theme ./node_modules/nativescript-typedoc-theme --excludeExternals --externalPattern \"**/+(tns-core-modules|module).d.ts\"",
|
||||||
"dev-typedoc": "npm run typedoc && cd bin/dist/apiref && npx http-server",
|
"dev-typedoc": "npm run typedoc && cd bin/dist/apiref && npx http-server",
|
||||||
"tslint": "tslint --project tsconfig.tslint.json --config build/tslint.json",
|
|
||||||
"prepare-dist": "bash ./build/prepare-dist.sh",
|
"prepare-dist": "bash ./build/prepare-dist.sh",
|
||||||
"pack-dist": "bash ./build/pack-dist.sh"
|
"pack-dist": "bash ./build/pack-dist.sh"
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,6 @@
|
|||||||
"!node-tests/",
|
"!node-tests/",
|
||||||
"!declarations.android.d.ts",
|
"!declarations.android.d.ts",
|
||||||
"!declarations.ios.d.ts",
|
"!declarations.ios.d.ts",
|
||||||
"!gruntfile.js",
|
|
||||||
"!org.nativescript.widgets.d.ts"
|
"!org.nativescript.widgets.d.ts"
|
||||||
],
|
],
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
@ -1,5 +1,32 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.shared",
|
"compilerOptions": {
|
||||||
|
"noEmitOnError": false,
|
||||||
|
"noEmitHelpers": true,
|
||||||
|
"target": "es5",
|
||||||
|
"module": "commonjs",
|
||||||
|
"declaration": false,
|
||||||
|
"noImplicitAny": false,
|
||||||
|
"noImplicitUseStrict": true,
|
||||||
|
"removeComments": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"diagnostics": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"lib": [
|
||||||
|
"es6",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
|
"types": [
|
||||||
|
"node",
|
||||||
|
"chai",
|
||||||
|
"mocha"
|
||||||
|
],
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"tns-core-modules/*": [
|
||||||
|
"tns-core-modules/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"tns-core-modules/node_modules/",
|
"tns-core-modules/node_modules/",
|
||||||
"tns-core-modules/package/",
|
"tns-core-modules/package/",
|
||||||
@ -14,6 +41,7 @@
|
|||||||
"tns-platform-declarations/android/androidx-*.d.ts",
|
"tns-platform-declarations/android/androidx-*.d.ts",
|
||||||
"tests/",
|
"tests/",
|
||||||
"apps/",
|
"apps/",
|
||||||
|
"dist/",
|
||||||
"e2e/",
|
"e2e/",
|
||||||
"node_modules/",
|
"node_modules/",
|
||||||
"package/",
|
"package/",
|
||||||
@ -24,4 +52,4 @@
|
|||||||
"obj",
|
"obj",
|
||||||
"unit-tests/common-types.d.ts"
|
"unit-tests/common-types.d.ts"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": "./tsconfig.shared",
|
|
||||||
"compilerOptions": {
|
|
||||||
"noUnusedLocals": true
|
|
||||||
},
|
|
||||||
"include": [
|
|
||||||
"tns-core-modules/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"tns-core-modules/node_modules/",
|
|
||||||
"tns-core-modules/package/"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"noEmitOnError": true,
|
|
||||||
"noEmitHelpers": true,
|
|
||||||
"target": "es5",
|
|
||||||
"module": "commonjs",
|
|
||||||
"declaration": false,
|
|
||||||
"noImplicitAny": false,
|
|
||||||
"noImplicitUseStrict": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"lib": [
|
|
||||||
"es2016"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"tns-core-modules/tns-core-modules.es2016.d.ts"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"noEmitOnError": true,
|
|
||||||
"noEmitHelpers": true,
|
|
||||||
"target": "es5",
|
|
||||||
"module": "commonjs",
|
|
||||||
"declaration": false,
|
|
||||||
"noImplicitAny": false,
|
|
||||||
"noImplicitUseStrict": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"lib": [
|
|
||||||
"es6"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"files": [
|
|
||||||
"tns-core-modules/tns-core-modules.es6.d.ts"
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"noEmitOnError": false,
|
|
||||||
"noEmitHelpers": true,
|
|
||||||
"target": "es5",
|
|
||||||
"module": "commonjs",
|
|
||||||
"declaration": false,
|
|
||||||
"noImplicitAny": false,
|
|
||||||
"noImplicitUseStrict": true,
|
|
||||||
"removeComments": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"diagnostics": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"jsx": "react",
|
|
||||||
"reactNamespace": "UIBuilder",
|
|
||||||
"lib": [
|
|
||||||
"es6", "dom"
|
|
||||||
],
|
|
||||||
"types": [
|
|
||||||
"node",
|
|
||||||
"chai",
|
|
||||||
"mocha"
|
|
||||||
],
|
|
||||||
"baseUrl": ".",
|
|
||||||
"paths": {
|
|
||||||
"tns-core-modules/*": ["tns-core-modules/*"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,6 +1,18 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.shared",
|
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"noEmitOnError": false,
|
||||||
|
"noEmitHelpers": true,
|
||||||
|
"target": "es5",
|
||||||
|
"module": "commonjs",
|
||||||
|
"noImplicitUseStrict": true,
|
||||||
|
"removeComments": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"diagnostics": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"lib": [
|
||||||
|
"es6",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
"noUnusedLocals": true,
|
"noUnusedLocals": true,
|
||||||
"noUnusedParameters": true
|
"noUnusedParameters": true
|
||||||
},
|
},
|
||||||
@ -13,4 +25,4 @@
|
|||||||
"**/node_modules/**",
|
"**/node_modules/**",
|
||||||
"**/platforms/**"
|
"**/platforms/**"
|
||||||
]
|
]
|
||||||
}
|
}
|
@ -1,21 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"sourceMap": true,
|
|
||||||
"inlineSourceMap": false
|
|
||||||
},
|
|
||||||
"extends": "./tsconfig.shared",
|
|
||||||
"include": [
|
|
||||||
"tns-core-modules/**/*.ts",
|
|
||||||
"unit-tests/**/*.ts"
|
|
||||||
],
|
|
||||||
"exclude": [
|
|
||||||
"**/*.android.ts",
|
|
||||||
"**/*.android.d.ts",
|
|
||||||
"**/*.ios.ts",
|
|
||||||
"**/*.ios.d.ts",
|
|
||||||
"tns-platform-declarations",
|
|
||||||
"tns-core-modules/node-modules",
|
|
||||||
"tns-core-modules/references.d.ts",
|
|
||||||
"tns-core-modules/platforms"
|
|
||||||
]
|
|
||||||
}
|
|
42
unit-tests/tsconfig.json
Normal file
42
unit-tests/tsconfig.json
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"noEmitOnError": false,
|
||||||
|
"noEmitHelpers": true,
|
||||||
|
"target": "es5",
|
||||||
|
"module": "commonjs",
|
||||||
|
"noImplicitUseStrict": true,
|
||||||
|
"removeComments": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"diagnostics": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"inlineSourceMap": false,
|
||||||
|
"lib": [
|
||||||
|
"es6",
|
||||||
|
"dom"
|
||||||
|
],
|
||||||
|
"types": [
|
||||||
|
"node",
|
||||||
|
"chai",
|
||||||
|
"mocha"
|
||||||
|
],
|
||||||
|
"baseUrl": "..",
|
||||||
|
"paths": {
|
||||||
|
"tns-core-modules/*": [
|
||||||
|
"tns-core-modules/*"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"../tns-core-modules/**/*.ts",
|
||||||
|
"./**/*.ts"
|
||||||
|
],
|
||||||
|
"exclude": [
|
||||||
|
"../tns-core-modules/**/*.android.ts",
|
||||||
|
"../tns-core-modules/**/*.android.d.ts",
|
||||||
|
"../tns-core-modules/**/*.ios.ts",
|
||||||
|
"../tns-core-modules/**/*.ios.d.ts",
|
||||||
|
"../tns-core-modules/node-modules",
|
||||||
|
"../tns-core-modules/references.d.ts",
|
||||||
|
"../tns-core-modules/platforms"
|
||||||
|
]
|
||||||
|
}
|
Reference in New Issue
Block a user