Copy node_modules if the directory exists (#607)

This commit is contained in:
エリス
2018-12-19 10:33:16 +09:00
committed by GitHub
parent 5f44af3757
commit f228d90ca2
3 changed files with 8 additions and 6 deletions
+6 -3
View File
@@ -160,7 +160,7 @@ function copyBuildRules (projectPath, isLegacy) {
}
}
function copyScripts (projectPath, options) {
function copyScripts (projectPath) {
var bin = path.join(ROOT, 'bin');
var srcScriptsDir = path.join(bin, 'templates', 'cordova');
var destScriptsDir = path.join(projectPath, 'cordova');
@@ -168,7 +168,10 @@ function copyScripts (projectPath, options) {
shell.rm('-rf', destScriptsDir);
// Copy in the new ones.
shell.cp('-r', srcScriptsDir, projectPath);
if (options.copyPlatformNodeModules) shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir);
let nodeModulesDir = path.join(ROOT, 'node_modules');
if (fs.existsSync(nodeModulesDir)) shell.cp('-r', nodeModulesDir, destScriptsDir);
shell.cp(path.join(bin, 'check_reqs*'), destScriptsDir);
shell.cp(path.join(bin, 'android_sdk_version*'), destScriptsDir);
var check_reqs = path.join(destScriptsDir, 'check_reqs');
@@ -324,7 +327,7 @@ exports.create = function (project_path, config, options, events) {
var manifest_path = path.join(app_path, 'AndroidManifest.xml');
manifest.write(manifest_path);
exports.copyScripts(project_path, options);
exports.copyScripts(project_path);
exports.copyBuildRules(project_path);
});
// Link it to local android install.