@ryanatkn/gro 0.134.0 → 0.135.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 (51) hide show
  1. package/dist/args.d.ts.map +1 -1
  2. package/dist/args.js +6 -2
  3. package/dist/changeset.task.js +3 -3
  4. package/dist/check.task.js +2 -2
  5. package/dist/deploy.task.d.ts +2 -2
  6. package/dist/deploy.task.d.ts.map +1 -1
  7. package/dist/deploy.task.js +7 -7
  8. package/dist/esbuild_helpers.js +3 -3
  9. package/dist/gen.js +3 -3
  10. package/dist/gen.task.d.ts.map +1 -1
  11. package/dist/gen.task.js +8 -8
  12. package/dist/gro_helpers.js +1 -1
  13. package/dist/invoke.js +3 -0
  14. package/dist/invoke_task.d.ts.map +1 -1
  15. package/dist/invoke_task.js +8 -8
  16. package/dist/package.js +15 -15
  17. package/dist/package_json.js +3 -3
  18. package/dist/paths.js +2 -2
  19. package/dist/publish.task.js +4 -4
  20. package/dist/resolve.task.js +3 -3
  21. package/dist/run.task.js +2 -2
  22. package/dist/run_gen.js +3 -3
  23. package/dist/run_task.d.ts.map +1 -1
  24. package/dist/run_task.js +6 -5
  25. package/dist/task.js +3 -3
  26. package/dist/task_logging.js +7 -7
  27. package/dist/test.task.js +2 -2
  28. package/dist/watch_dir.js +1 -1
  29. package/package.json +14 -14
  30. package/src/lib/args.ts +6 -2
  31. package/src/lib/changeset.task.ts +3 -3
  32. package/src/lib/check.task.ts +2 -2
  33. package/src/lib/deploy.task.ts +12 -7
  34. package/src/lib/esbuild_helpers.ts +3 -3
  35. package/src/lib/gen.task.ts +11 -9
  36. package/src/lib/gen.ts +3 -3
  37. package/src/lib/gro_helpers.ts +1 -1
  38. package/src/lib/invoke.ts +4 -0
  39. package/src/lib/invoke_task.ts +10 -8
  40. package/src/lib/package.ts +15 -15
  41. package/src/lib/package_json.ts +3 -3
  42. package/src/lib/paths.ts +2 -2
  43. package/src/lib/publish.task.ts +4 -4
  44. package/src/lib/resolve.task.ts +3 -3
  45. package/src/lib/run.task.ts +2 -2
  46. package/src/lib/run_gen.ts +3 -3
  47. package/src/lib/run_task.ts +8 -5
  48. package/src/lib/task.ts +3 -3
  49. package/src/lib/task_logging.ts +10 -10
  50. package/src/lib/test.task.ts +2 -2
  51. package/src/lib/watch_dir.ts +1 -1
@@ -1,5 +1,6 @@
1
- import {cyan, red} from '@ryanatkn/belt/styletext.js';
2
- import {print_log_label, System_Logger} from '@ryanatkn/belt/log.js';
1
+ import {styleText as st} from 'node:util';
2
+ import {print_log_label} from '@ryanatkn/belt/print.js';
3
+ import {System_Logger} from '@ryanatkn/belt/log.js';
3
4
  import type {Timings} from '@ryanatkn/belt/timings.js';
4
5
 
5
6
  import {parse_args, type Args} from './args.js';
