diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index d1f6636..04d47b8 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -16,7 +16,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
- node-version: 12
+ node-version: 12.20
registry-url: https://npm.pkg.github.com/
scope: '@atao60'
- run: npm ci
diff --git a/.vscode/settings.json b/.vscode/settings.json
index e6c0660..5fe0628 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -30,9 +30,12 @@
"typescript.tsdk": "node_modules/typescript/lib",
"cSpell.ignoreWords": [
"anyfileext",
+ "apigithub",
+ "apigithuburl",
"browserslistrc",
"commitlint",
"currentinputs",
+ "def",
"dirpath",
"florian",
"fullcheck",
@@ -40,9 +43,12 @@
"fulltest",
"fulltext",
"gerth",
+ "gitquery",
"globaltest",
"hassy",
"ignorecase",
+ "job",
+ "js",
"khaled",
"kreuzer",
"logerror",
@@ -61,6 +67,7 @@
"preinstall",
"readdirp",
"refname",
+ "repos",
"rootpath",
"shortpath",
"startingat",
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index d38075d..8fef18a 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -107,10 +107,11 @@ At the moment there is no CI/Build configuration on [Github](https://github.com)
## Prerequisites
* [Git](https://git-scm.com/)
-* [Node.js](https://nodejs.org/)
-* [Npm](https://www.npmjs.com/) - comes with Node.js
-* [Npx](https://github.com/npm/npx#readme) - comes with Node.js
+* [Node.js](https://nodejs.org/) - *at least version 12.20*
+* [Npm](https://www.npmjs.com/) - *comes with Node.js*
+* [Npx](https://github.com/npm/npx#readme) - *comes with Node.js*
* [Docker](https://www.docker.com/)
+* [nvm](https://github.com/nvm-sh/nvm) - *optional*
and possibly:
* a [GitHub account](https://github.com/)
@@ -126,6 +127,8 @@ git --version
docker --version # check if BuildKit can be used, i.e. with Docker 18.09 or higher
+nvm --version # required only if you need to install Node with at least version 12.20 or higher
+
npm list -g --depth 0 2>&1 | grep fse-cli # (°°)
```
@@ -138,6 +141,8 @@ npm list -g --depth 0 2>&1 | grep fse-cli # (°°)
### Fork
```bash
+node --version ### check Node.js is installed with at least version 12.20
+
sudo npm uninstall -g @atao60/fse-cli ### if needed; required to avoid any issue with `npm link`, see below
git clone https://github.com/atao60/fse-cli.git atao60-fse-cli
@@ -213,17 +218,20 @@ npm start ### will rebuild and test after each code change
```
### Iterate tests over main versions of Node.js
-To ensure this package `@atao60/fse-cli` is compatible with all major versions of [Node.js](https://nodejs.org), a [Docker](https://www.docker.com/) image with the last release of each of them is used to run the tests:
+To ensure this package `@atao60/fse-cli` is compatible with all major versions of [Node.js](https://nodejs.org), a [Docker](https://www.docker.com/)(°) image with the last release of each of them is used to run the tests:
```bash
./make.sh nodecheckall
```
-The checked versions of [Node.js](https://nodejs.org) are from 10 to 16.
+The checked releases of [Node.js](https://nodejs.org) are from 12 to last available one as long as a version compatible with [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) is available(°°).
-> As soon as [Docker](https://www.docker.com/) is installed, some Bourne shell or compatible should be available, allowing running `make.sh`.
+> (°) As soon as [Docker](https://www.docker.com/) is installed, some Bourne shell or compatible one should be available, allowing cross-platform running of `make.sh`.
->[EOL](https://en.wikipedia.org/wiki/End-of-life_product) of `Node.js` 10 was the 30th April 2021, see [Node.js' Releases](https://github.com/nodejs/Release).
-Even if [Docker Official Images for Node.js](https://hub.docker.com/_/node) doesn't support any more versions below 12, older versions are still available.
+> (°°) Already reached [EOL](https://en.wikipedia.org/wiki/End-of-life_product) of [Node.js' Releases](https://github.com/nodejs/Release) are:
+- 10: 30th April 2021,
+- 13: 1st of june 2020,
+- 15: 1st of june 2021.
+As release 15 is compatible with `ESM`, it's not been removed from checking yet.
> Don't forget to regularly check and clean up disk space used by [Docker](https://www.docker.com/): `docker system df` and `docker system prune` are your friends here!
diff --git a/README.md b/README.md
index 86fc729..be0429f 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@ Welcome to @atao/fse-cli
A [CLI](https://en.wikipedia.org/wiki/Command-line_interface) for [fs-extra](https://github.com/jprichardson/node-fs-extra).
-> Releases (0.0.x) will be the last ones to support version 10 of [Node.js](https://nodejs.org).
+> Releases (0.0.x) will be the last ones to support LTS release [10](https://nodejs.org/download/release/v10.24.1/) of [Node.js](https://nodejs.org). Moreover the releases [11](https://nodejs.org/download/release/v11.15.0/) and [13](https://nodejs.org/download/release/v13.14.0/) are also no more supported.
## 💡 Rational
Everyone needs simple file system operations like copy, remove, clean, ... that can be used from the terminal or via scripts.
diff --git a/USAGE b/USAGE
index 35ac325..4f12f02 100644
--- a/USAGE
+++ b/USAGE
@@ -38,7 +38,7 @@ or the environment variable 'FSE_CLI_QUIET=true'.
`fse remove --quiet `
* touch Ensures that the file exists. If the file that is requested to be created is in directories that do not exist,
- these directories are created. If the file already exists, it is NOT MODIFIED."
+ these directories are created. If the file already exists, it is NOT MODIFIED.
Aliases: ***ensureFile***, ***touch***
`fse touch --quiet `
diff --git a/babel.config.cjs b/babel.config.cjs
index 8e98ed2..faea32e 100644
--- a/babel.config.cjs
+++ b/babel.config.cjs
@@ -1,5 +1,5 @@
const targets = {
- node: "10.15.3" // See also engines.node in package.json
+ node: "12.20.0" // See also engines.node in package.json
// With @atao/fse-cli, indeed no '.browserslistrc'
};
@@ -45,7 +45,7 @@ const presets = [
},
// Now Babel defaults 'modules' to 'auto', not any more to 'commonjs' (which won’t tree-shake.)
// So no more need to setup 'modules' to 'false':
- // modules: false,
+ modules: false,
targets
}
]
diff --git a/bin/fse.js b/bin/fse.js
index edda235..0277db3 100755
--- a/bin/fse.js
+++ b/bin/fse.js
@@ -1,3 +1,3 @@
#!/usr/bin/env node
-require('../dist/index.js');
+import '../dist/index.js';
diff --git a/make.sh b/make.sh
index 0c12308..a1e7363 100755
--- a/make.sh
+++ b/make.sh
@@ -5,7 +5,7 @@ MAKE=$0
OWNER=atao60
NAME=fse-cli
VERSION=${2:-10.15.3}
-ALL_MAIN_VERSIONS="10 11 12 13 14 15 16"
+ALL_MAIN_VERSIONS="12 14 15 16"
TEST_IMAGE_NAME=$OWNER/$NAME-test
diff --git a/package-lock.json b/package-lock.json
index f1c078f..87c3901 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -7636,6 +7636,15 @@
"integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==",
"dev": true
},
+ "supports-color": {
+ "version": "8.1.1",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
+ "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
"to-regex-range": {
"version": "5.0.1",
"resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz",
@@ -9294,12 +9303,20 @@
"dev": true
},
"supports-color": {
- "version": "8.1.1",
- "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz",
- "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==",
+ "version": "9.0.1",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-9.0.1.tgz",
+ "integrity": "sha512-e8HnXOAd61fVNyYRcKoqGNpnpceN/+IbDlWCBVjeqfASq/kbH4JwNj1Y4TFrve+w838Ff4eupPKXtY03zhCBKQ==",
"dev": true,
"requires": {
- "has-flag": "^4.0.0"
+ "has-flag": "^5.0.0"
+ },
+ "dependencies": {
+ "has-flag": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-5.0.0.tgz",
+ "integrity": "sha512-dmhh9fPE7WRat4yiFvyhXh7LytudXDcE89VEdR3sxfWQKtFPr7jpXip5H402aeFfA36ucqSKecGEapc7N44k+g==",
+ "dev": true
+ }
}
},
"supports-hyperlinks": {
@@ -9362,12 +9379,27 @@
"dev": true
},
"terminal-link": {
- "version": "2.1.1",
- "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-2.1.1.tgz",
- "integrity": "sha512-un0FmiRUQNr5PJqy9kP7c40F5BOfpGlYTrxonDChEZB7pzZxRNp/bt+ymiy9/npwXya9KH99nJ/GXFIiUkYGFQ==",
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/terminal-link/-/terminal-link-3.0.0.tgz",
+ "integrity": "sha512-flFL3m4wuixmf6IfhFJd1YPiLiMuxEc8uHRM1buzIeZPm22Au2pDqBJQgdo7n1WfPU1ONFGv7YDwpFBmHGF6lg==",
"requires": {
- "ansi-escapes": "^4.2.1",
- "supports-hyperlinks": "^2.0.0"
+ "ansi-escapes": "^5.0.0",
+ "supports-hyperlinks": "^2.2.0"
+ },
+ "dependencies": {
+ "ansi-escapes": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-5.0.0.tgz",
+ "integrity": "sha512-5GFMVX8HqE/TB+FuBJGuO5XG0WrsA6ptUqoODaT/n9mmUaZFkqnBueB4leqGBCmrUHnCnC4PCZTCd0E7QQ83bA==",
+ "requires": {
+ "type-fest": "^1.0.2"
+ }
+ },
+ "type-fest": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-1.2.1.tgz",
+ "integrity": "sha512-SbmIRuXhJs8KTneu77Ecylt9zuqL683tuiLYpTRil4H++eIhqCmx6ko6KAFem9dty8sOdnEiX7j4K1nRE628fQ=="
+ }
}
},
"text-extensions": {
diff --git a/package.json b/package.json
index 2465ba6..9d2ceae 100644
--- a/package.json
+++ b/package.json
@@ -2,8 +2,9 @@
"name": "@atao60/fse-cli",
"version": "0.0.63",
"description": "A cli for fs-extra",
- "main": "./dist/index.js",
+ "exports": "./dist/index.js",
"types": "./dist/index-types.d.ts",
+ "type": "module",
"bin": {
"fse": "./bin/fse.js",
"fse-cli": "./bin/fse.js",
@@ -126,8 +127,8 @@
"author": "Pierre Raoul ",
"license": "MIT",
"engines": {
- "node": ">=10.15.3",
- "npm": ">=6.4.1"
+ "node": "^12.20.0 || ^14.13.1 || >=16.0.0",
+ "npm": ">=6.14.11"
},
"dependencies": {
"@babel/runtime": "^7.13.10",
@@ -139,7 +140,7 @@
"inquirer": "^8.0.0",
"regenerator-runtime": "^0.13.7",
"source-map-support": "^0.5.19",
- "terminal-link": "^2.1.1",
+ "terminal-link": "^3.0.0",
"tslib": "^2.2.0"
},
"devDependencies": {
@@ -189,7 +190,7 @@
"npm-force-resolutions": "0.0.10",
"readdirp": "^3.6.0",
"standard-version": "^9.2.0",
- "supports-color": "^8.1.1",
+ "supports-color": "^9.0.1",
"ts-node": "^10.0.0",
"typescript": "^4.2"
},
diff --git a/src/config.ts b/src/config.ts
index bc8c9ef..e30e2a2 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -2,11 +2,14 @@ import arg from 'arg';
import chalk from 'chalk';
import inquirer from 'inquirer';
const { prompt } = inquirer;
-import { basename, join } from 'path';
+import { basename, dirname, join } from 'path';
import { exit } from 'process';
+import { fileURLToPath } from 'url';
import { JobDef } from './job-def.js';
+const __dirname = dirname(fileURLToPath(import.meta.url));
+
// !!! ⚠️ Don't forget to update the section 'bin' of package.json for any change of jobLinks ⚠️ !!!
const jobLinks = Object.freeze({
copy: 'copy',
diff --git a/src/tasks/help.ts b/src/tasks/help.ts
index b01b0df..0992f3c 100644
--- a/src/tasks/help.ts
+++ b/src/tasks/help.ts
@@ -1,12 +1,15 @@
+import chalk, { Chalk } from 'chalk';
import fse from 'fs-extra';
const { existsSync, readFileSync } = fse;
-import { join } from 'path';
-import chalk, { Chalk } from 'chalk';
+import { dirname, join } from 'path';
import terminalLink from 'terminal-link';
+import { fileURLToPath } from 'url';
import { job as version } from './version.js';
import { info } from '../logger.js';
+const __dirname = dirname(fileURLToPath(import.meta.url));
+
const versionDef = {
name: 'help',
spec: {},
diff --git a/src/tasks/version.ts b/src/tasks/version.ts
index 623e12a..415c817 100644
--- a/src/tasks/version.ts
+++ b/src/tasks/version.ts
@@ -1,9 +1,12 @@
import fse from 'fs-extra';
const { existsSync, readFileSync } = fse;
-import { join } from 'path';
+import { dirname, join } from 'path';
+import { fileURLToPath } from 'url';
import * as logger from '../logger.js';
+const __dirname = dirname(fileURLToPath(import.meta.url));
+
const versionDef = {
name: 'version',
spec: {},
diff --git a/src/tsconfig.json b/src/tsconfig.json
index 80014c4..168599a 100644
--- a/src/tsconfig.json
+++ b/src/tsconfig.json
@@ -8,11 +8,11 @@
"strict": true,
"outDir": "../dist",
"baseUrl": "",
- "module": "commonjs",
+ "module": "ES2020",
"moduleResolution": "node",
"lib": [
"es2018",
"dom"
]
}
-}
+}
\ No newline at end of file
diff --git a/src/wrapper.ts b/src/wrapper.ts
index 9376494..9e7e613 100644
--- a/src/wrapper.ts
+++ b/src/wrapper.ts
@@ -1,4 +1,7 @@
-import { join } from 'path';
+import { dirname, join } from 'path';
+import { fileURLToPath } from 'url';
+
+const __dirname = dirname(fileURLToPath(import.meta.url));
const tasksSubDir = 'tasks';
diff --git a/test/cli.test.ts b/test/cli.test.ts
index 8998e09..4e7c48a 100644
--- a/test/cli.test.ts
+++ b/test/cli.test.ts
@@ -3,14 +3,17 @@ import gfs from 'graceful-fs';
const { closeSync, existsSync, mkdtempSync, mkdirSync, openSync, readFileSync, rmdirSync, statSync, unlinkSync, writeSync } = gfs;
import mocha from 'mocha';
const { describe, it } = mocha;
-import { join } from 'path';
+import { dirname, join } from 'path';
import { env } from 'process';
-import { format as printf } from 'util';
import sc from 'supports-color';
const { stdout: supportsColorStdout } = sc;
+import { fileURLToPath } from 'url';
+import { format as printf } from 'util';
import { execute as run } from './cmd.js';
+const __dirname = dirname(fileURLToPath(import.meta.url));
+
const LIB_DIR = join(__dirname, env.APP_CODE_PATH || '../../dist');
// os.tmpdir() is not used here, to stay inside project folder
const TMP_DIR = join(__dirname, env.PROJECT_TARGET_PATH || '../.tmp-dir');
diff --git a/test/tsconfig.json b/test/tsconfig.json
index 7d4e5d3..ee71076 100644
--- a/test/tsconfig.json
+++ b/test/tsconfig.json
@@ -7,12 +7,14 @@
"allowSyntheticDefaultImports": true,
"outDir": "../dist",
"baseUrl": "",
- "module": "commonjs",
+ "module": "ES2020",
"moduleResolution": "node",
"lib": [
"es2018",
"dom"
]
},
- "include": ["**/*.test.ts"]
-}
+ "include": [
+ "**/*.test.ts"
+ ]
+}
\ No newline at end of file
diff --git a/tools/package.json b/tools/package.json
new file mode 100644
index 0000000..6a0d2ef
--- /dev/null
+++ b/tools/package.json
@@ -0,0 +1,3 @@
+{
+ "type": "commonjs"
+}
\ No newline at end of file