@ryanatkn/gro 0.129.0 → 0.129.2

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 (80) hide show
  1. package/README.md +3 -3
  2. package/dist/args.d.ts +2 -2
  3. package/dist/args.js +2 -2
  4. package/dist/changelog.test.js +1 -1
  5. package/dist/changeset.task.js +6 -6
  6. package/dist/cli.js +1 -1
  7. package/dist/config.d.ts +1 -3
  8. package/dist/config.js +2 -2
  9. package/dist/deploy.task.js +1 -1
  10. package/dist/docs/README.gen.md.js +1 -1
  11. package/dist/docs/package_json.md +2 -1
  12. package/dist/env.d.ts +2 -2
  13. package/dist/env.js +10 -11
  14. package/dist/esbuild_helpers.js +2 -1
  15. package/dist/esbuild_plugin_external_worker.js +1 -1
  16. package/dist/esbuild_plugin_svelte.js +3 -3
  17. package/dist/esbuild_plugin_sveltekit_local_imports.js +2 -2
  18. package/dist/esbuild_plugin_sveltekit_shim_env.js +2 -2
  19. package/dist/format_file.js +2 -2
  20. package/dist/gen.d.ts +10 -12
  21. package/dist/gen.js +3 -3
  22. package/dist/gen.task.js +1 -1
  23. package/dist/gen.test.js +2 -5
  24. package/dist/git.d.ts +1 -1
  25. package/dist/gro.config.default.js +1 -1
  26. package/dist/gro.js +1 -1
  27. package/dist/gro_helpers.js +1 -2
  28. package/dist/gro_plugin_gen.js +3 -4
  29. package/dist/gro_plugin_server.d.ts +5 -7
  30. package/dist/gro_plugin_server.js +3 -3
  31. package/dist/gro_plugin_sveltekit_app.d.ts +3 -5
  32. package/dist/gro_plugin_sveltekit_app.js +38 -28
  33. package/dist/gro_plugin_sveltekit_library.d.ts +2 -2
  34. package/dist/gro_plugin_sveltekit_library.js +2 -2
  35. package/dist/input_path.test.js +1 -1
  36. package/dist/invoke_task.js +3 -3
  37. package/dist/lint.task.js +1 -2
  38. package/dist/loader.js +3 -3
  39. package/dist/package.d.ts +7 -10
  40. package/dist/package.gen.js +3 -3
  41. package/dist/package.js +18 -15
  42. package/dist/package_json.d.ts +4 -6
  43. package/dist/package_json.js +14 -15
  44. package/dist/package_json.test.js +12 -12
  45. package/dist/path.d.ts +2 -6
  46. package/dist/plugin.d.ts +1 -3
  47. package/dist/plugin.js +2 -2
  48. package/dist/plugin.test.js +3 -3
  49. package/dist/publish.task.js +4 -4
  50. package/dist/release.task.js +2 -2
  51. package/dist/resolve.task.d.ts +3 -0
  52. package/dist/resolve.task.js +22 -8
  53. package/dist/resolve_node_specifier.d.ts +1 -1
  54. package/dist/resolve_node_specifier.js +2 -2
  55. package/dist/resolve_node_specifier.test.js +6 -6
  56. package/dist/resolve_specifier.d.ts +1 -1
  57. package/dist/resolve_specifier.js +1 -1
  58. package/dist/resolve_specifier.test.js +16 -16
  59. package/dist/run_gen.test.js +11 -11
  60. package/dist/run_task.js +1 -1
  61. package/dist/run_task.test.js +3 -2
  62. package/dist/src_json.d.ts +3 -5
  63. package/dist/src_json.js +11 -13
  64. package/dist/src_json.test.js +2 -2
  65. package/dist/sveltekit_config.js +1 -1
  66. package/dist/sveltekit_helpers.d.ts +4 -4
  67. package/dist/sveltekit_helpers.js +4 -4
  68. package/dist/sveltekit_shim_env.d.ts +1 -1
  69. package/dist/sveltekit_shim_env.js +2 -2
  70. package/dist/task.d.ts +1 -1
  71. package/dist/task.js +6 -1
  72. package/dist/task.test.js +5 -0
  73. package/dist/task_logging.d.ts +1 -1
  74. package/dist/task_logging.js +3 -4
  75. package/dist/upgrade.task.js +9 -3
  76. package/dist/watch_dir.d.ts +1 -3
  77. package/dist/watch_dir.js +6 -6
  78. package/package.json +18 -21
  79. package/dist/fs.test.d.ts +0 -1
  80. package/dist/fs.test.js +0 -16
@@ -3,7 +3,7 @@ import { plural } from '@ryanatkn/belt/string.js';
3
3
  import { print_value } from '@ryanatkn/belt/print.js';
4
4
  import { ZodFirstPartyTypeKind } from 'zod';
5
5
  import { print_path } from './paths.js';
