Skip to content

Commit

Permalink
Copy node_modules if the directory exists
Browse files Browse the repository at this point in the history
  • Loading branch information
erisu committed Dec 19, 2018
1 parent 4694547 commit 0e28de8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 1 addition & 2 deletions bin/create
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 5 additions & 3 deletions bin/lib/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand All @@ -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);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 0e28de8

Please sign in to comment.