@ryanatkn/gro 0.118.0 → 0.119.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 +6 -4
- package/dist/build.task.d.ts +3 -0
- package/dist/build.task.js +5 -1
- package/dist/changeset.task.d.ts +2 -2
- package/dist/changeset.task.js +9 -5
- package/dist/check.task.js +1 -1
- package/dist/deploy.task.d.ts +0 -6
- package/dist/deploy.task.js +2 -7
- package/dist/dev.task.d.ts +2 -2
- package/dist/docs/gen.md +11 -0
- package/dist/docs/publish.md +1 -8
- package/dist/docs/task.md +7 -0
- package/dist/docs/tasks.md +1 -0
- package/dist/format_directory.d.ts +8 -2
- package/dist/format_directory.js +15 -10
- package/dist/gen.d.ts +14 -0
- package/dist/gen.js +45 -0
- package/dist/gen.task.js +17 -17
- package/dist/gen_module.d.ts +1 -14
- package/dist/gen_module.js +0 -22
- package/dist/git.d.ts +5 -0
- package/dist/git.js +15 -0
- package/dist/git.test.js +4 -1
- package/dist/gro.config.default.js +5 -9
- package/dist/gro_plugin_gen.js +1 -1
- package/dist/gro_plugin_server.d.ts +4 -1
- package/dist/gro_plugin_server.js +6 -1
- package/dist/gro_plugin_sveltekit_library.js +9 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +0 -1
- package/dist/invoke.js +2 -0
- package/dist/invoke_task.d.ts +1 -1
- package/dist/invoke_task.js +1 -1
- package/dist/package.d.ts +11 -0
- package/dist/package.js +26 -8
- package/dist/package_json.js +1 -1
- package/dist/path_constants.d.ts +1 -0
- package/dist/path_constants.js +1 -0
- package/dist/publish.task.d.ts +9 -6
- package/dist/publish.task.js +25 -13
- package/dist/reinstall.task.d.ts +5 -0
- package/dist/reinstall.task.js +32 -0
- package/dist/release.task.js +4 -5
- package/dist/run.task.js +1 -1
- package/dist/run_task.js +1 -1
- package/dist/sveltekit_helpers.d.ts +15 -2
- package/dist/sveltekit_helpers.js +48 -6
- package/dist/sync.task.d.ts +0 -1
- package/dist/sync.task.js +2 -11
- package/dist/task_logging.js +25 -11
- package/dist/typecheck.task.js +1 -1
- package/dist/upgrade.task.d.ts +4 -1
- package/dist/upgrade.task.js +30 -5
- package/package.json +7 -3
package/dist/task_logging.js
CHANGED
|
@@ -111,11 +111,9 @@ const to_args_schema_type = ({ _def }) => {
|
|
|
111
111
|
case ZodFirstPartyTypeKind.ZodUnion:
|
|
112
112
|
return 'string | string[]'; // TODO support unions of arbitrary types, or more hardcoded ones as needed
|
|
113
113
|
default: {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
else if ('innerType' in _def) {
|
|
118
|
-
return to_args_schema_type(_def.innerType);
|
|
114
|
+
const subschema = to_subschema(_def);
|
|
115
|
+
if (subschema) {
|
|
116
|
+
return to_args_schema_type(subschema);
|
|
119
117
|
}
|
|
120
118
|
else {
|
|
121
119
|
throw Error('Unknown zod type ' + t);
|
|
@@ -124,18 +122,34 @@ const to_args_schema_type = ({ _def }) => {
|
|
|
124
122
|
}
|
|
125
123
|
};
|
|
126
124
|
const to_args_schema_description = ({ _def }) => {
|
|
127
|
-
if (_def.description)
|
|
125
|
+
if (_def.description) {
|
|
128
126
|
return _def.description;
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
}
|
|
128
|
+
const subschema = to_subschema(_def);
|
|
129
|
+
if (subschema) {
|
|
130
|
+
return to_args_schema_description(subschema);
|
|
131
131
|
}
|
|
132
132
|
return '';
|
|
133
133
|
};
|
|
134
134
|
const to_args_schema_default = ({ _def }) => {
|
|
135
|
-
if (_def.defaultValue)
|
|
135
|
+
if (_def.defaultValue) {
|
|
136
136
|
return _def.defaultValue();
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
}
|
|
138
|
+
const subschema = to_subschema(_def);
|
|
139
|
+
if (subschema) {
|
|
140
|
+
return to_args_schema_default(subschema);
|
|
141
|
+
}
|
|
142
|
+
return undefined;
|
|
143
|
+
};
|
|
144
|
+
const to_subschema = (_def) => {
|
|
145
|
+
if ('type' in _def) {
|
|
146
|
+
return _def.type;
|
|
147
|
+
}
|
|
148
|
+
else if ('innerType' in _def) {
|
|
149
|
+
return _def.innerType;
|
|
150
|
+
}
|
|
151
|
+
else if ('schema' in _def) {
|
|
152
|
+
return _def.schema;
|
|
139
153
|
}
|
|
140
154
|
return undefined;
|
|
141
155
|
};
|
package/dist/typecheck.task.js
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from 'zod';
|
|
|
3
3
|
import { Task_Error } from './task.js';
|
|
4
4
|
import { print_command_args, serialize_args, to_forwarded_args } from './args.js';
|
|
5
5
|
import { find_cli, spawn_cli } from './cli.js';
|
|
6
|
-
import { sveltekit_sync } from './
|
|
6
|
+
import { sveltekit_sync } from './sveltekit_helpers.js';
|
|
7
7
|
export const Args = z.object({}).strict();
|
|
8
8
|
export const task = {
|
|
9
9
|
summary: 'run tsc on the project without emitting any files',
|
package/dist/upgrade.task.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import type
|
|
2
|
+
import { type Task } from './task.js';
|
|
3
3
|
export declare const Args: z.ZodObject<{
|
|
4
4
|
_: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
|
|
5
|
+
only: z.ZodEffects<z.ZodDefault<z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>, string[], string | string[] | undefined>;
|
|
5
6
|
origin: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Origin">>;
|
|
6
7
|
force: z.ZodDefault<z.ZodBoolean>;
|
|
7
8
|
pull: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -14,6 +15,7 @@ export declare const Args: z.ZodObject<{
|
|
|
14
15
|
dry: boolean;
|
|
15
16
|
force: boolean;
|
|
16
17
|
'no-pull': boolean;
|
|
18
|
+
only: string[];
|
|
17
19
|
}, {
|
|
18
20
|
_?: string[] | undefined;
|
|
19
21
|
origin?: string | undefined;
|
|
@@ -21,6 +23,7 @@ export declare const Args: z.ZodObject<{
|
|
|
21
23
|
dry?: boolean | undefined;
|
|
22
24
|
force?: boolean | undefined;
|
|
23
25
|
'no-pull'?: boolean | undefined;
|
|
26
|
+
only?: string | string[] | undefined;
|
|
24
27
|
}>;
|
|
25
28
|
export type Args = z.infer<typeof Args>;
|
|
26
29
|
export declare const task: Task<Args>;
|
package/dist/upgrade.task.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import { spawn } from '@ryanatkn/belt/process.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { Task_Error } from './task.js';
|
|
3
4
|
import { load_package_json } from './package_json.js';
|
|
4
5
|
import { Git_Origin, git_pull } from './git.js';
|
|
6
|
+
import { spawn_cli } from './cli.js';
|
|
5
7
|
export const Args = z
|
|
6
8
|
.object({
|
|
7
9
|
_: z.array(z.string(), { description: 'names of deps to exclude from the upgrade' }).default([]),
|
|
10
|
+
only: z
|
|
11
|
+
.union([z.string(), z.array(z.string())], {
|
|
12
|
+
description: 'names of deps to include in the upgrade',
|
|
13
|
+
})
|
|
14
|
+
.default([])
|
|
15
|
+
.transform((v) => (Array.isArray(v) ? v : [v])),
|
|
8
16
|
origin: Git_Origin.describe('git origin to deploy to').default('origin'),
|
|
9
17
|
force: z.boolean({ description: 'if true, print out the planned upgrades' }).default(false),
|
|
10
18
|
pull: z.boolean({ description: 'dual of no-pull' }).default(true),
|
|
@@ -15,14 +23,23 @@ export const Args = z
|
|
|
15
23
|
export const task = {
|
|
16
24
|
summary: 'upgrade deps',
|
|
17
25
|
Args,
|
|
18
|
-
run: async ({ args, log
|
|
19
|
-
const { _, origin, force, pull, dry } = args;
|
|
26
|
+
run: async ({ args, log }) => {
|
|
27
|
+
const { _, only, origin, force, pull, dry } = args;
|
|
28
|
+
if (_.length && only.length) {
|
|
29
|
+
throw new Task_Error('Cannot call `gro upgrade` with both rest args and --only.');
|
|
30
|
+
}
|
|
20
31
|
// TODO maybe a different task that pulls and does other things, like `gro ready`
|
|
21
32
|
if (pull) {
|
|
22
33
|
await git_pull(origin);
|
|
23
34
|
}
|
|
24
35
|
const package_json = await load_package_json();
|
|
25
|
-
const
|
|
36
|
+
const all_deps = to_deps(package_json);
|
|
37
|
+
const deps = only.length
|
|
38
|
+
? all_deps.filter((d) => only.includes(d.key))
|
|
39
|
+
: all_deps.filter((d) => !_.includes(d.key));
|
|
40
|
+
if (only.length && only.length !== deps.length) {
|
|
41
|
+
throw new Task_Error(`Some deps to upgrade were not found: ${only.filter((o) => !deps.find((d) => d.key === o)).join(', ')}`);
|
|
42
|
+
}
|
|
26
43
|
const upgrade_items = to_upgrade_items(deps);
|
|
27
44
|
log.info(`upgrading:`, upgrade_items.join(' '));
|
|
28
45
|
const install_args = ['install'].concat(upgrade_items);
|
|
@@ -34,7 +51,8 @@ export const task = {
|
|
|
34
51
|
install_args.push('--force');
|
|
35
52
|
}
|
|
36
53
|
await spawn('npm', install_args);
|
|
37
|
-
|
|
54
|
+
// Sync in a new process to pick up any changes after installing, avoiding some errors.
|
|
55
|
+
await spawn_cli('gro', ['sync']);
|
|
38
56
|
},
|
|
39
57
|
};
|
|
40
58
|
const to_deps = (package_json) => {
|
|
@@ -46,4 +64,11 @@ const to_deps = (package_json) => {
|
|
|
46
64
|
: [];
|
|
47
65
|
return prod_deps.concat(dev_deps);
|
|
48
66
|
};
|
|
49
|
-
|
|
67
|
+
// TODO hacky and limited
|
|
68
|
+
// TODO probably want to pass through exact deps as well, e.g. @foo/bar@1
|
|
69
|
+
const to_upgrade_items = (deps) => deps.map((dep) => {
|
|
70
|
+
if (dep.key.endsWith('@next') || dep.key.endsWith('@latest')) {
|
|
71
|
+
return dep.key;
|
|
72
|
+
}
|
|
73
|
+
return dep.key + (dep.value.includes('-next.') ? '@next' : '@latest');
|
|
74
|
+
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ryanatkn/gro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.119.0",
|
|
4
4
|
"description": "task runner and toolkit extending SvelteKit",
|
|
5
5
|
"motto": "generate, run, optimize",
|
|
6
6
|
"icon": "🌰",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@ryanatkn/fuz": "^0.102.1",
|
|
70
70
|
"@ryanatkn/moss": "^0.4.0",
|
|
71
71
|
"@sveltejs/adapter-static": "^3.0.2",
|
|
72
|
-
"@sveltejs/kit": "^2.5.
|
|
72
|
+
"@sveltejs/kit": "^2.5.16",
|
|
73
73
|
"@sveltejs/package": "^2.3.2",
|
|
74
74
|
"@sveltejs/vite-plugin-svelte": "^3.1.1",
|
|
75
75
|
"@types/fs-extra": "^11.0.4",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"@typescript-eslint/parser": "^7.13.0",
|
|
79
79
|
"esbuild": "^0.20.2",
|
|
80
80
|
"eslint": "^8.57.0",
|
|
81
|
-
"eslint-plugin-svelte": "^2.39.
|
|
81
|
+
"eslint-plugin-svelte": "^2.39.4",
|
|
82
82
|
"svelte": "^5.0.0-next.155",
|
|
83
83
|
"svelte-check": "^3.8.0",
|
|
84
84
|
"typescript": "^5.4.5",
|
|
@@ -330,6 +330,10 @@
|
|
|
330
330
|
"default": "./dist/register.js",
|
|
331
331
|
"types": "./dist/register.d.ts"
|
|
332
332
|
},
|
|
333
|
+
"./reinstall.task.js": {
|
|
334
|
+
"default": "./dist/reinstall.task.js",
|
|
335
|
+
"types": "./dist/reinstall.task.d.ts"
|
|
336
|
+
},
|
|
333
337
|
"./release.task.js": {
|
|
334
338
|
"default": "./dist/release.task.js",
|
|
335
339
|
"types": "./dist/release.task.d.ts"
|