inray 0.0.4 → 0.0.6
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/LICENSE.md +29 -27
- package/README.md +57 -29
- package/dist/cli/mod.d.ts +2 -0
- package/dist/cli/mod.d.ts.map +1 -0
- package/dist/cli/mod.js +2 -0
- package/dist/cli/mod.js.map +1 -0
- package/dist/cli/src/index.d.ts +25 -0
- package/dist/cli/src/index.d.ts.map +1 -0
- package/dist/cli/src/index.js +25 -0
- package/dist/cli/src/index.js.map +1 -0
- package/dist/cli/src/lib/argument.d.ts +82 -0
- package/dist/cli/src/lib/argument.d.ts.map +1 -0
- package/dist/cli/src/lib/argument.js +143 -0
- package/dist/cli/src/lib/argument.js.map +1 -0
- package/dist/cli/src/lib/command.d.ts +1051 -0
- package/dist/cli/src/lib/command.d.ts.map +1 -0
- package/dist/cli/src/lib/command.js +2208 -0
- package/dist/cli/src/lib/command.js.map +1 -0
- package/dist/cli/src/lib/error.d.ts +35 -0
- package/dist/cli/src/lib/error.d.ts.map +1 -0
- package/dist/cli/src/lib/error.js +49 -0
- package/dist/cli/src/lib/error.js.map +1 -0
- package/dist/cli/src/lib/help.d.ts +250 -0
- package/dist/cli/src/lib/help.d.ts.map +1 -0
- package/dist/cli/src/lib/help.js +583 -0
- package/dist/cli/src/lib/help.js.map +1 -0
- package/dist/cli/src/lib/option.d.ts +189 -0
- package/dist/cli/src/lib/option.d.ts.map +1 -0
- package/dist/cli/src/lib/option.js +364 -0
- package/dist/cli/src/lib/option.js.map +1 -0
- package/dist/cli/src/lib/suggestSimilar.d.ts +18 -0
- package/dist/cli/src/lib/suggestSimilar.d.ts.map +1 -0
- package/dist/cli/src/lib/suggestSimilar.js +99 -0
- package/dist/cli/src/lib/suggestSimilar.js.map +1 -0
- package/dist/db/postgres/src/bytes.js +1 -0
- package/dist/db/postgres/src/connection.js +1 -0
- package/dist/db/postgres/src/errors.js +1 -0
- package/dist/db/postgres/src/index.js +1 -0
- package/dist/db/postgres/src/large.js +1 -0
- package/dist/db/postgres/src/query.js +1 -0
- package/dist/db/postgres/src/queue.js +1 -0
- package/dist/db/postgres/src/result.js +1 -0
- package/dist/db/postgres/src/subscribe.js +1 -0
- package/dist/db/postgres/src/types.js +1 -0
- package/dist/db-migrator/src/bin.d.ts +3 -0
- package/dist/db-migrator/src/bin.d.ts.map +1 -0
- package/dist/db-migrator/src/bin.js +72 -0
- package/dist/db-migrator/src/bin.js.map +1 -0
- package/dist/db-migrator/src/index.d.ts +5 -0
- package/dist/db-migrator/src/index.d.ts.map +1 -0
- package/dist/db-migrator/src/index.js +4 -0
- package/dist/db-migrator/src/index.js.map +1 -0
- package/dist/db-migrator/src/lib/MigrationError.d.ts +5 -0
- package/dist/db-migrator/src/lib/MigrationError.d.ts.map +1 -0
- package/dist/db-migrator/src/lib/MigrationError.js +12 -0
- package/dist/db-migrator/src/lib/MigrationError.js.map +1 -0
- package/dist/db-migrator/src/lib/clients/index.d.ts +9 -0
- package/dist/db-migrator/src/lib/clients/index.d.ts.map +1 -0
- package/dist/db-migrator/src/lib/clients/index.js +10 -0
- package/dist/db-migrator/src/lib/clients/index.js.map +1 -0
- package/dist/db-migrator/src/lib/clients/postgres.d.ts +3 -0
- package/dist/db-migrator/src/lib/clients/postgres.d.ts.map +1 -0
- package/dist/db-migrator/src/lib/clients/postgres.js +44 -0
- package/dist/db-migrator/src/lib/clients/postgres.js.map +1 -0
- package/dist/db-migrator/src/lib/migrator.log.d.ts +4 -0
- package/dist/db-migrator/src/lib/migrator.log.d.ts.map +1 -0
- package/dist/db-migrator/src/lib/migrator.log.js +46 -0
- package/dist/db-migrator/src/lib/migrator.log.js.map +1 -0
- package/dist/db-migrator/src/lib/migrator.sql.d.ts +5 -0
- package/dist/db-migrator/src/lib/migrator.sql.d.ts.map +1 -0
- package/dist/db-migrator/src/lib/migrator.sql.js +13 -0
- package/dist/db-migrator/src/lib/migrator.sql.js.map +1 -0
- package/dist/db-migrator/src/lib/migrator.types.d.ts +55 -0
- package/dist/db-migrator/src/lib/migrator.types.d.ts.map +1 -0
- package/dist/db-migrator/src/lib/migrator.types.js +2 -0
- package/dist/db-migrator/src/lib/migrator.types.js.map +1 -0
- package/dist/db-migrator/src/lib/util.d.ts +9 -0
- package/dist/db-migrator/src/lib/util.d.ts.map +1 -0
- package/dist/db-migrator/src/lib/util.js +93 -0
- package/dist/db-migrator/src/lib/util.js.map +1 -0
- package/dist/db-migrator/src/migrator.d.ts +6 -0
- package/dist/db-migrator/src/migrator.d.ts.map +1 -0
- package/dist/db-migrator/src/migrator.js +121 -0
- package/dist/db-migrator/src/migrator.js.map +1 -0
- package/dist/utils/mkdirs.d.ts +15 -0
- package/dist/utils/mkdirs.d.ts.map +1 -0
- package/dist/utils/mkdirs.js +42 -0
- package/dist/utils/mkdirs.js.map +1 -0
- package/dist/utils/mod.d.ts +2 -0
- package/dist/utils/mod.d.ts.map +1 -1
- package/dist/utils/mod.js +2 -0
- package/dist/utils/mod.js.map +1 -1
- package/dist/utils/totalist.d.ts +13 -0
- package/dist/utils/totalist.d.ts.map +1 -0
- package/dist/utils/totalist.js +39 -0
- package/dist/utils/totalist.js.map +1 -0
- package/dist/utils/validation/vEnvBoolean.d.ts +1 -1
- package/package.json +15 -3
package/LICENSE.md
CHANGED
|
@@ -18,33 +18,35 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
18
18
|
|
|
19
19
|
Additional Functionality and integrated external libraries:
|
|
20
20
|
|
|
21
|
-
| Library name | Author
|
|
22
|
-
| :---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
-
| [valibot](https://valibot.dev/) | [Fabian Hiller](https://github.com/fabian-hiller)
|
|
24
|
-
| [@valibot/i18n](https://github.com/open-circle/valibot/tree/main/packages/i18n) | [Fabian Hiller](https://github.com/fabian-hiller)
|
|
25
|
-
| [@valibot/to-json-schema](https://github.com/open-circle/valibot/tree/main/packages/to-json-schema) | [Fabian Hiller](https://github.com/fabian-hiller)
|
|
26
|
-
| [node-cron](https://www.nodecron.com/) | [Lucas Merencia](https://github.com/merencia)
|
|
27
|
-
| [yaml](https://eemeli.org/yaml/#yaml) | [Eemeli Aro](https://github.com/eemeli)
|
|
28
|
-
| [@std/async](https://jsr.io/@std/async) | [Deno authors](https://github.com/denoland)
|
|
29
|
-
| [@std/bytes](https://jsr.io/@std/bytes) | [Deno authors](https://github.com/denoland)
|
|
30
|
-
| [@std/collections](https://jsr.io/@std/collections) | [Deno authors](https://github.com/denoland)
|
|
31
|
-
| [@std/csv](https://jsr.io/@std/csv) | [Deno authors](https://github.com/denoland)
|
|
32
|
-
| [@std/data-structures](https://jsr.io/@std/data-structures) | [Deno authors](https://github.com/denoland)
|
|
33
|
-
| [@std/encoding](https://jsr.io/@std/encoding) | [Deno authors](https://github.com/denoland)
|
|
34
|
-
| [@std/fmt](https://jsr.io/@std/fmt) | [Deno authors](https://github.com/denoland)
|
|
35
|
-
| [@std/json](https://jsr.io/@std/json) | [Deno authors](https://github.com/denoland)
|
|
36
|
-
| [@std/jsonc](https://jsr.io/@std/jsonc) | [Deno authors](https://github.com/denoland)
|
|
37
|
-
| [@std/media-types](https://jsr.io/@std/media-types) | [Deno authors](https://github.com/denoland)
|
|
38
|
-
| [@std/streams](https://jsr.io/@std/streams) | [Deno authors](https://github.com/denoland)
|
|
39
|
-
| [jose](https://github.com/panva/jose) | [Filip Skokan](https://github.com/panva)
|
|
40
|
-
| [date-fns](https://date-fns.org/) | [Sasha Koss](https://github.com/kossnocorp)
|
|
41
|
-
| [unidecode](https://github.com/FGRibreau/node-unidecode) | [Francois-Guillaume Ribreau](https://fgribreau.com)
|
|
42
|
-
| [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) | [Nikolay Kuchumov](https://gitlab.com/catamphetamine)
|
|
43
|
-
| [logtape](https://logtape.org/) and parts: <br> @logtape/config, @logtape/file, <br> @logtape/pretty, @logtape/redaction, @logtape/syslog | [Hong Minhee (洪 民憙)](https://github.com/dahlia)
|
|
44
|
-
| [postgres.js](https://github.com/porsager/postgres/tree/master) | [Rasmus Porsager](https://github.com/porsager)
|
|
45
|
-
| [hono](https://hono.dev/) | [Yusuke Wada](https://github.com/yusukebe)
|
|
46
|
-
| [@hono/node-server](https://github.com/honojs/node-server) | [Yusuke Wada](https://github.com/yusukebe)
|
|
47
|
-
| [cache-manager](https://cacheable.org/docs/cache-manager/) and parts: keyv, @keyv/serialize, @cacheable/utils, hashery, hookified | [Jared Wray](https://github.com/jaredwray)
|
|
21
|
+
| Library name | Author | License | Version\* | Modification level\*\* | Internal name\*\*\* |
|
|
22
|
+
| :---------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------- | :-----------------------------------------------------------------------------------: | :--------------- | ---------------------- | ------------------- |
|
|
23
|
+
| [valibot](https://valibot.dev/) | [Fabian Hiller](https://github.com/fabian-hiller) | [MIT](./src/valibot/LICENSE.md) | **1.4.2** | Zero or low | same |
|
|
24
|
+
| [@valibot/i18n](https://github.com/open-circle/valibot/tree/main/packages/i18n) | [Fabian Hiller](https://github.com/fabian-hiller) | [MIT](./src/valibot/i18n/LICENSE.md) | **1.2.0** | Zero or low | same |
|
|
25
|
+
| [@valibot/to-json-schema](https://github.com/open-circle/valibot/tree/main/packages/to-json-schema) | [Fabian Hiller](https://github.com/fabian-hiller) | [MIT](./src/valibot/to-json-schema/LICENSE.md) | **1.7.1** | Zero | same |
|
|
26
|
+
| [node-cron](https://www.nodecron.com/) | [Lucas Merencia](https://github.com/merencia) | [ISC](./src/node-cron/LICENSE.md) | **4.6.0** | Zero or low | same |
|
|
27
|
+
| [yaml](https://eemeli.org/yaml/#yaml) | [Eemeli Aro](https://github.com/eemeli) | [ISC](./src/yaml/LICENSE.md) | **3.0.0-1 (RC)** | Zero or low | same |
|
|
28
|
+
| [@std/async](https://jsr.io/@std/async) | [Deno authors](https://github.com/denoland) | [MIT](./src/async/LICENSE.md) | **1.5.0** | Zero or low | same as domain |
|
|
29
|
+
| [@std/bytes](https://jsr.io/@std/bytes) | [Deno authors](https://github.com/denoland) | [MIT](./src/bytes/LICENSE.md) | **1.0.6** | Zero or low | same as domain |
|
|
30
|
+
| [@std/collections](https://jsr.io/@std/collections) | [Deno authors](https://github.com/denoland) | [MIT](./src/collections/LICENSE.md) | **1.3.0** | Zero or low | same as domain |
|
|
31
|
+
| [@std/csv](https://jsr.io/@std/csv) | [Deno authors](https://github.com/denoland) | [MIT](./src/csv/LICENSE.md) | **1.0.6** | Low | same as domain |
|
|
32
|
+
| [@std/data-structures](https://jsr.io/@std/data-structures) | [Deno authors](https://github.com/denoland) | [MIT](./src/data-structures/LICENSE.md) | **1.1.1** | Zero or low | same as domain |
|
|
33
|
+
| [@std/encoding](https://jsr.io/@std/encoding) | [Deno authors](https://github.com/denoland) | [MIT](./src/encoding/LICENSE.md) | **1.0.11** | Low | same as domain |
|
|
34
|
+
| [@std/fmt](https://jsr.io/@std/fmt) | [Deno authors](https://github.com/denoland) | [MIT](./src/fmt/LICENSE.md) | **1.0.10** | Low | same as domain |
|
|
35
|
+
| [@std/json](https://jsr.io/@std/json) | [Deno authors](https://github.com/denoland) | [MIT](./src/json/LICENSE.md) | **1.1.0** | Low | same as domain |
|
|
36
|
+
| [@std/jsonc](https://jsr.io/@std/jsonc) | [Deno authors](https://github.com/denoland) | [MIT](./src/jsonc/LICENSE.md) | **1.0.2** | Zero or low | same as domain |
|
|
37
|
+
| [@std/media-types](https://jsr.io/@std/media-types) | [Deno authors](https://github.com/denoland) | [MIT](./src/media_types/LICENSE.md) | **1.1.0** | Zero or low | same as domain |
|
|
38
|
+
| [@std/streams](https://jsr.io/@std/streams) | [Deno authors](https://github.com/denoland) | [MIT](./src/streams/LICENSE.md) | **1.1.1** | Low | same as domain |
|
|
39
|
+
| [jose](https://github.com/panva/jose) | [Filip Skokan](https://github.com/panva) | [MIT](./src/jose/LICENSE.md) | **6.2.8** | Zero or low | same |
|
|
40
|
+
| [date-fns](https://date-fns.org/) | [Sasha Koss](https://github.com/kossnocorp) | [MIT](./src/date-fns/core/LICENSE.md) | **4.4.0** | Zero or low | same |
|
|
41
|
+
| [unidecode](https://github.com/FGRibreau/node-unidecode) | [Francois-Guillaume Ribreau](https://fgribreau.com) | [BSD](./src/unidecode/LICENSE.md) | **1.1.0** | Average | same |
|
|
42
|
+
| [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) | [Nikolay Kuchumov](https://gitlab.com/catamphetamine) | [MIT](./src/phonenumbers/LICENSE.md), [Apache](./src/phonenumbers//LICENSE.Apache.md) | **1.13.11** | High | phonenumbers |
|
|
43
|
+
| [logtape](https://logtape.org/) and parts: <br> @logtape/config, @logtape/file, <br> @logtape/pretty, @logtape/redaction, @logtape/syslog | [Hong Minhee (洪 民憙)](https://github.com/dahlia) | [MIT](./src/logtape/LICENSE.md) | **2.3.2** | Zero or low | same |
|
|
44
|
+
| [postgres.js](https://github.com/porsager/postgres/tree/master) | [Rasmus Porsager](https://github.com/porsager) | [UNLICENSE](./src/db/postgres/UNLICENSE.md) | **3.4.9** | Zero | same |
|
|
45
|
+
| [hono](https://hono.dev/) | [Yusuke Wada](https://github.com/yusukebe) | [MIT](./src/hono/LICENSE.md) | **4.13.5** | Low | same |
|
|
46
|
+
| [@hono/node-server](https://github.com/honojs/node-server) | [Yusuke Wada](https://github.com/yusukebe) | [MIT](./src/hono/node-server/LICENSE.md) | **2.1.1** | Zero or low | same |
|
|
47
|
+
| [cache-manager](https://cacheable.org/docs/cache-manager/) and parts: keyv, @keyv/serialize, @cacheable/utils, hashery, hookified | [Jared Wray](https://github.com/jaredwray) | [MIT](<./src/caching/LICENSE%20(cache-manager%20and%20parts).md>) | **7.2.9** | Average | caching |
|
|
48
|
+
| [commander.js](https://github.com/tj/commander.js) | [TJ Holowaychuk](https://github.com/tj)<br> [John Gee](https://github.com/shadowspawn) | [MIT](./src/cli/LICENSE.md) | **15.0.0** | Average | cli |
|
|
49
|
+
| [ley](https://github.com/lukeed/ley) and parts: <br> mk-dirs, totalist | [Luke Edwards](https://github.com/lukeed) | [MIT](./src/db/migrator/LICENSE.md) | **0.8.1** | High | db-migrator |
|
|
48
50
|
|
|
49
51
|
\* - integrated version of library
|
|
50
52
|
|
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ Inray - all-in-one инструментарий для разработки **No
|
|
|
64
64
|
|
|
65
65
|
<span style="color:red">I</span> - _"Поставка в составе SDK"_, исходная библиотека поставляется как есть
|
|
66
66
|
|
|
67
|
-
<span style="color:green">II</span> - _"Первичная интеграция"_, библиотека приводится под единый TypeScript конфиг + тесты переводится на Vitest (всё одинаковое в рамках SDK). Функционал по возможности остаётся как есть
|
|
67
|
+
<span style="color:green">II</span> - _"Первичная интеграция"_, библиотека приводится под единый TypeScript конфиг + тесты переводится на единую конфигурацию Vitest (всё одинаковое в рамках SDK). Функционал по возможности остаётся как есть
|
|
68
68
|
|
|
69
69
|
<span style="color:blue">III</span> - _"Рефакторинг" (форк)_, дублирующий API, по отношению к SDK - вычищается, библиотека начинает использовать инструментарий из SDK
|
|
70
70
|
|
|
@@ -84,14 +84,33 @@ Inray - all-in-one инструментарий для разработки **No
|
|
|
84
84
|
| Задачи по расписанию | /node-cron | <span style="color:green">II</span> | [node-cron](https://www.nodecron.com/) | |
|
|
85
85
|
| Валидация | /valibot | <span style="color:green">II</span> | [valibot (и его части)](https://valibot.dev/) | |
|
|
86
86
|
| Драйверы к базам данных | /db/postgres | <span style="color:red">I</span> | [postgres.js](https://github.com/porsager/postgres/tree/master) | |
|
|
87
|
+
| CLI средство для миграций БД | /db-migrator | <span style="color:blue">III</span> | [ley](https://github.com/lukeed/ley) | |
|
|
87
88
|
| Криптографические функции | /jose | <span style="color:green">II</span> | [jose](https://github.com/panva/jose) | |
|
|
88
89
|
| Работа с телефонными номерами | /phonenumbers | <span style="color:blue">III</span> | [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) | |
|
|
89
90
|
| Основной серверный фреймворк | /hono | <span style="color:green">II</span> | [hono](https://hono.dev/docs/) | |
|
|
90
91
|
| Различные инструменты и вспомогательные функции общего назначения | /utils | <span style="color:blue">III</span> | - | |
|
|
91
92
|
| Кеширование | /caching | <span style="color:blue">III</span> | [cache-manager (и его части)](https://cacheable.org/) | |
|
|
93
|
+
| Обработка аргументов командной строки (CLI) | /cli | <span style="color:green">II</span> | [commander.js](https://github.com/tj/commander.js) | |
|
|
92
94
|
|
|
93
95
|
\* _уровень может отображать как итог, так и процесс_
|
|
94
96
|
|
|
97
|
+
🚧⚠️🛠️ ROADMAP дальнейших интеграций 🚧⚠️🛠️:
|
|
98
|
+
|
|
99
|
+
- iconv (работа с кодировками) 🛠️...
|
|
100
|
+
- tedious (драйвер для работы с MS SQL Server) 🛠️...
|
|
101
|
+
- redis/valkey (кеширование) 🛠️...
|
|
102
|
+
- S3 (для работы с AWS, MiniO, RustFS и т.д.) 🛠️...
|
|
103
|
+
- kafka 🛠️...
|
|
104
|
+
- nodemailer либо upyo (для работы с SMTP/IMAP)
|
|
105
|
+
- amqp (для работы с RabbitMQ)
|
|
106
|
+
- ws и работа с сокетами
|
|
107
|
+
- graphql + dataloader (говорит само за себя)
|
|
108
|
+
- rpc (пока не определено конкретно)
|
|
109
|
+
- RxJS (мета, реактивность, под вопросом интеграции)
|
|
110
|
+
- fp-ts (мета, функциональная парадигма, под вопросом интеграции)
|
|
111
|
+
- await-to-js (мета, go-подобный стиль, под вопросом интеграции)
|
|
112
|
+
- immer (гарантии иммутабельности, под вопросом интеграции)
|
|
113
|
+
|
|
95
114
|
## Обновления и версионирование
|
|
96
115
|
|
|
97
116
|
In progress 🛠️...
|
|
@@ -116,6 +135,10 @@ In progress 🛠️...
|
|
|
116
135
|
|
|
117
136
|
In progress 🛠️...
|
|
118
137
|
|
|
138
|
+
### inray/cli - CLI приложения
|
|
139
|
+
|
|
140
|
+
In progress 🛠️...
|
|
141
|
+
|
|
119
142
|
### inray/collections - коллекции и вспомогательные функции для работы с итерируемыми объектами
|
|
120
143
|
|
|
121
144
|
In progress 🛠️...
|
|
@@ -132,7 +155,7 @@ In progress 🛠️...
|
|
|
132
155
|
|
|
133
156
|
In progress 🛠️...
|
|
134
157
|
|
|
135
|
-
### inray/db, inray/db/postgres - работа с БД
|
|
158
|
+
### inray/db, inray/db/postgres, inray/db-migrator - работа с БД
|
|
136
159
|
|
|
137
160
|
In progress 🛠️...
|
|
138
161
|
|
|
@@ -224,33 +247,35 @@ PERFORMANCE OF THIS SOFTWARE.
|
|
|
224
247
|
|
|
225
248
|
Integrated and modified external libraries:
|
|
226
249
|
|
|
227
|
-
| Library name | Author
|
|
228
|
-
| :---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
229
|
-
| [valibot](https://valibot.dev/) | [Fabian Hiller](https://github.com/fabian-hiller)
|
|
230
|
-
| [@valibot/i18n](https://github.com/open-circle/valibot/tree/main/packages/i18n) | [Fabian Hiller](https://github.com/fabian-hiller)
|
|
231
|
-
| [@valibot/to-json-schema](https://github.com/open-circle/valibot/tree/main/packages/to-json-schema) | [Fabian Hiller](https://github.com/fabian-hiller)
|
|
232
|
-
| [node-cron](https://www.nodecron.com/) | [Lucas Merencia](https://github.com/merencia)
|
|
233
|
-
| [yaml](https://eemeli.org/yaml/#yaml) | [Eemeli Aro](https://github.com/eemeli)
|
|
234
|
-
| [@std/async](https://jsr.io/@std/async) | [Deno authors](https://github.com/denoland)
|
|
235
|
-
| [@std/bytes](https://jsr.io/@std/bytes) | [Deno authors](https://github.com/denoland)
|
|
236
|
-
| [@std/collections](https://jsr.io/@std/collections) | [Deno authors](https://github.com/denoland)
|
|
237
|
-
| [@std/csv](https://jsr.io/@std/csv) | [Deno authors](https://github.com/denoland)
|
|
238
|
-
| [@std/data-structures](https://jsr.io/@std/data-structures) | [Deno authors](https://github.com/denoland)
|
|
239
|
-
| [@std/encoding](https://jsr.io/@std/encoding) | [Deno authors](https://github.com/denoland)
|
|
240
|
-
| [@std/fmt](https://jsr.io/@std/fmt) | [Deno authors](https://github.com/denoland)
|
|
241
|
-
| [@std/json](https://jsr.io/@std/json) | [Deno authors](https://github.com/denoland)
|
|
242
|
-
| [@std/jsonc](https://jsr.io/@std/jsonc) | [Deno authors](https://github.com/denoland)
|
|
243
|
-
| [@std/media-types](https://jsr.io/@std/media-types) | [Deno authors](https://github.com/denoland)
|
|
244
|
-
| [@std/streams](https://jsr.io/@std/streams) | [Deno authors](https://github.com/denoland)
|
|
245
|
-
| [jose](https://github.com/panva/jose) | [Filip Skokan](https://github.com/panva)
|
|
246
|
-
| [date-fns](https://date-fns.org/) | [Sasha Koss](https://github.com/kossnocorp)
|
|
247
|
-
| [unidecode](https://github.com/FGRibreau/node-unidecode) | [Francois-Guillaume Ribreau](https://fgribreau.com)
|
|
248
|
-
| [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) | [Nikolay Kuchumov](https://gitlab.com/catamphetamine)
|
|
249
|
-
| [logtape](https://logtape.org/) and parts: <br> @logtape/config, @logtape/file, <br> @logtape/pretty, @logtape/redaction, @logtape/syslog | [Hong Minhee (洪 民憙)](https://github.com/dahlia)
|
|
250
|
-
| [postgres.js](https://github.com/porsager/postgres/tree/master) | [Rasmus Porsager](https://github.com/porsager)
|
|
251
|
-
| [hono](https://hono.dev/) | [Yusuke Wada](https://github.com/yusukebe)
|
|
252
|
-
| [@hono/node-server](https://github.com/honojs/node-server) | [Yusuke Wada](https://github.com/yusukebe)
|
|
253
|
-
| [cache-manager](https://cacheable.org/docs/cache-manager/) and parts: keyv, @keyv/serialize, @cacheable/utils, hashery, hookified | [Jared Wray](https://github.com/jaredwray)
|
|
250
|
+
| Library name | Author | License | Version\* | Modification level\*\* | Internal name\*\*\* |
|
|
251
|
+
| :---------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------- | :---------: | :--------------- | ---------------------- | ------------------- |
|
|
252
|
+
| [valibot](https://valibot.dev/) | [Fabian Hiller](https://github.com/fabian-hiller) | MIT | **1.4.2** | Zero or low | same |
|
|
253
|
+
| [@valibot/i18n](https://github.com/open-circle/valibot/tree/main/packages/i18n) | [Fabian Hiller](https://github.com/fabian-hiller) | MIT | **1.2.0** | Zero or low | same |
|
|
254
|
+
| [@valibot/to-json-schema](https://github.com/open-circle/valibot/tree/main/packages/to-json-schema) | [Fabian Hiller](https://github.com/fabian-hiller) | MIT | **1.7.1** | Zero | same |
|
|
255
|
+
| [node-cron](https://www.nodecron.com/) | [Lucas Merencia](https://github.com/merencia) | ISC | **4.6.0** | Zero or low | same |
|
|
256
|
+
| [yaml](https://eemeli.org/yaml/#yaml) | [Eemeli Aro](https://github.com/eemeli) | ISC | **3.0.0-1 (RC)** | Zero or low | same |
|
|
257
|
+
| [@std/async](https://jsr.io/@std/async) | [Deno authors](https://github.com/denoland) | MIT | **1.5.0** | Zero or low | same as domain |
|
|
258
|
+
| [@std/bytes](https://jsr.io/@std/bytes) | [Deno authors](https://github.com/denoland) | MIT | **1.0.6** | Zero or low | same as domain |
|
|
259
|
+
| [@std/collections](https://jsr.io/@std/collections) | [Deno authors](https://github.com/denoland) | MIT | **1.3.0** | Zero or low | same as domain |
|
|
260
|
+
| [@std/csv](https://jsr.io/@std/csv) | [Deno authors](https://github.com/denoland) | MIT | **1.0.6** | Low | same as domain |
|
|
261
|
+
| [@std/data-structures](https://jsr.io/@std/data-structures) | [Deno authors](https://github.com/denoland) | MIT | **1.1.1** | Zero or low | same as domain |
|
|
262
|
+
| [@std/encoding](https://jsr.io/@std/encoding) | [Deno authors](https://github.com/denoland) | MIT | **1.0.11** | Low | same as domain |
|
|
263
|
+
| [@std/fmt](https://jsr.io/@std/fmt) | [Deno authors](https://github.com/denoland) | MIT | **1.0.10** | Low | same as domain |
|
|
264
|
+
| [@std/json](https://jsr.io/@std/json) | [Deno authors](https://github.com/denoland) | MIT | **1.1.0** | Low | same as domain |
|
|
265
|
+
| [@std/jsonc](https://jsr.io/@std/jsonc) | [Deno authors](https://github.com/denoland) | MIT | **1.0.2** | Zero or low | same as domain |
|
|
266
|
+
| [@std/media-types](https://jsr.io/@std/media-types) | [Deno authors](https://github.com/denoland) | MIT | **1.1.0** | Zero or low | same as domain |
|
|
267
|
+
| [@std/streams](https://jsr.io/@std/streams) | [Deno authors](https://github.com/denoland) | MIT | **1.1.1** | Low | same as domain |
|
|
268
|
+
| [jose](https://github.com/panva/jose) | [Filip Skokan](https://github.com/panva) | MIT | **6.2.8** | Zero or low | same |
|
|
269
|
+
| [date-fns](https://date-fns.org/) | [Sasha Koss](https://github.com/kossnocorp) | MIT | **4.4.0** | Zero or low | same |
|
|
270
|
+
| [unidecode](https://github.com/FGRibreau/node-unidecode) | [Francois-Guillaume Ribreau](https://fgribreau.com) | BSD | **1.1.0** | Average | same |
|
|
271
|
+
| [libphonenumber-js](https://gitlab.com/catamphetamine/libphonenumber-js) | [Nikolay Kuchumov](https://gitlab.com/catamphetamine) | MIT, Apache | **1.13.11** | High | phonenumbers |
|
|
272
|
+
| [logtape](https://logtape.org/) and parts: <br> @logtape/config, @logtape/file, <br> @logtape/pretty, @logtape/redaction, @logtape/syslog | [Hong Minhee (洪 民憙)](https://github.com/dahlia) | MIT | **2.3.2** | Zero or low | same |
|
|
273
|
+
| [postgres.js](https://github.com/porsager/postgres/tree/master) | [Rasmus Porsager](https://github.com/porsager) | UNLICENSE | **3.4.9** | Zero | same |
|
|
274
|
+
| [hono](https://hono.dev/) | [Yusuke Wada](https://github.com/yusukebe) | MIT | **4.13.5** | Low | same |
|
|
275
|
+
| [@hono/node-server](https://github.com/honojs/node-server) | [Yusuke Wada](https://github.com/yusukebe) | MIT | **2.1.1** | Zero or low | same |
|
|
276
|
+
| [cache-manager](https://cacheable.org/docs/cache-manager/) and parts: keyv, @keyv/serialize, @cacheable/utils, hashery, hookified | [Jared Wray](https://github.com/jaredwray) | MIT | **7.2.9** | Average | caching |
|
|
277
|
+
| [commander.js](https://github.com/tj/commander.js) | [TJ Holowaychuk](https://github.com/tj)<br> [John Gee](https://github.com/shadowspawn) | MIT | **15.0.0** | Average | cli |
|
|
278
|
+
| [ley](https://github.com/lukeed/ley) and parts: <br> mk-dirs, totalist | [Luke Edwards](https://github.com/lukeed) | MIT | **0.8.1** | High | db-migrator |
|
|
254
279
|
|
|
255
280
|
\* - integrated version of library
|
|
256
281
|
|
|
@@ -301,3 +326,6 @@ However, sometimes integrated libraries change their original name for one or mo
|
|
|
301
326
|
- [Tomas Zijdemans](https://github.com/tomas-zijdemans)
|
|
302
327
|
- [Rasmus Porsager](https://github.com/porsager)
|
|
303
328
|
- [Jared Wray](https://github.com/jaredwray)
|
|
329
|
+
- [TJ Holowaychuk](https://github.com/tj)
|
|
330
|
+
- [John Gee](https://github.com/shadowspawn)
|
|
331
|
+
- [Luke Edwards](https://github.com/lukeed)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/cli/mod.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
package/dist/cli/mod.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mod.js","sourceRoot":"","sources":["../../src/cli/mod.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Original library: commander.js (v15.0.0)
|
|
3
|
+
* - Copyright (c) 2011 TJ Holowaychuk
|
|
4
|
+
* - Copyright (c) John Gee and "commander.js" authors
|
|
5
|
+
*
|
|
6
|
+
* Modified and integrated in "Inray":
|
|
7
|
+
* - Evgeniy Bushin
|
|
8
|
+
*/
|
|
9
|
+
/***/
|
|
10
|
+
import { Argument } from './lib/argument.ts';
|
|
11
|
+
import { Command } from './lib/command.ts';
|
|
12
|
+
import { CommanderError, InvalidArgumentError } from './lib/error.ts';
|
|
13
|
+
import { Help } from './lib/help.ts';
|
|
14
|
+
import { Option } from './lib/option.ts';
|
|
15
|
+
export declare const program: Command;
|
|
16
|
+
export declare const createCommand: (name: string) => Command;
|
|
17
|
+
export declare const createOption: (flags: string, description?: string) => Option;
|
|
18
|
+
export declare const createArgument: (name: string, description?: string) => Argument;
|
|
19
|
+
/**
|
|
20
|
+
* Expose classes
|
|
21
|
+
*/
|
|
22
|
+
export { Command, Option, Argument, Help };
|
|
23
|
+
export { CommanderError, InvalidArgumentError };
|
|
24
|
+
export { InvalidArgumentError as InvalidOptionArgumentError };
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,KAAK;AAEL,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,eAAO,MAAM,OAAO,SAAgB,CAAC;AAErC,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,YAAsB,CAAC;AACjE,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,EAAE,cAAc,MAAM,WAAmC,CAAC;AACpG,eAAO,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,cAAc,MAAM,aAAoC,CAAC;AAEtG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC;AAChD,OAAO,EAAE,oBAAoB,IAAI,0BAA0B,EAAE,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Original library: commander.js (v15.0.0)
|
|
3
|
+
* - Copyright (c) 2011 TJ Holowaychuk
|
|
4
|
+
* - Copyright (c) John Gee and "commander.js" authors
|
|
5
|
+
*
|
|
6
|
+
* Modified and integrated in "Inray":
|
|
7
|
+
* - Evgeniy Bushin
|
|
8
|
+
*/
|
|
9
|
+
/***/
|
|
10
|
+
import { Argument } from "./lib/argument.js";
|
|
11
|
+
import { Command } from "./lib/command.js";
|
|
12
|
+
import { CommanderError, InvalidArgumentError } from "./lib/error.js";
|
|
13
|
+
import { Help } from "./lib/help.js";
|
|
14
|
+
import { Option } from "./lib/option.js";
|
|
15
|
+
export const program = new Command();
|
|
16
|
+
export const createCommand = (name) => new Command(name);
|
|
17
|
+
export const createOption = (flags, description) => new Option(flags, description);
|
|
18
|
+
export const createArgument = (name, description) => new Argument(name, description);
|
|
19
|
+
/**
|
|
20
|
+
* Expose classes
|
|
21
|
+
*/
|
|
22
|
+
export { Command, Option, Argument, Help };
|
|
23
|
+
export { CommanderError, InvalidArgumentError };
|
|
24
|
+
export { InvalidArgumentError as InvalidOptionArgumentError }; // Deprecated
|
|
25
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cli/src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,KAAK;AAEL,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAErC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,KAAa,EAAE,WAAoB,EAAE,EAAE,CAAC,IAAI,MAAM,CAAC,KAAK,EAAE,WAAW,CAAC,CAAC;AACpG,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,WAAoB,EAAE,EAAE,CAAC,IAAI,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;AAEtG;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;AAC3C,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,CAAC;AAChD,OAAO,EAAE,oBAAoB,IAAI,0BAA0B,EAAE,CAAC,CAAC,aAAa"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Original library: commander.js (v15.0.0)
|
|
3
|
+
* - Copyright (c) 2011 TJ Holowaychuk
|
|
4
|
+
* - Copyright (c) John Gee and "commander.js" authors
|
|
5
|
+
*
|
|
6
|
+
* Modified and integrated in "Inray":
|
|
7
|
+
* - Evgeniy Bushin
|
|
8
|
+
*/
|
|
9
|
+
/***/
|
|
10
|
+
export type ArgumentParseFunction = (value: string, previous: any) => any;
|
|
11
|
+
export declare class Argument {
|
|
12
|
+
description: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
variadic: boolean;
|
|
15
|
+
defaultValue?: any;
|
|
16
|
+
defaultValueDescription?: string;
|
|
17
|
+
parseArg?: ArgumentParseFunction;
|
|
18
|
+
argChoices?: string[];
|
|
19
|
+
_name: string;
|
|
20
|
+
/**
|
|
21
|
+
* Initialize a new command argument with the given name and description.
|
|
22
|
+
* The default is that the argument is required, and you can explicitly
|
|
23
|
+
* indicate this with <> around the name. Put [] around the name for an optional argument.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} name
|
|
26
|
+
* @param {string} [description]
|
|
27
|
+
*/
|
|
28
|
+
constructor(name: string, description?: string);
|
|
29
|
+
/**
|
|
30
|
+
* Return argument name.
|
|
31
|
+
*
|
|
32
|
+
* @return {string}
|
|
33
|
+
*/
|
|
34
|
+
name(): string;
|
|
35
|
+
/**
|
|
36
|
+
* @package
|
|
37
|
+
*/
|
|
38
|
+
_collectValue(value: any, previous: any): any;
|
|
39
|
+
/**
|
|
40
|
+
* Set the default value, and optionally supply the description to be displayed in the help.
|
|
41
|
+
*
|
|
42
|
+
* @param {*} value
|
|
43
|
+
* @param {string} [description]
|
|
44
|
+
* @return {Argument}
|
|
45
|
+
*/
|
|
46
|
+
default(value: unknown, description?: string): this;
|
|
47
|
+
/**
|
|
48
|
+
* Set the custom handler for processing CLI command arguments into argument values.
|
|
49
|
+
*
|
|
50
|
+
* @param {Function} [fn]
|
|
51
|
+
* @return {Argument}
|
|
52
|
+
*/
|
|
53
|
+
argParser(fn: ArgumentParseFunction): this;
|
|
54
|
+
/**
|
|
55
|
+
* Only allow argument value to be one of choices.
|
|
56
|
+
*
|
|
57
|
+
* @param {string[]} values
|
|
58
|
+
* @return {Argument}
|
|
59
|
+
*/
|
|
60
|
+
choices(values: readonly string[]): this;
|
|
61
|
+
/**
|
|
62
|
+
* Make argument required.
|
|
63
|
+
*
|
|
64
|
+
* @returns {Argument}
|
|
65
|
+
*/
|
|
66
|
+
argRequired(): this;
|
|
67
|
+
/**
|
|
68
|
+
* Make argument optional.
|
|
69
|
+
*
|
|
70
|
+
* @returns {Argument}
|
|
71
|
+
*/
|
|
72
|
+
argOptional(): this;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Takes an argument and returns its human readable equivalent for help usage.
|
|
76
|
+
*
|
|
77
|
+
* @param {Argument} arg
|
|
78
|
+
* @return {string}
|
|
79
|
+
* @private
|
|
80
|
+
*/
|
|
81
|
+
export declare function humanReadableArgName(arg: Argument): string;
|
|
82
|
+
//# sourceMappingURL=argument.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argument.d.ts","sourceRoot":"","sources":["../../../../src/cli/src/lib/argument.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,KAAK;AAIL,MAAM,MAAM,qBAAqB,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,GAAG,KAAK,GAAG,CAAC;AAE1E,qBAAa,QAAQ;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,GAAG,CAAC;IACnB,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,EAAE,qBAAqB,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;gBACS,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM;IA6B9C;;;;OAIG;IACH,IAAI,IAAI,MAAM;IAId;;OAEG;IACH,aAAa,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,GAAG,GAAG;IAS7C;;;;;;OAMG;IACH,OAAO,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI;IAMnD;;;;;OAKG;IACH,SAAS,CAAC,EAAE,EAAE,qBAAqB,GAAG,IAAI;IAK1C;;;;;OAKG;IACH,OAAO,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,GAAG,IAAI;IAcxC;;;;OAIG;IACH,WAAW;IAKX;;;;OAIG;IACH,WAAW;CAIZ;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,QAAQ,GAAG,MAAM,CAI1D"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Original library: commander.js (v15.0.0)
|
|
3
|
+
* - Copyright (c) 2011 TJ Holowaychuk
|
|
4
|
+
* - Copyright (c) John Gee and "commander.js" authors
|
|
5
|
+
*
|
|
6
|
+
* Modified and integrated in "Inray":
|
|
7
|
+
* - Evgeniy Bushin
|
|
8
|
+
*/
|
|
9
|
+
/***/
|
|
10
|
+
import { InvalidArgumentError } from "./error.js";
|
|
11
|
+
export class Argument {
|
|
12
|
+
description;
|
|
13
|
+
required;
|
|
14
|
+
variadic;
|
|
15
|
+
defaultValue;
|
|
16
|
+
defaultValueDescription;
|
|
17
|
+
parseArg;
|
|
18
|
+
argChoices;
|
|
19
|
+
_name;
|
|
20
|
+
/**
|
|
21
|
+
* Initialize a new command argument with the given name and description.
|
|
22
|
+
* The default is that the argument is required, and you can explicitly
|
|
23
|
+
* indicate this with <> around the name. Put [] around the name for an optional argument.
|
|
24
|
+
*
|
|
25
|
+
* @param {string} name
|
|
26
|
+
* @param {string} [description]
|
|
27
|
+
*/
|
|
28
|
+
constructor(name, description) {
|
|
29
|
+
this.description = description || '';
|
|
30
|
+
this.variadic = false;
|
|
31
|
+
this.parseArg = undefined;
|
|
32
|
+
this.defaultValue = undefined;
|
|
33
|
+
this.defaultValueDescription = undefined;
|
|
34
|
+
this.argChoices = undefined;
|
|
35
|
+
switch (name[0]) {
|
|
36
|
+
case '<': // e.g. <required>
|
|
37
|
+
this.required = true;
|
|
38
|
+
this._name = name.slice(1, -1);
|
|
39
|
+
break;
|
|
40
|
+
case '[': // e.g. [optional]
|
|
41
|
+
this.required = false;
|
|
42
|
+
this._name = name.slice(1, -1);
|
|
43
|
+
break;
|
|
44
|
+
default:
|
|
45
|
+
this.required = true;
|
|
46
|
+
this._name = name;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
if (this._name.endsWith('...')) {
|
|
50
|
+
this.variadic = true;
|
|
51
|
+
this._name = this._name.slice(0, -3);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Return argument name.
|
|
56
|
+
*
|
|
57
|
+
* @return {string}
|
|
58
|
+
*/
|
|
59
|
+
name() {
|
|
60
|
+
return this._name;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @package
|
|
64
|
+
*/
|
|
65
|
+
_collectValue(value, previous) {
|
|
66
|
+
if (previous === this.defaultValue || !Array.isArray(previous)) {
|
|
67
|
+
return [value];
|
|
68
|
+
}
|
|
69
|
+
previous.push(value);
|
|
70
|
+
return previous;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Set the default value, and optionally supply the description to be displayed in the help.
|
|
74
|
+
*
|
|
75
|
+
* @param {*} value
|
|
76
|
+
* @param {string} [description]
|
|
77
|
+
* @return {Argument}
|
|
78
|
+
*/
|
|
79
|
+
default(value, description) {
|
|
80
|
+
this.defaultValue = value;
|
|
81
|
+
this.defaultValueDescription = description;
|
|
82
|
+
return this;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Set the custom handler for processing CLI command arguments into argument values.
|
|
86
|
+
*
|
|
87
|
+
* @param {Function} [fn]
|
|
88
|
+
* @return {Argument}
|
|
89
|
+
*/
|
|
90
|
+
argParser(fn) {
|
|
91
|
+
this.parseArg = fn;
|
|
92
|
+
return this;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Only allow argument value to be one of choices.
|
|
96
|
+
*
|
|
97
|
+
* @param {string[]} values
|
|
98
|
+
* @return {Argument}
|
|
99
|
+
*/
|
|
100
|
+
choices(values) {
|
|
101
|
+
this.argChoices = values.slice();
|
|
102
|
+
this.parseArg = (arg, previous) => {
|
|
103
|
+
if (!this.argChoices?.includes(arg)) {
|
|
104
|
+
throw new InvalidArgumentError(`Allowed choices are ${this.argChoices?.join(', ')}.`);
|
|
105
|
+
}
|
|
106
|
+
if (this.variadic) {
|
|
107
|
+
return this._collectValue(arg, previous);
|
|
108
|
+
}
|
|
109
|
+
return arg;
|
|
110
|
+
};
|
|
111
|
+
return this;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Make argument required.
|
|
115
|
+
*
|
|
116
|
+
* @returns {Argument}
|
|
117
|
+
*/
|
|
118
|
+
argRequired() {
|
|
119
|
+
this.required = true;
|
|
120
|
+
return this;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Make argument optional.
|
|
124
|
+
*
|
|
125
|
+
* @returns {Argument}
|
|
126
|
+
*/
|
|
127
|
+
argOptional() {
|
|
128
|
+
this.required = false;
|
|
129
|
+
return this;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Takes an argument and returns its human readable equivalent for help usage.
|
|
134
|
+
*
|
|
135
|
+
* @param {Argument} arg
|
|
136
|
+
* @return {string}
|
|
137
|
+
* @private
|
|
138
|
+
*/
|
|
139
|
+
export function humanReadableArgName(arg) {
|
|
140
|
+
const nameOutput = arg.name() + (arg.variadic === true ? '...' : '');
|
|
141
|
+
return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=argument.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"argument.js","sourceRoot":"","sources":["../../../../src/cli/src/lib/argument.ts"],"names":[],"mappings":"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"}
|