Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
chore(deps): Update npm deps, add Node 20 to CI
  • Loading branch information
dpogue committed Apr 15, 2024
commit d1c9c4c551b080207c8a33b12da44f16544c4236
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [16.x, 18.x, 20.x]
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

Expand Down
13 changes: 7 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
under the License.
*/

const fs = require('fs-extra');
const path = require('path');
const fs = require('node:fs');
const path = require('node:path');
const tmp = require('tmp');
const npa = require('npm-package-arg');
const globby = require('globby');
Expand Down Expand Up @@ -116,10 +116,10 @@ function cordovaCreate (dest, opts = {}) {
try {
// Copy files from template to project
emit('verbose', 'Copying assets.');
fs.copySync(import_from_path, dir);
fs.cpSync(import_from_path, dir, { recursive: true });
} catch (e) {
if (!dirAlreadyExisted) {
fs.removeSync(dir);
fs.rmSync(dir, { recursive: true, force: true });
}
throw e;
}
Expand All @@ -130,7 +130,7 @@ function cordovaCreate (dest, opts = {}) {
// https://github.com/apache/cordova-discuss/issues/69
globby.sync(['**/gitignore'], { cwd: dir, absolute: true })
.forEach(f =>
fs.moveSync(f, path.join(path.dirname(f), '.gitignore'))
fs.renameSync(f, path.join(path.dirname(f), '.gitignore'))
);

// Write out id, name and version to config.xml
Expand All @@ -154,7 +154,8 @@ function cordovaCreate (dest, opts = {}) {
version: conf.version()
});

fs.writeJsonSync(pkgJsonPath, pkgJson, { spaces: 2 });
const jsonStr = JSON.stringify(pkgJson, null, 2);
fs.writeFileSync(pkgJsonPath, `${jsonStr}\n`, 'utf8');
}
});
}
Expand Down
Loading