6
- export const log_tasks = async (log, loaded_tasks, log_intro = true) => {
6
+ export const log_tasks = (log, loaded_tasks, log_intro = true) => {
7
7
  const { modules, found_tasks } = loaded_tasks;
8
8
  const { resolved_input_files_by_root_dir } = found_tasks;
9
9
  const logged = [];
@@ -20,7 +20,7 @@ export const log_tasks = async (log, loaded_tasks, log_intro = true) => {
20
20
  const longest_task_name = to_max_length(modules, (m) => m.name);
21
21
  for (const resolved_input_file of resolved_input_files) {
22
22
  const meta = modules.find((m) => m.id === resolved_input_file.id);
23
- logged.push('\n' + cyan(pad(meta.name, longest_task_name)), ' ', meta.mod.task.summary || '');
23
+ logged.push('\n' + cyan(pad(meta.name, longest_task_name)), ' ', meta.mod.task.summary ?? '');
24
24
  }
25
25
  }
26
26
  log[log_intro ? 'info' : 'plain'](logged.join('') + '\n');
@@ -34,7 +34,7 @@ const ARGS_PROPERTY_NAME = '[...args]';
34
34
  export const log_task_help = (log, meta) => {
35
35
  const { name, mod: { task }, } = meta;
36
36
  const logged = [];
37
- logged.push(cyan(name), 'help', cyan(`\n\ngro ${name}`) + `: ${task.summary || '(no summary available)'}\n`);
37
+ logged.push(cyan(name), 'help', cyan(`\n\ngro ${name}`) + `: ${task.summary ?? '(no summary available)'}\n`);
38
38
  if (task.Args) {
39
39
  const properties = to_arg_properties(task.Args._def, meta);
40
40
  // TODO hacky padding for some quick and dirty tables
@@ -121,7 +121,6 @@ const to_args_schema_default = ({ _def }) => {
121
121
  if (subschema) {
122
122
  return to_args_schema_default(subschema);
123
123
  }
124
- return undefined;
125
124
  };
126
125
  const to_subschema = (_def) => {
127
126
  if ('type' in _def) {
@@ -32,7 +32,7 @@ export const task = {
32
32
  if (pull) {
33
33
  await git_pull(origin);
34
34
  }
35
- const package_json = await load_package_json();
35
+ const package_json = load_package_json();
36
36
  const all_deps = to_deps(package_json);
37
37
  const deps = only.length
38
38
  ? all_deps.filter((d) => only.includes(d.key))
@@ -64,11 +64,17 @@ const to_deps = (package_json) => {
64
64
  : [];
65
65
  return prod_deps.concat(dev_deps);
66
66
  };
67
+ const EXACT_VERSION_MATCHER = /^..*@.+/u;
68
+ const CUSTOM_TAG_MATCHER = /^[\^~><=]*.+-(.+)/u;
67
69
  // TODO hacky and limited
68
70
  // TODO probably want to pass through exact deps as well, e.g. @foo/bar@1
69
71
  const to_upgrade_items = (deps) => deps.map((dep) => {
70
- if (dep.key.endsWith('@next') || dep.key.endsWith('@latest')) {
72
+ if (EXACT_VERSION_MATCHER.test(dep.key)) {
71
73
  return dep.key;
72
74
  }
73
- return dep.key + (dep.value.includes('-next.') ? '@next' : '@latest');
75
+ const custom_tag_matches = CUSTOM_TAG_MATCHER.exec(dep.value);
76
+ if (custom_tag_matches) {
77
+ return dep.key + '@' + custom_tag_matches[1].split('.')[0]; // I tried adding `\.?` to the end but doesn't work and I'm being lazy so I'm just splitting
78
+ }
79
+ return dep.key + '@latest';
74
80
  });
@@ -10,9 +10,7 @@ export interface Watcher_Change {
10
10
  is_directory: boolean;
11
11
  }
12
12
  export type Watcher_Change_Type = 'create' | 'update' | 'delete';
13
- export interface Watcher_Change_Callback {
14
- (change: Watcher_Change): void;
15
- }
13
+ export type Watcher_Change_Callback = (change: Watcher_Change) => void;
16
14
  export interface Options {
17
15
  dir: string;
18
16
  on_change: Watcher_Change_Callback;
package/dist/watch_dir.js CHANGED
@@ -9,22 +9,22 @@ export const watch_dir = ({ dir, on_change, filter, absolute = true, chokidar: c
9
9
  return {
10
10
  init: async () => {
11
11
  watcher = chokidar.watch(dir, chokidar_options);
12
- watcher.on('add', async (path, s) => {
13
- const stats = s || statSync(path);
12
+ watcher.on('add', (path, s) => {
13
+ const stats = s ?? statSync(path);
14
14
  const final_path = absolute ? path : relative(dir, path);
15
15
  if (filter && !filter(final_path, stats.isDirectory()))
16
16
  return;
17
17
  on_change({ type: 'create', path: final_path, is_directory: stats.isDirectory() });
18
18
  });
19
- watcher.on('addDir', async (path, s) => {
20
- const stats = s || statSync(path);
19
+ watcher.on('addDir', (path, s) => {
20
+ const stats = s ?? statSync(path);
21
21
  const final_path = absolute ? path : relative(dir, path);
22
22
  if (filter && !filter(final_path, stats.isDirectory()))
23
23
  return;
24
24
  on_change({ type: 'create', path: final_path, is_directory: stats.isDirectory() });
25
25
  });
26
- watcher.on('change', async (path, s) => {
27
- const stats = s || statSync(path);
26
+ watcher.on('change', (path, s) => {
27
+ const stats = s ?? statSync(path);
28
28
  const final_path = absolute ? path : relative(dir, path);
29
29
  if (filter && !filter(final_path, stats.isDirectory()))
30
30
  return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.129.0",
3
+ "version": "0.129.2",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -21,9 +21,14 @@
21
21
  "bugs": "https://github.com/ryanatkn/gro/issues",
22
22
  "funding": "https://www.ryanatkn.com/funding",
23
23
  "scripts": {
24
- "build": "rm -rf .gro dist && svelte-kit sync && svelte-package && chmod +x ./dist/gro.js && npm link -f",
24
+ "bootstrap": "rm -rf .gro dist && svelte-kit sync && svelte-package && chmod +x ./dist/gro.js && npm link -f",
25
25
  "start": "gro dev",
26
- "test": "gro test"
26
+ "dev": "gro dev",
27
+ "build": "gro build",
28
+ "check": "gro check",
29
+ "test": "gro test",
30
+ "preview": "vite preview",
31
+ "deploy": "gro deploy"
27
32
  },
28
33
  "type": "module",
29
34
  "engines": {
@@ -44,7 +49,7 @@
44
49
  "typescript"
45
50
  ],
46
51
  "dependencies": {
47
- "@ryanatkn/belt": "^0.24.1",
52
+ "@ryanatkn/belt": "^0.24.2",
48
53
  "chokidar": "^3.6.0",
49
54
  "dotenv": "^16.4.5",
50
55
  "es-module-lexer": "^1.5.4",
@@ -57,38 +62,30 @@
57
62
  "zod": "^3.23.8"
58
63
  },
59
64
  "peerDependencies": {
60
- "esbuild": "^0.21",
65
+ "esbuild": "^0.21.0",
61
66
  "svelte": "^5.0.0-next.0"
62
67
  },
63
68
  "devDependencies": {
64
69
  "@changesets/changelog-git": "^0.2.0",
65
70
  "@changesets/types": "^6.0.0",
66
- "@ryanatkn/eslint-config": "^0.1.3",
67
- "@ryanatkn/fuz": "^0.107.0",
68
- "@ryanatkn/moss": "^0.6.3",
71
+ "@ryanatkn/eslint-config": "^0.4.0",
72
+ "@ryanatkn/fuz": "^0.108.3",
73
+ "@ryanatkn/moss": "^0.7.0",
69
74
  "@sveltejs/adapter-static": "^3.0.2",
70
75
  "@sveltejs/kit": "^2.5.18",
71
76
  "@sveltejs/package": "^2.3.2",
72
77
  "@sveltejs/vite-plugin-svelte": "^3.1.1",
73
78
  "@types/fs-extra": "^11.0.4",
74
- "@types/node": "^20.14.9",
75
- "@typescript-eslint/eslint-plugin": "^7.14.1",
76
- "@typescript-eslint/parser": "^7.14.1",
79
+ "@types/node": "^20.14.10",
77
80
  "esbuild": "^0.21.5",
78
- "eslint": "^8.57.0",
81
+ "eslint": "^9.6.0",
79
82
  "eslint-plugin-svelte": "^2.41.0",
80
- "svelte": "^5.0.0-next.167",
83
+ "svelte": "^5.0.0-next.175",
81
84
  "svelte-check": "^3.8.4",
82
- "typescript": "^5.5.2",
85
+ "typescript": "^5.5.3",
86
+ "typescript-eslint": "^8.0.0-alpha.39",
83
87
  "uvu": "^0.5.6"
84
88
  },
85
- "eslintConfig": {
86
- "root": true,
87
- "extends": "@ryanatkn",
88
- "rules": {
89
- "no-console": 1
90
- }
91
- },
92
89
  "prettier": {
93
90
  "plugins": [
94
91
  "prettier-plugin-svelte"
package/dist/fs.test.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/fs.test.js DELETED
@@ -1,16 +0,0 @@
1
- import { test } from 'uvu';
2
- import * as assert from 'uvu/assert';
3
- import { existsSync } from 'node:fs';
4
- test('file exists', async () => {
5
- assert.ok(existsSync('./src/lib/fs.ts'));
6
- });
7
- test('file does not exist', async () => {
8
- assert.ok(!existsSync('./src/lib/existsssss.ts'));
9
- });
10
- test('directory exists', async () => {
11
- assert.ok(existsSync('./src/lib'));
12
- });
13
- test('directory does not exist', async () => {
14
- assert.ok(!existsSync('./src/libbbbbbbb'));
15
- });
16
- test.run();