Merge pull request #536 from erisu/remove-node_module-copy

Only copy platform node_modules when created by binary
This commit is contained in:
Darryl Pogue 2018-11-06 10:06:46 -08:00 committed by GitHub
commit fb75ac371d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -50,7 +50,8 @@ if (argv['activity-name']) config.setName(argv['activity-name']);
var options = { var options = {
link: argv.link || argv.shared, link: argv.link || argv.shared,
customTemplate: argv.argv.remain[3], customTemplate: argv.argv.remain[3],
activityName: argv['activity-name'] activityName: argv['activity-name'],
copyPlatformNodeModules: true
}; };
require('./templates/cordova/loggingHelper').adjustLoggerLevel(argv); require('./templates/cordova/loggingHelper').adjustLoggerLevel(argv);

View File

@ -160,7 +160,7 @@ function copyBuildRules (projectPath, isLegacy) {
} }
} }
function copyScripts (projectPath) { function copyScripts (projectPath, options) {
var bin = path.join(ROOT, 'bin'); var bin = path.join(ROOT, 'bin');
var srcScriptsDir = path.join(bin, 'templates', 'cordova'); var srcScriptsDir = path.join(bin, 'templates', 'cordova');
var destScriptsDir = path.join(projectPath, 'cordova'); var destScriptsDir = path.join(projectPath, 'cordova');
@ -168,7 +168,7 @@ function copyScripts (projectPath) {
shell.rm('-rf', destScriptsDir); shell.rm('-rf', destScriptsDir);
// Copy in the new ones. // Copy in the new ones.
shell.cp('-r', srcScriptsDir, projectPath); shell.cp('-r', srcScriptsDir, projectPath);
shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir); if (options.copyPlatformNodeModules) shell.cp('-r', path.join(ROOT, 'node_modules'), destScriptsDir);
shell.cp(path.join(bin, 'check_reqs*'), destScriptsDir); shell.cp(path.join(bin, 'check_reqs*'), destScriptsDir);
shell.cp(path.join(bin, 'android_sdk_version*'), destScriptsDir); shell.cp(path.join(bin, 'android_sdk_version*'), destScriptsDir);
var check_reqs = path.join(destScriptsDir, 'check_reqs'); var check_reqs = path.join(destScriptsDir, 'check_reqs');
@ -324,7 +324,7 @@ exports.create = function (project_path, config, options, events) {
var manifest_path = path.join(app_path, 'AndroidManifest.xml'); var manifest_path = path.join(app_path, 'AndroidManifest.xml');
manifest.write(manifest_path); manifest.write(manifest_path);
exports.copyScripts(project_path); exports.copyScripts(project_path, options);
exports.copyBuildRules(project_path); exports.copyBuildRules(project_path);
}); });
// Link it to local android install. // Link it to local android install.

View File

@ -259,7 +259,7 @@ describe('create', function () {
}); });
it('should copy template scripts into generated project', function (done) { it('should copy template scripts into generated project', function (done) {
create.create(project_path, config_mock, {}, events_mock).then(function () { create.create(project_path, config_mock, {}, events_mock).then(function () {
expect(create.copyScripts).toHaveBeenCalledWith(project_path); expect(create.copyScripts).toHaveBeenCalledWith(project_path, {});
}).fail(fail).done(done); }).fail(fail).done(done);
}); });
it('should copy build rules / gradle files into generated project', function (done) { it('should copy build rules / gradle files into generated project', function (done) {