Merge pull request #290 from stevengill/master
CB-13055: removed nofetch option
diff --git a/doc/config.txt b/doc/config.txt
index 3d24d36..2b0b35f 100644
--- a/doc/config.txt
+++ b/doc/config.txt
@@ -24,12 +24,6 @@
Allows the user to set save to true or false when adding platforms or plugins.
When false, platforms/plugins are not saved to `config.xml` and `package.json`.
- fetch .......................... default setting = true
- Allows the user to set fetch to true or false when adding platforms or plugins.
- When false, platforms/plugins are fetched. It does not install to the project using
- `npm install` and it does not store it in the apps `node_modules`directory.
- It uses the fetching logic of previous cordova versions.
-
browserify ...................... default setting = false
Allows the user to use the browserify module to bundle the JavaScript files of
the included plugins at build time versus our traditional run time loading of
@@ -38,4 +32,3 @@
Examples
cordova config set autosave false
cordova config set browserify true
- cordova config set fetch false
\ No newline at end of file
diff --git a/doc/cordova.txt b/doc/cordova.txt
index 7da9ed3..ccd3fae 100644
--- a/doc/cordova.txt
+++ b/doc/cordova.txt
@@ -49,5 +49,3 @@
cordova-cli run android
cordova-cli build android --release -- --keystore="..\android.keystore" --storePassword=android --alias=mykey
cordova-cli config ls
- cordova-cli platform add ios --nofetch
- cordova-cli plugin add cordova-plugin-camera --nofetch
diff --git a/doc/platform.txt b/doc/platform.txt
index 199d451..d301be0 100644
--- a/doc/platform.txt
+++ b/doc/platform.txt
@@ -14,17 +14,10 @@
library directly instead of making a copy of it (support
varies by platform; useful for platform development)
- --nofetch ..................... Prevent fetching the plugin into the project's node_modules
- directory. Uses older fetching method (pre cordova-7)
- instead of using npm install under the hood
-
remove <platform> [...] ........... Remove specified platforms
--nosave ...................... Prevent deleting specified platforms from
config.xml & package.json after removing them
- --nofetch ..................... Prevent removing the plugin from the project's node_modules
- directory. Uses older fetching method (pre cordova-7)
- instead of using npm install under the hood
update <plat-spec> ................ Update the version of Cordova used for a specific platform;
update to the latest <version> if no <plat-spec> is specified
@@ -55,5 +48,3 @@
cordova-cli platform add ../cordova-android.tgz
cordova-cli platform rm android --nosave
cordova-cli platform ls
- cordova-cli platform add android --nofetch
- cordova-cli platform rm android --nofetch
diff --git a/doc/plugin.txt b/doc/plugin.txt
index 3fd0273..05bf382 100644
--- a/doc/plugin.txt
+++ b/doc/plugin.txt
@@ -24,20 +24,13 @@
--force ........................ Forces copying source files from the plugin even if the
same file already exists in the target directory.
-
- --nofetch ...................... Prevents fetching the plugin into the project's
- node_modules directory. Prevents using
- `npm install` to do the fetching.
+
remove <pluginid>|<name> [...] ..... Remove plugins with the given IDs/name and
removes the information for specified plugin from config.xml & package.json.
--nosave ....................... Prevents removing the information for
specified plugin from config.xml & package.json.
- --nofetch ...................... Prevents removing the plugin from the project's
- node_modules directory. Prevents using
- `npm uninstall` under the hood.
-
list .............................. List currently installed plugins
save .............................. Saves the information for all currently added plugins to config.xml
@@ -67,5 +60,3 @@
cordova-cli plugin add ../cordova-plugin-camera.tgz --nosave
cordova-cli plugin rm camera --nosave
cordova-cli plugin ls
- cordova-cli plugin add cordova-plugin-camera --nofetch
- cordova-cli plugin rm cordova-plugin-camera --nofetch
diff --git a/doc/readme.md b/doc/readme.md
index 283a545..50b3332 100644
--- a/doc/readme.md
+++ b/doc/readme.md
@@ -81,12 +81,12 @@
# Create a cordova project
cordova create myApp com.myCompany.myApp myApp
cd myApp
- # Add camera plugin to the project and remember that in config.xml & package.json. Do not use npm install to fetch.
- cordova plugin add cordova-plugin-camera --nofetch
- # Add camera plugin to the project and remember that in config.xml and package.json. Uses pre cordova@7 fetching methods instead of cordova-fetch which uses npm install under the hood.
- cordova plugin add cordova-plugin-camera --nofetch
- # Add android platform to the project and remember that in config.xml & package.json. Uses pre cordova@7 fetching methods instead of cordova-fetch which uses npm install under the hood
- cordova platform add android --nofetch
+ # Add camera plugin to the project and remember that in config.xml & package.json.
+ cordova plugin add cordova-plugin-camera
+ # Add camera plugin to the project and remember that in config.xml and package.json.
+ cordova plugin add cordova-plugin-camera
+ # Add android platform to the project and remember that in config.xml & package.json.
+ cordova platform add android
# Check to see if your system is configured for building android platform.
cordova requirements android
# Build the android and emit verbose logs.
@@ -209,8 +209,8 @@
```bash
cordova {platform | platforms} [
- add <platform-spec> [...] {--save | link=<path> | --fetch } |
- {remove | rm} platform [...] {--save | --fetch}|
+ add <platform-spec> [...] {--save | link=<path> } |
+ {remove | rm} platform [...] {--save}|
{list | ls} |
check |
save |
@@ -222,13 +222,10 @@
| add `<platform-spec>` [...] | | Add specified platforms |
| | --nosave | Do not save `<platform-spec>` into `config.xml` & `package.json` after installing them using `<engine>` tag |
| | --link=`<path>` | When `<platform-spec>` is a local path, links the platform library directly instead of making a copy of it (support varies by platform; useful for platform development)
-| | --nofetch | Do not fetch the platform using `npm install` and do not store it into the apps `node_modules` directory |
| remove `<platform>` [...] | | Remove specified platforms |
| | --nosave | Do not delete specified platforms from `config.xml` & `package.json` after removing them |
-| | --nofetch | Prevent removing the platform using `npm uninstall` and prevent removing it from the apps `node_modules` directory |
| update `platform` [...] | | Update specified platforms |
| | --save | Updates the version specified in `config.xml` |
-| | --nofetch | Do not fetch the platform using `npm install` and do not store it into the apps `node_modules` directory |
| list | | List all installed and available platforms |
| check | | List platforms which can be updated by `cordova-cli platform update` |
| save | | Save `<platform-spec>` of all platforms added to config.xml |
@@ -271,10 +268,6 @@
cordova platform add android ios
-- Add pinned version of the `android` and `ios` platform and save the downloaded version to `config.xml` & `package.json`. Do not install to the project using `npm install` and do not store it in the apps `node_modules` directory:
-
- cordova platform add android ios --nofetch
-
- Add `android` platform with [semver](http://semver.org/) version ^5.0.0 and save it to `config.xml` & `package.json`:
cordova platform add android@^5.0.0
@@ -299,10 +292,6 @@
cordova platform rm android --nosave
-- Remove `android` platform from the project and do NOT remove from `config.xml` & 'package.json. Do not run `npm uninstall` to remove it
-
- cordova platform rm android --nosave --nofetch
-
- List available and installed platforms with version numbers. This is useful to find version numbers when reporting issues:
cordova platform ls
@@ -321,8 +310,8 @@
```bash
cordova {plugin | plugins} [
- add <plugin-spec> [..] {--searchpath=<directory> | --noregistry | --link | --save | --browserify | --force | --nofetch} |
- {remove | rm} {<pluginid> | <name>} --save --nofetch |
+ add <plugin-spec> [..] {--searchpath=<directory> | --noregistry | --link | --save | --browserify | --force} |
+ {remove | rm} {<pluginid> | <name>} --save |
{list | ls} |
search [<keyword>] |
save |
@@ -338,10 +327,8 @@
| |--nosave | Do NOT save the `<plugin-spec>` as part of the `plugin` element into `config.xml` or `package.json`.
| |--browserify | Compile plugin JS at build time using browserify instead of runtime.
| |--force | _Introduced in version 6.1._ Forces copying source files from the plugin even if the same file already exists in the target directory.
-| |--nofetch | Do not fetch the plugin using `npm install` and do not store it into the apps `node_modules` directory |
| remove `<pluginid>|<name>` [...]| | Remove plugins with the given IDs/name.
| |--nosave | Do NOT remove the specified plugin from config.xml or package.json
-| |--nofetch | Do not remove the plugin using `npm uninstall` and do not remove it from the apps `node_modules` directory |
|list | | List currently installed plugins
|search `[<keyword>]` [...] | | Search http://plugins.cordova.io for plugins matching the keywords
|save | | Save `<plugin-spec>` of all plugins currently added to the project
@@ -360,7 +347,6 @@
| directory | Directory containing plugin.xml
| url | Url to a git repository containing a plugin.xml
| commit-ish | Commit/tag/branch reference. If none is specified, 'master' is used
-| subdir | Sub-directory to find plugin.xml for the specified plugin. (Doesn't work with `--fetch` option)
### Algorithm for resolving plugins
@@ -382,10 +368,6 @@
cordova plugin add cordova-plugin-camera@^2.0.0
-- Add `cordova-plugin-camera` with [semver](http://semver.org/) version ^2.0.0 and do not`npm install` it. It will not be stored in the `node_modules` directory:
-
- cordova plugin add cordova-plugin-camera@^2.0.0 --nofetch
-
- Add the plugin from the specified local directory:
cordova plugin add ../cordova-plugin-camera
@@ -402,10 +384,6 @@
cordova plugin rm camera --nosave
-- Remove the plugin from the project. Do not remove it from the node_modules directory and don't run npm uninstall under the hood:
-
- cordova plugin rm camera --nofetch
-
- List all plugins installed in the project:
cordova plugin ls
@@ -428,7 +406,7 @@
```
cordova prepare [<platform> [..]]
- [--browserify | --fetch]
+ [--browserify]
```
### Options
@@ -437,8 +415,6 @@
|------------|------------------
| `<platform> [..]` | Platform name(s) to prepare. If not specified, all platforms are built.
|--browserify | Compile plugin JS at build time using browserify instead of runtime.
-|--fetch | When restoring plugins or platforms, fetch will `npm install` the missing modules.
-
## cordova compile command
@@ -687,7 +663,6 @@
```
cordova config set autosave false
cordova config set browserify false
-cordova config set fetch true
```
[Hooks guide]: http://cordova.apache.org/docs/en/latest/guide_appdev_hooks_index.md.html
diff --git a/spec/cli.spec.js b/spec/cli.spec.js
index 8411426..109c841 100644
--- a/spec/cli.spec.js
+++ b/spec/cli.spec.js
@@ -88,42 +88,42 @@
it('Test#005 : will call command with all arguments passed through', function (done) {
cli(['node', 'cordova', 'build', 'blackberry10', '--', '-k', 'abcd1234'], function () {
- expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { argv: ['-k', 'abcd1234'], fetch: true }, verbose: false, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
+ expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { argv: ['-k', 'abcd1234'] }, verbose: false, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
done();
});
}, 60000);
it('Test#006 : will consume the first instance of -d', function (done) {
cli(['node', 'cordova', '-d', 'build', 'blackberry10', '--', '-k', 'abcd1234', '-d'], function () {
- expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '-d'], fetch: true }, verbose: true, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
+ expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '-d'] }, verbose: true, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
done();
});
});
it('Test#007 : will consume the first instance of --verbose', function (done) {
cli(['node', 'cordova', '--verbose', 'build', 'blackberry10', '--', '-k', 'abcd1234', '--verbose'], function () {
- expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '--verbose'], fetch: true }, verbose: true, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
+ expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '--verbose'] }, verbose: true, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
done();
});
});
it('Test#008 : will consume the first instance of either --verbose or -d', function (done) {
cli(['node', 'cordova', '--verbose', 'build', 'blackberry10', '--', '-k', 'abcd1234', '-d'], function () {
- expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '-d'], fetch: true }, verbose: true, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
+ expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '-d'] }, verbose: true, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
done();
});
});
it('Test#009 : will consume the first instance of either --verbose or -d', function (done) {
cli(['node', 'cordova', '-d', 'build', 'blackberry10', '--', '-k', 'abcd1234', '--verbose'], function () {
- expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '--verbose'], fetch: true }, verbose: true, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
+ expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { verbose: true, argv: ['-k', 'abcd1234', '--verbose'] }, verbose: true, silent: false, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
done();
});
});
it('Test#010 : will consume the first instance of --silent', function (done) {
cli(['node', 'cordova', '--silent', 'build', 'blackberry10', '--', '-k', 'abcd1234', '--silent'], function () {
- expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { silent: true, argv: ['-k', 'abcd1234', '--silent'], fetch: true }, verbose: false, silent: true, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
+ expect(cordova.build).toHaveBeenCalledWith({ platforms: ['blackberry10'], options: { silent: true, argv: ['-k', 'abcd1234', '--silent'] }, verbose: false, silent: true, browserify: false, fetch: true, nohooks: [ ], searchpath: undefined });
done();
});
});
@@ -238,19 +238,6 @@
});
});
- it('Test #019 : (add) will pass fetch:false', function (done) {
- cli(['node', 'cordova', 'plugin', 'add', 'device', '--nofetch'], function () {
- expect(cordova.plugin).toHaveBeenCalledWith(
- 'add',
- ['device'],
- jasmine.any(Object)
- );
- var opts = cordova.plugin.calls.argsFor(0)[2];
- expect(opts.fetch).toBe(false);
- done();
- });
- });
-
it('Test #020 : (add) fetch is true by default and will pass fetch:true', function (done) {
cli(['node', 'cordova', 'plugin', 'add', 'device'], function () {
expect(cordova.plugin).toHaveBeenCalledWith(
@@ -290,19 +277,6 @@
});
});
- it('Test #022 : (remove) will pass fetch:false', function (done) {
- cli(['node', 'cordova', 'plugin', 'remove', 'device', '--nofetch'], function () {
- expect(cordova.plugin).toHaveBeenCalledWith(
- 'remove',
- ['device'],
- jasmine.any(Object)
- );
- var opts = cordova.plugin.calls.argsFor(0)[2];
- expect(opts.fetch).toBe(false);
- done();
- });
- });
-
it('(add) will pass noprod:true and production:false', function (done) {
cli(['node', 'cordova', 'plugin', 'add', 'device', '--noprod'], function () {
expect(cordova.plugin).toHaveBeenCalledWith(
@@ -546,19 +520,6 @@
});
});
- it('Test #038 : (add) will pass fetch:false', function (done) {
- cli(['node', 'cordova', 'platform', 'add', 'device', '--nofetch'], function () {
- expect(cordova.platform).toHaveBeenCalledWith(
- 'add',
- ['device'],
- jasmine.any(Object)
- );
- var opts = cordova.platform.calls.argsFor(0)[2];
- expect(opts.fetch).toBe(false);
- done();
- });
- });
-
it('Test #039 : (add) fetch is true by default and will pass fetch:true', function (done) {
cli(['node', 'cordova', 'platform', 'add', 'device'], function () {
expect(cordova.platform).toHaveBeenCalledWith(
@@ -584,19 +545,6 @@
done();
});
});
-
- it('Test #041 : (remove) will pass fetch:false', function (done) {
- cli(['node', 'cordova', 'platform', 'remove', 'device', '--nofetch'], function () {
- expect(cordova.platform).toHaveBeenCalledWith(
- 'remove',
- ['device'],
- jasmine.any(Object)
- );
- var opts = cordova.platform.calls.argsFor(0)[2];
- expect(opts.fetch).toBe(false);
- done();
- });
- });
});
describe('config', function () {
diff --git a/src/cli.js b/src/cli.js
index 3f20766..7791b30 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -353,19 +353,13 @@
throw new CordovaError(msg2);
}
- if (args.nofetch) {
- args.fetch = false;
- } else {
- args.fetch = true;
- }
-
var opts = {
platforms: [],
options: [],
verbose: args.verbose || false,
silent: args.silent || false,
browserify: args.browserify || false,
- fetch: args.fetch,
+ fetch: true,
nohooks: args.nohooks || [],
searchpath: args.searchpath
};
@@ -463,10 +457,6 @@
// User explicitly did not pass in save
args.save = conf.get('autosave');
}
- if (args.fetch === undefined) {
- // User explicitly did not pass in fetch
- args.fetch = conf.get('fetch');
- }
if (args.browserify === undefined) {
// User explicitly did not pass in browserify
args.browserify = conf.get('browserify');
@@ -490,7 +480,7 @@
nohooks: args.nohooks,
cli_variables: cli_vars,
browserify: args.browserify || false,
- fetch: args.fetch,
+ fetch: true,
link: args.link || false,
save: args.save,
save_exact: args['save-exact'] || false,