mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
Copy node_modules if the directory exists (#607)
This commit is contained in:
+6
-3
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user