@ryanatkn/gro 0.129.1 → 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.
package/dist/package.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // generated by src/lib/package.gen.ts
2
2
  export const package_json = {
3
3
  name: '@ryanatkn/gro',
4
- version: '0.129.1',
4
+ version: '0.129.2',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  motto: 'generate, run, optimize',
7
7
  glyph: '🌰',
@@ -56,7 +56,7 @@ export const package_json = {
56
56
  '@changesets/changelog-git': '^0.2.0',
57
57
  '@changesets/types': '^6.0.0',
58
58
  '@ryanatkn/eslint-config': '^0.4.0',
59
- '@ryanatkn/fuz': '^0.108.2',
59
+ '@ryanatkn/fuz': '^0.108.3',
60
60
  '@ryanatkn/moss': '^0.7.0',
61
61
  '@sveltejs/adapter-static': '^3.0.2',
62
62
  '@sveltejs/kit': '^2.5.18',
@@ -266,7 +266,7 @@ export const package_json = {
266
266
  };
267
267
  export const src_json = {
268
268
  name: '@ryanatkn/gro',
269
- version: '0.129.1',
269
+ version: '0.129.2',
270
270
  modules: {
271
271
  '.': {
272
272
  path: 'index.ts',
@@ -2,10 +2,13 @@ import { z } from 'zod';
2
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
+ verbose: z.ZodDefault<z.ZodBoolean>;
5
6
  }, "strict", z.ZodTypeAny, {
6
7
  _: string[];
8
+ verbose: boolean;
7
9
  }, {
8
10
  _?: string[] | undefined;
11
+ verbose?: boolean | undefined;
9
12
  }>;
10
13
  export type Args = z.infer<typeof Args>;
11
14
  export declare const task: Task<Args>;
@@ -1,24 +1,38 @@
1
1
  import { z } from 'zod';
2
+ import { green, yellow } from '@ryanatkn/belt/styletext.js';
2
3
  import { TASK_FILE_SUFFIXES } from './task.js';
3
4
  import { resolve_input_paths, to_input_paths } from './input_path.js';
4
5
  export const Args = z
5
6
  .object({
6
7
  _: z.array(z.string(), { description: 'the input paths to resolve' }).default(['']),
8
+ verbose: z.boolean({ description: 'log diagnostics' }).default(false),
7
9
  })
8
10
  .strict();
9
11
  export const task = {
10
12
  summary: 'diagnostic that logs resolved filesystem info for the given input paths',
11
13
  Args,
12
14
  run: ({ args, config, log }) => {
13
- const { _ } = args;
14
- log.info('raw input paths:', _);
15
+ const { _, verbose } = args;
16
+ if (verbose)
17
+ log.info('raw input paths:', _);
15
18
  const input_paths = to_input_paths(_);
16
- log.info('input paths:', input_paths);
19
+ if (verbose)
20
+ log.info('input paths:', input_paths);
17
21
  const { task_root_dirs } = config;
18
- log.info('task root paths:', task_root_dirs);
22
+ if (verbose)
23
+ log.info('task root paths:', task_root_dirs);
19
24
  const { resolved_input_paths, possible_paths_by_input_path, unmapped_input_paths } = resolve_input_paths(input_paths, task_root_dirs, TASK_FILE_SUFFIXES);
20
- log.info('resolved_input_paths:', resolved_input_paths);
21
- log.info('possible_paths_by_input_path:', possible_paths_by_input_path);
22
- log.info('unmapped_input_paths:', unmapped_input_paths);
25
+ if (verbose)
26
+ log.info('resolved_input_paths:', resolved_input_paths);
27
+ if (verbose)
28
+ log.info('possible_paths_by_input_path:', possible_paths_by_input_path);
29
+ if (verbose)
30
+ log.info('unmapped_input_paths:', unmapped_input_paths);
31
+ for (const p of resolved_input_paths) {
32
+ log.info('resolved:', green(p.id));
33
+ }
34
+ if (!resolved_input_paths.length) {
35
+ log.warn(yellow('no input paths were resolved'));
36
+ }
23
37
  },
24
38
  };
package/dist/task.js CHANGED
@@ -17,7 +17,12 @@ export const to_task_name = (id, task_root_dir, input_path, root_path) => {
17
17
  task_name = strip_end(task_name, suffix);
18
18
  }
19
19
  if (isAbsolute(input_path)) {
20
- return relative(root_path, join(input_path, task_name));
20
+ // is a bit hacky, but does what we want
21
+ const relative_to_root = relative(root_path, join(task_root_dir, task_name));
22
+ if (relative_to_root.startsWith('node_modules/')) {
23
+ return task_name;
24
+ }
25
+ return relative_to_root;
21
26
  }
22
27
  return task_name;
23
28
  };
package/dist/task.test.js CHANGED
@@ -20,6 +20,11 @@ test('to_task_name basic behavior', () => {
20
20
  assert.is(to_task_name('/a/b/c/foo.task.ts', '/a/b', '/a/b', '/a/b/d'), '../c/foo');
21
21
  assert.is(to_task_name('/a/b/c/foo.task.ts', '/a/b', '/a/b', '/a/b'), 'c/foo');
22
22
  assert.is(to_task_name('/a/b/c/foo.task.ts', '/a/b', '/a/b', '/a/b/c'), 'foo');
23
+ assert.is(to_task_name('/a/b/d/foo.task.js', '/a/b/d', '/a/b/d/foo', '/a/c'), '../b/d/foo');
24
+ assert.is(to_task_name('/a/node_modules/b/c/foo.task.js', '/a/node_modules/b/c', '/a/node_modules/b/c/foo', '/a'), 'foo');
25
+ assert.is(to_task_name('/a/node_modules/b/c/foo.task.js', '/a/node_modules/b/c/', // compared to the above, adds a trailing slash here
26
+ '/a/node_modules/b/c/foo', '/a'), 'foo');
27
+ assert.is(to_task_name('/a/node_modules/b/c/foo.task.js', '/a/node_modules/b/c', '/a/node_modules/b/c/foo', '/a/'), 'foo');
23
28
  assert.is(to_task_name(resolve('a/b'), resolve('b'), '', ''), resolve('a/b'), 'falls back to the id when unresolved');
24
29
  });
25
30
  // TODO if we import directly, svelte-package generates types in `src/fixtures`
@@ -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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.129.1",
3
+ "version": "0.129.2",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -69,7 +69,7 @@
69
69
  "@changesets/changelog-git": "^0.2.0",
70
70
  "@changesets/types": "^6.0.0",
71
71
  "@ryanatkn/eslint-config": "^0.4.0",
72
- "@ryanatkn/fuz": "^0.108.2",
72
+ "@ryanatkn/fuz": "^0.108.3",
73
73
  "@ryanatkn/moss": "^0.7.0",
74
74
  "@sveltejs/adapter-static": "^3.0.2",
75
75
  "@sveltejs/kit": "^2.5.18",