@ryanatkn/gro 0.160.0 → 0.161.1
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 +2 -2
- package/dist/args.d.ts +1 -1
- package/dist/args.d.ts.map +1 -1
- package/dist/build.task.d.ts +1 -11
- package/dist/build.task.d.ts.map +1 -1
- package/dist/build.task.js +7 -8
- package/dist/changeset.task.d.ts +6 -25
- package/dist/changeset.task.d.ts.map +1 -1
- package/dist/changeset.task.js +13 -12
- package/dist/changeset_helpers.d.ts +10 -2
- package/dist/changeset_helpers.d.ts.map +1 -1
- package/dist/check.task.d.ts +1 -37
- package/dist/check.task.d.ts.map +1 -1
- package/dist/check.task.js +24 -21
- package/dist/clean.task.d.ts +1 -15
- package/dist/clean.task.d.ts.map +1 -1
- package/dist/clean.task.js +9 -9
- package/dist/commit.task.d.ts +2 -8
- package/dist/commit.task.d.ts.map +1 -1
- package/dist/commit.task.js +4 -5
- package/dist/deploy.task.d.ts +1 -25
- package/dist/deploy.task.d.ts.map +1 -1
- package/dist/deploy.task.js +15 -12
- package/dist/dev.task.d.ts +1 -15
- package/dist/dev.task.d.ts.map +1 -1
- package/dist/dev.task.js +10 -10
- package/dist/filer.d.ts +1 -1
- package/dist/filer.d.ts.map +1 -1
- package/dist/format.task.d.ts +1 -5
- package/dist/format.task.d.ts.map +1 -1
- package/dist/format.task.js +4 -5
- package/dist/gen.d.ts +0 -9
- package/dist/gen.d.ts.map +1 -1
- package/dist/gen.js +0 -4
- package/dist/gen.task.d.ts +3 -11
- package/dist/gen.task.d.ts.map +1 -1
- package/dist/gen.task.js +10 -7
- package/dist/github.d.ts +2 -22
- package/dist/github.d.ts.map +1 -1
- package/dist/github.js +2 -2
- package/dist/lint.task.d.ts +2 -8
- package/dist/lint.task.d.ts.map +1 -1
- package/dist/lint.task.js +4 -6
- package/dist/package.d.ts +4 -1212
- package/dist/package.d.ts.map +1 -1
- package/dist/package.gen.d.ts.map +1 -1
- package/dist/package.gen.js +5 -5
- package/dist/package.js +19 -44
- package/dist/package_json.d.ts +1 -361
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +2 -114
- package/dist/parse_exports.d.ts +2 -2
- package/dist/parse_exports.d.ts.map +1 -1
- package/dist/parse_exports_context.d.ts.map +1 -1
- package/dist/publish.task.d.ts +1 -29
- package/dist/publish.task.d.ts.map +1 -1
- package/dist/publish.task.js +22 -15
- package/dist/reinstall.task.d.ts +1 -1
- package/dist/reinstall.task.d.ts.map +1 -1
- package/dist/reinstall.task.js +2 -1
- package/dist/release.task.d.ts +1 -1
- package/dist/release.task.d.ts.map +1 -1
- package/dist/release.task.js +1 -1
- package/dist/resolve.task.d.ts +2 -8
- package/dist/resolve.task.d.ts.map +1 -1
- package/dist/resolve.task.js +4 -6
- package/dist/run.task.d.ts +2 -6
- package/dist/run.task.d.ts.map +1 -1
- package/dist/run.task.js +7 -5
- package/dist/run_task.d.ts.map +1 -1
- package/dist/run_task.js +2 -2
- package/dist/src_json.d.ts +2 -288
- package/dist/src_json.d.ts.map +1 -1
- package/dist/src_json.js +2 -45
- package/dist/sveltekit_helpers.d.ts +1 -1
- package/dist/sveltekit_helpers.d.ts.map +1 -1
- package/dist/sveltekit_helpers.js +1 -1
- package/dist/sveltekit_shim_app_paths.d.ts +4 -1
- package/dist/sveltekit_shim_app_paths.d.ts.map +1 -1
- package/dist/sveltekit_shim_app_paths.js +4 -1
- package/dist/sync.task.d.ts +1 -19
- package/dist/sync.task.d.ts.map +1 -1
- package/dist/sync.task.js +10 -12
- package/dist/task.d.ts +2 -2
- package/dist/task.d.ts.map +1 -1
- package/dist/task_logging.js +114 -47
- package/dist/test.task.d.ts +3 -13
- package/dist/test.task.d.ts.map +1 -1
- package/dist/test.task.js +8 -8
- package/dist/typecheck.task.d.ts +1 -11
- package/dist/typecheck.task.d.ts.map +1 -1
- package/dist/typecheck.task.js +10 -9
- package/dist/upgrade.task.d.ts +3 -27
- package/dist/upgrade.task.d.ts.map +1 -1
- package/dist/upgrade.task.js +20 -14
- package/package.json +19 -23
- package/src/lib/args.ts +5 -5
- package/src/lib/build.task.ts +9 -10
- package/src/lib/changeset.task.ts +27 -26
- package/src/lib/changeset_helpers.ts +1 -0
- package/src/lib/check.task.ts +28 -25
- package/src/lib/clean.task.ts +17 -17
- package/src/lib/commit.task.ts +9 -10
- package/src/lib/deploy.task.ts +32 -31
- package/src/lib/dev.task.ts +16 -17
- package/src/lib/filer.ts +1 -1
- package/src/lib/format.task.ts +6 -7
- package/src/lib/gen.task.ts +14 -11
- package/src/lib/gen.ts +0 -6
- package/src/lib/github.ts +2 -2
- package/src/lib/lint.task.ts +4 -6
- package/src/lib/package.gen.ts +7 -6
- package/src/lib/package.ts +25 -50
- package/src/lib/package_json.ts +3 -140
- package/src/lib/parse_exports.ts +2 -10
- package/src/lib/parse_exports_context.ts +9 -5
- package/src/lib/publish.task.ts +33 -26
- package/src/lib/reinstall.task.ts +2 -1
- package/src/lib/release.task.ts +1 -1
- package/src/lib/resolve.task.ts +4 -6
- package/src/lib/run.task.ts +10 -7
- package/src/lib/run_task.ts +4 -2
- package/src/lib/src_json.ts +3 -59
- package/src/lib/sveltekit_helpers.ts +2 -1
- package/src/lib/sveltekit_shim_app_paths.ts +5 -2
- package/src/lib/sveltekit_shim_app_state.ts +1 -1
- package/src/lib/sync.task.ts +10 -12
- package/src/lib/task.ts +2 -2
- package/src/lib/task_logging.ts +127 -49
- package/src/lib/test.task.ts +12 -12
- package/src/lib/typecheck.task.ts +16 -15
- package/src/lib/upgrade.task.ts +34 -28
- package/dist/package_meta.d.ts +0 -23
- package/dist/package_meta.d.ts.map +0 -1
- package/dist/package_meta.js +0 -56
- package/src/lib/package_meta.ts +0 -97
package/src/lib/task_logging.ts
CHANGED
|
@@ -2,7 +2,7 @@ import {styleText as st} from 'node:util';
|
|
|
2
2
|
import type {Logger} from '@ryanatkn/belt/log.js';
|
|
3
3
|
import {plural} from '@ryanatkn/belt/string.js';
|
|
4
4
|
import {print_value} from '@ryanatkn/belt/print.js';
|
|
5
|
-
import {
|
|
5
|
+
import {z} from 'zod';
|
|
6
6
|
|
|
7
7
|
import type {Arg_Schema} from './args.ts';
|
|
8
8
|
import type {Loaded_Tasks, Task_Module_Meta} from './task.ts';
|
|
@@ -64,7 +64,7 @@ export const log_task_help = (log: Logger, meta: Task_Module_Meta): void => {
|
|
|
64
64
|
st('cyan', `\n\ngro ${name}`) + `: ${task.summary ?? '(no summary available)'}\n`,
|
|
65
65
|
);
|
|
66
66
|
if (task.Args) {
|
|
67
|
-
const properties = to_arg_properties(task.Args
|
|
67
|
+
const properties = to_arg_properties(task.Args, meta, log);
|
|
68
68
|
// TODO hacky padding for some quick and dirty tables
|
|
69
69
|
const longest_task_name = Math.max(
|
|
70
70
|
ARGS_PROPERTY_NAME.length,
|
|
@@ -88,26 +88,37 @@ export const log_task_help = (log: Logger, meta: Task_Module_Meta): void => {
|
|
|
88
88
|
log.info(...logged, '\n');
|
|
89
89
|
};
|
|
90
90
|
|
|
91
|
+
// TODO rework all of this
|
|
92
|
+
// The following Zod helpers only need to support single-depth schemas for CLI args,
|
|
93
|
+
// but there's generic recursion to handle things like `ZodOptional` and `ZodDefault`.
|
|
94
|
+
|
|
91
95
|
interface Arg_Schema_Property {
|
|
92
96
|
name: string;
|
|
93
97
|
schema: Arg_Schema;
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
// TODO this blocks many usecases like unions, and it's only implemented for CLI arg types, need better support for arbitrary schemas
|
|
101
|
+
const to_arg_properties = (
|
|
102
|
+
schema: z.ZodType,
|
|
103
|
+
meta: Task_Module_Meta,
|
|
104
|
+
log: Logger,
|
|
105
|
+
): Array<Arg_Schema_Property> => {
|
|
106
|
+
const {def} = schema;
|
|
107
|
+
|
|
108
|
+
// TODO overly restrictive, support optional objects and/or unions?
|
|
109
|
+
if (!('shape' in def)) {
|
|
110
|
+
log.error(`Expected Args for task "${meta.name}" to be an object schema but got ${def.type}`);
|
|
111
|
+
return [];
|
|
102
112
|
}
|
|
103
|
-
const shape = (def as ZodObjectDef).shape
|
|
113
|
+
const shape = (def as z.core.$ZodObjectDef).shape;
|
|
114
|
+
|
|
104
115
|
const properties: Array<Arg_Schema_Property> = [];
|
|
105
116
|
for (const name in shape) {
|
|
106
117
|
if ('no-' + name in shape) continue;
|
|
107
|
-
const s = shape[name];
|
|
118
|
+
const s = shape[name] as z.ZodType;
|
|
108
119
|
const schema: Arg_Schema = {
|
|
109
120
|
type: to_args_schema_type(s),
|
|
110
|
-
description: to_args_schema_description(s),
|
|
121
|
+
description: to_args_schema_description(s) || '',
|
|
111
122
|
default: to_args_schema_default(s),
|
|
112
123
|
};
|
|
113
124
|
properties.push({name, schema});
|
|
@@ -118,61 +129,128 @@ const to_arg_properties = (def: ZodTypeDef, meta: Task_Module_Meta): Array<Arg_S
|
|
|
118
129
|
const to_max_length = <T>(items: Array<T>, toString: (item: T) => string) =>
|
|
119
130
|
items.reduce((max, m) => Math.max(toString(m).length, max), 0);
|
|
120
131
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const t = to_type_name(_def);
|
|
126
|
-
switch (t) {
|
|
127
|
-
case ZodFirstPartyTypeKind.ZodBoolean:
|
|
128
|
-
return 'boolean';
|
|
129
|
-
case ZodFirstPartyTypeKind.ZodString:
|
|
132
|
+
const to_args_schema_type = (schema: z.ZodType): Arg_Schema['type'] => {
|
|
133
|
+
const {def} = schema._zod;
|
|
134
|
+
switch (def.type) {
|
|
135
|
+
case 'string':
|
|
130
136
|
return 'string';
|
|
131
|
-
case
|
|
137
|
+
case 'number':
|
|
132
138
|
return 'number';
|
|
133
|
-
case
|
|
134
|
-
return '
|
|
135
|
-
case
|
|
136
|
-
return
|
|
137
|
-
case
|
|
138
|
-
return '
|
|
139
|
+
case 'int':
|
|
140
|
+
return 'int';
|
|
141
|
+
case 'boolean':
|
|
142
|
+
return 'boolean';
|
|
143
|
+
case 'bigint':
|
|
144
|
+
return 'bigint';
|
|
145
|
+
case 'symbol':
|
|
146
|
+
return 'symbol';
|
|
147
|
+
case 'null':
|
|
148
|
+
return 'null';
|
|
149
|
+
case 'undefined':
|
|
150
|
+
return 'undefined';
|
|
151
|
+
case 'void':
|
|
152
|
+
return 'void';
|
|
153
|
+
case 'never':
|
|
154
|
+
return 'never';
|
|
155
|
+
case 'any':
|
|
156
|
+
return 'any';
|
|
157
|
+
case 'unknown':
|
|
158
|
+
return 'unknown';
|
|
159
|
+
case 'date':
|
|
160
|
+
return 'date';
|
|
161
|
+
case 'object':
|
|
162
|
+
return 'object';
|
|
163
|
+
case 'record':
|
|
164
|
+
return 'record';
|
|
165
|
+
case 'file':
|
|
166
|
+
return 'file';
|
|
167
|
+
case 'array':
|
|
168
|
+
// TODO other types, only handling a subset of CLI arg cases
|
|
169
|
+
return 'Array<string>';
|
|
170
|
+
case 'tuple':
|
|
171
|
+
return 'tuple';
|
|
172
|
+
case 'union':
|
|
173
|
+
// TODO fix, this is a hacky way to handle unions for CLI args
|
|
174
|
+
return 'string | Array<string>';
|
|
175
|
+
case 'intersection':
|
|
176
|
+
return 'intersection';
|
|
177
|
+
case 'map':
|
|
178
|
+
return 'map';
|
|
179
|
+
case 'set':
|
|
180
|
+
return 'set';
|
|
181
|
+
case 'enum':
|
|
182
|
+
return (schema as unknown as {options: Array<string>}).options
|
|
183
|
+
.map((v) => `'${v}'`)
|
|
184
|
+
.join(' | ');
|
|
185
|
+
case 'literal':
|
|
186
|
+
return (def as unknown as {values: Array<any>}).values.map((v) => print_value(v)).join(' | ');
|
|
187
|
+
case 'nullable': {
|
|
188
|
+
const subschema = to_subschema(def);
|
|
189
|
+
return subschema ? to_args_schema_type(subschema) + ' | null' : 'nullable';
|
|
190
|
+
}
|
|
191
|
+
case 'optional': {
|
|
192
|
+
const subschema = to_subschema(def);
|
|
193
|
+
return subschema ? to_args_schema_type(subschema) + ' | undefined' : 'optional';
|
|
194
|
+
}
|
|
195
|
+
case 'success':
|
|
196
|
+
return 'success';
|
|
197
|
+
case 'catch':
|
|
198
|
+
return 'catch';
|
|
199
|
+
case 'nan':
|
|
200
|
+
return 'NaN';
|
|
201
|
+
case 'readonly':
|
|
202
|
+
return 'readonly';
|
|
203
|
+
case 'template_literal':
|
|
204
|
+
return 'template_literal';
|
|
205
|
+
case 'promise':
|
|
206
|
+
return 'promise';
|
|
207
|
+
case 'lazy':
|
|
208
|
+
return 'lazy';
|
|
209
|
+
case 'custom':
|
|
210
|
+
return 'custom';
|
|
211
|
+
// Unwrap these:
|
|
212
|
+
// case 'nonoptional':
|
|
213
|
+
// case 'transform':
|
|
214
|
+
// case 'default':
|
|
215
|
+
// case 'prefault':
|
|
216
|
+
// case 'pipe':
|
|
139
217
|
default: {
|
|
140
|
-
const subschema = to_subschema(
|
|
141
|
-
|
|
142
|
-
return to_args_schema_type(subschema);
|
|
143
|
-
} else {
|
|
144
|
-
throw Error('Unknown zod type ' + t);
|
|
145
|
-
}
|
|
218
|
+
const subschema = to_subschema(def);
|
|
219
|
+
return subschema ? to_args_schema_type(subschema) : def.type;
|
|
146
220
|
}
|
|
147
221
|
}
|
|
148
222
|
};
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
223
|
+
|
|
224
|
+
const to_args_schema_description = (schema: z.ZodType): string | null => {
|
|
225
|
+
const meta = schema.meta();
|
|
226
|
+
if (meta?.description) {
|
|
227
|
+
return meta.description;
|
|
152
228
|
}
|
|
153
|
-
const subschema = to_subschema(
|
|
229
|
+
const subschema = to_subschema(schema.def);
|
|
154
230
|
if (subschema) {
|
|
155
231
|
return to_args_schema_description(subschema);
|
|
156
232
|
}
|
|
157
|
-
return
|
|
233
|
+
return null;
|
|
158
234
|
};
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
235
|
+
|
|
236
|
+
const to_args_schema_default = (schema: z.ZodType): any => {
|
|
237
|
+
const {def} = schema._zod;
|
|
238
|
+
if ('defaultValue' in def) {
|
|
239
|
+
return def.defaultValue;
|
|
162
240
|
}
|
|
163
|
-
const subschema = to_subschema(
|
|
241
|
+
const subschema = to_subschema(def);
|
|
164
242
|
if (subschema) {
|
|
165
243
|
return to_args_schema_default(subschema);
|
|
166
244
|
}
|
|
167
245
|
};
|
|
168
246
|
|
|
169
|
-
const to_subschema = (
|
|
170
|
-
if ('
|
|
171
|
-
return
|
|
172
|
-
} else if ('
|
|
173
|
-
return
|
|
174
|
-
} else if ('schema' in
|
|
175
|
-
return
|
|
247
|
+
const to_subschema = (def: z.core.$ZodTypeDef): z.ZodType | undefined => {
|
|
248
|
+
if ('innerType' in def) {
|
|
249
|
+
return def.innerType as any;
|
|
250
|
+
} else if ('in' in def) {
|
|
251
|
+
return def.in as any;
|
|
252
|
+
} else if ('schema' in def) {
|
|
253
|
+
return def.schema as any;
|
|
176
254
|
}
|
|
177
255
|
return undefined;
|
|
178
256
|
};
|
package/src/lib/test.task.ts
CHANGED
|
@@ -5,18 +5,18 @@ import {Task_Error, type Task} from './task.ts';
|
|
|
5
5
|
import {paths} from './paths.ts';
|
|
6
6
|
import {find_cli} from './cli.ts';
|
|
7
7
|
|
|
8
|
-
export const Args = z
|
|
9
|
-
.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
8
|
+
export const Args = z.strictObject({
|
|
9
|
+
_: z.array(z.string()).meta({description: 'file patterns to test'}).default([`\\.test\\.ts$`]), // TODO maybe use uvu's default instead of being restrictive?
|
|
10
|
+
bail: z
|
|
11
|
+
.boolean()
|
|
12
|
+
.meta({description: 'the bail option to uvu run, exit immediately on failure'})
|
|
13
|
+
.default(false),
|
|
14
|
+
cwd: z.string().meta({description: 'the cwd option to uvu parse'}).optional(),
|
|
15
|
+
ignore: z
|
|
16
|
+
.union([z.string(), z.array(z.string())])
|
|
17
|
+
.meta({description: 'the ignore option to uvu parse'})
|
|
18
|
+
.optional(),
|
|
19
|
+
});
|
|
20
20
|
export type Args = z.infer<typeof Args>;
|
|
21
21
|
|
|
22
22
|
export const task: Task<Args> = {
|
|
@@ -8,24 +8,25 @@ import {SVELTE_CHECK_CLI, sveltekit_sync_if_available} from './sveltekit_helpers
|
|
|
8
8
|
import {configure_colored_output_with_path_replacement} from './child_process_logging.ts';
|
|
9
9
|
import {paths} from './paths.ts';
|
|
10
10
|
|
|
11
|
-
export const Args = z
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.
|
|
11
|
+
export const Args = z.strictObject({
|
|
12
|
+
svelte_check_cli: z
|
|
13
|
+
.string()
|
|
14
|
+
.meta({description: 'the svelte-check CLI to use'})
|
|
15
|
+
.default(SVELTE_CHECK_CLI),
|
|
16
|
+
typescript_cli: z
|
|
17
|
+
.string()
|
|
18
|
+
.meta({description: 'the TypeScript CLI to use as a fallback to svelte-check'})
|
|
19
|
+
.default('tsc'),
|
|
20
|
+
path_replacement: z
|
|
21
|
+
.string()
|
|
22
|
+
.meta({description: 'replacement string for current working directory in output'})
|
|
23
|
+
.default('.'),
|
|
24
|
+
cwd: z.string().meta({description: 'current working directory'}).default(paths.root),
|
|
25
|
+
});
|
|
25
26
|
export type Args = z.infer<typeof Args>;
|
|
26
27
|
|
|
27
28
|
export const task: Task<Args> = {
|
|
28
|
-
summary: 'run tsc on the project without emitting any files',
|
|
29
|
+
summary: 'run svelte-check or tsc on the project without emitting any files',
|
|
29
30
|
Args,
|
|
30
31
|
run: async ({args, log}): Promise<void> => {
|
|
31
32
|
const {svelte_check_cli, typescript_cli, path_replacement, cwd} = args;
|
package/src/lib/upgrade.task.ts
CHANGED
|
@@ -9,34 +9,40 @@ import {spawn_cli} from './cli.ts';
|
|
|
9
9
|
import {serialize_args, to_forwarded_args} from './args.ts';
|
|
10
10
|
import {NODE_MODULES_DIRNAME} from './constants.ts';
|
|
11
11
|
|
|
12
|
-
export const Args = z
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
12
|
+
export const Args = z.strictObject({
|
|
13
|
+
_: z
|
|
14
|
+
.array(z.string())
|
|
15
|
+
.meta({description: 'names of deps to exclude from the upgrade'})
|
|
16
|
+
.default([]),
|
|
17
|
+
only: z
|
|
18
|
+
.union([z.string(), z.array(z.string())])
|
|
19
|
+
.meta({
|
|
20
|
+
description: 'names of deps to include in the upgrade',
|
|
21
|
+
})
|
|
22
|
+
.default([])
|
|
23
|
+
.transform((v) => (Array.isArray(v) ? v : [v])),
|
|
24
|
+
origin: Git_Origin.describe('git origin to deploy to').default('origin'),
|
|
25
|
+
force: z.boolean().meta({description: 'if true, print out the planned upgrades'}).default(false),
|
|
26
|
+
pull: z.boolean().meta({description: 'dual of no-pull'}).default(true),
|
|
27
|
+
'no-pull': z.boolean().meta({description: 'opt out of git pull'}).default(false),
|
|
28
|
+
delete_node_modules: z
|
|
29
|
+
.boolean()
|
|
30
|
+
.meta({description: 'if true, deletes node_modules before upgrading'})
|
|
31
|
+
.default(false),
|
|
32
|
+
node_modules_path: z // TODO maybe configured globally instead
|
|
33
|
+
.string()
|
|
34
|
+
.meta({description: 'path to modules directory to delete'})
|
|
35
|
+
.default(NODE_MODULES_DIRNAME),
|
|
36
|
+
delete_lockfile: z
|
|
37
|
+
.boolean()
|
|
38
|
+
.meta({description: 'if true, deletes the lockfile before upgrading'})
|
|
39
|
+
.default(false),
|
|
40
|
+
lockfile_path: z
|
|
41
|
+
.string()
|
|
42
|
+
.meta({description: 'path to the lockfile to delete'})
|
|
43
|
+
.default('package-lock.json'),
|
|
44
|
+
dry: z.boolean().meta({description: 'if true, print out the planned upgrades'}).default(false),
|
|
45
|
+
});
|
|
40
46
|
export type Args = z.infer<typeof Args>;
|
|
41
47
|
|
|
42
48
|
export const task: Task<Args> = {
|
package/dist/package_meta.d.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Package_Json, Url } from './package_json.ts';
|
|
2
|
-
import type { Src_Json } from './src_json.ts';
|
|
3
|
-
export interface Package_Meta {
|
|
4
|
-
repo_url: Url;
|
|
5
|
-
package_json: Package_Json;
|
|
6
|
-
src_json: Src_Json;
|
|
7
|
-
name: string;
|
|
8
|
-
repo_name: string;
|
|
9
|
-
/**
|
|
10
|
-
* The github user/org.
|
|
11
|
-
*/
|
|
12
|
-
owner_name: string | null;
|
|
13
|
-
homepage_url: Url | null;
|
|
14
|
-
logo_url: Url | null;
|
|
15
|
-
logo_alt: string;
|
|
16
|
-
npm_url: Url | null;
|
|
17
|
-
changelog_url: Url | null;
|
|
18
|
-
published: boolean;
|
|
19
|
-
}
|
|
20
|
-
export declare const parse_package_meta: (package_json: Package_Json, src_json: Src_Json) => Package_Meta;
|
|
21
|
-
export declare const parse_repo_name: (name: string) => string;
|
|
22
|
-
export declare const parse_org_url: (pkg: Package_Meta) => string | null;
|
|
23
|
-
//# sourceMappingURL=package_meta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"package_meta.d.ts","sourceRoot":"../src/lib/","sources":["../src/lib/package_meta.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,YAAY,EAAE,GAAG,EAAC,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAG5C,MAAM,WAAW,YAAY;IAC5B,QAAQ,EAAE,GAAG,CAAC;IACd,YAAY,EAAE,YAAY,CAAC;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,YAAY,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,QAAQ,EAAE,GAAG,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACpB,aAAa,EAAE,GAAG,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;CACnB;AAED,eAAO,MAAM,kBAAkB,GAC9B,cAAc,YAAY,EAC1B,UAAU,QAAQ,KAChB,YAuDF,CAAC;AAGF,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MACH,CAAC;AAE7C,eAAO,MAAM,aAAa,GAAI,KAAK,YAAY,KAAG,MAAM,GAAG,IAQ1D,CAAC"}
|
package/dist/package_meta.js
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { strip_start, strip_end, ensure_end } from '@ryanatkn/belt/string.js';
|
|
2
|
-
export const parse_package_meta = (package_json, src_json) => {
|
|
3
|
-
const { name } = package_json;
|
|
4
|
-
// TODO hacky
|
|
5
|
-
const parse_repo = (r) => {
|
|
6
|
-
if (!r)
|
|
7
|
-
return null;
|
|
8
|
-
return strip_end(strip_start(strip_end(r, '.git'), 'git+'), '/');
|
|
9
|
-
};
|
|
10
|
-
const repo_url = parse_repo(package_json.repository
|
|
11
|
-
? typeof package_json.repository === 'string'
|
|
12
|
-
? package_json.repository
|
|
13
|
-
: package_json.repository.url
|
|
14
|
-
: null);
|
|
15
|
-
if (!repo_url) {
|
|
16
|
-
throw Error('failed to parse package_meta - `repo_url` is required in package_json');
|
|
17
|
-
}
|
|
18
|
-
const homepage_url = package_json.homepage ?? null;
|
|
19
|
-
const published = !package_json.private && !!package_json.exports && package_json.version !== '0.0.1';
|
|
20
|
-
// TODO generic registries
|
|
21
|
-
const npm_url = published ? 'https://www.npmjs.com/package/' + package_json.name : null;
|
|
22
|
-
const changelog_url = published && repo_url ? repo_url + '/blob/main/CHANGELOG.md' : null;
|
|
23
|
-
const repo_name = parse_repo_name(name);
|
|
24
|
-
const owner_name = repo_url ? strip_start(repo_url, 'https://github.com/').split('/')[0] : null;
|
|
25
|
-
const logo_url = homepage_url
|
|
26
|
-
? ensure_end(homepage_url, '/') +
|
|
27
|
-
(package_json.logo ? strip_start(package_json.logo, '/') : 'favicon.png')
|
|
28
|
-
: null;
|
|
29
|
-
const logo_alt = package_json.logo_alt ?? `logo for ${repo_name}`;
|
|
30
|
-
return {
|
|
31
|
-
package_json,
|
|
32
|
-
src_json,
|
|
33
|
-
name,
|
|
34
|
-
repo_name,
|
|
35
|
-
repo_url,
|
|
36
|
-
owner_name,
|
|
37
|
-
homepage_url,
|
|
38
|
-
logo_url,
|
|
39
|
-
logo_alt,
|
|
40
|
-
npm_url,
|
|
41
|
-
changelog_url,
|
|
42
|
-
published,
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
// TODO proper parsing
|
|
46
|
-
export const parse_repo_name = (name) => name[0] === '@' ? name.split('/')[1] : name;
|
|
47
|
-
export const parse_org_url = (pkg) => {
|
|
48
|
-
const { repo_name, repo_url } = pkg;
|
|
49
|
-
if (!repo_url)
|
|
50
|
-
return null;
|
|
51
|
-
const suffix = '/' + repo_name;
|
|
52
|
-
if (repo_url.endsWith(suffix)) {
|
|
53
|
-
return strip_end(repo_url, suffix);
|
|
54
|
-
}
|
|
55
|
-
return null;
|
|
56
|
-
};
|
package/src/lib/package_meta.ts
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import {strip_start, strip_end, ensure_end} from '@ryanatkn/belt/string.js';
|
|
2
|
-
|
|
3
|
-
import type {Package_Json, Url} from './package_json.ts';
|
|
4
|
-
import type {Src_Json} from './src_json.ts';
|
|
5
|
-
|
|
6
|
-
// TODO needs refactoring, more clarity
|
|
7
|
-
export interface Package_Meta {
|
|
8
|
-
repo_url: Url; // 'https://github.com/ryanatkn/fuz'
|
|
9
|
-
package_json: Package_Json;
|
|
10
|
-
src_json: Src_Json;
|
|
11
|
-
name: string; // '@ryanatkn/fuz_library'
|
|
12
|
-
repo_name: string; // fuz_library
|
|
13
|
-
/**
|
|
14
|
-
* The github user/org.
|
|
15
|
-
*/
|
|
16
|
-
owner_name: string | null; // 'fuz-dev'
|
|
17
|
-
homepage_url: Url | null; // 'https://www.fuz.dev/'
|
|
18
|
-
logo_url: Url | null; // 'https://www.fuz.dev/logo.svg' falling back to 'https://www.fuz.dev/favicon.png'
|
|
19
|
-
logo_alt: string; // 'icon for gro'
|
|
20
|
-
npm_url: Url | null; // 'https://npmjs.com/package/@ryanatkn/fuz_library'
|
|
21
|
-
changelog_url: Url | null;
|
|
22
|
-
published: boolean;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const parse_package_meta = (
|
|
26
|
-
package_json: Package_Json,
|
|
27
|
-
src_json: Src_Json,
|
|
28
|
-
): Package_Meta => {
|
|
29
|
-
const {name} = package_json;
|
|
30
|
-
|
|
31
|
-
// TODO hacky
|
|
32
|
-
const parse_repo = (r: string | null | undefined) => {
|
|
33
|
-
if (!r) return null;
|
|
34
|
-
return strip_end(strip_start(strip_end(r, '.git'), 'git+'), '/');
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const repo_url = parse_repo(
|
|
38
|
-
package_json.repository
|
|
39
|
-
? typeof package_json.repository === 'string'
|
|
40
|
-
? package_json.repository
|
|
41
|
-
: package_json.repository.url
|
|
42
|
-
: null,
|
|
43
|
-
);
|
|
44
|
-
if (!repo_url) {
|
|
45
|
-
throw Error('failed to parse package_meta - `repo_url` is required in package_json');
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const homepage_url = package_json.homepage ?? null;
|
|
49
|
-
|
|
50
|
-
const published =
|
|
51
|
-
!package_json.private && !!package_json.exports && package_json.version !== '0.0.1';
|
|
52
|
-
|
|
53
|
-
// TODO generic registries
|
|
54
|
-
const npm_url = published ? 'https://www.npmjs.com/package/' + package_json.name : null;
|
|
55
|
-
|
|
56
|
-
const changelog_url = published && repo_url ? repo_url + '/blob/main/CHANGELOG.md' : null;
|
|
57
|
-
|
|
58
|
-
const repo_name = parse_repo_name(name);
|
|
59
|
-
|
|
60
|
-
const owner_name = repo_url ? strip_start(repo_url, 'https://github.com/').split('/')[0] : null;
|
|
61
|
-
|
|
62
|
-
const logo_url = homepage_url
|
|
63
|
-
? ensure_end(homepage_url, '/') +
|
|
64
|
-
(package_json.logo ? strip_start(package_json.logo, '/') : 'favicon.png')
|
|
65
|
-
: null;
|
|
66
|
-
|
|
67
|
-
const logo_alt = package_json.logo_alt ?? `logo for ${repo_name}`;
|
|
68
|
-
|
|
69
|
-
return {
|
|
70
|
-
package_json,
|
|
71
|
-
src_json,
|
|
72
|
-
name,
|
|
73
|
-
repo_name,
|
|
74
|
-
repo_url,
|
|
75
|
-
owner_name,
|
|
76
|
-
homepage_url,
|
|
77
|
-
logo_url,
|
|
78
|
-
logo_alt,
|
|
79
|
-
npm_url,
|
|
80
|
-
changelog_url,
|
|
81
|
-
published,
|
|
82
|
-
};
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// TODO proper parsing
|
|
86
|
-
export const parse_repo_name = (name: string): string =>
|
|
87
|
-
name[0] === '@' ? name.split('/')[1] : name;
|
|
88
|
-
|
|
89
|
-
export const parse_org_url = (pkg: Package_Meta): string | null => {
|
|
90
|
-
const {repo_name, repo_url} = pkg;
|
|
91
|
-
if (!repo_url) return null;
|
|
92
|
-
const suffix = '/' + repo_name;
|
|
93
|
-
if (repo_url.endsWith(suffix)) {
|
|
94
|
-
return strip_end(repo_url, suffix);
|
|
95
|
-
}
|
|
96
|
-
return null;
|
|
97
|
-
};
|