@ryanatkn/gro 0.129.15 → 0.130.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.
@@ -4,8 +4,8 @@ import { clean_fs } from './clean_fs.js';
4
4
  export const Args = z
5
5
  .object({
6
6
  install: z.boolean({ description: 'dual of no-install' }).default(true),
7
- 'no-install': z
8
- .boolean({ description: 'opt out of npm installing before building' })
7
+ 'no-install': z // convenience, same as `gro build -- gro sync --no-install` but the latter takes precedence
8
+ .boolean({ description: 'opt out of `npm install` before building' })
9
9
  .default(false),
10
10
  })
11
11
  .strict();
@@ -10,31 +10,31 @@ export declare const Args: z.ZodObject<{
10
10
  dir: z.ZodDefault<z.ZodString>;
11
11
  access: z.ZodOptional<z.ZodEnum<["restricted", "public"]>>;
12
12
  changelog: z.ZodDefault<z.ZodString>;
13
- install: z.ZodDefault<z.ZodBoolean>;
14
- 'no-install': z.ZodDefault<z.ZodBoolean>;
13
+ dep: z.ZodDefault<z.ZodBoolean>;
14
+ 'no-dep': z.ZodDefault<z.ZodBoolean>;
15
15
  origin: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Origin">>;
16
16
  changeset_cli: z.ZodDefault<z.ZodString>;
17
17
  }, "strict", z.ZodTypeAny, {
18
18
  _: string[];
19
19
  dir: string;
20
- install: boolean;
21
- 'no-install': boolean;
22
20
  origin: string & z.BRAND<"Git_Origin">;
23
21
  minor: boolean;
24
22
  major: boolean;
25
23
  changelog: string;
24
+ dep: boolean;
25
+ 'no-dep': boolean;
26
26
  changeset_cli: string;
27
27
  access?: "public" | "restricted" | undefined;
28
28
  }, {
29
29
  _?: string[] | undefined;
30
30
  dir?: string | undefined;
31
- install?: boolean | undefined;
32
- 'no-install'?: boolean | undefined;
33
31
  origin?: string | undefined;
34
32
  minor?: boolean | undefined;
35
33
  major?: boolean | undefined;
36
34
  access?: "public" | "restricted" | undefined;
37
35
  changelog?: string | undefined;
36
+ dep?: boolean | undefined;
37
+ 'no-dep'?: boolean | undefined;
38
38
  changeset_cli?: string | undefined;
39
39
  }>;
40
40
  export type Args = z.infer<typeof Args>;
@@ -21,10 +21,10 @@ export const Args = z
21
21
  dir: z.string({ description: 'changeset dir' }).default(CHANGESET_DIR),
22
22
  access: Changeset_Access.describe("changeset 'access' config value, the default depends on package.json#private").optional(),
23
23
  changelog: z
24
- .string({ description: 'changeset "changelog" config value' })
24
+ .string({ description: 'changelog dep package name, used as changeset\'s "changelog" config' })
25
25
  .default('@changesets/changelog-git'),
26
- install: z.boolean({ description: 'dual of no-install' }).default(true),
27
- 'no-install': z
26
+ dep: z.boolean({ description: 'dual of no-dep' }).default(true),
27
+ 'no-dep': z
28
28
  .boolean({ description: 'opt out of npm installing the changelog package' })
29
29
  .default(false),
30
30
  origin: Git_Origin.describe('git origin to deploy to').default('origin'),
@@ -44,7 +44,7 @@ export const task = {
44
44
  summary: 'call changeset with gro patterns',
45
45
  Args,
46
46
  run: async (ctx) => {
47
- const { invoke_task, args: { _, minor, major, dir, access: access_arg, changelog, install, origin, changeset_cli }, log, sveltekit_config, } = ctx;
47
+ const { invoke_task, args: { _, minor, major, dir, access: access_arg, changelog, dep, origin, changeset_cli }, log, sveltekit_config, } = ctx;
48
48
  const message = _.join(' ');
49
49
  if (!message && (minor || major))
50
50
  throw new Task_Error('cannot bump version without a message');
@@ -76,12 +76,12 @@ export const task = {
76
76
  });
77
77
  }
78
78
  await spawn('git', ['add', dir]);
79
- if (install) {
79
+ if (dep) {
80
80
  await spawn('npm', ['i', '-D', changelog]);
81
81
  }
82
82
  }
