@ryanatkn/gro 0.141.1 → 0.143.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/dist/build.task.js +1 -1
- package/dist/changeset.task.d.ts.map +1 -1
- package/dist/changeset.task.js +4 -4
- package/dist/check.task.d.ts.map +1 -1
- package/dist/check.task.js +4 -2
- package/dist/clean_fs.js +1 -1
- package/dist/cli.js +1 -1
- package/dist/{path_constants.d.ts → constants.d.ts} +4 -1
- package/dist/constants.d.ts.map +1 -0
- package/dist/{path_constants.js → constants.js} +3 -0
- package/dist/deploy.task.js +1 -1
- package/dist/dev.task.js +1 -1
- package/dist/esbuild_plugin_svelte.js +1 -1
- package/dist/esbuild_plugin_sveltekit_local_imports.js +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_app.js +1 -1
- package/dist/esbuild_plugin_sveltekit_shim_env.js +1 -1
- package/dist/filer.d.ts +7 -0
- package/dist/filer.d.ts.map +1 -1
- package/dist/filer.js +28 -29
- package/dist/format.task.d.ts.map +1 -1
- package/dist/format.task.js +2 -2
- package/dist/format_directory.d.ts +1 -1
- package/dist/format_directory.d.ts.map +1 -1
- package/dist/format_directory.js +5 -6
- package/dist/gen.task.js +1 -1
- package/dist/gro_config.d.ts +12 -2
- package/dist/gro_config.d.ts.map +1 -1
- package/dist/gro_config.js +10 -6
- package/dist/gro_helpers.d.ts +1 -1
- package/dist/gro_helpers.d.ts.map +1 -1
- package/dist/gro_helpers.js +3 -3
- package/dist/gro_plugin_server.js +4 -4
- package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
- package/dist/gro_plugin_sveltekit_app.js +5 -5
- package/dist/gro_plugin_sveltekit_library.js +7 -7
- package/dist/loader.d.ts.map +1 -1
- package/dist/loader.js +23 -17
- package/dist/module.js +1 -1
- package/dist/moss_helpers.d.ts +1 -1
- package/dist/moss_helpers.d.ts.map +1 -1
- package/dist/moss_helpers.js +4 -3
- package/dist/package.d.ts +334 -172
- package/dist/package.d.ts.map +1 -1
- package/dist/package.js +51 -51
- package/dist/package_json.d.ts +9 -6
- package/dist/package_json.d.ts.map +1 -1
- package/dist/package_json.js +21 -6
- package/dist/package_meta.d.ts +1 -1
- package/dist/parse_imports.js +1 -1
- package/dist/paths.js +1 -1
- package/dist/publish.task.d.ts.map +1 -1
- package/dist/publish.task.js +7 -20
- package/dist/reinstall.task.js +11 -11
- package/dist/resolve_node_specifier.d.ts +7 -1
- package/dist/resolve_node_specifier.d.ts.map +1 -1
- package/dist/resolve_node_specifier.js +78 -14
- package/dist/resolve_specifier.d.ts +2 -6
- package/dist/resolve_specifier.d.ts.map +1 -1
- package/dist/resolve_specifier.js +2 -6
- package/dist/run_task.js +1 -1
- package/dist/src_json.d.ts +39 -3
- package/dist/src_json.d.ts.map +1 -1
- package/dist/sveltekit_config.d.ts +1 -1
- package/dist/sveltekit_config.d.ts.map +1 -1
- package/dist/sveltekit_config.js +1 -1
- package/dist/sveltekit_helpers.d.ts +3 -3
- package/dist/sveltekit_helpers.d.ts.map +1 -1
- package/dist/sveltekit_helpers.js +7 -7
- package/dist/sync.task.js +5 -5
- package/dist/upgrade.task.d.ts.map +1 -1
- package/dist/upgrade.task.js +4 -2
- package/dist/watch_dir.d.ts.map +1 -1
- package/dist/watch_dir.js +5 -5
- package/package.json +18 -18
- package/src/lib/build.task.ts +1 -1
- package/src/lib/changeset.task.ts +4 -3
- package/src/lib/check.task.ts +4 -2
- package/src/lib/clean_fs.ts +1 -1
- package/src/lib/cli.ts +1 -1
- package/src/lib/{path_constants.ts → constants.ts} +4 -0
- package/src/lib/deploy.task.ts +1 -1
- package/src/lib/dev.task.ts +1 -1
- package/src/lib/esbuild_plugin_svelte.ts +1 -1
- package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +1 -1
- package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +1 -1
- package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +1 -1
- package/src/lib/filer.ts +37 -27
- package/src/lib/format.task.ts +10 -2
- package/src/lib/format_directory.ts +10 -9
- package/src/lib/gen.task.ts +1 -1
- package/src/lib/gro_config.ts +23 -5
- package/src/lib/gro_helpers.ts +3 -2
- package/src/lib/gro_plugin_server.ts +4 -4
- package/src/lib/gro_plugin_sveltekit_app.ts +7 -5
- package/src/lib/gro_plugin_sveltekit_library.ts +7 -7
- package/src/lib/loader.ts +25 -17
- package/src/lib/module.ts +1 -1
- package/src/lib/moss_helpers.ts +4 -2
- package/src/lib/package.ts +51 -51
- package/src/lib/package_json.ts +23 -6
- package/src/lib/package_meta.ts +1 -1
- package/src/lib/parse_imports.ts +1 -1
- package/src/lib/paths.ts +1 -1
- package/src/lib/publish.task.ts +7 -22
- package/src/lib/reinstall.task.ts +11 -11
- package/src/lib/resolve_node_specifier.ts +100 -18
- package/src/lib/resolve_specifier.ts +2 -6
- package/src/lib/run_task.ts +1 -1
- package/src/lib/sveltekit_config.ts +2 -2
- package/src/lib/sveltekit_helpers.ts +7 -4
- package/src/lib/sync.task.ts +5 -5
- package/src/lib/upgrade.task.ts +4 -2
- package/src/lib/watch_dir.ts +6 -6
- package/dist/path_constants.d.ts.map +0 -1
package/src/lib/sync.task.ts
CHANGED
|
@@ -14,26 +14,26 @@ export const Args = z
|
|
|
14
14
|
gen: z.boolean({description: 'dual of no-gen'}).default(true),
|
|
15
15
|
'no-gen': z.boolean({description: 'opt out of running gen'}).default(false),
|
|
16
16
|
install: z.boolean({description: 'dual of no-install'}).default(true),
|
|
17
|
-
'no-install': z.boolean({description: 'opt out of
|
|
17
|
+
'no-install': z.boolean({description: 'opt out of installing packages'}).default(false),
|
|
18
18
|
})
|
|
19
19
|
.strict();
|
|
20
20
|
export type Args = z.infer<typeof Args>;
|
|
21
21
|
|
|
22
22
|
export const task: Task<Args> = {
|
|
23
|
-
summary: 'run `gro gen`, update `package.json`, and optionally
|
|
23
|
+
summary: 'run `gro gen`, update `package.json`, and optionally install packages to sync up',
|
|
24
24
|
Args,
|
|
25
25
|
run: async ({args, invoke_task, config, log}): Promise<void> => {
|
|
26
26
|
const {sveltekit, package_json, gen, install} = args;
|
|
27
27
|
|
|
28
28
|
if (install) {
|
|
29
|
-
const result = await spawn(
|
|
29
|
+
const result = await spawn(config.pm_cli, ['install']);
|
|
30
30
|
if (!result.ok) {
|
|
31
|
-
throw new Task_Error(
|
|
31
|
+
throw new Task_Error(`Failed \`${config.pm_cli} install\``);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
if (sveltekit) {
|
|
36
|
-
await sveltekit_sync();
|
|
36
|
+
await sveltekit_sync(undefined, config.pm_cli);
|
|
37
37
|
log.info('synced SvelteKit');
|
|
38
38
|
}
|
|
39
39
|
|
package/src/lib/upgrade.task.ts
CHANGED
|
@@ -5,6 +5,7 @@ import {Task_Error, type Task} from './task.js';
|
|
|
5
5
|
import {extract_deps, load_package_json, type Package_Json_Dep} from './package_json.js';
|
|
6
6
|
import {Git_Origin, git_pull} from './git.js';
|
|
7
7
|
import {spawn_cli} from './cli.js';
|
|
8
|
+
import {serialize_args, to_forwarded_args} from './args.js';
|
|
8
9
|
|
|
9
10
|
export const Args = z
|
|
10
11
|
.object({
|
|
@@ -27,7 +28,7 @@ export type Args = z.infer<typeof Args>;
|
|
|
27
28
|
export const task: Task<Args> = {
|
|
28
29
|
summary: 'upgrade deps',
|
|
29
30
|
Args,
|
|
30
|
-
run: async ({args, log}): Promise<void> => {
|
|
31
|
+
run: async ({args, log, config}): Promise<void> => {
|
|
31
32
|
const {_, only, origin, force, pull, dry} = args;
|
|
32
33
|
|
|
33
34
|
if (_.length && only.length) {
|
|
@@ -65,7 +66,8 @@ export const task: Task<Args> = {
|
|
|
65
66
|
if (force) {
|
|
66
67
|
install_args.push('--force');
|
|
67
68
|
}
|
|
68
|
-
|
|
69
|
+
install_args.push(...serialize_args(to_forwarded_args(config.pm_cli)));
|
|
70
|
+
await spawn(config.pm_cli, install_args);
|
|
69
71
|
|
|
70
72
|
// Sync in a new process to pick up any changes after installing, avoiding some errors.
|
|
71
73
|
await spawn_cli('gro', ['sync', '--no-install']); // don't install because we do above
|
package/src/lib/watch_dir.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {watch, type ChokidarOptions, type FSWatcher} from 'chokidar';
|
|
2
2
|
import {relative} from 'node:path';
|
|
3
3
|
import {statSync} from 'node:fs';
|
|
4
|
+
import {create_deferred, type Deferred} from '@ryanatkn/belt/async.js';
|
|
4
5
|
|
|
5
6
|
import type {Path_Filter} from './path.js';
|
|
6
7
|
|
|
@@ -42,13 +43,12 @@ export const watch_dir = ({
|
|
|
42
43
|
chokidar,
|
|
43
44
|
}: Options): Watch_Node_Fs => {
|
|
44
45
|
let watcher: FSWatcher | undefined;
|
|
45
|
-
let initing:
|
|
46
|
+
let initing: Deferred<void> | undefined;
|
|
46
47
|
|
|
47
48
|
return {
|
|
48
49
|
init: async () => {
|
|
49
|
-
if (initing) return initing;
|
|
50
|
-
|
|
51
|
-
initing = new Promise((r) => (resolve = r)); // TODO `create_deferred`?// cwd: chokidar?.cwd ?? process.cwd()
|
|
50
|
+
if (initing) return initing.promise;
|
|
51
|
+
initing = create_deferred();
|
|
52
52
|
watcher = watch(dir, {...chokidar});
|
|
53
53
|
watcher.on('add', (path) => {
|
|
54
54
|
const final_path = absolute ? path : relative(dir, path);
|
|
@@ -77,8 +77,8 @@ export const watch_dir = ({
|
|
|
77
77
|
on_change({type: 'delete', path: final_path, is_directory: true});
|
|
78
78
|
});
|
|
79
79
|
// wait until ready
|
|
80
|
-
watcher.once('ready', () => resolve());
|
|
81
|
-
await initing;
|
|
80
|
+
watcher.once('ready', () => initing?.resolve());
|
|
81
|
+
await initing.promise;
|
|
82
82
|
},
|
|
83
83
|
close: async () => {
|
|
84
84
|
initing = undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"path_constants.d.ts","sourceRoot":"../src/lib/","sources":["path_constants.ts"],"names":[],"mappings":"AASA,eAAO,MAAM,cAAc,QAAQ,CAAC;AACpC,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,eAAe,UAAU,CAAC;AACvC,eAAO,MAAM,gBAAgB,gBAAgB,CAAC;AAC9C,eAAO,MAAM,eAAe,QAAuB,CAAC;AACpD,eAAO,MAAM,UAAU,QAAuB,CAAC;AAC/C,eAAO,MAAM,OAAO,QAAoB,CAAC;AACzC,eAAO,MAAM,WAAW,QAAwB,CAAC;AACjD,eAAO,MAAM,eAAe,kBAAkB,CAAC;AAC/C,eAAO,MAAM,eAAe,cAAc,CAAC;AAC3C,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAC5D,eAAO,MAAM,oBAAoB,mBAAmB,CAAC;AACrD,eAAO,MAAM,oBAAoB,iBAAiB,CAAC;AACnD,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AACrD,eAAO,MAAM,qBAAqB,gBAAgB,CAAC;AACnD,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAC/C,eAAO,MAAM,sBAAsB,SAAS,CAAC;AAC7C,eAAO,MAAM,yBAAyB,QAAkC,CAAC;AACzE,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,WAAW,SAAS,CAAC;AAClC,eAAO,MAAM,iBAAiB,kBAAkB,CAAC;AAEjD,eAAO,MAAM,UAAU,QAAwB,CAAC;AAChD,eAAO,MAAM,UAAU,QAAwB,CAAC;AAChD,eAAO,MAAM,YAAY,QAAY,CAAC;AACtC,eAAO,MAAM,kBAAkB,QAAO,CAAC"}
|