You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ra...@apache.org on 2019/11/19 09:47:45 UTC

[cordova-cli] branch master updated: refactor(create): use cordova-create 3.0.0-nightly (#494)

This is an automated email from the ASF dual-hosted git repository.

raphinesse pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-cli.git


The following commit(s) were added to refs/heads/master by this push:
     new ed5e60b  refactor(create): use cordova-create 3.0.0-nightly (#494)
ed5e60b is described below

commit ed5e60b3f0eddefb4f4a6a2d670e51901dc1a5cf
Author: Raphael von der GrĂ¼n <ra...@gmail.com>
AuthorDate: Tue Nov 19 10:47:35 2019 +0100

    refactor(create): use cordova-create 3.0.0-nightly (#494)
    
    - remove support for --link-to option from code
    - use --template option instead of --link-to in test
    - remove --link-to option from docs
    - update code & test to use new cordova-create interface
---
 doc/create.txt   |  3 +--
 doc/readme.md    |  6 ------
 package.json     |  2 +-
 spec/cli.spec.js | 14 ++++++++------
 src/cli.js       | 30 ++----------------------------
 5 files changed, 12 insertions(+), 43 deletions(-)

diff --git a/doc/create.txt b/doc/create.txt
index 1013034..6a39c56 100644
--- a/doc/create.txt
+++ b/doc/create.txt
@@ -11,7 +11,6 @@ Create a Cordova project
 Options
 
     --template=<PATH|NPM PACKAGE|GIT URL> ... use a custom template located locally, in NPM, or GitHub.
-    --link-to=<PATH> ........................ symlink to custom www assets without creating a copy.
 
 Example
-    cordova-cli create myapp com.mycompany.myteam.myapp MyApp
\ No newline at end of file
+    cordova-cli create myapp com.mycompany.myteam.myapp MyApp
diff --git a/doc/readme.md b/doc/readme.md
index 1810fa3..a64093e 100644
--- a/doc/readme.md
+++ b/doc/readme.md
@@ -117,7 +117,6 @@ cordova create path [id [name]] [options]
 | Option | Description |
 |--------|-------------|
 | --template |  Use a custom template located locally, in NPM, or GitHub. |
-|--link-to | Symlink to specified `www` directory without creating a copy. |
 
 ### Directory structure
 
@@ -183,11 +182,6 @@ It is recommended not to check in `platforms/` and `plugins/` directories into v
 
         cordova create myapp com.mycompany.myteam.myapp MyApp
 
-- Create a Cordova project with a symlink to an existing `www` directory. This can be useful if you have a custom build process or existing web assets that you want to use in your Cordova app:
-
-        cordova create myapp --link-to=../www
-
-
 ## cordova platform command
 
 ### Synopsis
diff --git a/package.json b/package.json
index 65ce423..4998e44 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,7 @@
   "dependencies": {
     "configstore": "^4.0.0",
     "cordova-common": "^3.1.0",
-    "cordova-create": "^2.0.0",
+    "cordova-create": "^3.0.0-nightly.2019.11.19.1d0d67e0",
     "cordova-lib": "^9.0.0",
     "editor": "^1.0.0",
     "insight": "^0.10.1",
diff --git a/spec/cli.spec.js b/spec/cli.spec.js
index 66530f5..051054f 100644
--- a/spec/cli.spec.js
+++ b/spec/cli.spec.js
@@ -122,12 +122,14 @@ describe('cordova cli', () => {
             });
         });
 
-        it('Test#011 : calls cordova create', () => {
-            return cli(['node', 'cordova', 'create', 'a', 'b', 'c', '--link-to', 'c:\\personalWWW']).then(() => {
-                expect(cli.__get__('cordovaCreate')).toHaveBeenCalledWith(
-                    'a', 'b', 'c', jasmine.any(Object), jasmine.any(Object)
-                );
-            });
+        it('Test#011 : calls cordova create', async () => {
+            const dest = 'a';
+            const opts = { id: 'b', name: 'c', template: '../my-template' };
+            await cli(['node', 'cordova', 'create', dest, opts.id, opts.name, '--template', opts.template]);
+
+            expect(cli.__get__('cordovaCreate')).toHaveBeenCalledWith(
+                dest, jasmine.objectContaining(opts)
+            );
         });
     });
 
diff --git a/src/cli.js b/src/cli.js
index 7288d22..913da00 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -15,7 +15,6 @@
     under the License.
 */
 
-var path = require('path');
 var nopt = require('nopt');
 var updateNotifier = require('update-notifier');
 var pkg = require('../package.json');
@@ -48,7 +47,6 @@ var knownOpts = {
     noregistry: Boolean,
     nohooks: Array,
     shrinkwrap: Boolean,
-    'link-to': path,
     searchpath: String,
     variable: Array,
     link: Boolean,
@@ -412,7 +410,8 @@ function cli (inputArgs) {
         var port = undashed[1];
         return cordova.serve(port);
     } else if (cmd === 'create') {
-        return create(undashed, args);
+        const [, dest, id, name] = undashed;
+        return cordovaCreate(dest, { id, name, events, template: args.template });
     } else if (cmd === 'config') {
         // Don't need to do anything with cordova-lib since config was handled above
         return true;
@@ -461,28 +460,3 @@ function cli (inputArgs) {
         return cordova[cmd](subcommand, targets, download_opts);
     }
 }
-
-function create ([_, dir, id, name], args) {
-    var cfg = {};
-
-    // Template path
-    var customWww = args['link-to'] || args.template;
-
-    if (customWww) {
-        // TODO Handle in create
-        if (!args.template && customWww.indexOf('http') === 0) {
-            throw new CordovaError(
-                'Only local paths for custom www assets are supported for linking' + customWww
-            );
-        }
-
-        // Template config
-        cfg.lib = {};
-        cfg.lib.www = {
-            url: customWww,
-            template: 'template' in args,
-            link: 'link-to' in args
-        };
-    }
-    return cordovaCreate(dir, id, name, cfg, events || undefined);
-}


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