83
83
  // TODO small problem here where generated files don't get committed
84
- await invoke_task('sync'); // after the `npm i` above, and in all cases
84
+ await invoke_task('sync', { install: inited || !dep }); // after the `npm i` above, and in all cases
85
85
  if (message) {
86
86
  // TODO see the helper below, simplify this to CLI flags when support is added to Changesets
87
87
  const changeset_adder = create_changeset_adder(package_json.name, dir, message, bump);
@@ -15,11 +15,15 @@ export declare const Args: z.ZodObject<{
15
15
  'no-lint': z.ZodDefault<z.ZodBoolean>;
16
16
  sync: z.ZodDefault<z.ZodBoolean>;
17
17
  'no-sync': z.ZodDefault<z.ZodBoolean>;
18
+ install: z.ZodDefault<z.ZodBoolean>;
19
+ 'no-install': z.ZodDefault<z.ZodBoolean>;
18
20
  workspace: z.ZodDefault<z.ZodBoolean>;
19
21
  }, "strict", z.ZodTypeAny, {
20
22
  sync: boolean;
21
23
  package_json: boolean;
22
24
  format: boolean;
25
+ install: boolean;
26
+ 'no-install': boolean;
23
27
  typecheck: boolean;
24
28
  'no-typecheck': boolean;
25
29
  test: boolean;
@@ -36,6 +40,8 @@ export declare const Args: z.ZodObject<{
36
40
  sync?: boolean | undefined;
37
41
  package_json?: boolean | undefined;
38
42
  format?: boolean | undefined;
43
+ install?: boolean | undefined;
44
+ 'no-install'?: boolean | undefined;
39
45
  typecheck?: boolean | undefined;
40
46
  'no-typecheck'?: boolean | undefined;
41
47
  test?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"check.task.d.ts","sourceRoot":"../src/lib/","sources":["check.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAIhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAoBP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAyD3B,CAAC"}
1
+ {"version":3,"file":"check.task.d.ts","sourceRoot":"../src/lib/","sources":["check.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAIhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAyD3B,CAAC"}
@@ -20,6 +20,8 @@ export const Args = z
20
20
  'no-lint': z.boolean({ description: 'opt out of linting' }).default(false),
21
21
  sync: z.boolean({ description: 'dual of no-sync' }).default(true),
22
22
  'no-sync': z.boolean({ description: 'opt out of syncing' }).default(false),
23
+ install: z.boolean({ description: 'dual of no-install' }).default(true),
24
+ 'no-install': z.boolean({ description: 'opt out of `npm install` when syncing' }).default(false), // convenience, same as `gro check -- gro sync --no-install` but the latter takes precedence
23
25
  workspace: z
24
26
  .boolean({ description: 'ensure a clean git workspace, useful for CI, also implies --no-sync' })
25
27
  .default(false),
@@ -29,11 +31,11 @@ export const task = {
29
31
  summary: 'check that everything is ready to commit',
30
32
  Args,
31
33
  run: async ({ args, invoke_task, log, config }) => {
32
- const { typecheck, test, gen, format, package_json, lint, sync, workspace } = args;
34
+ const { typecheck, test, gen, format, package_json, lint, sync, install, workspace } = args;
33
35
  // When checking the workspace, which was added for CI, never sync.
34
36
  // Setup like `npm i` and `sveltekit-sync` should be done in the CI setup.
35
37
  if (sync && !workspace) {
36
- await invoke_task('sync', { gen: false }); // never generate because `gro gen --check` runs below
38
+ await invoke_task('sync', { install, gen: false }); // never generate because `gro gen --check` runs below
37
39
  }
38
40
  if (typecheck) {
39
41
  await invoke_task('typecheck');
@@ -6,14 +6,20 @@ export declare const Args: z.ZodObject<{
6
6
  'no-watch': z.ZodDefault<z.ZodBoolean>;
7
7
  sync: z.ZodDefault<z.ZodBoolean>;
8
8
  'no-sync': z.ZodDefault<z.ZodBoolean>;
9
+ install: z.ZodDefault<z.ZodBoolean>;
10
+ 'no-install': z.ZodDefault<z.ZodBoolean>;
9
11
  }, "strict", z.ZodTypeAny, {
10
12
  sync: boolean;
11
13
  watch: boolean;
14
+ install: boolean;
15
+ 'no-install': boolean;
12
16
  'no-sync': boolean;
13
17
  'no-watch': boolean;
14
18
  }, {
15
19
  sync?: boolean | undefined;
16
20
  watch?: boolean | undefined;
21
+ install?: boolean | undefined;
22
+ 'no-install'?: boolean | undefined;
17
23
  'no-sync'?: boolean | undefined;
18
24
  'no-watch'?: boolean | undefined;
19
25
  }>;
@@ -1 +1 @@
1
- {"version":3,"file":"dev.task.d.ts","sourceRoot":"../src/lib/","sources":["dev.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EAAU,KAAK,cAAc,EAAC,MAAM,aAAa,CAAC;AAGzD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;EAYP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AAEnD,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAmB3B,CAAC"}
1
+ {"version":3,"file":"dev.task.d.ts","sourceRoot":"../src/lib/","sources":["dev.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EAAU,KAAK,cAAc,EAAC,MAAM,aAAa,CAAC;AAGzD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;EAgBP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,MAAM,MAAM,eAAe,GAAG,cAAc,CAAC,IAAI,CAAC,CAAC;AAEnD,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAmB3B,CAAC"}
package/dist/dev.task.js CHANGED
@@ -11,6 +11,10 @@ export const Args = z
11
11
  .default(false),
12
12
  sync: z.boolean({ description: 'dual of no-sync' }).default(true),
13
13
  'no-sync': z.boolean({ description: 'opt out of gro sync' }).default(false),
14
+ install: z.boolean({ description: 'dual of no-install' }).default(true),
15
+ 'no-install': z // convenience, same as `gro dev -- gro sync --no-install` but the latter takes precedence
16
+ .boolean({ description: 'opt out of `npm install` before starting the dev server' })
17
+ .default(false),
14
18
  })
15
19
  .strict();
16
20
  export const task = {
@@ -18,10 +22,10 @@ export const task = {
18
22
  Args,
19
23
  run: async (ctx) => {
20
24
  const { args, invoke_task } = ctx;
21
- const { watch, sync } = args;
25
+ const { watch, sync, install } = args;
22
26
  await clean_fs({ build_dev: true });
23
27
  if (sync) {
24
- await invoke_task('sync');
28
+ await invoke_task('sync', { install });
25
29
  }
26
30
  const plugins = await Plugins.create({ ...ctx, dev: true, watch });
27
31
  await plugins.setup();
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.15',
4
+ version: '0.130.1',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  motto: 'generate, run, optimize',
7
7
  glyph: '🌰',
@@ -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.15',
269
+ version: '0.130.1',
270
270
  modules: {
271
271
  '.': {
272
272
  path: 'index.ts',
@@ -1 +1 @@
1
- {"version":3,"file":"publish.task.d.ts","sourceRoot":"../src/lib/","sources":["publish.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAwBhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAsI3B,CAAC"}
1
+ {"version":3,"file":"publish.task.d.ts","sourceRoot":"../src/lib/","sources":["publish.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAItB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAwBhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2BP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA+I3B,CAAC"}
@@ -79,6 +79,7 @@ export const task = {
79
79
  await invoke_task('check', { workspace: true });
80
80
  }
81
81
  let version;
82
+ let optional_and_version_unchanged = false;
82
83
  // Bump the version so the package.json is updated before building:
83
84
  // TODO problem here is build may fail and put us in a bad state,
84
85
  // but I don't see how we could do this to robustly
@@ -116,16 +117,24 @@ export const task = {
116
117
  // The version didn't change.
117
118
  // For now this is the best detection we have for a no-op `changeset version`.
118
119
  if (optional) {
119
- return; // exit gracefully
120
+ optional_and_version_unchanged = true;
120
121
  }
121
122
  else {
123
+ // Doesn't build if the version didn't change and publishing isn't optional.
122
124
  throw new Task_Error(`\`${changeset_cli} version\` failed: are there any changes?`);
123
125
  }
124
126
  }
125
127
  }
128
+ // Build after the version is bumped so the new version is in the build as needed.
126
129
  if (build) {
127
130
  await invoke_task('build');
128
131
  }
132
+ // Return early if there are no changes and publishing is optional, but after building,
133
+ // so if callers want to optimize away building
134
+ // they need to do so manually like in `gro release`.
135
+ // TODO this could be cleaned up if tasks had a return value to callers, it could specifiy that it didn't build
136
+ if (optional_and_version_unchanged)
137
+ return;
129
138
  if (dry) {
130
139
  log.info('publishing branch ' + branch);
131
140
  log.info(green('dry run complete!'));
@@ -8,10 +8,12 @@ export declare const Args: z.ZodObject<{
8
8
  gen: z.ZodDefault<z.ZodBoolean>;
9
9
  'no-gen': z.ZodDefault<z.ZodBoolean>;
10
10
  install: z.ZodDefault<z.ZodBoolean>;
11
+ 'no-install': z.ZodDefault<z.ZodBoolean>;
11
12
  }, "strict", z.ZodTypeAny, {
12
13
  package_json: boolean;
13
14
  sveltekit: boolean;
14
15
  install: boolean;
16
+ 'no-install': boolean;
15
17
  gen: boolean;
16
18
  'no-gen': boolean;
17
19
  'no-package_json': boolean;
@@ -20,6 +22,7 @@ export declare const Args: z.ZodObject<{
20
22
  package_json?: boolean | undefined;
21
23
  sveltekit?: boolean | undefined;
22
24
  install?: boolean | undefined;
25
+ 'no-install'?: boolean | undefined;
23
26
  gen?: boolean | undefined;
24
27
  'no-gen'?: boolean | undefined;
25
28
  'no-package_json'?: boolean | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"sync.task.d.ts","sourceRoot":"../src/lib/","sources":["sync.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAIhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;EAUP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA0B3B,CAAC"}
1
+ {"version":3,"file":"sync.task.d.ts","sourceRoot":"../src/lib/","sources":["sync.task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAGtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAIhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;EAWP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA0B3B,CAAC"}
package/dist/sync.task.js CHANGED
@@ -10,8 +10,9 @@ export const Args = z
10
10
  package_json: z.boolean({ description: 'dual of no-package_json' }).default(true),
11
11
  'no-package_json': z.boolean({ description: 'opt out of package.json sync' }).default(false),
12
12
  gen: z.boolean({ description: 'dual of no-gen' }).default(true),
13
- 'no-gen': z.boolean({ description: 'opt out of gen sync' }).default(false),
14
- install: z.boolean({ description: 'run npm install' }).default(false),
13
+ 'no-gen': z.boolean({ description: 'opt out of running gen' }).default(false),
14
+ install: z.boolean({ description: 'dual of no-install' }).default(true),
15
+ 'no-install': z.boolean({ description: 'opt out of `npm install`' }).default(false),
15
16
  })
16
17
  .strict();
17
18
  export const task = {
@@ -1 +1 @@
1
- {"version":3,"file":"upgrade.task.d.ts","sourceRoot":"../src/lib/","sources":["upgrade.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAKhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;EAeP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CAiD3B,CAAC"}
1
+ {"version":3,"file":"upgrade.task.d.ts","sourceRoot":"../src/lib/","sources":["upgrade.task.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,CAAC,EAAC,MAAM,KAAK,CAAC;AAEtB,OAAO,EAAa,KAAK,IAAI,EAAC,MAAM,WAAW,CAAC;AAKhD,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;EAeP,CAAC;AACX,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,IAAI,CAAC,CAAC;AAExC,eAAO,MAAM,IAAI,EAAE,IAAI,CAAC,IAAI,CA8C3B,CAAC"}
@@ -52,7 +52,7 @@ export const task = {
52
52
  }
53
53
  await spawn('npm', install_args);
54
54
  // Sync in a new process to pick up any changes after installing, avoiding some errors.
55
- await spawn_cli('gro', ['sync']);
55
+ await spawn_cli('gro', ['sync', '--no-install']); // don't install because we do above
56
56
  },
57
57
  };
58
58
  const to_deps = (package_json) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.129.15",
3
+ "version": "0.130.1",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "motto": "generate, run, optimize",
6
6
  "glyph": "🌰",
@@ -7,8 +7,8 @@ import {clean_fs} from './clean_fs.js';
7
7
  export const Args = z
8
8
  .object({
9
9
  install: z.boolean({description: 'dual of no-install'}).default(true),
10
- 'no-install': z
11
- .boolean({description: 'opt out of npm installing before building'})
10
+ 'no-install': z // convenience, same as `gro build -- gro sync --no-install` but the latter takes precedence
11
+ .boolean({description: 'opt out of `npm install` before building'})
12
12
  .default(false),
13
13
  })
14
14
  .strict();
@@ -33,10 +33,10 @@ export const Args = z
33
33
  "changeset 'access' config value, the default depends on package.json#private",
34
34
  ).optional(),
35
35
  changelog: z
36
- .string({description: 'changeset "changelog" config value'})
36
+ .string({description: 'changelog dep package name, used as changeset\'s "changelog" config'})
37
37
  .default('@changesets/changelog-git'),
38
- install: z.boolean({description: 'dual of no-install'}).default(true),
39
- 'no-install': z
38
+ dep: z.boolean({description: 'dual of no-dep'}).default(true),
39
+ 'no-dep': z
40
40
  .boolean({description: 'opt out of npm installing the changelog package'})
41
41
  .default(false),
42
42
  origin: Git_Origin.describe('git origin to deploy to').default('origin'),
@@ -60,7 +60,7 @@ export const task: Task<Args> = {
60
60
  run: async (ctx): Promise<void> => {
61
61
  const {
62
62
  invoke_task,
63
- args: {_, minor, major, dir, access: access_arg, changelog, install, origin, changeset_cli},
63
+ args: {_, minor, major, dir, access: access_arg, changelog, dep, origin, changeset_cli},
64
64
  log,
65
65
  sveltekit_config,
66
66
  } = ctx;
@@ -111,13 +111,13 @@ export const task: Task<Args> = {
111
111
 
112
112
  await spawn('git', ['add', dir]);
113
113
 
114
- if (install) {
114
+ if (dep) {
115
115
  await spawn('npm', ['i', '-D', changelog]);
116
116
  }
117
117
  }
118
118
 
119
119
  // TODO small problem here where generated files don't get committed
120
- await invoke_task('sync'); // after the `npm i` above, and in all cases
120
+ await invoke_task('sync', {install: inited || !dep}); // after the `npm i` above, and in all cases
121
121
 
122
122
  if (message) {
123
123
  // TODO see the helper below, simplify this to CLI flags when support is added to Changesets
@@ -22,6 +22,8 @@ export const Args = z
22
22
  'no-lint': z.boolean({description: 'opt out of linting'}).default(false),
23
23
  sync: z.boolean({description: 'dual of no-sync'}).default(true),
24
24
  'no-sync': z.boolean({description: 'opt out of syncing'}).default(false),
25
+ install: z.boolean({description: 'dual of no-install'}).default(true),
26
+ 'no-install': z.boolean({description: 'opt out of `npm install` when syncing'}).default(false), // convenience, same as `gro check -- gro sync --no-install` but the latter takes precedence
25
27
  workspace: z
26
28
  .boolean({description: 'ensure a clean git workspace, useful for CI, also implies --no-sync'})
27
29
  .default(false),
@@ -33,12 +35,12 @@ export const task: Task<Args> = {
33
35
  summary: 'check that everything is ready to commit',
34
36
  Args,
35
37
  run: async ({args, invoke_task, log, config}) => {
36
- const {typecheck, test, gen, format, package_json, lint, sync, workspace} = args;
38
+ const {typecheck, test, gen, format, package_json, lint, sync, install, workspace} = args;
37
39
 
38
40
  // When checking the workspace, which was added for CI, never sync.
39
41
  // Setup like `npm i` and `sveltekit-sync` should be done in the CI setup.
40
42
  if (sync && !workspace) {
41
- await invoke_task('sync', {gen: false}); // never generate because `gro gen --check` runs below
43
+ await invoke_task('sync', {install, gen: false}); // never generate because `gro gen --check` runs below
42
44
  }
43
45
 
44
46
  if (typecheck) {
@@ -15,6 +15,10 @@ export const Args = z
15
15
  .default(false),
16
16
  sync: z.boolean({description: 'dual of no-sync'}).default(true),
17
17
  'no-sync': z.boolean({description: 'opt out of gro sync'}).default(false),
18
+ install: z.boolean({description: 'dual of no-install'}).default(true),
19
+ 'no-install': z // convenience, same as `gro dev -- gro sync --no-install` but the latter takes precedence
20
+ .boolean({description: 'opt out of `npm install` before starting the dev server'})
21
+ .default(false),
18
22
  })
19
23
  .strict();
20
24
  export type Args = z.infer<typeof Args>;
@@ -26,12 +30,12 @@ export const task: Task<Args> = {
26
30
  Args,
27
31
  run: async (ctx) => {
28
32
  const {args, invoke_task} = ctx;
29
- const {watch, sync} = args;
33
+ const {watch, sync, install} = args;
30
34
 
31
35
  await clean_fs({build_dev: true});
32
36
 
33
37
  if (sync) {
34
- await invoke_task('sync');
38
+ await invoke_task('sync', {install});
35
39
  }
36
40
 
37
41
  const plugins = await Plugins.create({...ctx, dev: true, watch});
@@ -5,7 +5,7 @@ import type {Src_Json} from './src_json.js';
5
5
 
6
6
  export const package_json = {
7
7
  name: '@ryanatkn/gro',
8
- version: '0.129.15',
8
+ version: '0.130.1',
9
9
  description: 'task runner and toolkit extending SvelteKit',
10
10
  motto: 'generate, run, optimize',
11
11
  glyph: '🌰',
@@ -272,7 +272,7 @@ export const package_json = {
272
272
 
273
273
  export const src_json = {
274
274
  name: '@ryanatkn/gro',
275
- version: '0.129.15',
275
+ version: '0.130.1',
276
276
  modules: {
277
277
  '.': {
278
278
  path: 'index.ts',
@@ -114,6 +114,7 @@ export const task: Task<Args> = {
114
114
  }
115
115
 
116
116
  let version!: string;
117
+ let optional_and_version_unchanged = false;
117
118
 
118
119
  // Bump the version so the package.json is updated before building:
119
120
  // TODO problem here is build may fail and put us in a bad state,
@@ -159,17 +160,25 @@ export const task: Task<Args> = {
159
160
  // The version didn't change.
160
161
  // For now this is the best detection we have for a no-op `changeset version`.
161
162
  if (optional) {
162
- return; // exit gracefully
163
+ optional_and_version_unchanged = true;
163
164
  } else {
165
+ // Doesn't build if the version didn't change and publishing isn't optional.
164
166
  throw new Task_Error(`\`${changeset_cli} version\` failed: are there any changes?`);
165
167
  }
166
168
  }
167
169
  }
168
170
 
171
+ // Build after the version is bumped so the new version is in the build as needed.
169
172
  if (build) {
170
173
  await invoke_task('build');
171
174
  }
172
175
 
176
+ // Return early if there are no changes and publishing is optional, but after building,
177
+ // so if callers want to optimize away building
178
+ // they need to do so manually like in `gro release`.
179
+ // TODO this could be cleaned up if tasks had a return value to callers, it could specifiy that it didn't build
180
+ if (optional_and_version_unchanged) return;
181
+
173
182
  if (dry) {
174
183
  log.info('publishing branch ' + branch);
175
184
  log.info(green('dry run complete!'));
@@ -12,8 +12,9 @@ export const Args = z
12
12
  package_json: z.boolean({description: 'dual of no-package_json'}).default(true),
13
13
  'no-package_json': z.boolean({description: 'opt out of package.json sync'}).default(false),
14
14
  gen: z.boolean({description: 'dual of no-gen'}).default(true),
15
- 'no-gen': z.boolean({description: 'opt out of gen sync'}).default(false),
16
- install: z.boolean({description: 'run npm install'}).default(false),
15
+ 'no-gen': z.boolean({description: 'opt out of running gen'}).default(false),
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
18
  })
18
19
  .strict();
19
20
  export type Args = z.infer<typeof Args>;
@@ -58,20 +58,17 @@ export const task: Task<Args> = {
58
58
  log.info(`upgrading:`, upgrade_items.join(' '));
59
59
 
60
60
  const install_args = ['install'].concat(upgrade_items);
61
-
62
61
  if (dry) {
63
62
  install_args.push('--dry-run');
64
63
  log.info(`deps`, deps);
65
64
  }
66
-
67
65
  if (force) {
68
66
  install_args.push('--force');
69
67
  }
70
-
71
68
  await spawn('npm', install_args);
72
69
 
73
70
  // Sync in a new process to pick up any changes after installing, avoiding some errors.
74
- await spawn_cli('gro', ['sync']);
71
+ await spawn_cli('gro', ['sync', '--no-install']); // don't install because we do above
75
72
  },
76
73
  };
77
74