You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by GitBox <gi...@apache.org> on 2018/12/19 01:33:12 UTC

[GitHub] erisu closed pull request #482: Copy node_modules if the directory exists

erisu closed pull request #482: Copy node_modules if the directory exists
URL: https://github.com/apache/cordova-ios/pull/482
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/bin/create b/bin/create
index 5c06978d1..ac1b167a4 100755
--- a/bin/create
+++ b/bin/create
@@ -63,8 +63,7 @@ if (argv.argv.remain[2]) config.setName(argv.argv.remain[2]);
 var options = {
     cli: argv.cli,
     link: argv.link || argv.shared,
-    customTemplate: argv.argv.remain[3],
-    copyPlatformNodeModules: true
+    customTemplate: argv.argv.remain[3]
 };
 
 require('./templates/scripts/cordova/loggingHelper').adjustLoggerLevel(argv);
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 8205bfd26..27838a4f2 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -66,7 +66,7 @@ function copyJsAndCordovaLib (projectPath, projectName, use_shared) {
     });
 }
 
-function copyScripts (projectPath, projectName, options) {
+function copyScripts (projectPath, projectName) {
     var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'scripts', 'cordova');
     var destScriptsDir = path.join(projectPath, 'cordova');
 
@@ -76,7 +76,9 @@ function copyScripts (projectPath, projectName, options) {
     // Copy in the new ones.
     var binDir = path.join(ROOT, 'bin');
     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);
 
     // Copy the check_reqs script
     shell.cp(path.join(binDir, 'check_reqs*'), destScriptsDir);
@@ -232,7 +234,7 @@ exports.createProject = function (project_path, package_name, project_name, opts
 
     // CordovaLib stuff
     copyJsAndCordovaLib(project_path, project_name, use_shared);
-    copyScripts(project_path, project_name, opts);
+    copyScripts(project_path, project_name);
 
     events.emit('log', generateDoneMessage('create', use_shared));
     return Q.resolve();


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org