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 2019/11/21 16:13:16 UTC
[cordova-electron] branch master updated: refactor: remove shelljs
and update tests (#116)
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-electron.git
The following commit(s) were added to refs/heads/master by this push:
new 61f4d0f refactor: remove shelljs and update tests (#116)
61f4d0f is described below
commit 61f4d0f64607be5edebbc3b084cb0da516b8b489
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Fri Nov 22 01:13:09 2019 +0900
refactor: remove shelljs and update tests (#116)
* refator: remove shelljs and update tests
* Update tests/spec/unit/templates/cordova/lib/prepare.spec.js
Co-Authored-By: Raphael von der Grün <ra...@gmail.com>
* Update tests/spec/unit/templates/cordova/lib/prepare.spec.js
Co-Authored-By: Raphael von der Grün <ra...@gmail.com>
* Update tests/spec/unit/templates/cordova/lib/prepare.spec.js
Co-Authored-By: Raphael von der Grün <ra...@gmail.com>
* Update tests/spec/unit/templates/cordova/lib/prepare.spec.js
Co-Authored-By: Raphael von der Grün <ra...@gmail.com>
* chore: cleanup
* test: fix test case
* chore: fix package-lock.json
---
bin/templates/cordova/lib/prepare.js | 9 +-
package-lock.json | 289 +++++++++------------
package.json | 3 +-
.../unit/templates/cordova/lib/prepare.spec.js | 47 +---
4 files changed, 136 insertions(+), 212 deletions(-)
diff --git a/bin/templates/cordova/lib/prepare.js b/bin/templates/cordova/lib/prepare.js
index 351fdeb..3832d64 100644
--- a/bin/templates/cordova/lib/prepare.js
+++ b/bin/templates/cordova/lib/prepare.js
@@ -19,7 +19,6 @@
const fs = require('fs-extra');
const path = require('path');
-const shell = require('shelljs');
const { ConfigParser, xmlHelpers, events, CordovaError } = require('cordova-common');
const ManifestJsonParser = require('./ManifestJsonParser');
const PackageJsonParser = require('./PackageJsonParser');
@@ -339,11 +338,9 @@ function createResourceMap (cordovaProject, locations, resources) {
* Get a map containing resources of a specified name (or directory) to the target directory.
*/
function mapResources (rootDir, sourcePath, targetPath) {
- const pathMap = {};
- shell.ls(path.join(rootDir, sourcePath)).forEach(() => {
- pathMap[sourcePath] = targetPath;
- });
- return pathMap;
+ return fs.existsSync(path.join(rootDir, sourcePath))
+ ? { [sourcePath]: targetPath }
+ : {};
}
/**
diff --git a/package-lock.json b/package-lock.json
index ff7542e..82e89b1 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -287,6 +287,12 @@
"defer-to-connect": "^1.0.1"
}
},
+ "@types/color-name": {
+ "version": "1.1.1",
+ "resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
+ "integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ==",
+ "dev": true
+ },
"@types/debug": {
"version": "4.1.5",
"resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.5.tgz",
@@ -1003,13 +1009,6 @@
"delayed-stream": "~1.0.0"
}
},
- "commander": {
- "version": "2.20.3",
- "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz",
- "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==",
- "dev": true,
- "optional": true
- },
"commondir": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
@@ -2087,9 +2086,9 @@
}
},
"find-cache-dir": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.1.0.tgz",
- "integrity": "sha512-zw+EFiNBNPgI2NTrKkDd1xd7q0cs6wr/iWnr/oUkI0yF9K9GqQ+riIt4aiyFaaqpaWbxPrJXHI+QvmNUQbX+0Q==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-3.0.0.tgz",
+ "integrity": "sha512-t7ulV1fmbxh5G9l/492O1p5+EBbr3uwpt6odhFTMc+nWyhmbloe+ja9BZ8pIBtqFWhOmCWVjx+pTW4zDkFoclw==",
"dev": true,
"requires": {
"commondir": "^1.0.1",
@@ -2244,9 +2243,9 @@
"dev": true
},
"which": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/which/-/which-2.0.1.tgz",
- "integrity": "sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": {
"isexe": "^2.0.0"
@@ -2387,18 +2386,6 @@
"resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz",
"integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ=="
},
- "handlebars": {
- "version": "4.5.3",
- "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.3.tgz",
- "integrity": "sha512-3yPecJoJHK/4c6aZhSvxOyG4vJKDshV36VHp0iVCDVh7o9w2vwi3NSnL2MMPj3YdduqaBcu7cGbggJQM0br9xA==",
- "dev": true,
- "requires": {
- "neo-async": "^2.6.0",
- "optimist": "^0.6.1",
- "source-map": "^0.6.1",
- "uglify-js": "^3.1.4"
- }
- },
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
@@ -2474,6 +2461,12 @@
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.5.tgz",
"integrity": "sha512-kssjab8CvdXfcXMXVcvsXum4Hwdq9XGtRD3TteMEvEbq0LXyiNQr6AprqKqfeaDXze7SxWvRxdpwE6ku7ikLkg=="
},
+ "html-escaper": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.0.tgz",
+ "integrity": "sha512-a4u9BeERWGu/S8JiWEAQcdrg9v4QArtP9keViQjGMdff20fBdd8waotXaNmODqBe6uZ3Nafi7K/ho4gCQHV3Ig==",
+ "dev": true
+ },
"http-cache-semantics": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.0.3.tgz",
@@ -2900,9 +2893,9 @@
"dev": true
},
"which": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/which/-/which-2.0.1.tgz",
- "integrity": "sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": {
"isexe": "^2.0.0"
@@ -2954,9 +2947,9 @@
}
},
"istanbul-lib-source-maps": {
- "version": "4.0.0-alpha.2",
- "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0-alpha.2.tgz",
- "integrity": "sha512-taJF9b9Ddd2rQeajwCdQ+byO5li7MBFnebTo7BIIUSS4dVZHafHP5bVh5wPQ92FAjom9Rn0q3ymd3LykmAjYrQ==",
+ "version": "4.0.0-alpha.4",
+ "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.0-alpha.4.tgz",
+ "integrity": "sha512-T6SCz977OqDyT30dxME6QsrosclFxO2vMcFyVWxzhMECbBtOvErgpIpSIeFrxi6s9wEW2P5HYVDG2gmlM2P3Zg==",
"dev": true,
"requires": {
"debug": "^4.1.1",
@@ -2976,12 +2969,12 @@
}
},
"istanbul-reports": {
- "version": "3.0.0-alpha.3",
- "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.0-alpha.3.tgz",
- "integrity": "sha512-rZVjflOwhnHDS9Ch8aCP71yzr9BpKKGyptl1CvXYgIM6WA6glg+yDv7hblAoG0jWOzfsC1NiGG9Wy7fue2l5KA==",
+ "version": "3.0.0-alpha.4",
+ "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.0.0-alpha.4.tgz",
+ "integrity": "sha512-TPIUdttWC1oUvTL163ZtS0FqTlYaaAQBQdlVpF9Enu+w6oPOUR0p//WRdRyT/hbDG83PoQoSyatYzV6FrICDKg==",
"dev": true,
"requires": {
- "handlebars": "^4.4.2",
+ "html-escaper": "^2.0.0",
"istanbul-lib-report": "^3.0.0-alpha.1"
}
},
@@ -3214,15 +3207,6 @@
"trim-newlines": "^1.0.0"
}
},
- "merge-source-map": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/merge-source-map/-/merge-source-map-1.1.0.tgz",
- "integrity": "sha512-Qkcp7P2ygktpMPh2mCQZaf3jhN6D3Z/qVZHSdWvQ+2Ef5HgRAPBO57A77+ENm0CPx2+1Ce/MYKi3ymqdfuqibw==",
- "dev": true,
- "requires": {
- "source-map": "^0.6.1"
- }
- },
"merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@@ -3301,12 +3285,6 @@
"integrity": "sha1-Sr6/7tdUHywnrPspvbvRXI1bpPc=",
"dev": true
},
- "neo-async": {
- "version": "2.6.1",
- "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz",
- "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==",
- "dev": true
- },
"nested-error-stacks": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/nested-error-stacks/-/nested-error-stacks-2.1.0.tgz",
@@ -3392,32 +3370,31 @@
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0="
},
"nyc": {
- "version": "15.0.0-beta.0",
- "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.0.0-beta.0.tgz",
- "integrity": "sha512-sJr1oFObhy+bi++7wnwCGIV0kjlvBv5Zwq3xCJ4fY95lXk57H+zbloQY4Wzcz0jY5Li3ygZ+V8WjUazAmK31aQ==",
+ "version": "15.0.0-beta.1",
+ "resolved": "https://registry.npmjs.org/nyc/-/nyc-15.0.0-beta.1.tgz",
+ "integrity": "sha512-Zn3S5mjiROpxUvUB7w+2lXQ5wKDft9mhDP+aZ4ZH6WasXl+6LLjJd8NSsNq6DqciSsteuPOjpde4aCQy41uGyQ==",
"dev": true,
"requires": {
"@istanbuljs/load-nyc-config": "^1.0.0-alpha.1",
"@istanbuljs/schema": "^0.1.1",
"caching-transform": "^4.0.0",
- "convert-source-map": "^1.6.0",
+ "convert-source-map": "^1.7.0",
"cp-file": "^7.0.0",
"decamelize": "^1.2.0",
- "find-cache-dir": "^3.0.0",
+ "find-cache-dir": "=3.0.0",
"find-up": "^4.1.0",
"foreground-child": "^2.0.0",
- "glob": "^7.1.4",
+ "glob": "^7.1.6",
"istanbul-lib-coverage": "^3.0.0-alpha.1",
"istanbul-lib-hook": "^3.0.0-alpha.1",
- "istanbul-lib-instrument": "^4.0.0-alpha.1",
+ "istanbul-lib-instrument": "^4.0.0-alpha.2",
"istanbul-lib-processinfo": "^2.0.2",
"istanbul-lib-report": "^3.0.0-alpha.1",
- "istanbul-lib-source-maps": "^4.0.0-alpha.2",
- "istanbul-reports": "^3.0.0-alpha.2",
+ "istanbul-lib-source-maps": "^4.0.0-alpha.4",
+ "istanbul-reports": "^3.0.0-alpha.4",
"js-yaml": "^3.13.1",
"make-dir": "^3.0.0",
- "merge-source-map": "^1.1.0",
- "node-preload": "^0.1.3",
+ "node-preload": "^0.1.4",
"p-map": "^3.0.0",
"resolve-from": "^5.0.0",
"rimraf": "^3.0.0",
@@ -3425,22 +3402,63 @@
"spawn-wrap": "^2.0.0-beta.0",
"test-exclude": "^6.0.0-alpha.1",
"uuid": "^3.3.3",
- "yargs": "^14.2.0",
- "yargs-parser": "^15.0.0"
+ "yargs": "^15.0.1"
},
"dependencies": {
"ansi-regex": {
- "version": "4.1.0",
- "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz",
- "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==",
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
+ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"dev": true
},
+ "ansi-styles": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.0.tgz",
+ "integrity": "sha512-7kFQgnEaMdRtwf6uSfUnVr9gSGC7faurn+J/Mv90/W+iTtN0405/nLdopfMWwchyxhbGYl6TC4Sccn9TUkGAgg==",
+ "dev": true,
+ "requires": {
+ "@types/color-name": "^1.1.1",
+ "color-convert": "^2.0.1"
+ }
+ },
"camelcase": {
"version": "5.3.1",
"resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz",
"integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==",
"dev": true
},
+ "cliui": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
+ "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
+ "dev": true,
+ "requires": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^6.2.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "dev": true,
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
+ "dev": true
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
+ "dev": true
+ },
"find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
@@ -3452,9 +3470,9 @@
}
},
"is-fullwidth-code-point": {
- "version": "2.0.0",
- "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz",
- "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
},
"locate-path": {
@@ -3512,84 +3530,59 @@
"dev": true
},
"string-width": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/string-width/-/string-width-3.1.0.tgz",
- "integrity": "sha512-vafcv6KjVZKSgz06oM/H6GDBrAtz8vdhQakGjFIvNrHA6y3HCF1CInLy+QLq8dTJPQ1b+KDUqDFctkdRW44e1w==",
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
+ "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
"dev": true,
"requires": {
- "emoji-regex": "^7.0.1",
- "is-fullwidth-code-point": "^2.0.0",
- "strip-ansi": "^5.1.0"
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.0"
}
},
"strip-ansi": {
- "version": "5.2.0",
- "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz",
- "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==",
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
+ "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"dev": true,
"requires": {
- "ansi-regex": "^4.1.0"
+ "ansi-regex": "^5.0.0"
+ }
+ },
+ "wrap-ansi": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
+ "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
}
},
"yargs": {
- "version": "14.2.0",
- "resolved": "https://registry.npmjs.org/yargs/-/yargs-14.2.0.tgz",
- "integrity": "sha512-/is78VKbKs70bVZH7w4YaZea6xcJWOAwkhbR0CFuZBmYtfTYF0xjGJF43AYd8g2Uii1yJwmS5GR2vBmrc32sbg==",
+ "version": "15.0.2",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.0.2.tgz",
+ "integrity": "sha512-GH/X/hYt+x5hOat4LMnCqMd8r5Cv78heOMIJn1hr7QPPBqfeC6p89Y78+WB9yGDvfpCvgasfmWLzNzEioOUD9Q==",
"dev": true,
"requires": {
- "cliui": "^5.0.0",
+ "cliui": "^6.0.0",
"decamelize": "^1.2.0",
- "find-up": "^3.0.0",
+ "find-up": "^4.1.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
- "string-width": "^3.0.0",
+ "string-width": "^4.2.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
- "yargs-parser": "^15.0.0"
- },
- "dependencies": {
- "find-up": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz",
- "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==",
- "dev": true,
- "requires": {
- "locate-path": "^3.0.0"
- }
- },
- "locate-path": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-3.0.0.tgz",
- "integrity": "sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==",
- "dev": true,
- "requires": {
- "p-locate": "^3.0.0",
- "path-exists": "^3.0.0"
- }
- },
- "p-locate": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-3.0.0.tgz",
- "integrity": "sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==",
- "dev": true,
- "requires": {
- "p-limit": "^2.0.0"
- }
- },
- "path-exists": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz",
- "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=",
- "dev": true
- }
+ "yargs-parser": "^16.1.0"
}
},
"yargs-parser": {
- "version": "15.0.0",
- "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-15.0.0.tgz",
- "integrity": "sha512-xLTUnCMc4JhxrPEPUYD5IBR1mWCK/aT6+RJ/K29JY2y1vD+FhtgKK0AXRWvI262q3QSffAQuTouFIKUuHX89wQ==",
+ "version": "16.1.0",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-16.1.0.tgz",
+ "integrity": "sha512-H/V41UNZQPkUMIT5h5hiwg4QKIY1RPvoBV4XcjUbRM8Bk2oKqqyZ0DIEbTFZB0XjbtSPG8SAa/0DxCQmiRgzKg==",
"dev": true,
"requires": {
"camelcase": "^5.0.0",
@@ -3654,24 +3647,6 @@
"mimic-fn": "^2.1.0"
}
},
- "optimist": {
- "version": "0.6.1",
- "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz",
- "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=",
- "dev": true,
- "requires": {
- "minimist": "~0.0.1",
- "wordwrap": "~0.0.2"
- },
- "dependencies": {
- "minimist": {
- "version": "0.0.10",
- "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz",
- "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=",
- "dev": true
- }
- }
- },
"optionator": {
"version": "0.8.3",
"resolved": "https://registry.npmjs.org/optionator/-/optionator-0.8.3.tgz",
@@ -4661,11 +4636,6 @@
"resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz",
"integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM="
},
- "shelljs": {
- "version": "0.5.3",
- "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.5.3.tgz",
- "integrity": "sha1-xUmCuZbHbvDB5rWfvcWCX1txMRM="
- },
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
@@ -4751,9 +4721,9 @@
"dev": true
},
"which": {
- "version": "2.0.1",
- "resolved": "https://registry.npmjs.org/which/-/which-2.0.1.tgz",
- "integrity": "sha512-N7GBZOTswtB9lkQBZA4+zAXrjEIWAUOB93AvzUiudRzRxhUdLURQ7D/gAIMY1gatT/LTbmbcv8SiYazy3eYB7w==",
+ "version": "2.0.2",
+ "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz",
+ "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==",
"dev": true,
"requires": {
"isexe": "^2.0.0"
@@ -5170,17 +5140,6 @@
"is-typedarray": "^1.0.0"
}
},
- "uglify-js": {
- "version": "3.6.9",
- "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.9.tgz",
- "integrity": "sha512-pcnnhaoG6RtrvHJ1dFncAe8Od6Nuy30oaJ82ts6//sGSXOP5UjBMEthiProjXmMNHOfd93sqlkztifFMcb+4yw==",
- "dev": true,
- "optional": true,
- "requires": {
- "commander": "~2.20.3",
- "source-map": "~0.6.1"
- }
- },
"underscore": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.9.1.tgz",
@@ -5330,12 +5289,6 @@
"integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==",
"dev": true
},
- "wordwrap": {
- "version": "0.0.3",
- "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz",
- "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=",
- "dev": true
- },
"wrap-ansi": {
"version": "5.1.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-5.1.0.tgz",
diff --git a/package.json b/package.json
index 219d11c..be51f45 100644
--- a/package.json
+++ b/package.json
@@ -28,8 +28,7 @@
"electron-builder": "^21.2.0",
"execa": "^3.3.0",
"fs-extra": "^8.0.1",
- "nopt": "^4.0.1",
- "shelljs": "^0.5.3"
+ "nopt": "^4.0.1"
},
"devDependencies": {
"@cordova/eslint-config": "^2.0.0",
diff --git a/tests/spec/unit/templates/cordova/lib/prepare.spec.js b/tests/spec/unit/templates/cordova/lib/prepare.spec.js
index cc23c7c..83591c1 100644
--- a/tests/spec/unit/templates/cordova/lib/prepare.spec.js
+++ b/tests/spec/unit/templates/cordova/lib/prepare.spec.js
@@ -1414,7 +1414,6 @@ describe('Testing prepare.js:', () => {
describe('createResourceMap method', () => {
let createResourceMap;
- let shellLsSpy;
let cordovaProject;
let locations;
@@ -1424,10 +1423,8 @@ describe('Testing prepare.js:', () => {
cordovaProject = Object.assign({}, cordovaProjectDefault);
locations = Object.assign({}, locationsDefault);
createResourceMap = prepare.__get__('createResourceMap');
- shellLsSpy = prepare.__get__('mapResources');
-
- shellLsSpy = jasmine.createSpy('ls').and.returnValue([true]);
- prepare.__set__('shell', { ls: shellLsSpy });
+ const existsSyncSpy = jasmine.createSpy('existsSyncSpy').and.returnValue(true);
+ prepare.__set__('fs', { existsSync: existsSyncSpy });
});
it('should map custom icon to installer and app icon locations', () => {
@@ -1443,9 +1440,6 @@ describe('Testing prepare.js:', () => {
};
const actual = createResourceMap(cordovaProject, locations, data);
-
- expect(shellLsSpy).toHaveBeenCalled();
-
const expected = [
{ [path.join('res', 'logo.png')]: path.join('MOCK_PROJECT_ROOT', 'www', 'img', 'app.png') },
{ [path.join('res', 'logo.png')]: path.join('MOCK_PROJECT_ROOT', 'build-res', 'installer.png') }
@@ -1468,9 +1462,6 @@ describe('Testing prepare.js:', () => {
};
const actual = createResourceMap(cordovaProject, locations, data);
-
- expect(shellLsSpy).toHaveBeenCalled();
-
const expected = [
{ [path.join('res', 'electron', 'cordova_512.png')]: path.join('MOCK_PROJECT_ROOT', 'build-res', 'installer.png') }
];
@@ -1499,9 +1490,6 @@ describe('Testing prepare.js:', () => {
};
const actual = createResourceMap(cordovaProject, locations, data);
-
- expect(shellLsSpy).toHaveBeenCalled();
-
const expected = [
{ [path.join('res', 'electron', 'cordova.png')]: path.join('MOCK_PROJECT_ROOT', 'www', 'img', 'app.png') },
{ [path.join('res', 'electron', 'cordova_512.png')]: path.join('MOCK_PROJECT_ROOT', 'build-res', 'installer.png') }
@@ -1531,9 +1519,6 @@ describe('Testing prepare.js:', () => {
};
const actual = createResourceMap(cordovaProject, locations, data);
-
- expect(shellLsSpy).toHaveBeenCalled();
-
const expected = [
{ [path.join('res', 'electron', 'cordova@1.5x.png')]: path.join('MOCK_PROJECT_ROOT', 'www', 'img', 'icon@1.5x.png') },
{ [path.join('res', 'electron', 'cordova@2x.png')]: path.join('MOCK_PROJECT_ROOT', 'www', 'img', 'icon@2x.png') },
@@ -1572,9 +1557,6 @@ describe('Testing prepare.js:', () => {
};
const actual = createResourceMap(cordovaProject, locations, data);
-
- expect(shellLsSpy).toHaveBeenCalled();
-
const expected = [
{ [path.join('res', 'electron', 'cordova_512.png')]: path.join('MOCK_PROJECT_ROOT', 'build-res', 'installer.png') },
{ [path.join('res', 'electron', 'cordova@1.5x.png')]: path.join('MOCK_PROJECT_ROOT', 'www', 'img', 'icon@1.5x.png') },
@@ -1597,9 +1579,6 @@ describe('Testing prepare.js:', () => {
};
const actual = createResourceMap(cordovaProject, locations, data);
-
- expect(shellLsSpy).toHaveBeenCalled();
-
const expected = [
{ [path.join('res', 'electron', 'splash.png')]: path.join('MOCK_PROJECT_ROOT', 'www', '.cdv', 'splashScreen.png') }
];
@@ -1610,7 +1589,7 @@ describe('Testing prepare.js:', () => {
describe('mapResources method', () => {
let mapResources;
- let shellLsSpy;
+ let existsSyncSpy;
let cordovaProject;
beforeEach(() => {
@@ -1618,19 +1597,15 @@ describe('Testing prepare.js:', () => {
cordovaProject = Object.assign({}, cordovaProjectDefault);
mapResources = prepare.__get__('mapResources');
- shellLsSpy = prepare.__get__('mapResources');
- shellLsSpy = jasmine.createSpy('ls').and.returnValue([true]);
- prepare.__set__('shell', { ls: shellLsSpy });
+ existsSyncSpy = jasmine.createSpy('existsSyncSpy').and.returnValue(true);
+ prepare.__set__('fs', { existsSync: existsSyncSpy });
});
- it('should not be called if resource does not exist.', () => {
- mapResources(cordovaProject.root, '', '');
-
- shellLsSpy = jasmine.createSpy('ls').and.returnValue([false]);
- prepare.__set__('shell', { ls: shellLsSpy });
-
- expect(shellLsSpy).not.toHaveBeenCalled();
+ it('should return an empty object when the resource path does not exist.', () => {
+ existsSyncSpy.and.returnValue(false);
+ const resources = mapResources(cordovaProject.root, '', '');
+ expect(resources).toEqual({});
});
it('should map to file to file', () => {
@@ -1641,7 +1616,7 @@ describe('Testing prepare.js:', () => {
expected[sourcePath] = targetPath;
const actual = mapResources(cordovaProject.root, sourcePath, targetPath);
- expect(shellLsSpy).toHaveBeenCalled();
+ expect(existsSyncSpy).toHaveBeenCalled();
expect(expected).toEqual(actual);
});
@@ -1653,7 +1628,7 @@ describe('Testing prepare.js:', () => {
expected[sourcePath] = targetPath;
const actual = mapResources(cordovaProject.root, sourcePath, targetPath);
- expect(shellLsSpy).toHaveBeenCalled();
+ expect(existsSyncSpy).toHaveBeenCalled();
expect(expected).toEqual(actual);
});
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org