@ryanatkn/gro 0.191.0 → 0.192.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/README.md +4 -278
- package/package.json +5 -142
- package/LICENSE +0 -21
- package/dist/args.d.ts +0 -37
- package/dist/args.d.ts.map +0 -1
- package/dist/args.js +0 -102
- package/dist/build.task.d.ts +0 -20
- package/dist/build.task.d.ts.map +0 -1
- package/dist/build.task.js +0 -119
- package/dist/build_cache.d.ts +0 -100
- package/dist/build_cache.d.ts.map +0 -1
- package/dist/build_cache.js +0 -299
- package/dist/changelog.d.ts +0 -11
- package/dist/changelog.d.ts.map +0 -1
- package/dist/changelog.js +0 -47
- package/dist/changeset.task.d.ts +0 -35
- package/dist/changeset.task.d.ts.map +0 -1
- package/dist/changeset.task.js +0 -151
- package/dist/changeset_helpers.d.ts +0 -17
- package/dist/changeset_helpers.d.ts.map +0 -1
- package/dist/changeset_helpers.js +0 -7
- package/dist/check.task.d.ts +0 -28
- package/dist/check.task.d.ts.map +0 -1
- package/dist/check.task.js +0 -104
- package/dist/child_process_logging.d.ts +0 -10
- package/dist/child_process_logging.d.ts.map +0 -1
- package/dist/child_process_logging.js +0 -26
- package/dist/clean.task.d.ts +0 -15
- package/dist/clean.task.d.ts.map +0 -1
- package/dist/clean.task.js +0 -40
- package/dist/clean_fs.d.ts +0 -9
- package/dist/clean_fs.d.ts.map +0 -1
- package/dist/clean_fs.js +0 -28
- package/dist/cli.d.ts +0 -34
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -61
- package/dist/commit.task.d.ts +0 -11
- package/dist/commit.task.d.ts.map +0 -1
- package/dist/commit.task.js +0 -24
- package/dist/constants.d.ts +0 -46
- package/dist/constants.d.ts.map +0 -1
- package/dist/constants.js +0 -52
- package/dist/deploy.task.d.ts +0 -29
- package/dist/deploy.task.d.ts.map +0 -1
- package/dist/deploy.task.js +0 -217
- package/dist/dev.task.d.ts +0 -16
- package/dist/dev.task.d.ts.map +0 -1
- package/dist/dev.task.js +0 -44
- package/dist/disknode.d.ts +0 -23
- package/dist/disknode.d.ts.map +0 -1
- package/dist/disknode.js +0 -1
- package/dist/env.d.ts +0 -11
- package/dist/env.d.ts.map +0 -1
- package/dist/env.js +0 -49
- package/dist/esbuild_helpers.d.ts +0 -16
- package/dist/esbuild_helpers.d.ts.map +0 -1
- package/dist/esbuild_helpers.js +0 -36
- package/dist/esbuild_plugin_external_worker.d.ts +0 -23
- package/dist/esbuild_plugin_external_worker.d.ts.map +0 -1
- package/dist/esbuild_plugin_external_worker.js +0 -55
- package/dist/esbuild_plugin_svelte.d.ts +0 -15
- package/dist/esbuild_plugin_svelte.d.ts.map +0 -1
- package/dist/esbuild_plugin_svelte.js +0 -83
- package/dist/esbuild_plugin_sveltekit_local_imports.d.ts +0 -8
- package/dist/esbuild_plugin_sveltekit_local_imports.d.ts.map +0 -1
- package/dist/esbuild_plugin_sveltekit_local_imports.js +0 -30
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts +0 -7
- package/dist/esbuild_plugin_sveltekit_shim_alias.d.ts.map +0 -1
- package/dist/esbuild_plugin_sveltekit_shim_alias.js +0 -18
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts +0 -9
- package/dist/esbuild_plugin_sveltekit_shim_app.d.ts.map +0 -1
- package/dist/esbuild_plugin_sveltekit_shim_app.js +0 -22
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts +0 -11
- package/dist/esbuild_plugin_sveltekit_shim_env.d.ts.map +0 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.js +0 -18
- package/dist/filer.d.ts +0 -33
- package/dist/filer.d.ts.map +0 -1
- package/dist/filer.js +0 -385
- package/dist/format.task.d.ts +0 -11
- package/dist/format.task.d.ts.map +0 -1
- package/dist/format.task.js +0 -27
- package/dist/format_directory.d.ts +0 -13
- package/dist/format_directory.d.ts.map +0 -1
- package/dist/format_directory.js +0 -40
- package/dist/format_file.d.ts +0 -9
- package/dist/format_file.d.ts.map +0 -1
- package/dist/format_file.js +0 -42
- package/dist/gen.d.ts +0 -142
- package/dist/gen.d.ts.map +0 -1
- package/dist/gen.js +0 -199
- package/dist/gen.task.d.ts +0 -12
- package/dist/gen.task.d.ts.map +0 -1
- package/dist/gen.task.js +0 -149
- package/dist/gen_helpers.d.ts +0 -11
- package/dist/gen_helpers.d.ts.map +0 -1
- package/dist/gen_helpers.js +0 -76
- package/dist/github.d.ts +0 -19
- package/dist/github.d.ts.map +0 -1
- package/dist/github.js +0 -33
- package/dist/gro.config.default.d.ts +0 -13
- package/dist/gro.config.default.d.ts.map +0 -1
- package/dist/gro.config.default.js +0 -33
- package/dist/gro.d.ts +0 -3
- package/dist/gro.d.ts.map +0 -1
- package/dist/gro.js +0 -21
- package/dist/gro_config.d.ts +0 -115
- package/dist/gro_config.d.ts.map +0 -1
- package/dist/gro_config.js +0 -114
- package/dist/gro_helpers.d.ts +0 -49
- package/dist/gro_helpers.d.ts.map +0 -1
- package/dist/gro_helpers.js +0 -97
- package/dist/gro_plugin_gen.d.ts +0 -12
- package/dist/gro_plugin_gen.d.ts.map +0 -1
- package/dist/gro_plugin_gen.js +0 -101
- package/dist/gro_plugin_server.d.ts +0 -80
- package/dist/gro_plugin_server.d.ts.map +0 -1
- package/dist/gro_plugin_server.js +0 -167
- package/dist/gro_plugin_sveltekit_app.d.ts +0 -9
- package/dist/gro_plugin_sveltekit_app.d.ts.map +0 -1
- package/dist/gro_plugin_sveltekit_app.js +0 -42
- package/dist/gro_plugin_sveltekit_library.d.ts +0 -16
- package/dist/gro_plugin_sveltekit_library.d.ts.map +0 -1
- package/dist/gro_plugin_sveltekit_library.js +0 -34
- package/dist/index.d.ts +0 -9
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -4
- package/dist/input_path.d.ts +0 -64
- package/dist/input_path.d.ts.map +0 -1
- package/dist/input_path.js +0 -199
- package/dist/invoke.d.ts +0 -2
- package/dist/invoke.d.ts.map +0 -1
- package/dist/invoke.js +0 -28
- package/dist/invoke_task.d.ts +0 -30
- package/dist/invoke_task.d.ts.map +0 -1
- package/dist/invoke_task.js +0 -104
- package/dist/lint.task.d.ts +0 -11
- package/dist/lint.task.d.ts.map +0 -1
- package/dist/lint.task.js +0 -32
- package/dist/loader.d.ts +0 -6
- package/dist/loader.d.ts.map +0 -1
- package/dist/loader.js +0 -192
- package/dist/module.d.ts +0 -4
- package/dist/module.d.ts.map +0 -1
- package/dist/module.js +0 -6
- package/dist/modules.d.ts +0 -36
- package/dist/modules.d.ts.map +0 -1
- package/dist/modules.js +0 -71
- package/dist/package_json.d.ts +0 -32
- package/dist/package_json.d.ts.map +0 -1
- package/dist/package_json.js +0 -178
- package/dist/parse_exports.d.ts +0 -20
- package/dist/parse_exports.d.ts.map +0 -1
- package/dist/parse_exports.js +0 -65
- package/dist/parse_exports_context.d.ts +0 -21
- package/dist/parse_exports_context.d.ts.map +0 -1
- package/dist/parse_exports_context.js +0 -332
- package/dist/parse_imports.d.ts +0 -5
- package/dist/parse_imports.d.ts.map +0 -1
- package/dist/parse_imports.js +0 -140
- package/dist/paths.d.ts +0 -41
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.js +0 -69
- package/dist/plugin.d.ts +0 -36
- package/dist/plugin.d.ts.map +0 -1
- package/dist/plugin.js +0 -78
- package/dist/publish.task.d.ts +0 -26
- package/dist/publish.task.d.ts.map +0 -1
- package/dist/publish.task.js +0 -176
- package/dist/register.d.ts +0 -2
- package/dist/register.d.ts.map +0 -1
- package/dist/register.js +0 -2
- package/dist/reinstall.task.d.ts +0 -8
- package/dist/reinstall.task.d.ts.map +0 -1
- package/dist/reinstall.task.js +0 -35
- package/dist/release.task.d.ts +0 -8
- package/dist/release.task.d.ts.map +0 -1
- package/dist/release.task.js +0 -20
- package/dist/resolve.task.d.ts +0 -11
- package/dist/resolve.task.d.ts.map +0 -1
- package/dist/resolve.task.js +0 -38
- package/dist/resolve_specifier.d.ts +0 -22
- package/dist/resolve_specifier.d.ts.map +0 -1
- package/dist/resolve_specifier.js +0 -57
- package/dist/run.task.d.ts +0 -16
- package/dist/run.task.d.ts.map +0 -1
- package/dist/run.task.js +0 -52
- package/dist/run_gen.d.ts +0 -10
- package/dist/run_gen.d.ts.map +0 -1
- package/dist/run_gen.js +0 -73
- package/dist/run_task.d.ts +0 -17
- package/dist/run_task.d.ts.map +0 -1
- package/dist/run_task.js +0 -45
- package/dist/source_json.d.ts +0 -7
- package/dist/source_json.d.ts.map +0 -1
- package/dist/source_json.js +0 -145
- package/dist/svelte_config.d.ts +0 -57
- package/dist/svelte_config.d.ts.map +0 -1
- package/dist/svelte_config.js +0 -81
- package/dist/sveltekit_helpers.d.ts +0 -75
- package/dist/sveltekit_helpers.d.ts.map +0 -1
- package/dist/sveltekit_helpers.js +0 -94
- package/dist/sveltekit_shim_app.d.ts +0 -11
- package/dist/sveltekit_shim_app.d.ts.map +0 -1
- package/dist/sveltekit_shim_app.js +0 -31
- package/dist/sveltekit_shim_app_environment.d.ts +0 -13
- package/dist/sveltekit_shim_app_environment.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_environment.js +0 -14
- package/dist/sveltekit_shim_app_forms.d.ts +0 -5
- package/dist/sveltekit_shim_app_forms.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_forms.js +0 -6
- package/dist/sveltekit_shim_app_navigation.d.ts +0 -10
- package/dist/sveltekit_shim_app_navigation.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_navigation.js +0 -11
- package/dist/sveltekit_shim_app_paths.d.ts +0 -17
- package/dist/sveltekit_shim_app_paths.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_paths.js +0 -10
- package/dist/sveltekit_shim_app_state.d.ts +0 -5
- package/dist/sveltekit_shim_app_state.d.ts.map +0 -1
- package/dist/sveltekit_shim_app_state.js +0 -26
- package/dist/sveltekit_shim_env.d.ts +0 -5
- package/dist/sveltekit_shim_env.d.ts.map +0 -1
- package/dist/sveltekit_shim_env.js +0 -23
- package/dist/sync.task.d.ts +0 -16
- package/dist/sync.task.d.ts.map +0 -1
- package/dist/sync.task.js +0 -39
- package/dist/task.d.ts +0 -98
- package/dist/task.d.ts.map +0 -1
- package/dist/task.js +0 -109
- package/dist/task_logging.d.ts +0 -6
- package/dist/task_logging.d.ts.map +0 -1
- package/dist/task_logging.js +0 -201
- package/dist/test.task.d.ts +0 -13
- package/dist/test.task.d.ts.map +0 -1
- package/dist/test.task.js +0 -53
- package/dist/typecheck.task.d.ts +0 -13
- package/dist/typecheck.task.d.ts.map +0 -1
- package/dist/typecheck.task.js +0 -68
- package/dist/upgrade.task.d.ts +0 -20
- package/dist/upgrade.task.d.ts.map +0 -1
- package/dist/upgrade.task.js +0 -111
- package/dist/watch_dir.d.ts +0 -36
- package/dist/watch_dir.d.ts.map +0 -1
- package/dist/watch_dir.js +0 -69
- package/src/lib/args.ts +0 -115
- package/src/lib/build.task.ts +0 -151
- package/src/lib/build_cache.ts +0 -378
- package/src/lib/changelog.ts +0 -69
- package/src/lib/changeset.task.ts +0 -228
- package/src/lib/changeset_helpers.ts +0 -14
- package/src/lib/check.task.ts +0 -132
- package/src/lib/child_process_logging.ts +0 -38
- package/src/lib/clean.task.ts +0 -48
- package/src/lib/clean_fs.ts +0 -54
- package/src/lib/cli.ts +0 -98
- package/src/lib/commit.task.ts +0 -34
- package/src/lib/constants.ts +0 -56
- package/src/lib/deploy.task.ts +0 -287
- package/src/lib/dev.task.ts +0 -52
- package/src/lib/disknode.ts +0 -26
- package/src/lib/env.ts +0 -78
- package/src/lib/esbuild_helpers.ts +0 -49
- package/src/lib/esbuild_plugin_external_worker.ts +0 -94
- package/src/lib/esbuild_plugin_svelte.ts +0 -134
- package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +0 -38
- package/src/lib/esbuild_plugin_sveltekit_shim_alias.ts +0 -27
- package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +0 -42
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +0 -47
- package/src/lib/filer.ts +0 -458
- package/src/lib/format.task.ts +0 -44
- package/src/lib/format_directory.ts +0 -65
- package/src/lib/format_file.ts +0 -49
- package/src/lib/gen.task.ts +0 -206
- package/src/lib/gen.ts +0 -406
- package/src/lib/gen_helpers.ts +0 -131
- package/src/lib/github.ts +0 -46
- package/src/lib/gro.config.default.ts +0 -42
- package/src/lib/gro.ts +0 -29
- package/src/lib/gro_config.ts +0 -254
- package/src/lib/gro_helpers.ts +0 -108
- package/src/lib/gro_plugin_gen.ts +0 -149
- package/src/lib/gro_plugin_server.ts +0 -288
- package/src/lib/gro_plugin_sveltekit_app.ts +0 -58
- package/src/lib/gro_plugin_sveltekit_library.ts +0 -63
- package/src/lib/index.ts +0 -8
- package/src/lib/input_path.ts +0 -254
- package/src/lib/invoke.ts +0 -34
- package/src/lib/invoke_task.ts +0 -139
- package/src/lib/lint.task.ts +0 -39
- package/src/lib/loader.ts +0 -229
- package/src/lib/module.ts +0 -13
- package/src/lib/modules.ts +0 -117
- package/src/lib/package_json.ts +0 -255
- package/src/lib/parse_exports.ts +0 -100
- package/src/lib/parse_exports_context.ts +0 -395
- package/src/lib/parse_imports.ts +0 -180
- package/src/lib/paths.ts +0 -111
- package/src/lib/plugin.ts +0 -106
- package/src/lib/publish.task.ts +0 -228
- package/src/lib/register.ts +0 -3
- package/src/lib/reinstall.task.ts +0 -45
- package/src/lib/release.task.ts +0 -26
- package/src/lib/resolve.task.ts +0 -43
- package/src/lib/resolve_specifier.ts +0 -81
- package/src/lib/run.task.ts +0 -65
- package/src/lib/run_gen.ts +0 -110
- package/src/lib/run_task.ts +0 -82
- package/src/lib/source_json.ts +0 -183
- package/src/lib/svelte_config.ts +0 -140
- package/src/lib/sveltekit_helpers.ts +0 -193
- package/src/lib/sveltekit_shim_app.ts +0 -41
- package/src/lib/sveltekit_shim_app_environment.ts +0 -16
- package/src/lib/sveltekit_shim_app_forms.ts +0 -13
- package/src/lib/sveltekit_shim_app_navigation.ts +0 -23
- package/src/lib/sveltekit_shim_app_paths.ts +0 -26
- package/src/lib/sveltekit_shim_app_state.ts +0 -35
- package/src/lib/sveltekit_shim_env.ts +0 -45
- package/src/lib/sync.task.ts +0 -47
- package/src/lib/task.ts +0 -245
- package/src/lib/task_logging.ts +0 -255
- package/src/lib/test.task.ts +0 -63
- package/src/lib/typecheck.task.ts +0 -81
- package/src/lib/upgrade.task.ts +0 -148
- package/src/lib/watch_dir.ts +0 -115
package/README.md
CHANGED
|
@@ -1,283 +1,9 @@
|
|
|
1
|
-
# gro
|
|
1
|
+
# @ryanatkn/gro
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **DEPRECATED** — This package has moved to [`@fuzdev/gro`](https://www.npmjs.com/package/@fuzdev/gro).
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
[`npm i -D @ryanatkn/gro`](https://www.npmjs.com/package/@ryanatkn/gro)
|
|
8
|
-
|
|
9
|
-
> ⚠️ I still use Gro heavily but I'm transitioning to Rust-based tooling
|
|
10
|
-
> with [Fuz](https://github.com/fuzdev) using [Deno](https://github.com/denoland) as a sidecar.
|
|
11
|
-
> I consider Gro deprecated but there should be a migration path.
|
|
12
|
-
> Please open issues if you need help.
|
|
13
|
-
|
|
14
|
-
> ⚠️[Windows won't be supported](https://github.com/ryanatkn/gro/issues/319), I chose Bash instead.
|
|
15
|
-
|
|
16
|
-
Docs at [gro.ryanatkn.com/docs](https://gro.ryanatkn.com/docs) and [src/docs](./src/docs).
|
|
17
|
-
|
|
18
|
-
Need help or want to share thoughts? See the
|
|
19
|
-
[issues](https://github.com/ryanatkn/gro/issues) and
|
|
20
|
-
[discussions](https://github.com/ryanatkn/gro/discussions).
|
|
21
|
-
|
|
22
|
-
## about
|
|
23
|
-
|
|
24
|
-
Gro is a task runner and toolkit
|
|
25
|
-
extending [SvelteKit](https://github.com/sveltejs/kit),
|
|
26
|
-
[Vite](https://github.com/vitejs/vite),
|
|
27
|
-
and [esbuild](https://github.com/evanw/esbuild)
|
|
28
|
-
for making web frontends, servers, and libraries with TypeScript.
|
|
29
|
-
It's a dev tool, not for production use.
|
|
30
|
-
It includes:
|
|
31
|
-
|
|
32
|
-
- [task runner](/src/docs/task.md) that uses the filesystem convention `*.task.ts`
|
|
33
|
-
- lots of [common builtin tasks](/src/docs/tasks.md) that users can easily override and compose
|
|
34
|
-
- tools and patterns for
|
|
35
|
-
[developing](/src/docs/dev.md),
|
|
36
|
-
[building](/src/docs/build.md),
|
|
37
|
-
[testing](/src/docs/test.md),
|
|
38
|
-
[deploying](/src/docs/deploy.md),
|
|
39
|
-
and [publishing](/src/docs/publish.md)
|
|
40
|
-
[SvelteKit](https://github.com/sveltejs/kit) apps, library packages, and Node servers
|
|
41
|
-
- integrated [TypeScript](https://github.com/microsoft/typescript),
|
|
42
|
-
[Svelte](https://github.com/sveltejs/svelte),
|
|
43
|
-
and [SvelteKit](https://github.com/sveltejs/kit)
|
|
44
|
-
- defers to SvelteKit and Vite for the frontend and
|
|
45
|
-
[`@sveltejs/package`](https://kit.svelte.dev/docs/packaging) for the library
|
|
46
|
-
- exposes all of its internals in `$lib`
|
|
47
|
-
- uses [Changesets](https://github.com/changesets/changesets) for versioning and changelogs
|
|
48
|
-
- provides a [Node loader](/src/lib/loader.ts) with a [register hook](/src/lib/register.ts)
|
|
49
|
-
- uses Node's type stripping and supports importing JSON, SvelteKit shims,
|
|
50
|
-
and SSR'd Svelte files in tests/tasks/scripts
|
|
51
|
-
- supports [SvelteKit module imports](https://kit.svelte.dev/docs/modules) for
|
|
52
|
-
`$lib`, `$env`, and `$app` in tasks, tests, Node servers,
|
|
53
|
-
and other code outside of the SvelteKit frontend,
|
|
54
|
-
so you can use SvelteKit patterns everywhere
|
|
55
|
-
(these are best-effort shims, not perfect)
|
|
56
|
-
- supports running TypeScript files directly without a task via `gro run a.ts`
|
|
57
|
-
or `node --import @ryanatkn/gro/register.js a.ts`
|
|
58
|
-
- [configurable plugins](/src/docs/plugin.md) to support SvelteKit,
|
|
59
|
-
[auto-restarting Node servers](/src/lib/gro_plugin_server.ts),
|
|
60
|
-
and other external build processes
|
|
61
|
-
- see the [Gro config docs](/src/docs/config.md) and
|
|
62
|
-
[the default config](https://github.com/ryanatkn/gro/blob/main/src/lib/gro.config.default.ts)
|
|
63
|
-
- see [`fuz_template`](https://github.com/fuz-dev/fuz_template)
|
|
64
|
-
for a simple starter project example, and
|
|
65
|
-
[`@feltjs/felt`](https://github.com/feltjs/felt) for a more complex example with custom tasks
|
|
66
|
-
- [testing](/src/docs/test.md) with [`vitest`](https://github.com/vitest-dev/vitest)
|
|
67
|
-
- codegen by convention with [`gen`](/src/docs/gen.md)
|
|
68
|
-
- linting with [ESLint](https://github.com/eslint/eslint)
|
|
69
|
-
(I also maintain [`@feltjs/eslint-config`](https://github.com/feltjs/eslint-config))
|
|
70
|
-
- formatting with [Prettier](https://github.com/prettier/prettier)
|
|
71
|
-
|
|
72
|
-
## docs
|
|
73
|
-
|
|
74
|
-
- early API docs at [/docs/api](https://gro.ryanatkn.com/docs/api)
|
|
75
|
-
- developing web frontends, servers, and libraries
|
|
76
|
-
- [config](/src/docs/config.md)
|
|
77
|
-
- [dev](/src/docs/dev.md)
|
|
78
|
-
- [build](/src/docs/build.md) for production
|
|
79
|
-
- [deploy](/src/docs/deploy.md) to a branch, like for GitHub pages
|
|
80
|
-
- [publish](/src/docs/publish.md) to npm
|
|
81
|
-
- [`Task`](/src/docs/task.md) runner
|
|
82
|
-
- builtin [tasks](/src/docs/tasks.md) list
|
|
83
|
-
- [testing](/src/docs/test.md) with [`vitest`](https://github.com/vitest-dev/vitest)
|
|
84
|
-
- [`gen`](/src/docs/gen.md) code generation
|
|
85
|
-
- [`public` package](/src/docs/package_json.md#public-packages) features (nonstandard)
|
|
86
|
-
- full [docs index](/src/docs#readme)
|
|
87
|
-
|
|
88
|
-
## install
|
|
89
|
-
|
|
90
|
-
> depends on node >=20.12
|
|
91
|
-
|
|
92
|
-
Typical usage installs [@ryanatkn/gro](https://www.npmjs.com/package/@ryanatkn/gro)
|
|
93
|
-
as a dev dependency:
|
|
94
|
-
|
|
95
|
-
```bash
|
|
96
|
-
npm i -D @ryanatkn/gro
|
|
97
|
-
npx @ryanatkn/gro # note the package is namespaced, don't install `gro`
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
It's handy to install globally too:
|
|
101
|
-
|
|
102
|
-
```bash
|
|
103
|
-
npm i -g @ryanatkn/gro
|
|
104
|
-
gro
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## usage
|
|
108
|
-
|
|
109
|
-
Gro has a task runner that discovers and runs TypeScript modules with the `.task.` subextension.
|
|
110
|
-
Running `gro` with no args prints the tasks
|
|
111
|
-
it finds in the current directory along with its builtin tasks:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
gro # prints available tasks - defers to any local gro installation
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
```
|
|
118
|
-
Run a task: gro [name]
|
|
119
|
-
View help: gro [name] --help
|
|
120
|
-
|
|
121
|
-
19 tasks in gro:
|
|
122
|
-
|
|
123
|
-
build build the project
|
|
124
|
-
changeset call changeset with gro patterns
|
|
125
|
-
check check that everything is ready to commit
|
|
126
|
-
clean remove temporary dev and build files, and optionally prune git branches
|
|
127
|
-
commit commit and push to a new branch
|
|
128
|
-
deploy deploy to a branch
|
|
129
|
-
dev start SvelteKit and other dev plugins
|
|
130
|
-
format format source files
|
|
131
|
-
gen run code generation scripts
|
|
132
|
-
lint run eslint
|
|
133
|
-
publish bump version, publish to the configured registry, and git push
|
|
134
|
-
reinstall refreshes package-lock.json with the latest and cleanest deps
|
|
135
|
-
release publish and deploy
|
|
136
|
-
resolve diagnostic that logs resolved filesystem info for the given input paths
|
|
137
|
-
run execute a file with the loader, like `node` but works for TypeScript
|
|
138
|
-
sync run `gro gen`, update `package.json`, and optionally install packages to sync up
|
|
139
|
-
test run tests with vitest
|
|
140
|
-
typecheck run svelte-check or tsc on the project without emitting any files
|
|
141
|
-
upgrade upgrade deps
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
To run tasks, Gro matches your CLI input against its filesystem conventions.
|
|
145
|
-
It tries to do the right thing, where right is helpful but not surprising,
|
|
146
|
-
with some magic but not too much:
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
gro # displays all available tasks matching `src/lib/**/*.task.ts` and Gro's builtins
|
|
150
|
-
gro a # tries to run `src/lib/a.task.ts`, then `./a.task.ts`, then Gro's builtin if one exists
|
|
151
|
-
gro a --help # displays docs for the "a" task and its args, works for every task
|
|
152
|
-
gro some/dir # lists all tasks inside `src/lib/some/dir`
|
|
153
|
-
gro some/file # runs `src/lib/some/file.task.ts`
|
|
154
|
-
gro some/file.task.ts # same as above
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
Gro can also run non-task TypeScript files directly
|
|
158
|
-
with [the `gro run` task](/src/lib/run.task.ts) or [register hook](/src/lib/register.ts):
|
|
159
|
-
|
|
160
|
-
```bash
|
|
161
|
-
gro run foo.ts
|
|
162
|
-
node --import @ryanatkn/gro/register.js foo.ts
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
Or programmatically:
|
|
166
|
-
|
|
167
|
-
```js
|
|
168
|
-
// myfile.js
|
|
169
|
-
import {register} from 'node:module';
|
|
170
|
-
register('@ryanatkn/gro/loader.js', import.meta.url);
|
|
171
|
-
await import('./foo.ts');
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
Gro has a number of builtin tasks that you can run with the CLI.
|
|
175
|
-
To learn more [see the task docs](/src/docs/task.md)
|
|
176
|
-
and [the generated task index](/src/docs/tasks.md).
|
|
5
|
+
Install the new package:
|
|
177
6
|
|
|
178
7
|
```bash
|
|
179
|
-
|
|
180
|
-
gro dev -- vite --port 3003 # forward args by separating sections with --
|
|
8
|
+
npm install @fuzdev/gro
|
|
181
9
|
```
|
|
182
|
-
|
|
183
|
-
```bash
|
|
184
|
-
gro build # build everything for production
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
[Testing](/src/docs/test.md) with [`vitest`](https://github.com/vitest-dev/vitest),
|
|
188
|
-
including shims for [SvelteKit modules](https://kit.svelte.dev/docs/modules):
|
|
189
|
-
|
|
190
|
-
```bash
|
|
191
|
-
gro test # run all tests for `*.test.ts` files with `vitest`
|
|
192
|
-
gro test filepattern1 some.test another.test
|
|
193
|
-
gro test optional_pattern -t "optional search string for test name"
|
|
194
|
-
gro test -- vitest --forwarded_args 'to vitest'
|
|
195
|
-
```
|
|
196
|
-
|
|
197
|
-
Check all the things:
|
|
198
|
-
|
|
199
|
-
```bash
|
|
200
|
-
gro check # does all of the following:
|
|
201
|
-
gro typecheck # svelte-check with tsc fallback
|
|
202
|
-
gro test # run tests
|
|
203
|
-
gro gen --check # ensure generated files are current
|
|
204
|
-
gro format --check # ensure everything is formatted
|
|
205
|
-
gro lint # eslint
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
For a usage example see [the `check.yml` CI config](.github/workflows/check.yml).
|
|
209
|
-
|
|
210
|
-
Formatting with [`prettier`](https://github.com/prettier/prettier):
|
|
211
|
-
|
|
212
|
-
```bash
|
|
213
|
-
gro format # format all of the source files using Prettier
|
|
214
|
-
gro format --check # check that all source files are formatted
|
|
215
|
-
```
|
|
216
|
-
|
|
217
|
-
Codegen with [`gen`](/src/docs/gen.md):
|
|
218
|
-
|
|
219
|
-
```bash
|
|
220
|
-
gro gen # run codegen for all `*.gen.*` files
|
|
221
|
-
gro gen --check # error if any generated files are new or different
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
To deploy: (also see [`src/docs/deploy.md`](/src/docs/deploy.md))
|
|
225
|
-
|
|
226
|
-
```bash
|
|
227
|
-
gro deploy # build and push to the `deploy` branch
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
To publish: (also see [`src/docs/publish.md`](/src/docs/publish.md))
|
|
231
|
-
|
|
232
|
-
```bash
|
|
233
|
-
gro publish # flush changeset to changelog, bump version, publish to npm, and git push
|
|
234
|
-
```
|
|
235
|
-
|
|
236
|
-
More:
|
|
237
|
-
|
|
238
|
-
```bash
|
|
239
|
-
gro clean # delete all build artifacts from the filesystem
|
|
240
|
-
gro clean --sveltekit --nodemodules --git # also deletes dirs and prunes git branches
|
|
241
|
-
gro upgrade excluded-dep-1 excluded-dep-2 # npm updates to the latest everything
|
|
242
|
-
gro --version # print the Gro version
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
For more see [the tasks index](/src/docs/tasks.md),
|
|
246
|
-
[the task feature docs](/src/docs/task.md), and [the docs index](/src/docs/README.md).
|
|
247
|
-
|
|
248
|
-
## develop
|
|
249
|
-
|
|
250
|
-
```bash
|
|
251
|
-
npm i
|
|
252
|
-
npm run bootstrap # build and link `gro` without itself - needed only once
|
|
253
|
-
gro build # same as `npm run bootstrap` when the `gro` CLI is available
|
|
254
|
-
gro test # make sure everything looks good - same as `npm test`
|
|
255
|
-
gro test some.test another.test
|
|
256
|
-
|
|
257
|
-
# use your development version of `gro` locally in another project:
|
|
258
|
-
gro build # updates the `gro` CLI, same as `npm run bootstrap`
|
|
259
|
-
cd ../otherproject
|
|
260
|
-
npm link ../gro # from `otherproject/`
|
|
261
|
-
gro build # from `../gro` on changes
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
## credits 🐢<sub>🐢</sub><sub><sub>🐢</sub></sub>
|
|
265
|
-
|
|
266
|
-
Gro builds on
|
|
267
|
-
[TypeScript](https://github.com/microsoft/TypeScript) ∙
|
|
268
|
-
[Svelte](https://github.com/sveltejs/svelte) ∙
|
|
269
|
-
[SvelteKit](https://github.com/sveltejs/kit) ∙
|
|
270
|
-
[Vite](https://github.com/vitejs/vite) ∙
|
|
271
|
-
[esbuild](https://github.com/evanw/esbuild) ∙
|
|
272
|
-
[Vitest](https://github.com/vitest-dev/vitest) ∙
|
|
273
|
-
[chokidar](https://github.com/paulmillr/chokidar) ∙
|
|
274
|
-
[zod](https://github.com/colinhacks/zod) ∙
|
|
275
|
-
[@fuzdev/fuz_util](https://github.com/fuzdev/fuz_util) ∙
|
|
276
|
-
[ESLint](https://github.com/eslint/eslint) ∙
|
|
277
|
-
[Prettier](https://github.com/prettier/prettier) ∙
|
|
278
|
-
[svelte-check](https://github.com/sveltejs/language-tools/tree/master/packages/svelte-check) &
|
|
279
|
-
[more](package.json)
|
|
280
|
-
|
|
281
|
-
## license [🐦](https://wikipedia.org/wiki/Free_and_open-source_software)
|
|
282
|
-
|
|
283
|
-
[MIT](LICENSE)
|
package/package.json
CHANGED
|
@@ -1,144 +1,7 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"logo": "logo.svg",
|
|
8
|
-
"logo_alt": "a pixelated green oak acorn with a glint of sun",
|
|
9
|
-
"license": "MIT",
|
|
10
|
-
"homepage": "https://gro.ryanatkn.com/",
|
|
11
|
-
"author": {
|
|
12
|
-
"name": "Ryan Atkinson",
|
|
13
|
-
"email": "mail@ryanatkn.com",
|
|
14
|
-
"url": "https://www.ryanatkn.com/"
|
|
15
|
-
},
|
|
16
|
-
"repository": {
|
|
17
|
-
"type": "git",
|
|
18
|
-
"url": "git+https://github.com/ryanatkn/gro.git"
|
|
19
|
-
},
|
|
20
|
-
"bugs": "https://github.com/ryanatkn/gro/issues",
|
|
21
|
-
"funding": "https://www.ryanatkn.com/funding",
|
|
22
|
-
"scripts": {
|
|
23
|
-
"bootstrap": "rm -rf .gro dist && svelte-kit sync && svelte-package && chmod +x ./dist/gro.js && npm link -f",
|
|
24
|
-
"start": "gro dev",
|
|
25
|
-
"dev": "gro dev",
|
|
26
|
-
"build": "gro build",
|
|
27
|
-
"check": "gro check",
|
|
28
|
-
"test": "gro test",
|
|
29
|
-
"preview": "vite preview",
|
|
30
|
-
"deploy": "gro deploy"
|
|
31
|
-
},
|
|
32
|
-
"type": "module",
|
|
33
|
-
"engines": {
|
|
34
|
-
"node": ">=22.15"
|
|
35
|
-
},
|
|
36
|
-
"bin": {
|
|
37
|
-
"gro": "dist/gro.js"
|
|
38
|
-
},
|
|
39
|
-
"keywords": [
|
|
40
|
-
"web",
|
|
41
|
-
"tools",
|
|
42
|
-
"task runner",
|
|
43
|
-
"tasks",
|
|
44
|
-
"codegen",
|
|
45
|
-
"svelte",
|
|
46
|
-
"sveltekit",
|
|
47
|
-
"vite",
|
|
48
|
-
"typescript"
|
|
49
|
-
],
|
|
50
|
-
"dependencies": {
|
|
51
|
-
"chokidar": "^5.0.0",
|
|
52
|
-
"dotenv": "^17.2.3",
|
|
53
|
-
"esm-env": "^1.2.2",
|
|
54
|
-
"oxc-parser": "^0.99.0",
|
|
55
|
-
"prettier": "^3.7.4",
|
|
56
|
-
"prettier-plugin-svelte": "^3.4.1",
|
|
57
|
-
"ts-blank-space": "^0.6.2",
|
|
58
|
-
"tslib": "^2.8.1",
|
|
59
|
-
"zod": "^4.1.13"
|
|
60
|
-
},
|
|
61
|
-
"peerDependencies": {
|
|
62
|
-
"@fuzdev/fuz_util": ">=0.49.2",
|
|
63
|
-
"@sveltejs/kit": "^2",
|
|
64
|
-
"esbuild": "^0.27.0",
|
|
65
|
-
"svelte": "^5",
|
|
66
|
-
"typescript": "^5",
|
|
67
|
-
"vitest": "^3 || ^4"
|
|
68
|
-
},
|
|
69
|
-
"peerDependenciesMeta": {
|
|
70
|
-
"@sveltejs/kit": {
|
|
71
|
-
"optional": true
|
|
72
|
-
},
|
|
73
|
-
"vitest": {
|
|
74
|
-
"optional": true
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
"optionalDependencies": {
|
|
78
|
-
"vitest": "^3 || ^4"
|
|
79
|
-
},
|
|
80
|
-
"devDependencies": {
|
|
81
|
-
"@changesets/changelog-git": "^0.2.1",
|
|
82
|
-
"@changesets/types": "^6.1.0",
|
|
83
|
-
"@fuzdev/fuz_code": "^0.41.0",
|
|
84
|
-
"@fuzdev/fuz_css": "^0.47.0",
|
|
85
|
-
"@fuzdev/fuz_ui": "^0.181.1",
|
|
86
|
-
"@fuzdev/fuz_util": "^0.49.2",
|
|
87
|
-
"@ryanatkn/eslint-config": "^0.9.0",
|
|
88
|
-
"@sveltejs/adapter-static": "^3.0.10",
|
|
89
|
-
"@sveltejs/kit": "^2.50.1",
|
|
90
|
-
"@sveltejs/package": "^2.5.7",
|
|
91
|
-
"@sveltejs/vite-plugin-svelte": "^6.2.4",
|
|
92
|
-
"@types/node": "^24.10.1",
|
|
93
|
-
"@webref/css": "^8.2.0",
|
|
94
|
-
"esbuild": "^0.27.1",
|
|
95
|
-
"eslint": "^9.39.1",
|
|
96
|
-
"eslint-plugin-svelte": "^3.13.1",
|
|
97
|
-
"svelte": "^5.49.1",
|
|
98
|
-
"svelte-check": "^4.3.6",
|
|
99
|
-
"typescript": "^5.9.3",
|
|
100
|
-
"typescript-eslint": "^8.48.1",
|
|
101
|
-
"vitest": "^4.0.15"
|
|
102
|
-
},
|
|
103
|
-
"prettier": {
|
|
104
|
-
"plugins": [
|
|
105
|
-
"prettier-plugin-svelte"
|
|
106
|
-
],
|
|
107
|
-
"useTabs": true,
|
|
108
|
-
"printWidth": 100,
|
|
109
|
-
"singleQuote": true,
|
|
110
|
-
"bracketSpacing": false,
|
|
111
|
-
"overrides": [
|
|
112
|
-
{
|
|
113
|
-
"files": "package.json",
|
|
114
|
-
"options": {
|
|
115
|
-
"useTabs": false
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
]
|
|
119
|
-
},
|
|
120
|
-
"sideEffects": [
|
|
121
|
-
"**/*.css"
|
|
122
|
-
],
|
|
123
|
-
"files": [
|
|
124
|
-
"dist",
|
|
125
|
-
"src/lib/**/*.ts",
|
|
126
|
-
"!src/lib/**/*.test.*",
|
|
127
|
-
"!dist/**/*.test.*"
|
|
128
|
-
],
|
|
129
|
-
"exports": {
|
|
130
|
-
"./package.json": "./package.json",
|
|
131
|
-
".": {
|
|
132
|
-
"types": "./dist/index.d.ts",
|
|
133
|
-
"default": "./dist/index.js"
|
|
134
|
-
},
|
|
135
|
-
"./*.js": {
|
|
136
|
-
"types": "./dist/*.d.ts",
|
|
137
|
-
"default": "./dist/*.js"
|
|
138
|
-
},
|
|
139
|
-
"./*.ts": {
|
|
140
|
-
"types": "./dist/*.d.ts",
|
|
141
|
-
"default": "./dist/*.js"
|
|
142
|
-
}
|
|
143
|
-
}
|
|
2
|
+
"name": "@ryanatkn/gro",
|
|
3
|
+
"version": "0.192.0",
|
|
4
|
+
"description": "DEPRECATED: This package has moved to @fuzdev/gro",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": ""
|
|
144
7
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) Ryan Atkinson <mail@ryanatkn.com> <https://ryanatkn.com/>
|
|
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.
|
package/dist/args.d.ts
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { type Args } from '@fuzdev/fuz_util/args.js';
|
|
2
|
-
/**
|
|
3
|
-
* Parses `task_name` and `args` from `process.argv`,
|
|
4
|
-
* ignoring anything after any `--`.
|
|
5
|
-
*/
|
|
6
|
-
export declare const to_task_args: (argv?: string[]) => {
|
|
7
|
-
task_name: string;
|
|
8
|
-
args: Args;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Gets the array of raw string args starting with the first `--`, if any.
|
|
12
|
-
*/
|
|
13
|
-
export declare const to_raw_rest_args: (argv?: string[]) => Array<string>;
|
|
14
|
-
/**
|
|
15
|
-
* Parses `process.argv` for the specified `command`, so given
|
|
16
|
-
* `gro taskname arg1 --arg2 -- eslint eslintarg1 --eslintarg2 -- tsc --tscarg1 --tscarg2`
|
|
17
|
-
* the `command` `'eslint'` returns `eslintarg1 --eslintarg2`
|
|
18
|
-
* and `'tsc'` returns `--tscarg1` and `--tscarg2`.
|
|
19
|
-
*/
|
|
20
|
-
export declare const to_forwarded_args: (command: string, raw_rest_args?: Array<string>, cache?: Record<string, Args | undefined>) => Args;
|
|
21
|
-
export declare const to_forwarded_args_by_command: (raw_rest_args?: string[]) => Record<string, Args | undefined>;
|
|
22
|
-
/**
|
|
23
|
-
* Gets all args after the first `--` without assuming a command name.
|
|
24
|
-
* This is useful for tasks that want to forward args directly to a tool
|
|
25
|
-
* without requiring users to specify the tool name explicitly.
|
|
26
|
-
* Optionally strips a specific command name if present for backward compatibility.
|
|
27
|
-
* @example
|
|
28
|
-
* ```ts
|
|
29
|
-
* // `gro test -- --watch` → {watch: true}
|
|
30
|
-
* // `gro test -- foo.test.ts` → {_: ['foo.test.ts']}
|
|
31
|
-
* // `gro test -- vitest --watch` with command_to_strip='vitest' → {watch: true}
|
|
32
|
-
* to_implicit_forwarded_args('vitest')
|
|
33
|
-
* ```
|
|
34
|
-
*/
|
|
35
|
-
export declare const to_implicit_forwarded_args: (command_to_strip?: string, raw_rest_args?: string[]) => Args;
|
|
36
|
-
export declare const print_command_args: (serialized_args: Array<string>) => string;
|
|
37
|
-
//# sourceMappingURL=args.d.ts.map
|
package/dist/args.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"args.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/args.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,0BAA0B,CAAC;AAE/D;;;GAGG;AACH,eAAO,MAAM,YAAY,GAAI,eAAmB,KAAG;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAMhF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,eAAmB,KAAG,KAAK,CAAC,MAAM,CAGlE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC7B,SAAS,MAAM,EACf,gBAAgB,KAAK,CAAC,MAAM,CAAC,EAC7B,wCAAmD,KACjD,IAA4B,CAAC;AAEhC,eAAO,MAAM,4BAA4B,GACxC,wBAAkC,KAChC,MAAM,CAAC,MAAM,EAAE,IAAI,GAAG,SAAS,CAuCjC,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,0BAA0B,GACtC,mBAAmB,MAAM,EACzB,wBAAkC,KAChC,IAaF,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,iBAAiB,KAAK,CAAC,MAAM,CAAC,KAAG,MAK1C,CAAC"}
|
package/dist/args.js
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { styleText as st } from 'node:util';
|
|
2
|
-
import { argv_parse } from '@fuzdev/fuz_util/args.js';
|
|
3
|
-
/**
|
|
4
|
-
* Parses `task_name` and `args` from `process.argv`,
|
|
5
|
-
* ignoring anything after any `--`.
|
|
6
|
-
*/
|
|
7
|
-
export const to_task_args = (argv = process.argv) => {
|
|
8
|
-
const forwarded_index = argv.indexOf('--');
|
|
9
|
-
const args = argv_parse(forwarded_index === -1 ? argv.slice(2) : argv.slice(2, forwarded_index));
|
|
10
|
-
const task_name = args._.shift() ?? '';
|
|
11
|
-
if (!args._.length)
|
|
12
|
-
delete args._; // enable schema defaults
|
|
13
|
-
return { task_name, args };
|
|
14
|
-
};
|
|
15
|
-
/**
|
|
16
|
-
* Gets the array of raw string args starting with the first `--`, if any.
|
|
17
|
-
*/
|
|
18
|
-
export const to_raw_rest_args = (argv = process.argv) => {
|
|
19
|
-
const forwarded_index = argv.indexOf('--');
|
|
20
|
-
return forwarded_index === -1 ? [] : argv.slice(forwarded_index);
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Parses `process.argv` for the specified `command`, so given
|
|
24
|
-
* `gro taskname arg1 --arg2 -- eslint eslintarg1 --eslintarg2 -- tsc --tscarg1 --tscarg2`
|
|
25
|
-
* the `command` `'eslint'` returns `eslintarg1 --eslintarg2`
|
|
26
|
-
* and `'tsc'` returns `--tscarg1` and `--tscarg2`.
|
|
27
|
-
*/
|
|
28
|
-
export const to_forwarded_args = (command, raw_rest_args, cache = to_forwarded_args_by_command(raw_rest_args)) => cache[command] ?? {};
|
|
29
|
-
export const to_forwarded_args_by_command = (raw_rest_args = to_raw_rest_args()) => {
|
|
30
|
-
// Parse each segment of `argv` separated by `--`.
|
|
31
|
-
const argvs = [];
|
|
32
|
-
let arr;
|
|
33
|
-
for (const arg of raw_rest_args) {
|
|
34
|
-
if (arg === '--') {
|
|
35
|
-
if (arr?.length)
|
|
36
|
-
argvs.push(arr);
|
|
37
|
-
arr = [];
|
|
38
|
-
}
|
|
39
|
-
else if (!arr) {
|
|
40
|
-
continue;
|
|
41
|
-
}
|
|
42
|
-
else if (arg) {
|
|
43
|
-
arr.push(arg);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
if (arr?.length)
|
|
47
|
-
argvs.push(arr);
|
|
48
|
-
// Add each segment of parsed `argv` keyed by the first rest arg,
|
|
49
|
-
// which is assumed to be the CLI command that gets forwarded the args.
|
|
50
|
-
const forwarded_args_by_command = {};
|
|
51
|
-
for (const argv of argvs) {
|
|
52
|
-
const args = argv_parse(argv);
|
|
53
|
-
let command = args._.shift();
|
|
54
|
-
if (!command) {
|
|
55
|
-
// Skip sections without a command name - these are handled by `to_implicit_forwarded_args`.
|
|
56
|
-
// This allows `gro run script.ts -- --help` to pass `--help` to the script.
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
// Gro commands get combined with their task name.
|
|
60
|
-
if (command === 'gro') {
|
|
61
|
-
if (!args._.length) {
|
|
62
|
-
throw Error(`Malformed args following a \`--\`. Expected gro taskname: \`${argv.join(' ')}\``);
|
|
63
|
-
}
|
|
64
|
-
command += ' ' + args._.shift();
|
|
65
|
-
}
|
|
66
|
-
if (!args._.length)
|
|
67
|
-
delete args._;
|
|
68
|
-
forwarded_args_by_command[command] = args;
|
|
69
|
-
}
|
|
70
|
-
return forwarded_args_by_command;
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Gets all args after the first `--` without assuming a command name.
|
|
74
|
-
* This is useful for tasks that want to forward args directly to a tool
|
|
75
|
-
* without requiring users to specify the tool name explicitly.
|
|
76
|
-
* Optionally strips a specific command name if present for backward compatibility.
|
|
77
|
-
* @example
|
|
78
|
-
* ```ts
|
|
79
|
-
* // `gro test -- --watch` → {watch: true}
|
|
80
|
-
* // `gro test -- foo.test.ts` → {_: ['foo.test.ts']}
|
|
81
|
-
* // `gro test -- vitest --watch` with command_to_strip='vitest' → {watch: true}
|
|
82
|
-
* to_implicit_forwarded_args('vitest')
|
|
83
|
-
* ```
|
|
84
|
-
*/
|
|
85
|
-
export const to_implicit_forwarded_args = (command_to_strip, raw_rest_args = to_raw_rest_args()) => {
|
|
86
|
-
const start = raw_rest_args.indexOf('--');
|
|
87
|
-
if (start === -1)
|
|
88
|
-
return {};
|
|
89
|
-
let argv = raw_rest_args.slice(start + 1);
|
|
90
|
-
if (command_to_strip && argv[0] === command_to_strip) {
|
|
91
|
-
argv = argv.slice(1);
|
|
92
|
-
}
|
|
93
|
-
const args = argv_parse(argv);
|
|
94
|
-
if (!args._.length)
|
|
95
|
-
delete args._;
|
|
96
|
-
return args;
|
|
97
|
-
};
|
|
98
|
-
export const print_command_args = (serialized_args) => st('gray', '[') +
|
|
99
|
-
st('magenta', 'running command') +
|
|
100
|
-
st('gray', ']') +
|
|
101
|
-
' ' +
|
|
102
|
-
serialized_args.join(' ');
|
package/dist/build.task.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { type Task } from './task.ts';
|
|
3
|
-
/** @nodocs */
|
|
4
|
-
export declare const Args: z.ZodObject<{
|
|
5
|
-
sync: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
-
'no-sync': z.ZodDefault<z.ZodBoolean>;
|
|
7
|
-
gen: z.ZodDefault<z.ZodBoolean>;
|
|
8
|
-
'no-gen': z.ZodDefault<z.ZodBoolean>;
|
|
9
|
-
install: z.ZodDefault<z.ZodBoolean>;
|
|
10
|
-
'no-install': z.ZodDefault<z.ZodBoolean>;
|
|
11
|
-
force_build: z.ZodDefault<z.ZodBoolean>;
|
|
12
|
-
}, z.core.$strict>;
|
|
13
|
-
export type Args = z.infer<typeof Args>;
|
|
14
|
-
/**
|
|
15
|
-
* Length of git commit hash when displayed in logs (standard git convention).
|
|
16
|
-
*/
|
|
17
|
-
export declare const GIT_SHORT_HASH_LENGTH = 7;
|
|
18
|
-
/** @nodocs */
|
|
19
|
-
export declare const task: Task<Args>;
|
|
20
|
-
//# sourceMappingURL=build.task.d.ts.map
|
package/dist/build.task.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"build.task.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/build.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAOtB,OAAO,EAAY,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAW/C,cAAc;AACd,eAAO,MAAM,IAAI;;;;;;;;kBAcf,CAAC;AACH,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC;;GAEG;AACH,eAAO,MAAM,qBAAqB,IAAI,CAAC;AASvC,cAAc;AACd,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAqG3B,CAAC"}
|