@ryanatkn/gro 0.129.6 → 0.129.8
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 +30 -30
- package/dist/config.d.ts +3 -3
- package/dist/gen.test.js +1 -1
- package/dist/invoke.js +1 -1
- package/dist/package.js +2 -2
- package/dist/src_json.d.ts +1 -1
- package/dist/src_json.js +1 -1
- package/package.json +1 -1
- package/src/lib/config.ts +3 -3
- package/src/lib/gen.test.ts +1 -1
- package/src/lib/invoke.ts +1 -1
- package/src/lib/package.ts +2 -2
- package/src/lib/src_json.ts +1 -1
- package/dist/docs/README.gen.md.d.ts +0 -6
- package/dist/docs/README.gen.md.d.ts.map +0 -1
- package/dist/docs/README.gen.md.js +0 -53
- package/dist/docs/README.md +0 -20
- package/dist/docs/build.md +0 -41
- package/dist/docs/config.md +0 -213
- package/dist/docs/deploy.md +0 -32
- package/dist/docs/dev.md +0 -40
- package/dist/docs/gen.md +0 -269
- package/dist/docs/gro_plugin_sveltekit_app.md +0 -113
- package/dist/docs/package_json.md +0 -33
- package/dist/docs/plugin.md +0 -50
- package/dist/docs/publish.md +0 -137
- package/dist/docs/task.md +0 -391
- package/dist/docs/tasks.gen.md.d.ts +0 -3
- package/dist/docs/tasks.gen.md.d.ts.map +0 -1
- package/dist/docs/tasks.gen.md.js +0 -66
- package/dist/docs/tasks.md +0 -37
- package/dist/docs/test.md +0 -52
- package/src/lib/docs/README.gen.md.ts +0 -63
- package/src/lib/docs/README.md +0 -20
- package/src/lib/docs/build.md +0 -41
- package/src/lib/docs/config.md +0 -213
- package/src/lib/docs/deploy.md +0 -32
- package/src/lib/docs/dev.md +0 -40
- package/src/lib/docs/gen.md +0 -269
- package/src/lib/docs/gro_plugin_sveltekit_app.md +0 -113
- package/src/lib/docs/package_json.md +0 -33
- package/src/lib/docs/plugin.md +0 -50
- package/src/lib/docs/publish.md +0 -137
- package/src/lib/docs/task.md +0 -391
- package/src/lib/docs/tasks.gen.md.ts +0 -90
- package/src/lib/docs/tasks.md +0 -37
- package/src/lib/docs/test.md +0 -52
package/README.md
CHANGED
|
@@ -20,14 +20,14 @@ and [esbuild](https://github.com/evanw/esbuild)
|
|
|
20
20
|
for making web frontends, servers, and libraries with TypeScript.
|
|
21
21
|
It includes:
|
|
22
22
|
|
|
23
|
-
- [task runner](/src/
|
|
24
|
-
- lots of [common builtin tasks](/src/
|
|
23
|
+
- [task runner](/src/docs/task.md) that uses the filesystem convention `*.task.ts`
|
|
24
|
+
- lots of [common builtin tasks](/src/docs/tasks.md) that users can easily override and compose
|
|
25
25
|
- tools and patterns for
|
|
26
|
-
[developing](/src/
|
|
27
|
-
[building](/src/
|
|
28
|
-
[testing](/src/
|
|
29
|
-
[deploying](/src/
|
|
30
|
-
and [publishing](/src/
|
|
26
|
+
[developing](/src/docs/dev.md),
|
|
27
|
+
[building](/src/docs/build.md),
|
|
28
|
+
[testing](/src/docs/test.md),
|
|
29
|
+
[deploying](/src/docs/deploy.md),
|
|
30
|
+
and [publishing](/src/docs/publish.md)
|
|
31
31
|
[SvelteKit](https://github.com/sveltejs/kit) apps, library packages, and Node servers
|
|
32
32
|
- integrated [TypeScript](https://github.com/microsoft/typescript),
|
|
33
33
|
[Svelte](https://github.com/sveltejs/svelte),
|
|
@@ -45,16 +45,16 @@ It includes:
|
|
|
45
45
|
(these are best-effort shims, not perfect)
|
|
46
46
|
- supports running TypeScript files directly without a task via `gro run a.ts`
|
|
47
47
|
or `node --import @ryanatkn/gro/register.js a.ts`
|
|
48
|
-
- [configurable plugins](/src/
|
|
48
|
+
- [configurable plugins](/src/docs/plugin.md) to support SvelteKit,
|
|
49
49
|
[auto-restarting Node servers](/src/lib/gro_plugin_server.ts),
|
|
50
50
|
and other external build processes
|
|
51
|
-
- see the [Gro config docs](/src/
|
|
51
|
+
- see the [Gro config docs](/src/docs/config.md) and
|
|
52
52
|
[the default config](https://github.com/ryanatkn/gro/blob/main/src/lib/gro.config.default.ts)
|
|
53
53
|
- see [`fuz_template`](https://github.com/fuz-dev/fuz_template)
|
|
54
54
|
for a simple starter project example, and
|
|
55
55
|
[`@feltjs/felt`](https://github.com/feltjs/felt) for a more complex example with custom tasks
|
|
56
|
-
- [testing](/src/
|
|
57
|
-
- codegen by convention with [`gen`](/src/
|
|
56
|
+
- [testing](/src/docs/test.md) with [`uvu`](https://github.com/lukeed/uvu)
|
|
57
|
+
- codegen by convention with [`gen`](/src/docs/gen.md)
|
|
58
58
|
- linting with [ESLint](https://github.com/eslint/eslint)
|
|
59
59
|
(I also maintain [`@feltjs/eslint-config`](https://github.com/feltjs/eslint-config))
|
|
60
60
|
- formatting with [Prettier](https://github.com/prettier/prettier)
|
|
@@ -62,17 +62,17 @@ It includes:
|
|
|
62
62
|
## docs
|
|
63
63
|
|
|
64
64
|
- developing web frontends, servers, and libraries
|
|
65
|
-
- [config](/src/
|
|
66
|
-
- [dev](/src/
|
|
67
|
-
- [build](/src/
|
|
68
|
-
- [deploy](/src/
|
|
69
|
-
- [publish](/src/
|
|
70
|
-
- [`Task`](/src/
|
|
71
|
-
- builtin [tasks](/src/
|
|
72
|
-
- [testing](/src/
|
|
73
|
-
- [`gen`](/src/
|
|
74
|
-
- [`public` package](/src/
|
|
75
|
-
- full [docs index](/src/
|
|
65
|
+
- [config](/src/docs/config.md)
|
|
66
|
+
- [dev](/src/docs/dev.md)
|
|
67
|
+
- [build](/src/docs/build.md) for production
|
|
68
|
+
- [deploy](/src/docs/deploy.md) to a branch, like for GitHub pages
|
|
69
|
+
- [publish](/src/docs/publish.md) to npm
|
|
70
|
+
- [`Task`](/src/docs/task.md) runner
|
|
71
|
+
- builtin [tasks](/src/docs/tasks.md) list
|
|
72
|
+
- [testing](/src/docs/test.md) with [`uvu`](https://github.com/lukeed/uvu)
|
|
73
|
+
- [`gen`](/src/docs/gen.md) code generation
|
|
74
|
+
- [`public` package](/src/docs/package_json.md#public-packages) features (nonstandard)
|
|
75
|
+
- full [docs index](/src/docs#readme)
|
|
76
76
|
|
|
77
77
|
## install
|
|
78
78
|
|
|
@@ -161,8 +161,8 @@ await import('./foo.ts');
|
|
|
161
161
|
```
|
|
162
162
|
|
|
163
163
|
Gro has a number of builtin tasks that you can run with the CLI.
|
|
164
|
-
To learn more [see the task docs](/src/
|
|
165
|
-
and [the generated task index](/src/
|
|
164
|
+
To learn more [see the task docs](/src/docs/task.md)
|
|
165
|
+
and [the generated task index](/src/docs/tasks.md).
|
|
166
166
|
|
|
167
167
|
```bash
|
|
168
168
|
gro dev # start developing in watch mode
|
|
@@ -173,7 +173,7 @@ gro dev -- vite --port 3003 # forward args by separating sections with --
|
|
|
173
173
|
gro build # build everything for production
|
|
174
174
|
```
|
|
175
175
|
|
|
176
|
-
[Testing](/src/
|
|
176
|
+
[Testing](/src/docs/test.md) with [`uvu`](https://github.com/lukeed/uvu),
|
|
177
177
|
including shims for [SvelteKit modules](https://kit.svelte.dev/docs/modules):
|
|
178
178
|
|
|
179
179
|
```bash
|
|
@@ -202,20 +202,20 @@ gro format # format all of the source files using Prettier
|
|
|
202
202
|
gro format --check # check that all source files are formatted
|
|
203
203
|
```
|
|
204
204
|
|
|
205
|
-
Codegen with [`gen`](/src/
|
|
205
|
+
Codegen with [`gen`](/src/docs/gen.md):
|
|
206
206
|
|
|
207
207
|
```bash
|
|
208
208
|
gro gen # run codegen for all `*.gen.*` files
|
|
209
209
|
gro gen --check # error if any generated files are new or different
|
|
210
210
|
```
|
|
211
211
|
|
|
212
|
-
To deploy: (also see [`src/
|
|
212
|
+
To deploy: (also see [`src/docs/deploy.md`](/src/docs/deploy.md))
|
|
213
213
|
|
|
214
214
|
```bash
|
|
215
215
|
gro deploy # build and push to the `deploy` branch
|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
-
To publish: (also see [`src/
|
|
218
|
+
To publish: (also see [`src/docs/publish.md`](/src/docs/publish.md))
|
|
219
219
|
|
|
220
220
|
```bash
|
|
221
221
|
gro publish # flush changeset to changelog, bump version, publish to npm, and git push
|
|
@@ -230,8 +230,8 @@ gro upgrade excluded-dep-1 excluded-dep-2 # npm updates to the latest everything
|
|
|
230
230
|
gro --version # print the Gro version
|
|
231
231
|
```
|
|
232
232
|
|
|
233
|
-
For more see [the tasks index](/src/
|
|
234
|
-
[the task feature docs](/src/
|
|
233
|
+
For more see [the tasks index](/src/docs/tasks.md),
|
|
234
|
+
[the task feature docs](/src/docs/task.md), and [the docs index](/src/docs/README.md).
|
|
235
235
|
|
|
236
236
|
## develop
|
|
237
237
|
|
package/dist/config.d.ts
CHANGED
|
@@ -4,11 +4,11 @@ import type { Path_Filter, Path_Id } from './path.js';
|
|
|
4
4
|
/**
|
|
5
5
|
* The config that users can extend via `gro.config.ts`.
|
|
6
6
|
* This is exposed to users in places like tasks and genfiles.
|
|
7
|
-
* @see https://github.com/ryanatkn/gro/blob/main/src/
|
|
7
|
+
* @see https://github.com/ryanatkn/gro/blob/main/src/docs/config.md
|
|
8
8
|
*/
|
|
9
9
|
export interface Gro_Config {
|
|
10
10
|
/**
|
|
11
|
-
* @see https://github.com/ryanatkn/gro/blob/main/src/
|
|
11
|
+
* @see https://github.com/ryanatkn/gro/blob/main/src/docs/plugin.md
|
|
12
12
|
*/
|
|
13
13
|
plugins: Create_Config_Plugins;
|
|
14
14
|
/**
|
|
@@ -31,7 +31,7 @@ export interface Gro_Config {
|
|
|
31
31
|
/**
|
|
32
32
|
* The relaxed variant of `Gro_Config` that users can provide via `gro.config.ts`.
|
|
33
33
|
* Superset of `Gro_Config`.
|
|
34
|
-
* @see https://github.com/ryanatkn/gro/blob/main/src/
|
|
34
|
+
* @see https://github.com/ryanatkn/gro/blob/main/src/docs/config.md
|
|
35
35
|
*/
|
|
36
36
|
export interface Raw_Gro_Config {
|
|
37
37
|
plugins?: Create_Config_Plugins;
|
package/dist/gen.test.js
CHANGED
|
@@ -241,7 +241,7 @@ test('validate_gen_module basic behavior', () => {
|
|
|
241
241
|
assert.ok(!validate_gen_module({ task: { run: {} } }));
|
|
242
242
|
});
|
|
243
243
|
test('find_genfiles_result finds gen modules in a directory', () => {
|
|
244
|
-
const find_genfiles_result = find_genfiles(['docs'], [paths.lib], create_empty_config());
|
|
244
|
+
const find_genfiles_result = find_genfiles(['../docs'], [paths.lib], create_empty_config());
|
|
245
245
|
assert.ok(find_genfiles_result.ok);
|
|
246
246
|
assert.ok(find_genfiles_result.value.resolved_input_paths.length);
|
|
247
247
|
});
|
package/dist/invoke.js
CHANGED
|
@@ -7,7 +7,7 @@ import { sveltekit_sync_if_obviously_needed } from './sveltekit_helpers.js';
|
|
|
7
7
|
|
|
8
8
|
This module invokes the Gro CLI which in turn invokes tasks.
|
|
9
9
|
Tasks are the CLI's primary concept.
|
|
10
|
-
To learn more about them, see `src/
|
|
10
|
+
To learn more about them, see `src/docs/task.md`.
|
|
11
11
|
|
|
12
12
|
When the CLI is invoked it passes the first CLI arg as `task_name` to `invoke_task`,
|
|
13
13
|
and the rest of the args are forwarded to the task's `run` function.
|
package/dist/package.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// generated by src/lib/package.gen.ts
|
|
2
2
|
export const package_json = {
|
|
3
3
|
name: '@ryanatkn/gro',
|
|
4
|
-
version: '0.129.
|
|
4
|
+
version: '0.129.8',
|
|
5
5
|
description: 'task runner and toolkit extending SvelteKit',
|
|
6
6
|
motto: 'generate, run, optimize',
|
|
7
7
|
glyph: '🌰',
|
|
@@ -266,7 +266,7 @@ export const package_json = {
|
|
|
266
266
|
};
|
|
267
267
|
export const src_json = {
|
|
268
268
|
name: '@ryanatkn/gro',
|
|
269
|
-
version: '0.129.
|
|
269
|
+
version: '0.129.8',
|
|
270
270
|
modules: {
|
|
271
271
|
'.': {
|
|
272
272
|
path: 'index.ts',
|
package/dist/src_json.d.ts
CHANGED
|
@@ -88,7 +88,7 @@ export declare const Src_Modules: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
88
88
|
}, z.ZodTypeAny, "passthrough">>>;
|
|
89
89
|
export type Src_Modules = z.infer<typeof Src_Modules>;
|
|
90
90
|
/**
|
|
91
|
-
* @see https://github.com/ryanatkn/gro/blob/main/src/
|
|
91
|
+
* @see https://github.com/ryanatkn/gro/blob/main/src/docs/gro_plugin_sveltekit_app.md#well-known-src
|
|
92
92
|
*/
|
|
93
93
|
export declare const Src_Json: z.ZodIntersection<z.ZodRecord<z.ZodString, z.ZodUnknown>, z.ZodObject<{
|
|
94
94
|
name: z.ZodString;
|
package/dist/src_json.js
CHANGED
|
@@ -22,7 +22,7 @@ export const Src_Module = z
|
|
|
22
22
|
.passthrough();
|
|
23
23
|
export const Src_Modules = z.record(Src_Module);
|
|
24
24
|
/**
|
|
25
|
-
* @see https://github.com/ryanatkn/gro/blob/main/src/
|
|
25
|
+
* @see https://github.com/ryanatkn/gro/blob/main/src/docs/gro_plugin_sveltekit_app.md#well-known-src
|
|
26
26
|
*/
|
|
27
27
|
export const Src_Json = z.intersection(z.record(z.unknown()), // TODO is this what we want?
|
|
28
28
|
z
|
package/package.json
CHANGED
package/src/lib/config.ts
CHANGED
|
@@ -17,11 +17,11 @@ import type {Path_Filter, Path_Id} from './path.js';
|
|
|
17
17
|
/**
|
|
18
18
|
* The config that users can extend via `gro.config.ts`.
|
|
19
19
|
* This is exposed to users in places like tasks and genfiles.
|
|
20
|
-
* @see https://github.com/ryanatkn/gro/blob/main/src/
|
|
20
|
+
* @see https://github.com/ryanatkn/gro/blob/main/src/docs/config.md
|
|
21
21
|
*/
|
|
22
22
|
export interface Gro_Config {
|
|
23
23
|
/**
|
|
24
|
-
* @see https://github.com/ryanatkn/gro/blob/main/src/
|
|
24
|
+
* @see https://github.com/ryanatkn/gro/blob/main/src/docs/plugin.md
|
|
25
25
|
*/
|
|
26
26
|
plugins: Create_Config_Plugins;
|
|
27
27
|
/**
|
|
@@ -45,7 +45,7 @@ export interface Gro_Config {
|
|
|
45
45
|
/**
|
|
46
46
|
* The relaxed variant of `Gro_Config` that users can provide via `gro.config.ts`.
|
|
47
47
|
* Superset of `Gro_Config`.
|
|
48
|
-
* @see https://github.com/ryanatkn/gro/blob/main/src/
|
|
48
|
+
* @see https://github.com/ryanatkn/gro/blob/main/src/docs/config.md
|
|
49
49
|
*/
|
|
50
50
|
export interface Raw_Gro_Config {
|
|
51
51
|
plugins?: Create_Config_Plugins;
|
package/src/lib/gen.test.ts
CHANGED
|
@@ -298,7 +298,7 @@ test('validate_gen_module basic behavior', () => {
|
|
|
298
298
|
});
|
|
299
299
|
|
|
300
300
|
test('find_genfiles_result finds gen modules in a directory', () => {
|
|
301
|
-
const find_genfiles_result = find_genfiles(['docs'], [paths.lib], create_empty_config());
|
|
301
|
+
const find_genfiles_result = find_genfiles(['../docs'], [paths.lib], create_empty_config());
|
|
302
302
|
assert.ok(find_genfiles_result.ok);
|
|
303
303
|
assert.ok(find_genfiles_result.value.resolved_input_paths.length);
|
|
304
304
|
});
|
package/src/lib/invoke.ts
CHANGED
|
@@ -9,7 +9,7 @@ import {sveltekit_sync_if_obviously_needed} from './sveltekit_helpers.js';
|
|
|
9
9
|
|
|
10
10
|
This module invokes the Gro CLI which in turn invokes tasks.
|
|
11
11
|
Tasks are the CLI's primary concept.
|
|
12
|
-
To learn more about them, see `src/
|
|
12
|
+
To learn more about them, see `src/docs/task.md`.
|
|
13
13
|
|
|
14
14
|
When the CLI is invoked it passes the first CLI arg as `task_name` to `invoke_task`,
|
|
15
15
|
and the rest of the args are forwarded to the task's `run` function.
|
package/src/lib/package.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {Src_Json} from './src_json.js';
|
|
|
5
5
|
|
|
6
6
|
export const package_json = {
|
|
7
7
|
name: '@ryanatkn/gro',
|
|
8
|
-
version: '0.129.
|
|
8
|
+
version: '0.129.8',
|
|
9
9
|
description: 'task runner and toolkit extending SvelteKit',
|
|
10
10
|
motto: 'generate, run, optimize',
|
|
11
11
|
glyph: '🌰',
|
|
@@ -272,7 +272,7 @@ export const package_json = {
|
|
|
272
272
|
|
|
273
273
|
export const src_json = {
|
|
274
274
|
name: '@ryanatkn/gro',
|
|
275
|
-
version: '0.129.
|
|
275
|
+
version: '0.129.8',
|
|
276
276
|
modules: {
|
|
277
277
|
'.': {
|
|
278
278
|
path: 'index.ts',
|
package/src/lib/src_json.ts
CHANGED
|
@@ -35,7 +35,7 @@ export const Src_Modules = z.record(Src_Module);
|
|
|
35
35
|
export type Src_Modules = z.infer<typeof Src_Modules>;
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* @see https://github.com/ryanatkn/gro/blob/main/src/
|
|
38
|
+
* @see https://github.com/ryanatkn/gro/blob/main/src/docs/gro_plugin_sveltekit_app.md#well-known-src
|
|
39
39
|
*/
|
|
40
40
|
export const Src_Json = z.intersection(
|
|
41
41
|
z.record(z.unknown()), // TODO is this what we want?
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"README.gen.md.d.ts","sourceRoot":"","sources":["../../../../src/lib/docs/README.gen.md.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,KAAK,GAAG,EAAsB,MAAM,WAAW,CAAC;AAQxD;;GAEG;AACH,eAAO,MAAM,GAAG,EAAE,GA+CjB,CAAC"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { dirname, relative, basename } from 'node:path';
|
|
2
|
-
import { parse_path_parts, parse_path_segments } from '@ryanatkn/belt/path.js';
|
|
3
|
-
import { strip_start } from '@ryanatkn/belt/string.js';
|
|
4
|
-
import { to_output_file_name } from '../gen.js';
|
|
5
|
-
import { paths, base_path_to_path_id } from '../paths.js';
|
|
6
|
-
import { search_fs } from '../search_fs.js';
|
|
7
|
-
// TODO look at `tasks.gen.md.ts` to refactor and generalize
|
|
8
|
-
// TODO show nested structure, not a flat list
|
|
9
|
-
// TODO work with file types beyond markdown
|
|
10
|
-
/**
|
|
11
|
-
* Renders a simple index of a possibly nested directory of files.
|
|
12
|
-
*/
|
|
13
|
-
export const gen = ({ origin_id }) => {
|
|
14
|
-
// TODO need to get this from project config or something
|
|
15
|
-
const root_path = parse_path_segments(paths.root).at(-1);
|
|
16
|
-
const origin_dir = dirname(origin_id);
|
|
17
|
-
const origin_base = basename(origin_id);
|
|
18
|
-
const base_dir = paths.source;
|
|
19
|
-
const relative_path = strip_start(origin_id, base_dir);
|
|
20
|
-
const relative_dir = dirname(relative_path);
|
|
21
|
-
// TODO should this be passed in the context, like `defaultOutputFileName`?
|
|
22
|
-
const output_file_name = to_output_file_name(origin_base);
|
|
23
|
-
// TODO this is GitHub-specific
|
|
24
|
-
const root_link = `[${root_path}](/../..)`;
|
|
25
|
-
const doc_files = search_fs(origin_dir);
|
|
26
|
-
const doc_paths = [];
|
|
27
|
-
for (const { path } of doc_files) {
|
|
28
|
-
if (path === output_file_name || !path.endsWith('.md')) {
|
|
29
|
-
continue;
|
|
30
|
-
}
|
|
31
|
-
doc_paths.push(path);
|
|
32
|
-
}
|
|
33
|
-
// TODO do we want to use absolute paths instead of relative paths,
|
|
34
|
-
// because GitHub works with them and it simplifies the code?
|
|
35
|
-
const is_index_file = output_file_name === 'README.md';
|
|
36
|
-
const path_parts = parse_path_parts(relative_dir).map((relative_path_part) => {
|
|
37
|
-
const segment = parse_path_segments(relative_path_part).at(-1);
|
|
38
|
-
return is_index_file && relative_path_part === relative_dir
|
|
39
|
-
? segment
|
|
40
|
-
: `[${segment}](${relative(origin_dir, base_path_to_path_id(relative_path_part)) || './'})`;
|
|
41
|
-
});
|
|
42
|
-
const breadcrumbs = '> <sub>' + [root_link, ...path_parts, output_file_name].join(' / ') + '</sub>';
|
|
43
|
-
// TODO render the footer with the origin_id
|
|
44
|
-
return `# docs
|
|
45
|
-
|
|
46
|
-
${breadcrumbs}
|
|
47
|
-
|
|
48
|
-
${doc_paths.reduce((docList, doc) => docList + `- [${basename(doc, '.md')}](${doc})\n`, '')}
|
|
49
|
-
${breadcrumbs}
|
|
50
|
-
|
|
51
|
-
> <sub>generated by [${origin_base}](${origin_base})</sub>
|
|
52
|
-
`;
|
|
53
|
-
};
|
package/dist/docs/README.md
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# docs
|
|
2
|
-
|
|
3
|
-
> <sub>[gro](/../..) / [lib](..) / docs / README.md</sub>
|
|
4
|
-
|
|
5
|
-
- [build](build.md)
|
|
6
|
-
- [config](config.md)
|
|
7
|
-
- [deploy](deploy.md)
|
|
8
|
-
- [dev](dev.md)
|
|
9
|
-
- [gen](gen.md)
|
|
10
|
-
- [gro_plugin_sveltekit_app](gro_plugin_sveltekit_app.md)
|
|
11
|
-
- [package_json](package_json.md)
|
|
12
|
-
- [plugin](plugin.md)
|
|
13
|
-
- [publish](publish.md)
|
|
14
|
-
- [task](task.md)
|
|
15
|
-
- [tasks](tasks.md)
|
|
16
|
-
- [test](test.md)
|
|
17
|
-
|
|
18
|
-
> <sub>[gro](/../..) / [lib](..) / docs / README.md</sub>
|
|
19
|
-
|
|
20
|
-
> <sub>generated by [README.gen.md.ts](README.gen.md.ts)</sub>
|
package/dist/docs/build.md
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
# build
|
|
2
|
-
|
|
3
|
-
> these docs are for production builds, for development see [dev.md](dev.md)
|
|
4
|
-
|
|
5
|
-
## usage
|
|
6
|
-
|
|
7
|
-
The `gro build` task produces outputs for production:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
gro build
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
This runs the configured Gro plugins, `setup -> adapt -> teardown`, in production mode.
|
|
14
|
-
|
|
15
|
-
If your project has a SvelteKit frontend,
|
|
16
|
-
[the default plugin](../gro_plugin_sveltekit_app.ts) calls `vite build`,
|
|
17
|
-
forwarding any [`-- vite [...]` args](https://vitejs.dev/config/):
|
|
18
|
-
|
|
19
|
-
```bash
|
|
20
|
-
gro build -- vite --config my-config.js
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## plugins
|
|
24
|
-
|
|
25
|
-
`Plugin`s are objects that customize the behavior of `gro build` and `gro dev`.
|
|
26
|
-
They try to defer to underlying tools as much as possible, and exist to glue everything together.
|
|
27
|
-
For example, the library plugin internally uses
|
|
28
|
-
[`svelte-package`](https://kit.svelte.dev/docs/packaging).
|
|
29
|
-
See [plugin.md](plugin.md) to learn more.
|
|
30
|
-
|
|
31
|
-
## deploying and publishing
|
|
32
|
-
|
|
33
|
-
Now that we can produce builds, how do we share them with the world?
|
|
34
|
-
|
|
35
|
-
The [`gro deploy`](deploy.md) task outputs builds to a branch,
|
|
36
|
-
like for static publishing to GitHub pages.
|
|
37
|
-
|
|
38
|
-
The [`gro publish`](publish.md) task publishes packages to npm.
|
|
39
|
-
|
|
40
|
-
Both of these tasks call `gro build` internally,
|
|
41
|
-
and you can always run it manually if you're curious.
|
package/dist/docs/config.md
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
# config
|
|
2
|
-
|
|
3
|
-
Gro supports SvelteKit apps, Node libraries, and Node servers with minimal abstraction
|
|
4
|
-
with the help of an optional config file that lives at the root `gro.config.ts`.
|
|
5
|
-
If a project does not define a config, Gro imports a default config from
|
|
6
|
-
[`src/lib/gro.config.default.ts`](/src/lib/gro.config.default.ts),
|
|
7
|
-
which looks at your project for the familiar patterns and tries to do the right thing.
|
|
8
|
-
|
|
9
|
-
> The [default config](/src/lib/gro.config.default.ts)
|
|
10
|
-
> detects three types of projects that can coexist in one repo:
|
|
11
|
-
> SvelteKit frontends,
|
|
12
|
-
> Node libraries with [`@sveltejs/package`](https://kit.svelte.dev/docs/packaging),
|
|
13
|
-
> and Node servers.
|
|
14
|
-
|
|
15
|
-
See [`src/lib/config.ts`](/src/lib/config.ts) for the config types and implementation.
|
|
16
|
-
|
|
17
|
-
## examples
|
|
18
|
-
|
|
19
|
-
[The default config](/src/lib/gro.config.default.ts)
|
|
20
|
-
is used for projects that do not define `gro.config.ts`.
|
|
21
|
-
It's also passed as the first argument to `Create_Gro_Config`.
|
|
22
|
-
|
|
23
|
-
A simple config that does nothing:
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
// gro.config.ts
|
|
27
|
-
import type {Create_Gro_Config} from '@ryanatkn/gro';
|
|
28
|
-
|
|
29
|
-
const config: Create_Gro_Config = async (cfg) => {
|
|
30
|
-
// mutate `cfg` or return a new object
|
|
31
|
-
return cfg;
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export default config;
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
The default export of a Gro config is `Gro_Config | Create_Gro_Config`:
|
|
38
|
-
|
|
39
|
-
```ts
|
|
40
|
-
export interface Create_Gro_Config {
|
|
41
|
-
(base_config: Gro_Config): Raw_Gro_Config | Promise<Raw_Gro_Config>;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
// The strict variant that's used internally and exposed to users in tasks and elsewhere.
|
|
45
|
-
export interface Gro_Config {
|
|
46
|
-
plugins: Create_Config_Plugins;
|
|
47
|
-
map_package_json: Map_Package_Json | null;
|
|
48
|
-
task_root_dirs: Path_Id[];
|
|
49
|
-
search_filters: Path_Filter[];
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// The relaxed variant that users can provide. Superset of `Gro_Config`.
|
|
53
|
-
export interface Raw_Gro_Config {
|
|
54
|
-
plugins?: Create_Config_Plugins;
|
|
55
|
-
map_package_json?: Map_Package_Json | null;
|
|
56
|
-
task_root_dirs?: string[];
|
|
57
|
-
search_filters?: Path_Filter | Path_Filter[] | null;
|
|
58
|
-
}
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
To define a user config that overrides the default plugins:
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
import type {Create_Gro_Config} from '@ryanatkn/gro';
|
|
65
|
-
import {gro_plugin_sveltekit_app} from '@ryanatkn/gro/gro_plugin_sveltekit_app.js';
|
|
66
|
-
|
|
67
|
-
const config: Create_Gro_Config = async (cfg) => {
|
|
68
|
-
// `cfg`, which has type `Gro_Config` and is equal to `create_empty_config()`,
|
|
69
|
-
// can be mutated or you can return your own.
|
|
70
|
-
// A return value is required to avoid potential errors and reduce ambiguity.
|
|
71
|
-
|
|
72
|
-
// example setting your own plugins):
|
|
73
|
-
cfg.plugins = async () => [
|
|
74
|
-
gro_plugin_sveltekit_app(),
|
|
75
|
-
(await import('./src/custom_plugin.js')).plugin(),
|
|
76
|
-
];
|
|
77
|
-
|
|
78
|
-
// example extending the default plugins:
|
|
79
|
-
const get_base_plugins = cfg.plugins;
|
|
80
|
-
cfg.plugins = async (ctx) => {
|
|
81
|
-
// replace a base plugin with `import {replace_plugin} from '@ryanatkn/gro';`:
|
|
82
|
-
const updated_plugins = replace_plugin(
|
|
83
|
-
await get_base_plugins(ctx),
|
|
84
|
-
gro_plugin_sveltekit_app({
|
|
85
|
-
// host_target?: Host_Target;
|
|
86
|
-
// well_known_package_json?: boolean | Map_Package_Json;
|
|
87
|
-
}),
|
|
88
|
-
// 'gro_plugin_sveltekit_app', // optional name if they don't match
|
|
89
|
-
);
|
|
90
|
-
return updated_plugins.concat(create_some_custom_plugin());
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
return cfg; // return type is `Raw_Gro_Config`, which is a relaxed superset of `Gro_Config`
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
export default config;
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
You can also export a config object and use `create_empty_config` to get the defaults:
|
|
100
|
-
|
|
101
|
-
```ts
|
|
102
|
-
import {create_empty_config} from '@ryanatkn/gro/config.js';
|
|
103
|
-
|
|
104
|
-
const config = create_empty_config();
|
|
105
|
-
|
|
106
|
-
// config.plugins = ...;
|
|
107
|
-
// config.map_package_json = ...;
|
|
108
|
-
// config.task_root_dirs = ...;
|
|
109
|
-
// config.search_filters = ...;
|
|
110
|
-
|
|
111
|
-
export default config;
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
See also [Gro's own internal config](/gro.config.ts).
|
|
115
|
-
|
|
116
|
-
## `plugins`
|
|
117
|
-
|
|
118
|
-
The `plugins` property is a function that returns an array of `Plugin` instances.
|
|
119
|
-
Read more about plugins and the `Plugin` in
|
|
120
|
-
[plugin.md](plugin.md), [dev.md](dev.md#plugin), and [build.md](build.md#plugin).
|
|
121
|
-
|
|
122
|
-
```ts
|
|
123
|
-
export interface Create_Config_Plugins<T_Plugin_Context extends Plugin_Context = Plugin_Context> {
|
|
124
|
-
(
|
|
125
|
-
ctx: T_Plugin_Context,
|
|
126
|
-
):
|
|
127
|
-
| (Plugin<T_Plugin_Context> | null | Array<Plugin<T_Plugin_Context> | null>)
|
|
128
|
-
| Promise<Plugin<T_Plugin_Context> | null | Array<Plugin<T_Plugin_Context> | null>>;
|
|
129
|
-
}
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
## `map_package_json`
|
|
133
|
-
|
|
134
|
-
The Gro config option `map_package_json` hooks into Gro's `package.json` automations.
|
|
135
|
-
The `gro sync` task, which is called during the dev and build tasks among others,
|
|
136
|
-
performs several steps to get a project's state ready,
|
|
137
|
-
including `svelte-kit sync` and `package.json` automations.
|
|
138
|
-
When the `map_package_json` config value is truthy,
|
|
139
|
-
Gro outputs a mapped version of the root `package.json`.
|
|
140
|
-
|
|
141
|
-
> The `gro check` task integrates with `map_package_json` to ensure everything is synced.
|
|
142
|
-
|
|
143
|
-
The main purpose of `map_package_json` is to automate
|
|
144
|
-
the `"exports"` property of your root `package.json`.
|
|
145
|
-
The motivation is to streamline package publishing by supplementing
|
|
146
|
-
[`@sveltejs/package`](https://kit.svelte.dev/docs/packaging).
|
|
147
|
-
|
|
148
|
-
By default `package_json.exports` includes everything from `$lib/`
|
|
149
|
-
except for some ignored files like tests and markdown,
|
|
150
|
-
and you can provide your own `map_package_json` hook to
|
|
151
|
-
mutate the `package_json`, return new data, or return `null` to be a no-op.
|
|
152
|
-
|
|
153
|
-
Typical usage modifies `package_json.exports` during this step to define the public API.
|
|
154
|
-
|
|
155
|
-
### using `map_package_json`
|
|
156
|
-
|
|
157
|
-
```ts
|
|
158
|
-
// gro.config.ts
|
|
159
|
-
const config: Gro_Config = {
|
|
160
|
-
// ...other config
|
|
161
|
-
|
|
162
|
-
// disable mapping `package.json` with automated `exports`:
|
|
163
|
-
map_package_json: null,
|
|
164
|
-
|
|
165
|
-
// mutate anything and return the final config (can be async):
|
|
166
|
-
map_package_json: (package_json) => {
|
|
167
|
-
// example setting `exports`:
|
|
168
|
-
package_json.exports = {
|
|
169
|
-
'.': {
|
|
170
|
-
default: './dist/index.js',
|
|
171
|
-
types: './dist/index.d.ts',
|
|
172
|
-
},
|
|
173
|
-
'./example.js': {
|
|
174
|
-
default: './dist/example.js',
|
|
175
|
-
types: './dist/example.d.ts',
|
|
176
|
-
},
|
|
177
|
-
'./Example.svelte': {
|
|
178
|
-
svelte: './dist/Example.svelte',
|
|
179
|
-
types: './dist/Example.svelte.d.ts',
|
|
180
|
-
},
|
|
181
|
-
};
|
|
182
|
-
// example filtering `exports`:
|
|
183
|
-
package_json.exports = Object.fromEntries(
|
|
184
|
-
Object.entries(package_json.exports).filter(/* ... */),
|
|
185
|
-
);
|
|
186
|
-
return package_json; // returning `null` is a no-op
|
|
187
|
-
},
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
export interface Map_Package_Json {
|
|
191
|
-
(package_json: Package_Json): Package_Json | null | Promise<Package_Json | null>;
|
|
192
|
-
}
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
## `task_root_dirs`
|
|
196
|
-
|
|
197
|
-
The Gro config option `task_root_dirs` allows customizing Gro's task resolution.
|
|
198
|
-
When calling `gro [input_path]`, absolute and explicitly relative paths starting with `.`
|
|
199
|
-
are resolved according to normal filesystem rules,
|
|
200
|
-
but non-explicit input paths, like `foo`, are resolved by searching
|
|
201
|
-
through `task_root_dirs` in order until a matching file or directory is found on the filesystem.
|
|
202
|
-
|
|
203
|
-
The default task paths are `./src/lib`, then `.`, and then Gro's dist directory.
|
|
204
|
-
|
|
205
|
-
## `search_filters`
|
|
206
|
-
|
|
207
|
-
The Gro config option `search_filters` allows customizing
|
|
208
|
-
how Gro searches for tasks and genfiles on the filesystem.
|
|
209
|
-
Directories and files are included if they pass all of these filters.
|
|
210
|
-
|
|
211
|
-
By default, it uses the `DEFAULT_SEARCH_EXCLUDER` to exclude
|
|
212
|
-
dot-prefixed directories, node_modules,
|
|
213
|
-
and the build and dist directories for SvelteKit and Gro.
|
package/dist/docs/deploy.md
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# deploy
|
|
2
|
-
|
|
3
|
-
The [`gro deploy`](/src/lib/deploy.task.ts)
|
|
4
|
-
task was originally designed to support static deployments to
|
|
5
|
-
[GitHub pages](https://pages.github.com/),
|
|
6
|
-
but what it actually does is just [build](./build.md) and push to a branch.
|
|
7
|
-
|
|
8
|
-
Importantly, Gro **destructively force pushes** to the `--target` branch, `deploy` by default.
|
|
9
|
-
This is because Gro treats your deployment
|
|
10
|
-
branch as disposable, able to be deleted or squashed or whatever whenever.
|
|
11
|
-
Internally, `gro deploy` uses [git worktree](https://git-scm.com/docs/git-worktree)
|
|
12
|
-
for tidiness.
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
gro deploy # prepare build/ and commit it to the `deploy` branch, then push to go live
|
|
16
|
-
gro deploy --source my-branch # deploy from `my-branch` instead of the default `main`
|
|
17
|
-
|
|
18
|
-
# deploy to `custom-deploy-branch` instead of the default `deploy`
|
|
19
|
-
# WARNING! this force pushes to the target branch!
|
|
20
|
-
gro deploy --target custom-deploy-branch
|
|
21
|
-
# the above actually fails because force pushing is destructive, so add `--force` to be extra clear:
|
|
22
|
-
gro deploy --target custom-deploy-branch --force
|
|
23
|
-
# TODO maybe it should be `--dangerous-target-branch` instead of `--target` and `--force`?
|
|
24
|
-
|
|
25
|
-
gro deploy --dry # prepare build/ but don't commit or push
|
|
26
|
-
gro deploy --clean # if something goes wrong, use this to reset git and gro state
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Run `gro deploy --help` or see [`src/lib/deploy.task.ts`](/src/lib/deploy.task.ts) for the details.
|
|
30
|
-
|
|
31
|
-
For needs more advanced than pushing to a remote branch,
|
|
32
|
-
projects can implement a custom `src/lib/deploy.task.ts`.
|