@ryanatkn/gro 0.142.0 → 0.143.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.
Files changed (90) hide show
  1. package/dist/build.task.js +1 -1
  2. package/dist/changeset.task.js +3 -3
  3. package/dist/check.task.d.ts.map +1 -1
  4. package/dist/check.task.js +4 -2
  5. package/dist/clean_fs.js +1 -1
  6. package/dist/cli.js +1 -1
  7. package/dist/{path_constants.d.ts → constants.d.ts} +4 -1
  8. package/dist/constants.d.ts.map +1 -0
  9. package/dist/{path_constants.js → constants.js} +3 -0
  10. package/dist/deploy.task.js +1 -1
  11. package/dist/dev.task.js +1 -1
  12. package/dist/esbuild_plugin_svelte.js +1 -1
  13. package/dist/esbuild_plugin_sveltekit_local_imports.js +1 -1
  14. package/dist/esbuild_plugin_sveltekit_shim_app.js +1 -1
  15. package/dist/esbuild_plugin_sveltekit_shim_env.js +1 -1
  16. package/dist/format.task.d.ts.map +1 -1
  17. package/dist/format.task.js +2 -2
  18. package/dist/format_directory.d.ts +1 -1
  19. package/dist/format_directory.d.ts.map +1 -1
  20. package/dist/format_directory.js +5 -6
  21. package/dist/gen.task.js +1 -1
  22. package/dist/gro_config.d.ts +7 -2
  23. package/dist/gro_config.d.ts.map +1 -1
  24. package/dist/gro_config.js +9 -7
  25. package/dist/gro_helpers.d.ts +1 -1
  26. package/dist/gro_helpers.d.ts.map +1 -1
  27. package/dist/gro_helpers.js +3 -3
  28. package/dist/gro_plugin_server.js +4 -4
  29. package/dist/gro_plugin_sveltekit_app.d.ts.map +1 -1
  30. package/dist/gro_plugin_sveltekit_app.js +5 -5
  31. package/dist/gro_plugin_sveltekit_library.js +3 -3
  32. package/dist/loader.js +1 -1
  33. package/dist/module.js +1 -1
  34. package/dist/moss_helpers.d.ts +1 -1
  35. package/dist/moss_helpers.d.ts.map +1 -1
  36. package/dist/moss_helpers.js +3 -3
  37. package/dist/package.d.ts +11 -11
  38. package/dist/package.d.ts.map +1 -1
  39. package/dist/package.js +39 -39
  40. package/dist/package_json.js +2 -2
  41. package/dist/package_meta.d.ts +1 -1
  42. package/dist/parse_imports.js +1 -1
  43. package/dist/paths.js +1 -1
  44. package/dist/publish.task.d.ts.map +1 -1
  45. package/dist/publish.task.js +4 -12
  46. package/dist/reinstall.task.js +10 -10
  47. package/dist/resolve_node_specifier.js +2 -2
  48. package/dist/run_task.js +1 -1
  49. package/dist/sveltekit_config.js +1 -1
  50. package/dist/sveltekit_helpers.d.ts +3 -3
  51. package/dist/sveltekit_helpers.d.ts.map +1 -1
  52. package/dist/sveltekit_helpers.js +7 -7
  53. package/dist/sync.task.js +5 -5
  54. package/package.json +6 -6
  55. package/src/lib/build.task.ts +1 -1
  56. package/src/lib/changeset.task.ts +3 -3
  57. package/src/lib/check.task.ts +4 -2
  58. package/src/lib/clean_fs.ts +1 -1
  59. package/src/lib/cli.ts +1 -1
  60. package/src/lib/{path_constants.ts → constants.ts} +4 -0
  61. package/src/lib/deploy.task.ts +1 -1
  62. package/src/lib/dev.task.ts +1 -1
  63. package/src/lib/esbuild_plugin_svelte.ts +1 -1
  64. package/src/lib/esbuild_plugin_sveltekit_local_imports.ts +1 -1
  65. package/src/lib/esbuild_plugin_sveltekit_shim_app.ts +1 -1
  66. package/src/lib/esbuild_plugin_sveltekit_shim_env.ts +1 -1
  67. package/src/lib/format.task.ts +10 -2
  68. package/src/lib/format_directory.ts +10 -9
  69. package/src/lib/gen.task.ts +1 -1
  70. package/src/lib/gro_config.ts +16 -6
  71. package/src/lib/gro_helpers.ts +3 -2
  72. package/src/lib/gro_plugin_server.ts +4 -4
  73. package/src/lib/gro_plugin_sveltekit_app.ts +7 -5
  74. package/src/lib/gro_plugin_sveltekit_library.ts +3 -3
  75. package/src/lib/loader.ts +1 -1
  76. package/src/lib/module.ts +1 -1
  77. package/src/lib/moss_helpers.ts +3 -2
  78. package/src/lib/package.ts +39 -39
  79. package/src/lib/package_json.ts +2 -2
  80. package/src/lib/package_meta.ts +1 -1
  81. package/src/lib/parse_imports.ts +1 -1
  82. package/src/lib/paths.ts +1 -1
  83. package/src/lib/publish.task.ts +4 -13
  84. package/src/lib/reinstall.task.ts +10 -10
  85. package/src/lib/resolve_node_specifier.ts +2 -2
  86. package/src/lib/run_task.ts +1 -1
  87. package/src/lib/sveltekit_config.ts +1 -1
  88. package/src/lib/sveltekit_helpers.ts +7 -4
  89. package/src/lib/sync.task.ts +5 -5
  90. package/dist/path_constants.d.ts.map +0 -1
