@hugojosefson/cli 0.11.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/esm/deno.js +16 -8
- package/esm/node_modules/@conventional-changelog/template/LICENSE.md +21 -0
- package/esm/node_modules/@conventional-changelog/template/README.md +66 -0
- package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts +78 -0
- package/esm/node_modules/@conventional-changelog/template/dist/elements.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/elements.js +132 -0
- package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts +6 -0
- package/esm/node_modules/@conventional-changelog/template/dist/index.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/index.js +5 -0
- package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts +20 -0
- package/esm/node_modules/@conventional-changelog/template/dist/legacy.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/legacy.js +22 -0
- package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts +43 -0
- package/esm/node_modules/@conventional-changelog/template/dist/references.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/references.js +82 -0
- package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts +74 -0
- package/esm/node_modules/@conventional-changelog/template/dist/templates.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/templates.js +125 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts +37 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/commit.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/commit.js +2 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts +113 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/context.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/context.js +2 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts +4 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/index.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/index.js +2 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts +2 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/utils.d.ts.map +1 -0
- package/esm/node_modules/@conventional-changelog/template/dist/types/utils.js +2 -0
- package/esm/node_modules/@conventional-changelog/template/package.json +38 -0
- package/esm/node_modules/@simple-libs/stream-utils/LICENSE +21 -0
- package/esm/node_modules/@simple-libs/stream-utils/README.md +79 -0
- package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts +51 -0
- package/esm/node_modules/@simple-libs/stream-utils/dist/index.d.ts.map +1 -0
- package/esm/node_modules/@simple-libs/stream-utils/dist/index.js +116 -0
- package/esm/node_modules/@simple-libs/stream-utils/package.json +38 -0
- package/esm/node_modules/argue-cli/LICENSE +21 -0
- package/esm/node_modules/argue-cli/README.md +239 -0
- package/esm/node_modules/argue-cli/dist/args.d.ts +30 -0
- package/esm/node_modules/argue-cli/dist/args.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/argv.d.ts +14 -0
- package/esm/node_modules/argue-cli/dist/argv.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/core.d.ts +24 -0
- package/esm/node_modules/argue-cli/dist/core.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/index.d.ts +6 -0
- package/esm/node_modules/argue-cli/dist/index.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/index.js +254 -0
- package/esm/node_modules/argue-cli/dist/index.js.map +1 -0
- package/esm/node_modules/argue-cli/dist/options.d.ts +9 -0
- package/esm/node_modules/argue-cli/dist/options.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/types.d.ts +16 -0
- package/esm/node_modules/argue-cli/dist/types.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/dist/utils.d.ts +24 -0
- package/esm/node_modules/argue-cli/dist/utils.d.ts.map +1 -0
- package/esm/node_modules/argue-cli/package.json +34 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/LICENSE.md +21 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/README.md +369 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-changelog-writer/package.json +53 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/LICENSE +21 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/README.md +184 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-filter/package.json +31 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/LICENSE.md +21 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/README.md +383 -0
- package/esm/node_modules/conventional-changelog-core/node_modules/conventional-commits-parser/package.json +47 -0
- package/esm/node_modules/conventional-changelog-writer/README.md +49 -342
- package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts +3 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/index.js +68 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts +4 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/cli/utils.js +39 -0
- package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts +10 -0
- package/esm/node_modules/conventional-changelog-writer/dist/commit.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/commit.js +43 -0
- package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts +27 -0
- package/esm/node_modules/conventional-changelog-writer/dist/context.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/context.js +134 -0
- package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts +7 -0
- package/esm/node_modules/conventional-changelog-writer/dist/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/index.js +6 -0
- package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts +25 -0
- package/esm/node_modules/conventional-changelog-writer/dist/options.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/options.js +79 -0
- package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts +10 -0
- package/esm/node_modules/conventional-changelog-writer/dist/template.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/template.js +18 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts +8 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/index.js +2 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts +122 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/options.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/options.js +2 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts +9 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/types/utils.js +2 -0
- package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts +20 -0
- package/esm/node_modules/conventional-changelog-writer/dist/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/utils.js +70 -0
- package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts +29 -0
- package/esm/node_modules/conventional-changelog-writer/dist/writers.d.ts.map +1 -0
- package/esm/node_modules/conventional-changelog-writer/dist/writers.js +94 -0
- package/esm/node_modules/conventional-changelog-writer/package.json +24 -26
- package/esm/node_modules/conventional-commits-filter/README.md +51 -170
- package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts +17 -0
- package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/RevertedCommitsFilter.js +46 -0
- package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts +19 -0
- package/esm/node_modules/conventional-commits-filter/dist/filters.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/filters.js +34 -0
- package/esm/node_modules/conventional-commits-filter/dist/index.d.ts +4 -0
- package/esm/node_modules/conventional-commits-filter/dist/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/index.js +3 -0
- package/esm/node_modules/conventional-commits-filter/dist/types.d.ts +6 -0
- package/esm/node_modules/conventional-commits-filter/dist/types.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/types.js +2 -0
- package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts +16 -0
- package/esm/node_modules/conventional-commits-filter/dist/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-filter/dist/utils.js +43 -0
- package/esm/node_modules/conventional-commits-filter/package.json +22 -16
- package/esm/node_modules/conventional-commits-parser/README.md +49 -353
- package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts +40 -0
- package/esm/node_modules/conventional-commits-parser/dist/CommitParser.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/CommitParser.js +319 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts +3 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/index.js +67 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts +3 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/options.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/options.js +40 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts +5 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/cli/utils.js +49 -0
- package/esm/node_modules/conventional-commits-parser/dist/index.d.ts +4 -0
- package/esm/node_modules/conventional-commits-parser/dist/index.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/index.js +3 -0
- package/esm/node_modules/conventional-commits-parser/dist/options.d.ts +3 -0
- package/esm/node_modules/conventional-commits-parser/dist/options.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/options.js +27 -0
- package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts +8 -0
- package/esm/node_modules/conventional-commits-parser/dist/regex.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/regex.js +63 -0
- package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts +14 -0
- package/esm/node_modules/conventional-commits-parser/dist/stream.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/stream.js +38 -0
- package/esm/node_modules/conventional-commits-parser/dist/types.d.ts +100 -0
- package/esm/node_modules/conventional-commits-parser/dist/types.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/types.js +2 -0
- package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts +41 -0
- package/esm/node_modules/conventional-commits-parser/dist/utils.d.ts.map +1 -0
- package/esm/node_modules/conventional-commits-parser/dist/utils.js +75 -0
- package/esm/node_modules/conventional-commits-parser/package.json +22 -23
- package/esm/src/cli/command-help.js +15 -0
- package/esm/src/cli/repair-configuration-description.js +98 -0
- package/esm/src/cli/run-changelog.js +51 -0
- package/esm/src/cli/run-cli.js +8 -0
- package/esm/src/features/built-in-feature-registry.js +2 -0
- package/esm/src/features/changelog-feature.js +155 -0
- package/esm/src/features/github-ci-artifacts.js +17 -3
- package/esm/src/features/github-ci-runtime-matrix.js +50 -0
- package/esm/src/features/github-release-publish-artifacts.js +5 -4
- package/esm/src/features/github-release-publish-feature.js +4 -0
- package/esm/src/features/github-workflow-cache.js +18 -0
- package/esm/src/features/workflow-deno.js +1 -1
- package/esm/src/release/changelog-markdown.js +41 -0
- package/esm/src/release/changelog.js +155 -7
- package/esm/src/release/format-changelog.js +15 -0
- package/esm/src/release/migrate-changelog.js +92 -0
- package/esm/src/release/publish-github.js +7 -3
- package/esm/src/release/publish-tag-prepare.js +63 -78
- package/esm/src/release/release-history.js +53 -0
- package/npm-dependencies.lock.json +115 -48
- package/package.json +5 -3
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/dependencies.js +0 -11036
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.d.ts +0 -1416
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/index.js +0 -100
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/licenses.md +0 -1767
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/options.js +0 -92
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/parser.js +0 -84
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/utils.js +0 -7
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/build/validate.js +0 -122
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/license +0 -9
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/package.json +0 -107
- package/esm/node_modules/conventional-commits-parser/node_modules/meow/readme.md +0 -314
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/cli.mjs +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/index.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/lib/util.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/commit.hbs +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/footer.hbs +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/header.hbs +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core/node_modules/conventional-changelog-writer}/templates/template.hbs +0 -0
- /package/esm/node_modules/{conventional-commits-filter → conventional-changelog-core/node_modules/conventional-commits-filter}/index.js +0 -0
- /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/cli.mjs +0 -0
- /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/index.js +0 -0
- /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/lib/parser.js +0 -0
- /package/esm/node_modules/{conventional-commits-parser → conventional-changelog-core/node_modules/conventional-commits-parser}/lib/regex.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/dependencies.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/index.d.ts +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/index.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/licenses.md +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/options.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/parser.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/utils.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/build/validate.js +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/license +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/package.json +0 -0
- /package/esm/node_modules/{conventional-changelog-writer → conventional-changelog-core}/node_modules/meow/readme.md +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@simple-libs/stream-utils",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"version": "2.0.0",
|
|
5
|
+
"description": "A small set of utilities for streams.",
|
|
6
|
+
"author": {
|
|
7
|
+
"name": "Dan Onoshko",
|
|
8
|
+
"email": "danon0404@gmail.com",
|
|
9
|
+
"url": "https://github.com/dangreen"
|
|
10
|
+
},
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"homepage": "https://github.com/TrigenSoftware/simple-libs/tree/main/packages/stream-utils#readme",
|
|
13
|
+
"funding": "https://ko-fi.com/dangreen",
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/TrigenSoftware/simple-libs.git",
|
|
17
|
+
"directory": "packages/stream-utils"
|
|
18
|
+
},
|
|
19
|
+
"bugs": {
|
|
20
|
+
"url": "https://github.com/TrigenSoftware/simple-libs/issues"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"stream",
|
|
24
|
+
"streams",
|
|
25
|
+
"utilities",
|
|
26
|
+
"utils"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
"types": "./dist/index.d.ts",
|
|
33
|
+
"import": "./dist/index.js"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2016 - present, TrigenSoftware
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
# argue-cli
|
|
2
|
+
|
|
3
|
+
[![ESM-only package][package]][package-url]
|
|
4
|
+
[![NPM version][npm]][npm-url]
|
|
5
|
+
[![Node version][node]][node-url]
|
|
6
|
+
[![Dependencies status][deps]][deps-url]
|
|
7
|
+
[![Install size][size]][size-url]
|
|
8
|
+
[![Build status][build]][build-url]
|
|
9
|
+
[![Coverage status][coverage]][coverage-url]
|
|
10
|
+
|
|
11
|
+
[package]: https://img.shields.io/badge/package-ESM--only-ffe536.svg
|
|
12
|
+
[package-url]: https://nodejs.org/api/esm.html
|
|
13
|
+
|
|
14
|
+
[npm]: https://img.shields.io/npm/v/argue-cli.svg
|
|
15
|
+
[npm-url]: https://www.npmjs.com/package/argue-cli
|
|
16
|
+
|
|
17
|
+
[node]: https://img.shields.io/node/v/argue-cli.svg
|
|
18
|
+
[node-url]: https://nodejs.org
|
|
19
|
+
|
|
20
|
+
[deps]: https://img.shields.io/librariesio/release/npm/argue-cli
|
|
21
|
+
[deps-url]: https://libraries.io/npm/argue-cli
|
|
22
|
+
|
|
23
|
+
[size]: https://packagephobia.com/badge?p=argue-cli
|
|
24
|
+
[size-url]: https://packagephobia.com/result?p=argue-cli
|
|
25
|
+
|
|
26
|
+
[build]: https://img.shields.io/github/actions/workflow/status/TrigenSoftware/Argue/tests.yml?branch=master
|
|
27
|
+
[build-url]: https://github.com/TrigenSoftware/Argue/actions
|
|
28
|
+
|
|
29
|
+
[coverage]: https://img.shields.io/codecov/c/github/TrigenSoftware/Argue.svg
|
|
30
|
+
[coverage-url]: https://app.codecov.io/gh/TrigenSoftware/Argue
|
|
31
|
+
|
|
32
|
+
A thin and strongly typed CLI arguments parser for Node.js.
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
1. Install
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# pnpm
|
|
40
|
+
pnpm add argue-cli
|
|
41
|
+
# yarn
|
|
42
|
+
yarn add argue-cli
|
|
43
|
+
# npm
|
|
44
|
+
npm i argue-cli
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. Import in your code and use it!
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { read, end, expect, alias, option, readOptions } from 'argue-cli'
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Expect and read one of the commands
|
|
54
|
+
*/
|
|
55
|
+
const command = expect(
|
|
56
|
+
alias('install', 'i'),
|
|
57
|
+
'remove'
|
|
58
|
+
)
|
|
59
|
+
let options = {}
|
|
60
|
+
|
|
61
|
+
if (command === 'install') {
|
|
62
|
+
/**
|
|
63
|
+
* Read passed options
|
|
64
|
+
*/
|
|
65
|
+
options = readOptions(
|
|
66
|
+
option(alias('save', 'S'), Boolean),
|
|
67
|
+
option(alias('saveDev', 'save-dev', 'D'), Boolean),
|
|
68
|
+
option('workspace', String)
|
|
69
|
+
)
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Read next argument
|
|
74
|
+
*/
|
|
75
|
+
const packageName = read()
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Expect end of the arguments
|
|
79
|
+
*/
|
|
80
|
+
end()
|
|
81
|
+
|
|
82
|
+
/* ... */
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## API
|
|
86
|
+
|
|
87
|
+
Argue reads arguments sequentially from an internal state, which is initialized with `process.argv`. Every call consumes the arguments it reads, so you describe your CLI step by step: expect a command, read its options, read positional arguments, and finally assert the end.
|
|
88
|
+
|
|
89
|
+
> [!TIP]
|
|
90
|
+
> The internal state can be controlled manually with `setArgs(...args)` and `resetArgs()` — handy in tests.
|
|
91
|
+
|
|
92
|
+
### read
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
function read(): string
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Reads the next argument and returns it. Throws an error if there are no arguments left.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
// my-cli sort-imports
|
|
102
|
+
const fileName = read() // 'sort-imports'
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### rest
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
function rest(): string[]
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Reads all remaining arguments and returns them. Returns an empty array if there are none — unlike [`read`](#read), it never throws.
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
// my-cli format a.js b.js c.js
|
|
115
|
+
expect('format')
|
|
116
|
+
|
|
117
|
+
const files = rest() // ['a.js', 'b.js', 'c.js']
|
|
118
|
+
|
|
119
|
+
end() // always passes after rest()
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### end
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
function end(): void
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Asserts that all arguments were consumed. Throws an error if there are any arguments left — useful to catch typos and unexpected input.
|
|
129
|
+
|
|
130
|
+
```ts
|
|
131
|
+
// my-cli install --sav
|
|
132
|
+
expect('install')
|
|
133
|
+
readOptions(
|
|
134
|
+
option(alias('save', 'S'), Boolean)
|
|
135
|
+
)
|
|
136
|
+
end() // throws: Unexpected argument "--sav"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### expect
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
function expect(...argRefs: ArgRef[]): string
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Expects the next argument to be one of the given ones and returns the matched name. If an [alias](#alias) matches, the main name is returned. Throws an error on any other input.
|
|
146
|
+
|
|
147
|
+
The return type is inferred as a union of the given names:
|
|
148
|
+
|
|
149
|
+
```ts
|
|
150
|
+
// my-cli i
|
|
151
|
+
const command = expect(alias('install', 'i'), 'remove')
|
|
152
|
+
// typeof command: 'install' | 'remove'
|
|
153
|
+
// command === 'install'
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### alias
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
function alias(name: string, ...aliases: string[]): AliasArgRef
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Describes an argument that has alternative names. Use it anywhere an argument name is expected — in [`expect`](#expect) and [`option`](#option).
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
alias('install', 'i')
|
|
166
|
+
alias('saveDev', 'save-dev', 'D')
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### autocase
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
function autocase(argRef: ArgRef): ArgRef
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Describes an argument that matches both camelCase and kebab-case forms. The name can be given in either form — the twin form is added as an alias. Aliases longer than one character are autocased too. Use it anywhere an argument name is expected.
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
autocase('firstRelease')
|
|
179
|
+
// --firstRelease and --first-release are both accepted
|
|
180
|
+
|
|
181
|
+
autocase(alias('save-dev', 'D'))
|
|
182
|
+
// --save-dev, --saveDev and -D
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### option
|
|
186
|
+
|
|
187
|
+
```ts
|
|
188
|
+
function option(argRef: ArgRef, type: OptionConstructor): OptionReader
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Describes an option with a value of the given type, to be read by [`readOptions`](#readoptions):
|
|
192
|
+
|
|
193
|
+
- `String` — takes the next argument as a value: `--workspace packages/app`
|
|
194
|
+
- `Number` — parses the next argument as a number: `--port 8080`
|
|
195
|
+
- `Boolean` — a flag without a value, `true` when present: `--verbose`
|
|
196
|
+
- `Array` — splits the next argument by commas; repeated options are merged: `--plugins eslint,swc --plugins tsc` → `['eslint', 'swc', 'tsc']`
|
|
197
|
+
- `[String]` or `[Number]` — takes the next argument as a whole; repeated options are collected: `--match '*.{js,ts}' --match '*.css'` → `['*.{js,ts}', '*.css']`. Use it instead of `Array` for values that may contain commas of their own
|
|
198
|
+
|
|
199
|
+
### flag
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
function flag(argRef: ArgRef): OptionReader
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Describes a boolean flag with `--no-*` negation support, to be read by [`readOptions`](#readoptions): `--verbose` sets `true`, `--no-verbose` sets `false`. Use `option(argRef, Boolean)` when negation is not wanted.
|
|
206
|
+
|
|
207
|
+
```ts
|
|
208
|
+
const options = readOptions(
|
|
209
|
+
flag(autocase('firstRelease'))
|
|
210
|
+
)
|
|
211
|
+
// --first-release → { firstRelease: true }
|
|
212
|
+
// --no-first-release, --no-firstRelease → { firstRelease: false }
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### readOptions
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
function readOptions(...optionReaders: OptionReader[]): OptionResult
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Scans the arguments and reads all described options. Both `--option` and `-o` prefixes are accepted, and a value can be passed either as the next argument or inline: `--workspace packages/app` and `--workspace=packages/app` are equivalent. Arguments that don't match any described option are left untouched, so you can continue reading them afterwards.
|
|
222
|
+
|
|
223
|
+
The result is a strongly typed object, where every property is optional — an option simply may not be passed:
|
|
224
|
+
|
|
225
|
+
```ts
|
|
226
|
+
// my-cli --save-dev --workspace packages/app my-package
|
|
227
|
+
const options = readOptions(
|
|
228
|
+
option(alias('saveDev', 'save-dev', 'D'), Boolean),
|
|
229
|
+
option('workspace', String)
|
|
230
|
+
)
|
|
231
|
+
// typeof options: { saveDev?: boolean, workspace?: string }
|
|
232
|
+
// options: { saveDev: true, workspace: 'packages/app' }
|
|
233
|
+
|
|
234
|
+
const packageName = read() // 'my-package'
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## TypeScript
|
|
238
|
+
|
|
239
|
+
In the [API section](#api) types are described in a simplified way. A detailed example of the inferred types you can see in [type tests](src/types.spec.ts).
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { AliasArgRef, ArgRef, OptionConstructor, OptionsReaderState, OptionsReaderRead, OptionResult } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Describe argument with aliases.
|
|
4
|
+
* @param name - Main name.
|
|
5
|
+
* @param alias - Alias name.
|
|
6
|
+
* @param restAliases - Rest aliases.
|
|
7
|
+
* @returns Description of argument with aliases..
|
|
8
|
+
*/
|
|
9
|
+
export declare function alias<T extends string>(name: T, alias: string, ...restAliases: string[]): AliasArgRef<T>;
|
|
10
|
+
/**
|
|
11
|
+
* Describe argument that matches both camelCase and kebab-case forms.
|
|
12
|
+
* Name and every alias longer than one character get the twin form as an alias.
|
|
13
|
+
* @param argRef - Argument name in either form.
|
|
14
|
+
* @returns Description of argument with the twin forms as aliases.
|
|
15
|
+
*/
|
|
16
|
+
export declare function autocase<T extends string>(argRef: ArgRef<T>): ArgRef<T>;
|
|
17
|
+
/**
|
|
18
|
+
* Describe option with value.
|
|
19
|
+
* @param argRef - Option name.
|
|
20
|
+
* @param type - Value type.
|
|
21
|
+
* @returns Option reader.
|
|
22
|
+
*/
|
|
23
|
+
export declare function option<T extends string, K extends OptionConstructor>(argRef: ArgRef<T>, type: K): (option: string, read: OptionsReaderRead, options: OptionsReaderState) => OptionResult<T, K> | null;
|
|
24
|
+
/**
|
|
25
|
+
* Describe boolean flag with `--no-*` negation support.
|
|
26
|
+
* @param argRef - Flag name.
|
|
27
|
+
* @returns Option reader.
|
|
28
|
+
*/
|
|
29
|
+
export declare function flag<T extends string>(argRef: ArgRef<T>): (option: string) => OptionResult<T, BooleanConstructor> | null;
|
|
30
|
+
//# sourceMappingURL=args.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"args.d.ts","sourceRoot":"","sources":["../src/args.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,MAAM,EACN,iBAAiB,EACjB,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACb,MAAM,YAAY,CAAA;AAGnB;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,CAAC,SAAS,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,MAAM,EAAE,GAAG,WAAW,CAAC,CAAC,CAAC,CAKxG;AAUD;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAuBvE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,iBAAiB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,YAE5E,MAAM,QAAQ,iBAAiB,WAAW,kBAAkB,+BA4E/E;AAID;;;;GAIG;AACH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,YACtC,MAAM,gDAiBvB"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal state of arguments.
|
|
3
|
+
*/
|
|
4
|
+
export declare const argv: string[];
|
|
5
|
+
/**
|
|
6
|
+
* Reset arguments state.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resetArgs(): void;
|
|
9
|
+
/**
|
|
10
|
+
* Set arguments state.
|
|
11
|
+
* @param args
|
|
12
|
+
*/
|
|
13
|
+
export declare function setArgs(...args: string[]): void;
|
|
14
|
+
//# sourceMappingURL=argv.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argv.d.ts","sourceRoot":"","sources":["../src/argv.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,eAAO,MAAM,IAAI,UAAuC,CAAA;AAExD;;GAEG;AACH,wBAAgB,SAAS,SAGxB;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,GAAG,IAAI,EAAE,MAAM,EAAE,QAGxC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ArgRef } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Read next argument.
|
|
4
|
+
* Throws error if no next argument.
|
|
5
|
+
* @returns Next argument.
|
|
6
|
+
*/
|
|
7
|
+
export declare function read(): string;
|
|
8
|
+
/**
|
|
9
|
+
* Read all remaining arguments.
|
|
10
|
+
* @returns Remaining arguments, empty array if none.
|
|
11
|
+
*/
|
|
12
|
+
export declare function rest(): string[];
|
|
13
|
+
/**
|
|
14
|
+
* Expectation of the end.
|
|
15
|
+
* Throws an error if there are more arguments left.
|
|
16
|
+
*/
|
|
17
|
+
export declare function end(): void;
|
|
18
|
+
/**
|
|
19
|
+
* Expect one of the given arguments.
|
|
20
|
+
* @param argRefs
|
|
21
|
+
* @returns Expected full argument name.
|
|
22
|
+
*/
|
|
23
|
+
export declare function expect<T extends string>(...argRefs: [...ArgRef<T>[]]): T;
|
|
24
|
+
//# sourceMappingURL=core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAIxC;;;;GAIG;AACH,wBAAgB,IAAI,WAQnB;AAED;;;GAGG;AACH,wBAAgB,IAAI,aAEnB;AAED;;;GAGG;AACH,wBAAgB,GAAG,SAIlB;AAED;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,OAAO,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KASpE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mBAAmB,YAAY,CAAA;AAC/B,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,WAAW,CAAA;AACzB,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
//#region src/argv.ts
|
|
2
|
+
const ARGV_START_INDEX = 2;
|
|
3
|
+
/**
|
|
4
|
+
* Internal state of arguments.
|
|
5
|
+
*/
|
|
6
|
+
const argv = process.argv.slice(ARGV_START_INDEX);
|
|
7
|
+
/**
|
|
8
|
+
* Reset arguments state.
|
|
9
|
+
*/
|
|
10
|
+
function resetArgs() {
|
|
11
|
+
argv.splice(0, argv.length);
|
|
12
|
+
argv.push(...process.argv.slice(ARGV_START_INDEX));
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Set arguments state.
|
|
16
|
+
* @param args
|
|
17
|
+
*/
|
|
18
|
+
function setArgs(...args) {
|
|
19
|
+
argv.splice(0, argv.length);
|
|
20
|
+
argv.push(...args);
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/utils.ts
|
|
24
|
+
/**
|
|
25
|
+
* Match reference with argument.
|
|
26
|
+
* @param argRef
|
|
27
|
+
* @param arg
|
|
28
|
+
* @returns Full name or null.
|
|
29
|
+
*/
|
|
30
|
+
function matchArgName(argRef, arg) {
|
|
31
|
+
if (typeof argRef === "string") return argRef === arg ? argRef : null;
|
|
32
|
+
if (argRef.name === arg) return argRef.name;
|
|
33
|
+
return argRef.aliases.includes(arg) ? argRef.name : null;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Find full argument name in references.
|
|
37
|
+
* @param argRefs
|
|
38
|
+
* @param arg
|
|
39
|
+
* @returns Found argument's full name or null.
|
|
40
|
+
*/
|
|
41
|
+
function findArgName(argRefs, arg) {
|
|
42
|
+
let argRef;
|
|
43
|
+
let argName;
|
|
44
|
+
for (argRef of argRefs) {
|
|
45
|
+
argName = matchArgName(argRef, arg);
|
|
46
|
+
if (argName) return argName;
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
//#region src/core.ts
|
|
52
|
+
/**
|
|
53
|
+
* Read next argument.
|
|
54
|
+
* Throws error if no next argument.
|
|
55
|
+
* @returns Next argument.
|
|
56
|
+
*/
|
|
57
|
+
function read() {
|
|
58
|
+
const value = argv.shift();
|
|
59
|
+
if (!value) throw new Error("Unexpected end of arguments");
|
|
60
|
+
return value;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Read all remaining arguments.
|
|
64
|
+
* @returns Remaining arguments, empty array if none.
|
|
65
|
+
*/
|
|
66
|
+
function rest() {
|
|
67
|
+
return argv.splice(0, argv.length);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Expectation of the end.
|
|
71
|
+
* Throws an error if there are more arguments left.
|
|
72
|
+
*/
|
|
73
|
+
function end() {
|
|
74
|
+
if (argv.length) throw new Error(`Unexpected argument "${argv[0]}"`);
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Expect one of the given arguments.
|
|
78
|
+
* @param argRefs
|
|
79
|
+
* @returns Expected full argument name.
|
|
80
|
+
*/
|
|
81
|
+
function expect(...argRefs) {
|
|
82
|
+
const arg = read();
|
|
83
|
+
const argName = findArgName(argRefs, arg);
|
|
84
|
+
if (!argName) throw new Error(`Unexpected argument "${arg}"`);
|
|
85
|
+
return argName;
|
|
86
|
+
}
|
|
87
|
+
//#endregion
|
|
88
|
+
//#region src/args.ts
|
|
89
|
+
/**
|
|
90
|
+
* Describe argument with aliases.
|
|
91
|
+
* @param name - Main name.
|
|
92
|
+
* @param alias - Alias name.
|
|
93
|
+
* @param restAliases - Rest aliases.
|
|
94
|
+
* @returns Description of argument with aliases..
|
|
95
|
+
*/
|
|
96
|
+
function alias(name, alias, ...restAliases) {
|
|
97
|
+
return {
|
|
98
|
+
name,
|
|
99
|
+
aliases: [alias, ...restAliases]
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function caseTwin(name) {
|
|
103
|
+
return name.length > 1 ? name.includes("-") ? name.replace(/-+(.)/g, (_, char) => char.toUpperCase()) : name.replace(/[A-Z]/g, (char) => `-${char.toLowerCase()}`) : name;
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Describe argument that matches both camelCase and kebab-case forms.
|
|
107
|
+
* Name and every alias longer than one character get the twin form as an alias.
|
|
108
|
+
* @param argRef - Argument name in either form.
|
|
109
|
+
* @returns Description of argument with the twin forms as aliases.
|
|
110
|
+
*/
|
|
111
|
+
function autocase(argRef) {
|
|
112
|
+
let name;
|
|
113
|
+
let aliases;
|
|
114
|
+
if (typeof argRef === "string") {
|
|
115
|
+
name = argRef;
|
|
116
|
+
aliases = /* @__PURE__ */ new Set();
|
|
117
|
+
} else {
|
|
118
|
+
name = argRef.name;
|
|
119
|
+
aliases = new Set(argRef.aliases.concat(argRef.aliases.map(caseTwin)));
|
|
120
|
+
}
|
|
121
|
+
aliases.add(caseTwin(name));
|
|
122
|
+
aliases.delete(name);
|
|
123
|
+
if (!aliases.size) return argRef;
|
|
124
|
+
return {
|
|
125
|
+
name,
|
|
126
|
+
aliases: [...aliases]
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Describe option with value.
|
|
131
|
+
* @param argRef - Option name.
|
|
132
|
+
* @param type - Value type.
|
|
133
|
+
* @returns Option reader.
|
|
134
|
+
*/
|
|
135
|
+
function option(argRef, type) {
|
|
136
|
+
if (Array.isArray(type)) return (option, read, options) => {
|
|
137
|
+
const argName = matchArgName(argRef, option);
|
|
138
|
+
if (argName) {
|
|
139
|
+
const prevValues = options[argName];
|
|
140
|
+
const value = read();
|
|
141
|
+
return { [argName]: (Array.isArray(prevValues) ? prevValues : []).concat(type[0] === Number ? parseFloat(value) : value) };
|
|
142
|
+
}
|
|
143
|
+
return null;
|
|
144
|
+
};
|
|
145
|
+
if (type === String) return (option, read) => {
|
|
146
|
+
const argName = matchArgName(argRef, option);
|
|
147
|
+
if (argName) return { [argName]: read() };
|
|
148
|
+
return null;
|
|
149
|
+
};
|
|
150
|
+
if (type === Number) return (option, read) => {
|
|
151
|
+
const argName = matchArgName(argRef, option);
|
|
152
|
+
if (argName) return { [argName]: parseFloat(read()) };
|
|
153
|
+
return null;
|
|
154
|
+
};
|
|
155
|
+
if (type === Array) return (option, read, options) => {
|
|
156
|
+
const argName = matchArgName(argRef, option);
|
|
157
|
+
if (argName) {
|
|
158
|
+
const prevValues = options[argName];
|
|
159
|
+
const values = read().split(",");
|
|
160
|
+
return { [argName]: Array.isArray(prevValues) ? prevValues.concat(values) : values };
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
};
|
|
164
|
+
return (option) => {
|
|
165
|
+
const argName = matchArgName(argRef, option);
|
|
166
|
+
if (argName) return { [argName]: true };
|
|
167
|
+
return null;
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const NEGATION_PREFIX = "no-";
|
|
171
|
+
/**
|
|
172
|
+
* Describe boolean flag with `--no-*` negation support.
|
|
173
|
+
* @param argRef - Flag name.
|
|
174
|
+
* @returns Option reader.
|
|
175
|
+
*/
|
|
176
|
+
function flag(argRef) {
|
|
177
|
+
return (option) => {
|
|
178
|
+
let value = true;
|
|
179
|
+
let argName = matchArgName(argRef, option);
|
|
180
|
+
if (!argName && option.startsWith(NEGATION_PREFIX)) {
|
|
181
|
+
value = false;
|
|
182
|
+
argName = matchArgName(argRef, option.slice(3));
|
|
183
|
+
}
|
|
184
|
+
if (argName) return { [argName]: value };
|
|
185
|
+
return null;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
//#endregion
|
|
189
|
+
//#region src/options.ts
|
|
190
|
+
function isOption(arg) {
|
|
191
|
+
return /^--?[^-].*/.test(arg);
|
|
192
|
+
}
|
|
193
|
+
function removePrefix(arg) {
|
|
194
|
+
return arg.replace(/^--?/, "");
|
|
195
|
+
}
|
|
196
|
+
function splitOption(arg) {
|
|
197
|
+
const eqIndex = arg.indexOf("=");
|
|
198
|
+
return eqIndex === -1 ? [arg] : [arg.slice(0, eqIndex), arg.slice(eqIndex + 1)];
|
|
199
|
+
}
|
|
200
|
+
function createOptionReader(optionReaders) {
|
|
201
|
+
return optionReaders.reduceRight((readNextOption, readOption) => {
|
|
202
|
+
if (!readNextOption) return readOption;
|
|
203
|
+
return (option, read, options) => readOption(option, read, options) ?? readNextOption(option, read, options);
|
|
204
|
+
}, null);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Read options from arguments.
|
|
208
|
+
* @param optionReaders
|
|
209
|
+
* @returns Options with values.
|
|
210
|
+
*/
|
|
211
|
+
function readOptions(...optionReaders) {
|
|
212
|
+
if (!argv.length) return {};
|
|
213
|
+
const readOption = createOptionReader(optionReaders);
|
|
214
|
+
if (!readOption) return {};
|
|
215
|
+
const options = {};
|
|
216
|
+
let i = 0;
|
|
217
|
+
let arg = argv[i];
|
|
218
|
+
let optionResult;
|
|
219
|
+
let optionEqValue;
|
|
220
|
+
const next = () => {
|
|
221
|
+
arg = argv[++i];
|
|
222
|
+
};
|
|
223
|
+
const remove = () => {
|
|
224
|
+
if (optionEqValue !== void 0) throw new Error(`Unexpected value for "${arg}"`);
|
|
225
|
+
argv.splice(i--, 1);
|
|
226
|
+
};
|
|
227
|
+
const read = () => {
|
|
228
|
+
if (optionEqValue !== void 0) {
|
|
229
|
+
const value = optionEqValue;
|
|
230
|
+
optionEqValue = void 0;
|
|
231
|
+
return value;
|
|
232
|
+
}
|
|
233
|
+
next();
|
|
234
|
+
remove();
|
|
235
|
+
if (!arg) throw new Error("Unexpected end of arguments");
|
|
236
|
+
return arg;
|
|
237
|
+
};
|
|
238
|
+
while (arg) {
|
|
239
|
+
if (isOption(arg)) {
|
|
240
|
+
[arg, optionEqValue] = splitOption(arg);
|
|
241
|
+
optionResult = readOption(removePrefix(arg), read, options);
|
|
242
|
+
if (optionResult) {
|
|
243
|
+
remove();
|
|
244
|
+
Object.assign(options, optionResult);
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
next();
|
|
248
|
+
}
|
|
249
|
+
return options;
|
|
250
|
+
}
|
|
251
|
+
//#endregion
|
|
252
|
+
export { alias, argv, autocase, end, expect, flag, option, read, readOptions, resetArgs, rest, setArgs };
|
|
253
|
+
|
|
254
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/argv.ts","../src/utils.ts","../src/core.ts","../src/args.ts","../src/options.ts"],"sourcesContent":["\nconst ARGV_START_INDEX = 2\n\n/**\n * Internal state of arguments.\n */\nexport const argv = process.argv.slice(ARGV_START_INDEX)\n\n/**\n * Reset arguments state.\n */\nexport function resetArgs() {\n argv.splice(0, argv.length)\n argv.push(...process.argv.slice(ARGV_START_INDEX))\n}\n\n/**\n * Set arguments state.\n * @param args\n */\nexport function setArgs(...args: string[]) {\n argv.splice(0, argv.length)\n argv.push(...args)\n}\n","\nimport type { ArgRef } from './types.js'\n\ntype FlatMerge<T> = T extends infer U ? { [K in keyof U]: U[K] } : never\n\nexport type Merge<T extends readonly [...unknown[]]> = T extends [infer L, ...infer R]\n ? FlatMerge<NonNullable<L> & Merge<R>>\n : unknown\n\nexport type UnionMerge<T extends readonly [...unknown[]]> = T extends [infer L, ...infer R]\n ? L | Merge<R>\n // oxlint-disable-next-line typescript/no-explicit-any\n : any\n\n// oxlint-disable-next-line typescript/no-explicit-any\ntype AnyFunction = (...args: any[]) => any\n\nexport type ReturnTypes<T extends readonly [...AnyFunction[]]> = T extends [infer L, ...infer R]\n ? L extends AnyFunction\n ? R extends AnyFunction[]\n ? [ReturnType<L>, ...ReturnTypes<R>]\n : []\n : []\n : []\n\n/**\n * Match reference with argument.\n * @param argRef\n * @param arg\n * @returns Full name or null.\n */\nexport function matchArgName<T extends string>(argRef: ArgRef<T>, arg: string) {\n if (typeof argRef === 'string') {\n return argRef === arg\n ? argRef\n : null\n }\n\n if (argRef.name === arg) {\n return argRef.name\n }\n\n return argRef.aliases.includes(arg)\n ? argRef.name\n : null\n}\n\n/**\n * Find full argument name in references.\n * @param argRefs\n * @param arg\n * @returns Found argument's full name or null.\n */\nexport function findArgName<T extends string>(argRefs: [...ArgRef<T>[]], arg: string) {\n let argRef: ArgRef<T>\n let argName: T | null\n\n for (argRef of argRefs) {\n argName = matchArgName(argRef, arg)\n\n if (argName) {\n return argName\n }\n }\n\n return null\n}\n","import type { ArgRef } from './types.js'\nimport { argv } from './argv.js'\nimport { findArgName } from './utils.js'\n\n/**\n * Read next argument.\n * Throws error if no next argument.\n * @returns Next argument.\n */\nexport function read() {\n const value = argv.shift()\n\n if (!value) {\n throw new Error('Unexpected end of arguments')\n }\n\n return value\n}\n\n/**\n * Read all remaining arguments.\n * @returns Remaining arguments, empty array if none.\n */\nexport function rest() {\n return argv.splice(0, argv.length)\n}\n\n/**\n * Expectation of the end.\n * Throws an error if there are more arguments left.\n */\nexport function end() {\n if (argv.length) {\n throw new Error(`Unexpected argument \"${argv[0]}\"`)\n }\n}\n\n/**\n * Expect one of the given arguments.\n * @param argRefs\n * @returns Expected full argument name.\n */\nexport function expect<T extends string>(...argRefs: [...ArgRef<T>[]]) {\n const arg = read()\n const argName = findArgName(argRefs, arg)\n\n if (!argName) {\n throw new Error(`Unexpected argument \"${arg}\"`)\n }\n\n return argName\n}\n","import type {\n AliasArgRef,\n ArgRef,\n OptionConstructor,\n OptionsReaderState,\n OptionsReaderRead,\n OptionResult\n} from './types.js'\nimport { matchArgName } from './utils.js'\n\n/**\n * Describe argument with aliases.\n * @param name - Main name.\n * @param alias - Alias name.\n * @param restAliases - Rest aliases.\n * @returns Description of argument with aliases..\n */\nexport function alias<T extends string>(name: T, alias: string, ...restAliases: string[]): AliasArgRef<T> {\n return {\n name,\n aliases: [alias, ...restAliases]\n }\n}\n\nfunction caseTwin(name: string) {\n return name.length > 1\n ? name.includes('-')\n ? name.replace(/-+(.)/g, (_, char: string) => char.toUpperCase())\n : name.replace(/[A-Z]/g, char => `-${char.toLowerCase()}`)\n : name\n}\n\n/**\n * Describe argument that matches both camelCase and kebab-case forms.\n * Name and every alias longer than one character get the twin form as an alias.\n * @param argRef - Argument name in either form.\n * @returns Description of argument with the twin forms as aliases.\n */\nexport function autocase<T extends string>(argRef: ArgRef<T>): ArgRef<T> {\n let name\n let aliases\n\n if (typeof argRef === 'string') {\n name = argRef\n aliases = new Set<string>()\n } else {\n name = argRef.name\n aliases = new Set(argRef.aliases.concat(argRef.aliases.map(caseTwin)))\n }\n\n aliases.add(caseTwin(name))\n aliases.delete(name)\n\n if (!aliases.size) {\n return argRef\n }\n\n return {\n name,\n aliases: [...aliases]\n }\n}\n\n/**\n * Describe option with value.\n * @param argRef - Option name.\n * @param type - Value type.\n * @returns Option reader.\n */\nexport function option<T extends string, K extends OptionConstructor>(argRef: ArgRef<T>, type: K) {\n if (Array.isArray(type)) {\n return (option: string, read: OptionsReaderRead, options: OptionsReaderState) => {\n const argName = matchArgName(argRef, option)\n\n if (argName) {\n const prevValues = options[argName]\n const value = read()\n\n return {\n [argName]: (Array.isArray(prevValues) ? prevValues : []).concat(\n type[0] === Number ? parseFloat(value) : value\n )\n } as OptionResult<T, K>\n }\n\n return null\n }\n }\n\n if (type === String) {\n return (option: string, read: OptionsReaderRead) => {\n const argName = matchArgName(argRef, option)\n\n if (argName) {\n return {\n [argName]: read()\n } as OptionResult<T, K>\n }\n\n return null\n }\n }\n\n if (type === Number) {\n return (option: string, read: OptionsReaderRead) => {\n const argName = matchArgName(argRef, option)\n\n if (argName) {\n return {\n [argName]: parseFloat(read())\n } as OptionResult<T, K>\n }\n\n return null\n }\n }\n\n if (type === Array) {\n return (option: string, read: OptionsReaderRead, options: OptionsReaderState) => {\n const argName = matchArgName(argRef, option)\n\n if (argName) {\n const prevValues = options[argName]\n const values = read().split(',')\n\n return {\n [argName]: Array.isArray(prevValues)\n ? prevValues.concat(values)\n : values\n } as OptionResult<T, K>\n }\n\n return null\n }\n }\n\n return (option: string) => {\n const argName = matchArgName(argRef, option)\n\n if (argName) {\n return {\n [argName]: true\n } as OptionResult<T, K>\n }\n\n return null\n }\n}\n\nconst NEGATION_PREFIX = 'no-'\n\n/**\n * Describe boolean flag with `--no-*` negation support.\n * @param argRef - Flag name.\n * @returns Option reader.\n */\nexport function flag<T extends string>(argRef: ArgRef<T>) {\n return (option: string) => {\n let value = true\n let argName = matchArgName(argRef, option)\n\n if (!argName && option.startsWith(NEGATION_PREFIX)) {\n value = false\n argName = matchArgName(argRef, option.slice(NEGATION_PREFIX.length))\n }\n\n if (argName) {\n return {\n [argName]: value\n } as OptionResult<T, BooleanConstructor>\n }\n\n return null\n }\n}\n","import type {\n OptionReader,\n OptionResult\n} from './types.js'\nimport type {\n Merge,\n ReturnTypes,\n UnionMerge\n} from './utils.js'\nimport { argv } from './argv.js'\n\nfunction isOption(arg: string) {\n return /^--?[^-].*/.test(arg)\n}\n\nfunction removePrefix(arg: string) {\n return arg.replace(/^--?/, '')\n}\n\nfunction splitOption(arg: string): [name: string, value?: string] {\n const eqIndex = arg.indexOf('=')\n\n return eqIndex === -1\n ? [arg]\n : [arg.slice(0, eqIndex), arg.slice(eqIndex + 1)]\n}\n\nfunction createOptionReader<T extends OptionReader[]>(optionReaders: [...T]) {\n const optionReader = optionReaders.reduceRight<OptionReader | null>(\n (readNextOption, readOption) => {\n if (!readNextOption) {\n return readOption\n }\n\n return (option, read, options) => readOption(option, read, options) ?? readNextOption(option, read, options)\n },\n null\n )\n\n return optionReader as OptionReader<UnionMerge<ReturnTypes<T>>> | null\n}\n\n/**\n * Read options from arguments.\n * @param optionReaders\n * @returns Options with values.\n */\nexport function readOptions<T extends OptionReader[]>(...optionReaders: [...T]): Partial<Merge<ReturnTypes<T>>> {\n if (!argv.length) {\n return {}\n }\n\n const readOption = createOptionReader(optionReaders)\n\n if (!readOption) {\n return {}\n }\n\n const options = {}\n let i = 0\n let arg = argv[i]\n let optionResult: OptionResult | null\n let optionEqValue: string | undefined\n const next = () => {\n arg = argv[++i]\n }\n const remove = () => {\n if (optionEqValue !== undefined) {\n throw new Error(`Unexpected value for \"${arg}\"`)\n }\n\n argv.splice(i--, 1)\n }\n const read = () => {\n if (optionEqValue !== undefined) {\n const value = optionEqValue\n\n optionEqValue = undefined\n\n return value\n }\n\n next()\n remove()\n\n if (!arg) {\n throw new Error('Unexpected end of arguments')\n }\n\n return arg\n }\n\n // oxlint-disable-next-line eslint/no-unmodified-loop-condition\n while (arg) {\n if (isOption(arg)) {\n [arg, optionEqValue] = splitOption(arg)\n optionResult = readOption(removePrefix(arg), read, options)\n\n if (optionResult) {\n remove()\n Object.assign(options, optionResult)\n }\n }\n\n next()\n }\n\n return options\n}\n"],"mappings":";AACA,MAAM,mBAAmB;;;;AAKzB,MAAa,OAAO,QAAQ,KAAK,MAAM,gBAAgB;;;;AAKvD,SAAgB,YAAY;CAC1B,KAAK,OAAO,GAAG,KAAK,MAAM;CAC1B,KAAK,KAAK,GAAG,QAAQ,KAAK,MAAM,gBAAgB,CAAC;AACnD;;;;;AAMA,SAAgB,QAAQ,GAAG,MAAgB;CACzC,KAAK,OAAO,GAAG,KAAK,MAAM;CAC1B,KAAK,KAAK,GAAG,IAAI;AACnB;;;;;;;;;ACQA,SAAgB,aAA+B,QAAmB,KAAa;CAC7E,IAAI,OAAO,WAAW,UACpB,OAAO,WAAW,MACd,SACA;CAGN,IAAI,OAAO,SAAS,KAClB,OAAO,OAAO;CAGhB,OAAO,OAAO,QAAQ,SAAS,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