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
18 changes: 17 additions & 1 deletion .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,20 @@ jobs:
- run: npm install
- run: npm run build
- run: npm test

min-node-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js 26.x
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 26.x
cache: 'npm'
- run: npm install
- run: npm run build
- name: Use Node.js 16.x
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 16.x
cache: 'npm'
- run: npm run test:no-build
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_modules/
index.js
index.d.ts
commonjs/index.js
index.d.ts
4 changes: 1 addition & 3 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@ test/
.git*
*.ts
!*.d.ts
tsconfig.json
tsconfig.base.json
tsconfig.commonjs.json
tsconfig.json
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,17 @@
- Fixes [#23](https://github.com/mccormicka/string-argv/issues/23) (unquoted tail after a quoted section was split into a separate argument)
- Known differences from bash, unchanged by this release: backslash escapes are not processed, `$variables`/globs are left literal, and an unclosed quote consumes the rest of the input instead of raising an error
- Security dependency bumps: minimatch 3.1.5 via [#25](https://github.com/mccormicka/string-argv/pull/25), brace-expansion 1.1.16 via [#27](https://github.com/mccormicka/string-argv/pull/27)
**Build / Breaking Changes**
- Update TypeScript to 7.0.2 (requires Node.js >=16.20)
- Drop CommonJS support: the package is now ESM-only (`import` only). The `commonjs/` build, the `require` export condition, and the `module`/`main` CJS entry points have been removed — `main` and `exports` now point to the single ESM build (`./index.js`)
- Consolidate to a single build: removed `tsconfig.base.json` and `tsconfig.commonjs.json`; `tsconfig.json` is now self-contained (`target` ES2022, `module` ESNext, `strict`, `declaration`) and `npm run build` runs a single `tsc -p .`. Note: TypeScript 7 no longer accepts the old `target` ES3 (hence the ES2022 baseline)
- Minimum Node.js version is now `>=16.20.0` (`engines` updated accordingly)
- Tests: removed the CJS `require()` spec (`test/Index.spec.cjs`); `test/config.json` now runs `*[sS]pec.js` only

## v0.3.2 (2023-05-01)
- Update TypeScript to 5.0.4 [b1015b8](https://github.com/mccormicka/string-argv/commit/b1015b8911b1505ed2ccd546fa0c35dc1dfcda07)
- CI workflow (`node.js.yml`) added via [#22](https://github.com/mccormicka/string-argv/pull/22)
- Retroactive note: this release (via the dual ESM/CommonJS layout from v0.3.1 combined with the TypeScript 5.0.4 toolchain) requires Node.js `>=12.20.0`. The ESM build (`index.js`) uses `export` syntax with `"type": "module"` and conditional `exports` (`import`/`require`), which need unflagged ESM support (Node.js 12.17+), and TypeScript 5.0 itself requires Node.js >=12.20 — so support for older Node versions (previously advertised as `>=0.6.19`) was effectively dropped here. Sorry we didn't call this out as a breaking change at the time — the `engines` field has now been corrected to `>=12.20.0`.

## v0.3.1 (2022-09-16)
- Now provides both esm and cjs builds
Expand Down
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,19 @@ This is useful when testing Command Line Utilities that you want to pass argumen
npm install string-argv --save
```

# Requirements

Requires Node.js `>=16.20.0`.

This package is ESM-only (`"type": "module"`). Use `import`, not `require()`:

```js
import stringArgv from 'string-argv';
```

TypeScript 7 requires Node.js >=16.20, and the single ESM build targets
ES2022, so 16.20.0 is the minimum supported version.

# Usage

```ts
Expand All @@ -25,8 +38,8 @@ console.log(args);
```

```js
// Javascript
var { parseArgsStringToArgv } = require('string-argv');
// Javascript (ESM)
import { parseArgsStringToArgv } from 'string-argv';

var args = parseArgsStringToArgv(
'-testing test -valid=true --quotes "test quotes" "nested \'quotes\'" --key="some value" --title="Peter\'s Friends"',
Expand Down
3 changes: 0 additions & 3 deletions commonjs/package.json

This file was deleted.

Loading
Loading