@@ -40,7 +41,7 @@ export const run_task = async (
40
41
  if (task.Args) {
41
42
  const parsed = parse_args(unparsed_args, task.Args);
42
43
  if (!parsed.success) {
43
- log.error(red(`Args validation failed:`), '\n', parsed.error.format());
44
+ log.error(st('red', `Args validation failed:`), '\n', parsed.error.format());
44
45
  throw new Task_Error(`Task args failed validation`);
45
46
  }
46
47
  args = parsed.data;
@@ -61,10 +62,12 @@ export const run_task = async (
61
62
  } catch (err) {
62
63
  return {
63
64
  ok: false,
64
- reason: red(
65
+ reason: st(
66
+ 'red',
65
67
  err?.constructor?.name === 'Task_Error'
66
68
  ? (err.message as string)
67
- : `Unexpected error running task ${cyan(
69
+ : `Unexpected error running task ${st(
70
+ 'cyan',
68
71
  task_meta.name,
69
72
  )}. If this is unexpected try running \`npm i\` and \`gro clean\`.`,
70
73
  ),
package/src/lib/task.ts CHANGED
@@ -2,7 +2,7 @@ import type {Logger} from '@ryanatkn/belt/log.js';
2
2
  import {ensure_end, strip_end, strip_start} from '@ryanatkn/belt/string.js';
3
3
  import type {z} from 'zod';
4
4
  import type {Timings} from '@ryanatkn/belt/timings.js';
5
- import {red} from '@ryanatkn/belt/styletext.js';
5
+ import {styleText as st} from 'node:util';
6
6
  import type {Result} from '@ryanatkn/belt/result.js';
7
7
  import {isAbsolute, join, relative} from 'node:path';
8
8
 
@@ -149,7 +149,7 @@ export const find_tasks = (
149
149
  input_paths,
150
150
  task_root_dirs,
151
151
  reasons: unmapped_input_paths.map((input_path) =>
152
- red(`Input path ${print_path(input_path)} cannot be mapped to a file or directory.`),
152
+ st('red', `Input path ${print_path(input_path)} cannot be mapped to a file or directory.`),
153
153
  ),
154
154
  };
155
155
  }
@@ -177,7 +177,7 @@ export const find_tasks = (
177
177
  input_paths,
178
178
  task_root_dirs,
179
179
  reasons: input_directories_with_no_files.map((input_path) =>
180
- red(`Input directory contains no matching files: ${print_path(input_path)}`),
180
+ st('red', `Input directory contains no matching files: ${print_path(input_path)}`),
181
181
  ),
182
182
  };
183
183
  }
@@ -1,4 +1,4 @@
1
- import {cyan, gray, green, red} from '@ryanatkn/belt/styletext.js';
1
+ 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';
@@ -15,8 +15,8 @@ export const log_tasks = (log: Logger, loaded_tasks: Loaded_Tasks, log_intro = t
15
15
  const logged: string[] = [];
16
16
  if (log_intro) {
17
17
  logged.unshift(
18
- `\n\n${gray('Run a task:')} gro [name]`,
19
- `\n${gray('View help:')} gro [name] --help`,
18
+ `\n\n${st('gray', 'Run a task:')} gro [name]`,
19
+ `\n${st('gray', 'View help:')} gro [name] --help`,
20
20
  );
21
21
  }
22
22
 
@@ -35,7 +35,7 @@ export const log_tasks = (log: Logger, loaded_tasks: Loaded_Tasks, log_intro = t
35
35
  for (const resolved_input_file of resolved_input_files) {
36
36
  const meta = modules.find((m) => m.id === resolved_input_file.id)!;
37
37
  logged.push(
38
- '\n' + cyan(meta.name.padEnd(longest_task_name)),
38
+ '\n' + st('cyan', meta.name.padEnd(longest_task_name)),
39
39
  ' ',
40
40
  meta.mod.task.summary ?? '',
41
41
  );
@@ -46,7 +46,7 @@ export const log_tasks = (log: Logger, loaded_tasks: Loaded_Tasks, log_intro = t
46
46
 
47
47
  export const log_error_reasons = (log: Logger, reasons: string[]): void => {
48
48
  for (const reason of reasons) {
49
- log.error(red(reason));
49
+ log.error(st('red', reason));
50
50
  }
51
51
  };
52
52
 
@@ -59,9 +59,9 @@ export const log_task_help = (log: Logger, meta: Task_Module_Meta): void => {
59
59
  } = meta;
60
60
  const logged: string[] = [];
61
61
  logged.push(
62
- cyan(name),
62
+ st('cyan', name),
63
63
  'help',
64
- cyan(`\n\ngro ${name}`) + `: ${task.summary ?? '(no summary available)'}\n`,
64
+ st('cyan', `\n\ngro ${name}`) + `: ${task.summary ?? '(no summary available)'}\n`,
65
65
  );
66
66
  if (task.Args) {
67
67
  const properties = to_arg_properties(task.Args._def, meta);
@@ -75,14 +75,14 @@ export const log_task_help = (log: Logger, meta: Task_Module_Meta): void => {
75
75
  for (const property of properties) {
76
76
  const name = property.name === '_' ? ARGS_PROPERTY_NAME : property.name;
77
77
  logged.push(
78
- `\n${green(name.padEnd(longest_task_name))} `,
79
- gray(property.schema.type.padEnd(longest_type)) + ' ',
78
+ `\n${st('green', name.padEnd(longest_task_name))} `,
79
+ st('gray', property.schema.type.padEnd(longest_type)) + ' ',
80
80
  print_value(property.schema.default).padEnd(longest_default) + ' ',
81
81
  property.schema.description || '(no description available)',
82
82
  );
83
83
  }
84
84
  if (!properties.length) {
85
- logged.push('\n' + gray('this task has no args'));
85
+ logged.push('\n' + st('gray', 'this task has no args'));
86
86
  }
87
87
  }
88
88
  log.info(...logged, '\n');
@@ -1,4 +1,4 @@
1
- import {yellow} from '@ryanatkn/belt/styletext.js';
1
+ import {styleText as st} from 'node:util';
2
2
  import {z} from 'zod';
3
3
 
4
4
  import {Task_Error, type Task} from './task.js';
@@ -26,7 +26,7 @@ export const task: Task<Args> = {
26
26
  const {_: patterns, bail, cwd, ignore} = args;
27
27
 
28
28
  if (!find_cli('uvu')) {
29
- log.warn(yellow('uvu is not installed, skipping tests'));
29
+ log.warn(st('yellow', 'uvu is not installed, skipping tests'));
30
30
  return;
31
31
  }
32
32
 
@@ -39,7 +39,7 @@ export const watch_dir = ({
39
39
  on_change,
40
40
  filter,
41
41
  absolute = true,
42
- chokidar = {},
42
+ chokidar,
43
43
  }: Options): Watch_Node_Fs => {
44
44
  let watcher: FSWatcher | undefined;
45
45