Work around npm bug when uninstalling old cordova platforms (#78)
When using `npm@>=6.11.0` on Windows, `npm uninstall`
of `cordova-android@5.1.1` will leave an empty folder
`node_modules/cordova-android/node_modules` behind. This causes one of
our tests to fail but it is very likely an issue with npm. Furthermore
this is very unlikely to affect users of `cordova-fetch` in production.
1 file changed
tree: 29112844c65757162685ac8d8c6ea145e54ec80f
- .github/
- spec/
- .eslintrc.yml
- .gitignore
- .ratignore
- .travis.yml
- appveyor.yml
- index.js
- package.json
- README.md
- RELEASENOTES.md
README.md
cordova-fetch
This package can be used to install and uninstall Node.js packages using npm.
Usage
fetch
Installs a module from npm, a git url or the local file system. Returns a Promise
resolving to the absolute path to the installed package.
const fetch = require('cordova-fetch');
fetch(spec, dest, opts).then(pathToInstalledPackage => {
// Do something
});
Parameters
Parameter | Description |
---|
spec | A spec for the package to be installed (anything supported by npm install ) |
dest | Location where to install the package |
opts | Additional options (optional) |
Options
Option | Default | Description |
---|
save | false | Adds the package as dependency to package.json iff true |
uninstall
Uninstalls a package from given directory. Returns a Promise
that resolves when removal has finished
const { uninstall } = require('cordova-fetch');
uninstall(packageName, dest, opts).then(() => {
// Do something
});
Parameters
Parameter | Description |
---|
packageName | Name of the package to be uninstalled |
dest | Location from where to uninstall the package |
opts | An Object with additional options |
Options
Option | Default | Description |
---|
save | false | Removes dependency from package.json iff true |