You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2018/12/19 01:33:21 UTC
[cordova-android] branch master updated: Copy node_modules if the
directory exists (#607)
This is an automated email from the ASF dual-hosted git repository.
erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git
The following commit(s) were added to refs/heads/master by this push:
new f228d90 Copy node_modules if the directory exists (#607)
f228d90 is described below
commit f228d90ca2f133e7b486a3d44f5df3bed752f2db
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Wed Dec 19 10:33:16 2018 +0900
Copy node_modules if the directory exists (#607)
---
bin/create | 3 +--
bin/lib/create.js | 9 ++++++---
spec/unit/create.spec.js | 2 +-
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/bin/create b/bin/create
index 0d841e1..fbab242 100755
--- a/bin/create
+++ b/bin/create
@@ -50,8 +50,7 @@ if (argv['activity-name']) config.setName(argv['activity-name']);
var options = {
link: argv.link || argv.shared,
customTemplate: argv.argv.remain[3],
- activityName: argv['activity-name'],
- copyPlatformNodeModules: true
+ activityName: argv['activity-name']
};
require('./templates/cordova/loggingHelper').adjustLoggerLevel(argv);
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 2b5a65e..d6451a7 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -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.
diff --git a/spec/unit/create.spec.js b/spec/unit/create.spec.js
index 2acaa8b..ac7026b 100644
--- a/spec/unit/create.spec.js
+++ b/spec/unit/create.spec.js
@@ -259,7 +259,7 @@ describe('create', function () {
});
it('should copy template scripts into generated project', function (done) {
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);
});
it('should copy build rules / gradle files into generated project', function (done) {
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org