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-browser.git


The following commit(s) were added to refs/heads/master by this push:
     new 39940f5  feat!: drop shelljs & prefix node modules w/ "node:*" (#151)
39940f5 is described below

commit 39940f5a441173c815888bd16a93e39e9b657cdb
Author: エリス <[email protected]>
AuthorDate: Wed Apr 1 10:49:59 2026 +0900

    feat!: drop shelljs & prefix node modules w/ "node:*" (#151)
    
    * chore!: remove unused bin/template/config.xml
    * feat!: drop shelljs for fs & prefix node modules 'node:*'
---
 bin/lib/create.js                       | 35 ++++++++++++++++++++-------------
 bin/lib/update.js                       | 17 ++--------------
 bin/template/config.xml                 | 22 ---------------------
 bin/template/cordova/Api.js             | 26 ++++++++++++++----------
 bin/template/cordova/browser_handler.js | 17 ++++++++--------
 bin/template/cordova/browser_parser.js  |  7 +++----
 bin/template/cordova/lib/build.js       |  2 +-
 bin/template/cordova/lib/clean.js       |  7 +++----
 bin/template/cordova/lib/run.js         |  6 +++---
 package-lock.json                       | 30 ++++++++++++++--------------
 package.json                            |  3 +--
 spec/browser_handler.spec.js            | 35 ++++++++++++++++++++-------------
 spec/projectApi.spec.js                 |  4 ++--
 13 files changed, 96 insertions(+), 115 deletions(-)

diff --git a/bin/lib/create.js b/bin/lib/create.js
index 5afb976..6042248 100644
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -19,9 +19,8 @@
     under the License.
 */
 
-const fs = require('fs');
-const shell = require('shelljs');
-const path = require('path');
+const fs = require('node:fs');
+const path = require('node:path');
 const ROOT = path.join(__dirname, '..', '..');
 const events = require('cordova-common').events;
 const check_reqs = require('./check_reqs');
@@ -53,29 +52,37 @@ module.exports.createProject = function (project_path, 
package_name, project_nam
         events.emit('error', 'Please make sure you meet the software 
requirements in order to build a browser cordova project');
     }
 
-    // copy template/cordova directory ( recursive )
-    shell.cp('-r', path.join(ROOT, 'bin/template/cordova'), project_path);
-
-    // copy template/www directory ( recursive )
-    shell.cp('-r', path.join(ROOT, 'bin/template/www'), project_path);
+    // copy template/* to project_path directory ( recursive )
+    fs.cpSync(path.join(ROOT, 'bin/template'), project_path, { recursive: true 
});
 
+    // TODO: stop copying cordova-browser logic into platforms/browser/
     // recreate our node_modules structure in the new project
     const nodeModulesDir = path.join(ROOT, 'node_modules');
-    if (fs.existsSync(nodeModulesDir)) shell.cp('-r', nodeModulesDir, 
path.join(project_path, 'cordova'));
+    if (fs.existsSync(nodeModulesDir)) {
+        fs.cpSync(nodeModulesDir, path.join(project_path, 
'cordova/node_modules'), { recursive: true });
+    }
 
     // copy check_reqs file
-    shell.cp(path.join(ROOT, 'bin/lib/check_reqs.js'),
-        path.join(project_path, 'cordova/lib'));
+    fs.cpSync(
+        path.join(ROOT, 'bin/lib/check_reqs.js'),
+        path.join(project_path, 'cordova/lib/check_reqs.js')
+    );
 
     // create platform_www dir if it does not exist yet
     const platform_www = path.join(project_path, 'platform_www');
-    shell.mkdir('-p', platform_www);
+    fs.mkdirSync(platform_www, { recursive: true });
 
     // copy cordova js file to platform_www
-    shell.cp(path.join(ROOT, 'bin/template/www/cordova.js'), platform_www);
+    fs.cpSync(
+        path.join(ROOT, 'bin/template/www/cordova.js'),
+        path.join(platform_www, 'cordova.js')
+    );
 
     // copy favicon file to platform_www
-    shell.cp(path.join(ROOT, 'bin/template/www/favicon.ico'), platform_www);
+    fs.cpSync(
+        path.join(ROOT, 'bin/template/www/favicon.ico'),
+        path.join(platform_www, 'favicon.ico')
+    );
 
     // load manifest to write name/shortname
     const manifest = require(path.join(ROOT, 'bin/template/www', 
'manifest.json'));
diff --git a/bin/lib/update.js b/bin/lib/update.js
index d453080..db712bf 100644
--- a/bin/lib/update.js
+++ b/bin/lib/update.js
@@ -18,8 +18,7 @@
 */
 
 const create = require('./create');
-const fs = require('fs');
-const shell = require('shelljs');
+const fs = require('node:fs');
 const { CordovaError } = require('cordova-common');
 
 module.exports.help = function () {
@@ -39,20 +38,8 @@ module.exports.run = function (argv) {
     }
 
     console.log('Removing existing browser platform.');
-    shellfatal(shell.rm, '-rf', projectPath);
+    fs.rmSync(projectPath, { recursive: true, force: true });
 
     // Create Project returns a resolved promise.
     return create.createProject(projectPath);
 };
-
-function shellfatal (shellFunc) {
-    const slicedArgs = Array.prototype.slice.call(arguments, 1);
-    let returnVal = null;
-    try {
-        shell.config.fatal = true;
-        returnVal = shellFunc.apply(shell, slicedArgs);
-    } finally {
-        shell.config.fatal = false;
-    }
-    return returnVal;
-}
diff --git a/bin/template/config.xml b/bin/template/config.xml
deleted file mode 100644
index f0563e7..0000000
--- a/bin/template/config.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-        http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
--->
-<widget xmlns="http://www.w3.org/ns/widgets";>
-
-</widget>
diff --git a/bin/template/cordova/Api.js b/bin/template/cordova/Api.js
index ff31b67..ffa9a8f 100644
--- a/bin/template/cordova/Api.js
+++ b/bin/template/cordova/Api.js
@@ -22,9 +22,8 @@
     'cordova platform add PATH' where path is this repo.
 */
 
-const shell = require('shelljs');
-const path = require('path');
-const fs = require('fs');
+const path = require('node:path');
+const fs = require('node:fs');
 
 const cdvcmn = require('cordova-common');
 const CordovaLogger = cdvcmn.CordovaLogger;
@@ -153,13 +152,13 @@ Api.prototype.prepare = async function (cordovaProject, 
options) {
     // restored or copy project config into platform if none exists.
     if (fs.existsSync(defaultConfigPath)) {
         this.events.emit('verbose', 'Generating config.xml from defaults for 
platform "' + this.platform + '"');
-        shell.cp('-f', defaultConfigPath, ownConfigPath);
+        fs.cpSync(defaultConfigPath, ownConfigPath, { force: true });
     } else if (fs.existsSync(ownConfigPath)) {
         this.events.emit('verbose', 'Generating defaults.xml from own 
config.xml for platform "' + this.platform + '"');
-        shell.cp('-f', ownConfigPath, defaultConfigPath);
+        fs.cpSync(ownConfigPath, defaultConfigPath, { force: true });
     } else {
         this.events.emit('verbose', 'case 3"' + this.platform + '"');
-        shell.cp('-f', sourceCfg.path, ownConfigPath);
+        fs.cpSync(sourceCfg.path, ownConfigPath, { force: true });
     }
 
     // merge our configs
@@ -181,7 +180,7 @@ Api.prototype.prepare = async function (cordovaProject, 
options) {
         // just blindly copy it to our output/www
         // todo: validate it? ensure all properties we expect exist?
         this.events.emit('verbose', 'copying ' + srcManifestPath + ' => ' + 
manifestPath);
-        shell.cp('-f', srcManifestPath, manifestPath);
+        fs.cpSync(srcManifestPath, manifestPath, { force: true });
     } else {
         const manifestJson = {
             background_color: '#FFF',
@@ -269,7 +268,11 @@ Api.prototype.prepare = async function (cordovaProject, 
options) {
     }
 
     // Copy munged config.xml to platform www dir
-    shell.cp('-rf', this.locations.configXml, this.locations.www);
+    fs.cpSync(
+        this.locations.configXml,
+        path.join(this.locations.www, 'config.xml'),
+        { force: true, recursive: true }
+    );
 };
 
 // Replace the www dir with contents of platform_www and app www.
@@ -391,7 +394,10 @@ Api.prototype.removePlugin = function (plugin, 
uninstallOptions) {
             self._removeModulesInfo(plugin, targetDir);
             // Remove stale plugin directory
             // TODO: this should be done by plugin files uninstaller
-            shell.rm('-rf', path.resolve(self.root, 'Plugins', plugin.id));
+            fs.rmSync(
+                path.resolve(self.root, 'Plugins', plugin.id),
+                { force: true, recursive: true }
+            );
         });
 };
 
@@ -505,7 +511,7 @@ Api.prototype._writePluginModules = function (targetDir) {
     final_contents += '// BOTTOM OF METADATA\n';
     final_contents += '});'; // Close cordova.define.
 
-    shell.mkdir('-p', targetDir);
+    fs.mkdirSync(targetDir, { recursive: true });
     fs.writeFileSync(path.join(targetDir, 'cordova_plugins.js'), 
final_contents, 'utf-8');
 };
 
diff --git a/bin/template/cordova/browser_handler.js 
b/bin/template/cordova/browser_handler.js
index b89596f..94da890 100644
--- a/bin/template/cordova/browser_handler.js
+++ b/bin/template/cordova/browser_handler.js
@@ -17,9 +17,8 @@
     under the License.
 */
 
-const path = require('path');
-const fs = require('fs');
-const shell = require('shelljs');
+const path = require('node:path');
+const fs = require('node:fs');
 const events = require('cordova-common').events;
 
 module.exports = {
@@ -59,7 +58,7 @@ module.exports = {
             scriptContent = 'cordova.define("' + moduleName + '", 
function(require, exports, module) { ' + scriptContent + '\n});\n';
 
             const moduleDestination = path.resolve(www_dir, 'plugins', 
plugin_id, jsModule.src);
-            shell.mkdir('-p', path.dirname(moduleDestination));
+            fs.mkdirSync(path.dirname(moduleDestination), { recursive: true });
             fs.writeFileSync(moduleDestination, scriptContent, 'utf-8');
         },
         uninstall: function (jsModule, www_dir, plugin_id) {
@@ -118,18 +117,18 @@ module.exports = {
             const dest = path.join(wwwDest, asset.target);
             const destDir = path.parse(dest).dir;
             if (destDir !== '' && !fs.existsSync(destDir)) {
-                shell.mkdir('-p', destDir);
+                fs.mkdirSync(destDir, { recursive: true });
             }
 
             if (fs.statSync(src).isDirectory()) {
-                shell.cp('-Rf', src + '/*', dest);
+                fs.cpSync(src, dest, { recursive: true, force: true });
             } else {
-                shell.cp('-f', src, dest);
+                fs.cpSync(src, dest, { force: true });
             }
         },
         uninstall: function (asset, wwwDest, plugin_id) {
-            shell.rm('-rf', path.join(wwwDest, asset.target));
-            shell.rm('-rf', path.join(wwwDest, 'plugins', plugin_id));
+            fs.rmSync(path.join(wwwDest, asset.target), { recursive: true, 
force: true });
+            fs.rmSync(path.join(wwwDest, 'plugins', plugin_id), { recursive: 
true, force: true });
         }
     }
 };
diff --git a/bin/template/cordova/browser_parser.js 
b/bin/template/cordova/browser_parser.js
index 79b7d23..50a1822 100644
--- a/bin/template/cordova/browser_parser.js
+++ b/bin/template/cordova/browser_parser.js
@@ -17,9 +17,8 @@
     under the License.
 */
 
-const fs = require('fs');
-const path = require('path');
-const shell = require('shelljs');
+const fs = require('node:fs');
+const path = require('node:path');
 const CordovaError = require('cordova-common').CordovaError;
 const events = require('cordova-common').events;
 const FileUpdater = require('cordova-common').FileUpdater;
@@ -78,5 +77,5 @@ browser_parser.prototype.config_xml = function () {
 
 browser_parser.prototype.update_project = async function (cfg) {
     // Copy munged config.xml to platform www dir
-    shell.cp('-rf', this.config_xml(), this.www_dir());
+    fs.cpSync(this.config_xml(), this.www_dir(), { recursive: true, force: 
true });
 };
diff --git a/bin/template/cordova/lib/build.js 
b/bin/template/cordova/lib/build.js
index 1901221..b3ce5e1 100644
--- a/bin/template/cordova/lib/build.js
+++ b/bin/template/cordova/lib/build.js
@@ -19,7 +19,7 @@
     under the License.
 */
 
-const path = require('path');
+const path = require('node:path');
 const check_reqs = require('./check_reqs');
 
 /**
diff --git a/bin/template/cordova/lib/clean.js 
b/bin/template/cordova/lib/clean.js
index 83f9f56..c8f18ac 100644
--- a/bin/template/cordova/lib/clean.js
+++ b/bin/template/cordova/lib/clean.js
@@ -19,9 +19,8 @@
     under the License.
 */
 
-const fs = require('fs');
-const shell = require('shelljs');
-const path = require('path');
+const fs = require('node:fs');
+const path = require('node:path');
 const check_reqs = require('./check_reqs');
 const platformBuildDir = path.join('platforms', 'browser', 'www');
 
@@ -35,7 +34,7 @@ const run = function () {
 
     try {
         if (fs.existsSync(platformBuildDir)) {
-            shell.rm('-r', platformBuildDir);
+            fs.rmSync(platformBuildDir, { recursive: true });
         }
     } catch (err) {
         console.log('could not remove ' + platformBuildDir + ' : ' + 
err.message);
diff --git a/bin/template/cordova/lib/run.js b/bin/template/cordova/lib/run.js
index e806de0..748523d 100644
--- a/bin/template/cordova/lib/run.js
+++ b/bin/template/cordova/lib/run.js
@@ -19,9 +19,9 @@
     under the License.
 */
 
-const fs = require('fs');
-const path = require('path');
-const url = require('url');
+const fs = require('node:fs');
+const path = require('node:path');
+const url = require('node:url');
 const cordovaServe = require('cordova-serve');
 
 module.exports.run = function (args) {
diff --git a/package-lock.json b/package-lock.json
index a350e9e..f09de3d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -10,8 +10,7 @@
       "license": "Apache-2.0",
       "dependencies": {
         "cordova-common": "^6.0.0",
-        "cordova-serve": "^4.0.1",
-        "shelljs": "^0.10.0"
+        "cordova-serve": "^4.0.1"
       },
       "devDependencies": {
         "@cordova/eslint-config": "^6.0.1",
@@ -1107,6 +1106,7 @@
       "version": "7.0.6",
       "resolved": 
"https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz";,
       "integrity": 
"sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "path-key": "^3.1.0",
@@ -1969,6 +1969,7 @@
       "version": "5.1.1",
       "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz";,
       "integrity": 
"sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "cross-spawn": "^7.0.3",
@@ -1992,6 +1993,7 @@
       "version": "3.0.7",
       "resolved": 
"https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz";,
       "integrity": 
"sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==",
+      "dev": true,
       "license": "ISC"
     },
     "node_modules/express": {
@@ -2362,6 +2364,7 @@
       "version": "6.0.1",
       "resolved": 
"https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz";,
       "integrity": 
"sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">=10"
@@ -2670,6 +2673,7 @@
       "version": "2.1.0",
       "resolved": 
"https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz";,
       "integrity": 
"sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==",
+      "dev": true,
       "license": "Apache-2.0",
       "engines": {
         "node": ">=10.17.0"
@@ -3075,6 +3079,7 @@
       "version": "2.0.1",
       "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz";,
       "integrity": 
"sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">=8"
@@ -3449,6 +3454,7 @@
       "version": "2.0.0",
       "resolved": 
"https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz";,
       "integrity": 
"sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==",
+      "dev": true,
       "license": "MIT"
     },
     "node_modules/merge2": {
@@ -3528,6 +3534,7 @@
       "version": "2.1.0",
       "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz";,
       "integrity": 
"sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">=6"
@@ -3592,6 +3599,7 @@
       "version": "4.0.1",
       "resolved": 
"https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz";,
       "integrity": 
"sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "path-key": "^3.0.0"
@@ -3727,6 +3735,7 @@
       "version": "5.1.2",
       "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz";,
       "integrity": 
"sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "mimic-fn": "^2.1.0"
@@ -3858,6 +3867,7 @@
       "version": "3.1.1",
       "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz";,
       "integrity": 
"sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">=8"
@@ -4360,6 +4370,7 @@
       "version": "2.0.0",
       "resolved": 
"https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz";,
       "integrity": 
"sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==",
+      "dev": true,
       "license": "MIT",
       "dependencies": {
         "shebang-regex": "^3.0.0"
@@ -4372,24 +4383,12 @@
       "version": "3.0.0",
       "resolved": 
"https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz";,
       "integrity": 
"sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">=8"
       }
     },
-    "node_modules/shelljs": {
-      "version": "0.10.0",
-      "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.10.0.tgz";,
-      "integrity": 
"sha512-Jex+xw5Mg2qMZL3qnzXIfaxEtBaC4n7xifqaqtrZDdlheR70OGkydrPJWT0V1cA1k3nanC86x9FwAmQl6w3Klw==",
-      "license": "BSD-3-Clause",
-      "dependencies": {
-        "execa": "^5.1.1",
-        "fast-glob": "^3.3.2"
-      },
-      "engines": {
-        "node": ">=18"
-      }
-    },
     "node_modules/side-channel": {
       "version": "1.1.0",
       "resolved": 
"https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz";,
@@ -4609,6 +4608,7 @@
       "version": "2.0.0",
       "resolved": 
"https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz";,
       "integrity": 
"sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==",
+      "dev": true,
       "license": "MIT",
       "engines": {
         "node": ">=6"
diff --git a/package.json b/package.json
index 16a8ec9..0f5ddac 100644
--- a/package.json
+++ b/package.json
@@ -20,8 +20,7 @@
   },
   "dependencies": {
     "cordova-common": "^6.0.0",
-    "cordova-serve": "^4.0.1",
-    "shelljs": "^0.10.0"
+    "cordova-serve": "^4.0.1"
   },
   "devDependencies": {
     "@cordova/eslint-config": "^6.0.1",
diff --git a/spec/browser_handler.spec.js b/spec/browser_handler.spec.js
index e4e3634..2285fc4 100644
--- a/spec/browser_handler.spec.js
+++ b/spec/browser_handler.spec.js
@@ -18,9 +18,8 @@
 */
 
 const browser_handler = require('../bin/template/cordova/browser_handler');
-const shell = require('shelljs');
-const fs = require('fs');
-const path = require('path');
+const fs = require('node:fs');
+const path = require('node:path');
 
 describe('Asset install tests', function () {
     let fsstatMock;
@@ -43,8 +42,8 @@ describe('Asset install tests', function () {
     const plugin_dir = 'pluginDir';
     const wwwDest = 'dest';
 
-    it('if src is a directory, should be called with cp, -Rf', function () {
-        const cp = spyOn(shell, 'cp').and.returnValue('-Rf');
+    it('if src is a directory, should be called with cpSync recursive force', 
function () {
+        const cp = spyOn(fs, 'cpSync').and.callFake(() => {});
         fsstatMock = {
             isDirectory: function () {
                 return true;
@@ -52,11 +51,14 @@ describe('Asset install tests', function () {
         };
         spyOn(fs, 'statSync').and.returnValue(fsstatMock);
         browser_handler.asset.install(asset, plugin_dir, wwwDest);
-        expect(cp).toHaveBeenCalledWith('-Rf', jasmine.any(String), 
path.join('dest', asset.target));
+        expect(cp).toHaveBeenCalledWith(jasmine.any(String), path.join('dest', 
asset.target), {
+            recursive: true,
+            force: true
+        });
     });
     it('if src is not a directory and asset has no path, should be called with 
cp, -f', function () {
-        const cp = spyOn(shell, 'cp').and.returnValue('-f');
-        const mkdir = spyOn(shell, 'mkdir');
+        const cp = spyOn(fs, 'cpSync').and.callFake(() => {});
+        const mkdir = spyOn(fs, 'mkdirSync');
         spyOn(fs, 'existsSync').and.returnValue(true);
         fsstatMock = {
             isDirectory: function () {
@@ -66,14 +68,16 @@ describe('Asset install tests', function () {
         spyOn(fs, 'statSync').and.returnValue(fsstatMock);
         browser_handler.asset.install(asset, plugin_dir, wwwDest);
         expect(mkdir).not.toHaveBeenCalled();
-        expect(cp).toHaveBeenCalledWith('-f', path.join('pluginDir', 
asset.src), path.join('dest', asset.target));
+        expect(cp).toHaveBeenCalledWith(path.join('pluginDir', asset.src), 
path.join('dest', asset.target), {
+            force: true
+        });
     });
     it('if src is not a directory and asset has a path, should be called with 
cp, -f', function () {
         /*
             Test that a dest directory gets created if it does not exist
         */
-        const cp = spyOn(shell, 'cp').and.returnValue('-f');
-        const mkdir = spyOn(shell, 'mkdir');
+        const cp = spyOn(fs, 'cpSync').and.callFake(() => {});
+        const mkdir = spyOn(fs, 'mkdirSync');
         fsstatMock = {
             isDirectory: function () {
                 return false;
@@ -82,9 +86,12 @@ describe('Asset install tests', function () {
         spyOn(fs, 'statSync').and.returnValue(fsstatMock);
 
         browser_handler.asset.install(assetWithPath, plugin_dir, wwwDest);
-        expect(mkdir).toHaveBeenCalledWith('-p', path.join('dest', 'js', 
'deepdown'));
-        expect(cp).toHaveBeenCalledWith('-f', path.join('pluginDir', 
assetWithPath.src),
-            path.join('dest', assetWithPath.target));
+        expect(mkdir).toHaveBeenCalledWith(path.join('dest', 'js', 
'deepdown'), {
+            recursive: true
+        });
+        expect(cp).toHaveBeenCalledWith(path.join('pluginDir', 
assetWithPath.src), path.join('dest', assetWithPath.target), {
+            force: true
+        });
         /*
             Now test that a second call to the same dest folder skips mkdir 
because the first asset call should have created it.
         */
diff --git a/spec/projectApi.spec.js b/spec/projectApi.spec.js
index ddd13c7..d5b68e0 100644
--- a/spec/projectApi.spec.js
+++ b/spec/projectApi.spec.js
@@ -17,8 +17,8 @@
     under the License.
 */
 
-const path = require('path');
-const EventEmitter = require('events');
+const path = require('node:path');
+const EventEmitter = require('node:events');
 
 const Api = require('../bin/template/cordova/Api');
 const create = require('../bin/lib/create');


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to