@@ -5,7 +5,7 @@ import {join} from 'node:path';
5
5
 
6
6
  import {Package_Json, has_dep} from './package_json.js';
7
7
  import {default_sveltekit_config, type Parsed_Sveltekit_Config} from './sveltekit_config.js';
8
- import {SVELTEKIT_CONFIG_FILENAME, SVELTEKIT_DEV_DIRNAME} from './path_constants.js';
8
+ import {SVELTEKIT_CONFIG_FILENAME, SVELTEKIT_DEV_DIRNAME, PM_CLI_DEFAULT} from './constants.js';
9
9
  import {find_cli, spawn_cli, to_cli_name, type Cli} from './cli.js';
10
10
  import {Task_Error} from './task.js';
11
11
  import {serialize_args, to_forwarded_args} from './args.js';
@@ -33,6 +33,7 @@ export const has_sveltekit_library = (
33
33
  package_json?: Package_Json,
34
34
  sveltekit_config: Parsed_Sveltekit_Config = default_sveltekit_config,
35
35
  dep_name = SVELTE_PACKAGE_DEP_NAME,
36
+ pm_cli = PM_CLI_DEFAULT, // TODO source from config when possible, is just needed for error messages
36
37
  ): Result<object, {message: string}> => {
37
38
  const has_sveltekit_app_result = has_sveltekit_app();
38
39
  if (!has_sveltekit_app_result.ok) {
@@ -46,7 +47,7 @@ export const has_sveltekit_library = (
46
47
  if (!has_dep(dep_name, package_json)) {
47
48
  return {
48
49
  ok: false,
49
- message: `no dependency found in package.json for ${dep_name}, install it with \`npm i -D ${dep_name}\``,
50
+ message: `no dependency found in package.json for ${dep_name}, install it with \`${pm_cli} install -D ${dep_name}\``,
50
51
  };
51
52
  }
52
53
 
@@ -55,11 +56,12 @@ export const has_sveltekit_library = (
55
56
 
56
57
  export const sveltekit_sync = async (
57
58
  sveltekit_cli: string | Cli = SVELTEKIT_CLI,
59
+ pm_cli = PM_CLI_DEFAULT, // TODO source from config when possible, is just needed for error messages
58
60
  ): Promise<void> => {
59
61
  const result = await spawn_cli(sveltekit_cli, ['sync']);
60
62
  if (!result) {
61
63
  throw new Task_Error(
62
- `Failed to find SvelteKit CLI \`${to_cli_name(sveltekit_cli)}\`, do you need to run \`npm i\`?`,
64
+ `Failed to find SvelteKit CLI \`${to_cli_name(sveltekit_cli)}\`, do you need to run \`${pm_cli} install\`?`,
63
65
  );
64
66
  } else if (!result.ok) {
65
67
  throw new Task_Error(`Failed ${to_cli_name(sveltekit_cli)} sync`);
@@ -151,6 +153,7 @@ export const run_svelte_package = async (
151
153
  options: Svelte_Package_Options | undefined,
152
154
  cli: string | Cli,
153
155
  log: Logger,
156
+ pm_cli: string,
154
157
  ): Promise<void> => {
155
158
  const has_sveltekit_library_result = has_sveltekit_library();
156
159
  if (!has_sveltekit_library_result.ok) {
@@ -162,7 +165,7 @@ export const run_svelte_package = async (
162
165
  const found_svelte_package_cli = cli === cli_name ? find_cli(cli) : (cli as Cli);
163
166
  if (found_svelte_package_cli?.kind !== 'local') {
164
167
  throw new Task_Error(
165
- `Failed to find SvelteKit packaging CLI \`${cli_name}\`, do you need to run \`npm i\`?`,
168
+ `Failed to find SvelteKit packaging CLI \`${cli_name}\`, do you need to run \`${pm_cli} install\`?`,
166
169
  );
167
170
  }
168
171
  const serialized_args = serialize_args({
@@ -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 `npm install`'}).default(false),
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 `npm i` to sync up',
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(config.pm_cli, ['i']);
29
+ const result = await spawn(config.pm_cli, ['install']);
30
30
  if (!result.ok) {
31
- throw new Task_Error('Failed npm install');
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
 
@@ -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"}