@ryanatkn/gro 0.112.5 → 0.113.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.
package/README.md CHANGED
@@ -31,6 +31,7 @@ It includes:
31
31
  and [SvelteKit](https://github.com/sveltejs/kit)
32
32
  - defers to SvelteKit and Vite for the frontend and
33
33
  [`@sveltejs/package`](https://kit.svelte.dev/docs/packaging) for the library
34
+ - exposes all of its internals in `$lib`
34
35
  - uses [Changesets](https://github.com/changesets/changesets) for versioning and changelogs
35
36
  - provides a [Node loader](/src/lib/loader.ts) and
36
37
  [esbuild plugins for the server](/src/lib/gro_plugin_server.ts)
@@ -14,12 +14,12 @@ export declare const Args: z.ZodObject<{
14
14
  changelog: z.ZodDefault<z.ZodString>;
15
15
  install: z.ZodDefault<z.ZodBoolean>;
16
16
  'no-install': z.ZodDefault<z.ZodBoolean>;
17
- origin: z.ZodDefault<z.ZodString>;
17
+ origin: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Origin">>;
18
18
  }, "strict", z.ZodTypeAny, {
19
19
  _: string[];
20
20
  dir: string;
21
21
  install: boolean;
22
- origin: string;
22
+ origin: string & z.BRAND<"Git_Origin">;
23
23
  minor: boolean;
24
24
  major: boolean;
25
25
  changelog: string;
@@ -9,6 +9,7 @@ import { exists } from './fs.js';
9
9
  import { load_package_json } from './package_json.js';
10
10
  import { find_cli, spawn_cli } from './cli.js';
11
11
  import { Git_Origin, git_push_to_create } from './git.js';
12
+ import { has_sveltekit_library } from './gro_plugin_sveltekit_library.js';
12
13
  const RESTRICTED_ACCESS = 'restricted';
13
14
  const PUBLIC_ACCESS = 'public';
14
15
  const CHANGESET_DIR = '.changeset';
@@ -60,9 +61,12 @@ export const task = {
60
61
  if (!(await find_cli('changeset'))) {
61
62
  throw new Task_Error('changeset command not found: install @changesets/cli locally or globally');
62
63
  }
64
+ const package_json = await load_package_json();
65
+ if (!(await has_sveltekit_library(package_json))) {
66
+ throw new Task_Error('no SvelteKit library detected');
67
+ }
63
68
  const path = join(dir, 'config.json');
64
69
  const inited = await exists(path);
65
- const package_json = await load_package_json();
66
70
  if (!inited) {
67
71
  await spawn_cli('changeset', ['init']);
68
72
  const access = access_arg ?? package_json.private ? RESTRICTED_ACCESS : PUBLIC_ACCESS;
@@ -6,14 +6,14 @@ export declare const Args: z.ZodObject<{
6
6
  sveltekit: z.ZodDefault<z.ZodBoolean>;
7
7
  nodemodules: z.ZodDefault<z.ZodBoolean>;
8
8
  git: z.ZodDefault<z.ZodBoolean>;
9
- git_origin: z.ZodDefault<z.ZodString>;
9
+ git_origin: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Origin">>;
10
10
  }, "strict", z.ZodTypeAny, {
11
11
  build_dev: boolean;
12
12
  build_dist: boolean;
13
13
  sveltekit: boolean;
14
14
  nodemodules: boolean;
15
15
  git: boolean;
16
- git_origin: string;
16
+ git_origin: string & z.BRAND<"Git_Origin">;
17
17
  }, {
18
18
  build_dev?: boolean | undefined;
19
19
  build_dist?: boolean | undefined;
@@ -1,6 +1,7 @@
1
1
  import { spawn } from '@ryanatkn/belt/process.js';
2
2
  import { z } from 'zod';
3
3
  import { clean_fs } from './clean_fs.js';
4
+ import { Git_Origin } from './git.js';
4
5
  export const Args = z
5
6
  .object({
6
7
  build_dev: z.boolean({ description: 'delete the Gro build dev directory' }).default(false),
@@ -14,11 +15,7 @@ export const Args = z
14
15
  description: 'run "git remote prune" to delete local branches referencing nonexistent remote branches',
15
16
  })
16
17
  .default(false),
17
- git_origin: z
18
- .string({
19
- description: 'the origin to "git remote prune"',
20
- })
21
- .default('origin'),
18
+ git_origin: Git_Origin.describe('the origin to "git remote prune"').default('origin'),
22
19
  })
23
20
  .strict();
24
21
  export const task = {
@@ -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
+ origin: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Origin">>;
5
6
  }, "strict", z.ZodTypeAny, {
6
7
  _: string[];
8
+ origin: string & z.BRAND<"Git_Origin">;
7
9
  }, {
8
10
  _?: string[] | undefined;
11
+ origin?: string | undefined;
9
12
  }>;
10
13
  export type Args = z.infer<typeof Args>;
11
14
  export declare const task: Task<Args>;
@@ -1,6 +1,6 @@
1
1
  import { spawn } from '@ryanatkn/belt/process.js';
2
2
  import { z } from 'zod';
3
- import { git_current_branch_name } from './git.js';
3
+ import { Git_Origin, git_current_branch_name, git_push } from './git.js';
4
4
  export const Args = z
5
5
  .object({
6
6
  _: z
@@ -8,15 +8,16 @@ export const Args = z
8
8
  description: 'the git commit message, the same as git commit -m or --message',
9
9
  })
10
10
  .default([]),
11
+ origin: Git_Origin.describe('git origin to commit to').default('origin'),
11
12
  })
12
13
  .strict();
13
14
  export const task = {
14
15
  summary: 'commit and push to a new branch',
15
16
  Args,
16
17
  run: async ({ args }) => {
17
- const { _: [message], } = args;
18
+ const { _: [message], origin, } = args;
18
19
  const branch = await git_current_branch_name();
19
20
  await spawn('git', ['commit', '-a', '-m', message]);
20
- await spawn(`git push -u origin ${branch}`, [], { shell: true });
21
+ await git_push(origin, branch, undefined, true);
21
22
  },
22
23
  };
@@ -1,9 +1,9 @@
1
1
  import { z } from 'zod';
2
2
  import { type Task } from './task.js';
3
3
  export declare const Args: z.ZodObject<{
4
- source: z.ZodDefault<z.ZodString>;
5
- target: z.ZodDefault<z.ZodString>;
6
- origin: z.ZodDefault<z.ZodString>;
4
+ source: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Branch">>;
5
+ target: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Branch">>;
6
+ origin: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Origin">>;
7
7
  deploy_dir: z.ZodDefault<z.ZodString>;
8
8
  build_dir: z.ZodDefault<z.ZodString>;
9
9
  dry: z.ZodDefault<z.ZodBoolean>;
@@ -16,12 +16,12 @@ export declare const Args: z.ZodObject<{
16
16
  'no-build': z.ZodDefault<z.ZodBoolean>;
17
17
  }, "strict", z.ZodTypeAny, {
18
18
  build: boolean;
19
- target: string;
19
+ target: string & z.BRAND<"Git_Branch">;
20
20
  install: boolean;
21
- origin: string;
21
+ origin: string & z.BRAND<"Git_Origin">;
22
22
  reset: boolean;
23
23
  'no-install': boolean;
24
- source: string;
24
+ source: string & z.BRAND<"Git_Branch">;
25
25
  deploy_dir: string;
26
26
  build_dir: string;
27
27
  dry: boolean;
@@ -120,7 +120,7 @@ export const task = {
120
120
  // It may not exist, or it may have been deleted after failing to sync above.
121
121
  if (!(await exists(resolved_deploy_dir))) {
122
122
  const local_deploy_branch_exists = await git_local_branch_exists(target);
123
- await git_fetch(origin, '+' + target + ':' + target); // fetch+merge and allow non-fastforward updates with the +
123
+ await git_fetch(origin, ('+' + target + ':' + target)); // fetch+merge and allow non-fastforward updates with the +
124
124
  await git_clone_locally(origin, target, cwd, resolved_deploy_dir);
125
125
  // Clean up if we created the target branch in the cwd
126
126
  if (!local_deploy_branch_exists) {
package/dist/git.d.ts CHANGED
@@ -1,23 +1,22 @@
1
1
  /// <reference types="node" />
2
- import type { Flavored } from '@ryanatkn/belt/types.js';
3
2
  import type { SpawnOptions } from 'child_process';
4
3
  import { z } from 'zod';
5
- export declare const Git_Origin: z.ZodString;
6
- export type Git_Origin = Flavored<z.infer<typeof Git_Origin>, 'Git_Origin'>;
7
- export declare const Git_Branch: z.ZodString;
8
- export type Git_Branch = Flavored<z.infer<typeof Git_Branch>, 'Git_Branch'>;
4
+ export declare const Git_Origin: z.ZodBranded<z.ZodString, "Git_Origin">;
5
+ export type Git_Origin = z.infer<typeof Git_Origin>;
6
+ export declare const Git_Branch: z.ZodBranded<z.ZodString, "Git_Branch">;
7
+ export type Git_Branch = z.infer<typeof Git_Branch>;
9
8
  /**
10
9
  * Returns the current git branch name or throws if something goes wrong.
11
10
  */
12
- export declare const git_current_branch_name: (options?: SpawnOptions) => Promise<string>;
11
+ export declare const git_current_branch_name: (options?: SpawnOptions) => Promise<Git_Branch>;
13
12
  /**
14
13
  * @returns a boolean indicating if the remote git branch exists
15
14
  */
16
- export declare const git_remote_branch_exists: (origin?: Flavored<string, "Git_Origin">, branch?: any, options?: SpawnOptions) => Promise<boolean>;
15
+ export declare const git_remote_branch_exists: (origin?: Git_Origin, branch?: Git_Branch, options?: SpawnOptions) => Promise<boolean>;
17
16
  /**
18
17
  * @returns a boolean indicating if the local git branch exists
19
18
  */
20
- export declare const git_local_branch_exists: (branch: Flavored<string, "Git_Branch">, options?: SpawnOptions) => Promise<boolean>;
19
+ export declare const git_local_branch_exists: (branch: Git_Branch, options?: SpawnOptions) => Promise<boolean>;
21
20
  /**
22
21
  * TODO make this return an enum and separate the text into a different function
23
22
  * @returns an error message if the git workspace has any unstaged or uncommitted changes, or `null` if it's clean
@@ -26,36 +25,36 @@ export declare const git_check_clean_workspace: (options?: SpawnOptions) => Prom
26
25
  /**
27
26
  * Calls `git fetch` and throws if anything goes wrong.
28
27
  */
29
- export declare const git_fetch: (origin?: Flavored<string, "Git_Origin">, branch?: any, options?: SpawnOptions) => Promise<void>;
28
+ export declare const git_fetch: (origin?: Git_Origin, branch?: Git_Branch, options?: SpawnOptions) => Promise<void>;
30
29
  /**
31
30
  * Calls `git checkout` and throws if anything goes wrong.
32
31
  * @returns the previous branch name, if it changed
33
32
  */
34
- export declare const git_checkout: (branch: Flavored<string, "Git_Branch">, options?: SpawnOptions) => Promise<Git_Branch | null>;
33
+ export declare const git_checkout: (branch: Git_Branch, options?: SpawnOptions) => Promise<Git_Branch | null>;
35
34
  /**
36
35
  * Calls `git pull` and throws if anything goes wrong.
37
36
  */
38
- export declare const git_pull: (origin?: Flavored<string, "Git_Origin">, branch?: any, options?: SpawnOptions) => Promise<void>;
37
+ export declare const git_pull: (origin?: Git_Origin, branch?: Git_Branch, options?: SpawnOptions) => Promise<void>;
39
38
  /**
40
39
  * Calls `git push` and throws if anything goes wrong.
41
40
  */
42
- export declare const git_push: (origin: Flavored<string, "Git_Origin">, branch: Flavored<string, "Git_Branch">, options?: SpawnOptions) => Promise<void>;
41
+ export declare const git_push: (origin: Git_Origin, branch: Git_Branch, options?: SpawnOptions, set_upstream?: boolean) => Promise<void>;
43
42
  /**
44
43
  * Calls `git push` and throws if anything goes wrong.
45
44
  */
46
- export declare const git_push_to_create: (origin?: Flavored<string, "Git_Origin">, branch?: any, options?: SpawnOptions) => Promise<void>;
45
+ export declare const git_push_to_create: (origin?: Git_Origin, branch?: Git_Branch, options?: SpawnOptions) => Promise<void>;
47
46
  /**
48
47
  * Deletes a branch locally and throws if anything goes wrong.
49
48
  */
50
- export declare const git_delete_local_branch: (branch: Flavored<string, "Git_Branch">, options?: SpawnOptions) => Promise<void>;
49
+ export declare const git_delete_local_branch: (branch: Git_Branch, options?: SpawnOptions) => Promise<void>;
51
50
  /**
52
51
  * Deletes a branch remotely and throws if anything goes wrong.
53
52
  */
54
- export declare const git_delete_remote_branch: (origin: Flavored<string, "Git_Origin">, branch: Flavored<string, "Git_Branch">, options?: SpawnOptions) => Promise<void>;
53
+ export declare const git_delete_remote_branch: (origin: Git_Origin, branch: Git_Branch, options?: SpawnOptions) => Promise<void>;
55
54
  /**
56
55
  * Resets the `target` branch back to its first commit both locally and remotely.
57
56
  */
58
- export declare const git_reset_branch_to_first_commit: (origin: Flavored<string, "Git_Origin">, branch: Flavored<string, "Git_Branch">, options?: SpawnOptions) => Promise<void>;
57
+ export declare const git_reset_branch_to_first_commit: (origin: Git_Origin, branch: Git_Branch, options?: SpawnOptions) => Promise<void>;
59
58
  /**
60
59
  * Returns the branch's latest commit hash or throws if something goes wrong.
61
60
  */
@@ -73,4 +72,4 @@ export declare const git_check_setting_pull_rebase: (options?: SpawnOptions) =>
73
72
  /**
74
73
  * Clones a branch locally to another directory and updates the origin to match the source.
75
74
  */
76
- export declare const git_clone_locally: (origin: Flavored<string, "Git_Origin">, branch: Flavored<string, "Git_Branch">, source_dir: string, target_dir: string, options?: SpawnOptions) => Promise<void>;
75
+ export declare const git_clone_locally: (origin: Git_Origin, branch: Git_Branch, source_dir: string, target_dir: string, options?: SpawnOptions) => Promise<void>;
package/dist/git.js CHANGED
@@ -3,8 +3,8 @@ import { z } from 'zod';
3
3
  import { exists } from './fs.js';
4
4
  import { to_file_path } from './path.js';
5
5
  // TODO maybe extract to `util-git`
6
- export const Git_Origin = z.string();
7
- export const Git_Branch = z.string();
6
+ export const Git_Origin = z.string().brand('Git_Origin');
7
+ export const Git_Branch = z.string().brand('Git_Branch');
8
8
  /**
9
9
  * Returns the current git branch name or throws if something goes wrong.
10
10
  */
@@ -105,9 +105,12 @@ export const git_pull = async (origin = 'origin', branch, options) => {
105
105
  /**
106
106
  * Calls `git push` and throws if anything goes wrong.
107
107
  */
108
- export const git_push = async (origin, branch, options) => {
108
+ export const git_push = async (origin, branch, options, set_upstream = false) => {
109
109
  const final_branch = branch ?? (await git_current_branch_name(options));
110
- const result = await spawn('git', ['push', origin, final_branch], options);
110
+ const args = ['push', origin, final_branch];
111
+ if (set_upstream)
112
+ args.push('-u');
113
+ const result = await spawn('git', args, options);
111
114
  if (!result.ok) {
112
115
  throw Error(`git_push failed for branch '${final_branch}' with code ${result.code}`);
113
116
  }
package/dist/package.d.ts CHANGED
@@ -18,10 +18,8 @@ export declare const package_json: {
18
18
  type: string;
19
19
  url: string;
20
20
  };
21
- bugs: {
22
- url: string;
23
- email: string;
24
- };
21
+ bugs: string;
22
+ funding: string;
25
23
  type: string;
26
24
  engines: {
27
25
  node: string;
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.112.5',
4
+ version: '0.113.1',
5
5
  description: 'task runner and toolkit extending SvelteKit',
6
6
  icon: '🌰',
7
7
  public: true,
@@ -10,7 +10,8 @@ export const package_json = {
10
10
  homepage: 'https://gro.ryanatkn.com/',
11
11
  author: { name: 'Ryan Atkinson', email: 'mail@ryanatkn.com', url: 'https://www.ryanatkn.com/' },
12
12
  repository: { type: 'git', url: 'git+https://github.com/ryanatkn/gro.git' },
13
- bugs: { url: 'https://github.com/ryanatkn/gro/issues', email: 'mail@ryanatkn.com' },
13
+ bugs: 'https://github.com/ryanatkn/gro/issues',
14
+ funding: 'https://www.ryanatkn.com/funding',
14
15
  type: 'module',
15
16
  engines: { node: '>=20.10' },
16
17
  scripts: {
@@ -31,10 +32,10 @@ export const package_json = {
31
32
  ],
32
33
  files: ['dist'],
33
34
  dependencies: {
34
- '@ryanatkn/belt': '^0.20.8',
35
+ '@ryanatkn/belt': '^0.20.10',
35
36
  chokidar: '^3.6.0',
36
37
  dotenv: '^16.4.5',
37
- 'es-module-lexer': '^1.4.2',
38
+ 'es-module-lexer': '^1.5.0',
38
39
  kleur: '^4.1.5',
39
40
  mri: '^1.2.0',
40
41
  prettier: '^3.2.5',
@@ -49,21 +50,21 @@ export const package_json = {
49
50
  '@changesets/changelog-git': '^0.2.0',
50
51
  '@changesets/types': '^6.0.0',
51
52
  '@ryanatkn/eslint-config': '^0.1.0',
52
- '@ryanatkn/fuz': '^0.91.3',
53
+ '@ryanatkn/fuz': '^0.92.0',
53
54
  '@sveltejs/adapter-static': '^3.0.1',
54
55
  '@sveltejs/kit': '^2.5.4',
55
56
  '@sveltejs/package': '^2.3.0',
56
57
  '@sveltejs/vite-plugin-svelte': '^3.0.2',
57
58
  '@types/fs-extra': '^11.0.4',
58
59
  '@types/node': '^20.11.30',
59
- '@typescript-eslint/eslint-plugin': '^7.3.1',
60
- '@typescript-eslint/parser': '^7.3.1',
60
+ '@typescript-eslint/eslint-plugin': '^7.4.0',
61
+ '@typescript-eslint/parser': '^7.4.0',
61
62
  esbuild: '^0.19.0',
62
63
  eslint: '^8.57.0',
63
64
  'eslint-plugin-svelte': '^2.35.1',
64
65
  svelte: '^4.2.12',
65
66
  'svelte-check': '^3.6.8',
66
- typescript: '^5.4.2',
67
+ typescript: '^5.4.3',
67
68
  uvu: '^0.5.6',
68
69
  },
69
70
  eslintConfig: { root: true, extends: '@ryanatkn', rules: { 'no-console': 1 } },
@@ -233,7 +234,7 @@ export const package_json = {
233
234
  };
234
235
  export const src_json = {
235
236
  name: '@ryanatkn/gro',
236
- version: '0.112.5',
237
+ version: '0.113.1',
237
238
  modules: {
238
239
  '.': {
239
240
  path: 'index.ts',
@@ -611,7 +612,6 @@ export const src_json = {
611
612
  { name: 'Package_Meta', kind: 'type' },
612
613
  { name: 'parse_package_meta', kind: 'function' },
613
614
  { name: 'parse_repo_name', kind: 'function' },
614
- { name: 'format_host', kind: 'function' },
615
615
  { name: 'parse_org_url', kind: 'function' },
616
616
  ],
617
617
  },
@@ -19,5 +19,4 @@ export interface Package_Meta {
19
19
  }
20
20
  export declare const parse_package_meta: (url: Flavored<string, "Url">, package_json: Package_Json, src_json: Src_Json) => Package_Meta;
21
21
  export declare const parse_repo_name: (name: string) => string;
22
- export declare const format_host: (url: string) => string;
23
22
  export declare const parse_org_url: (pkg: Package_Meta) => string | null;
@@ -35,7 +35,6 @@ export const parse_package_meta = (url, package_json, src_json) => {
35
35
  };
36
36
  // TODO proper parsing
37
37
  export const parse_repo_name = (name) => name[0] === '@' ? name.split('/')[1] : name;
38
- export const format_host = (url) => strip_start(new URL(url).host, 'www.');
39
38
  export const parse_org_url = (pkg) => {
40
39
  const { repo_name, repo_url } = pkg;
41
40
  if (!repo_url)
@@ -1,7 +1,8 @@
1
1
  import { z } from 'zod';
2
2
  import { type Task } from './task.js';
3
3
  export declare const Args: z.ZodObject<{
4
- branch: z.ZodDefault<z.ZodString>;
4
+ branch: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Branch">>;
5
+ origin: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Origin">>;
5
6
  changelog: z.ZodDefault<z.ZodString>;
6
7
  preserve_changelog: z.ZodDefault<z.ZodBoolean>;
7
8
  dry: z.ZodDefault<z.ZodBoolean>;
@@ -11,7 +12,8 @@ export declare const Args: z.ZodObject<{
11
12
  'no-install': z.ZodDefault<z.ZodBoolean>;
12
13
  }, "strict", z.ZodTypeAny, {
13
14
  install: boolean;
14
- branch: string;
15
+ origin: string & z.BRAND<"Git_Origin">;
16
+ branch: string & z.BRAND<"Git_Branch">;
15
17
  changelog: string;
16
18
  'no-install': boolean;
17
19
  check: boolean;
@@ -20,6 +22,7 @@ export declare const Args: z.ZodObject<{
20
22
  'no-check': boolean;
21
23
  }, {
22
24
  branch?: string | undefined;
25
+ origin?: string | undefined;
23
26
  changelog?: string | undefined;
24
27
  preserve_changelog?: boolean | undefined;
25
28
  dry?: boolean | undefined;
@@ -9,6 +9,7 @@ import { is_this_project_gro } from './paths.js';
9
9
  import { has_sveltekit_library } from './gro_plugin_sveltekit_library.js';
10
10
  import { update_changelog } from './changelog.js';
11
11
  import { load_from_env } from './env.js';
12
+ import { Git_Branch, Git_Origin, git_checkout, git_fetch, git_pull } from './git.js';
12
13
  // publish.task.ts
13
14
  // - usage: `gro publish patch`
14
15
  // - forwards args to `npm version`: https://docs.npmjs.com/v6/commands/npm-version
@@ -17,7 +18,8 @@ import { load_from_env } from './env.js';
17
18
  // - syncs commits and tags to the configured main branch
18
19
  export const Args = z
19
20
  .object({
20
- branch: z.string({ description: 'branch to publish from' }).default('main'),
21
+ branch: Git_Branch.describe('branch to publish from').default('main'),
22
+ origin: Git_Origin.describe('git origin to publish from').default('origin'),
21
23
  changelog: z
22
24
  .string({ description: 'file name and path of the changelog' })
23
25
  .default('CHANGELOG.md'),
@@ -43,7 +45,7 @@ export const task = {
43
45
  summary: 'bump version, publish to npm, and git push',
44
46
  Args,
45
47
  run: async ({ args, log, invoke_task }) => {
46
- const { branch, changelog, preserve_changelog, dry, check, install } = args;
48
+ const { branch, changelog, preserve_changelog, dry, check, install, origin } = args;
47
49
  if (dry) {
48
50
  log.info(green('dry run!'));
49
51
  }
@@ -59,9 +61,9 @@ export const task = {
59
61
  throw new Task_Error('changeset command not found: install @changesets/cli locally or globally');
60
62
  }
61
63
  // Make sure we're on the right branch:
62
- await spawn('git', ['fetch', 'origin', branch]);
63
- await spawn('git', ['checkout', branch]);
64
- await spawn('git', ['pull', 'origin', branch]);
64
+ await git_fetch(origin, branch);
65
+ await git_checkout(branch);
66
+ await git_pull(origin, branch);
65
67
  // Check before proceeding.
66
68
  if (check) {
67
69
  await invoke_task('check', { workspace: true });
@@ -2,12 +2,18 @@ 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
+ origin: z.ZodDefault<z.ZodBranded<z.ZodString, "Git_Origin">>;
6
+ force: z.ZodDefault<z.ZodBoolean>;
5
7
  dry: z.ZodDefault<z.ZodBoolean>;
6
8
  }, "strict", z.ZodTypeAny, {
7
9
  _: string[];
10
+ origin: string & z.BRAND<"Git_Origin">;
8
11
  dry: boolean;
12
+ force: boolean;
9
13
  }, {
10
14
  _?: string[] | undefined;
15
+ origin?: string | undefined;
16
+ force?: boolean | undefined;
11
17
  dry?: boolean | undefined;
12
18
  }>;
13
19
  export type Args = z.infer<typeof Args>;
@@ -1,9 +1,12 @@
1
1
  import { spawn } from '@ryanatkn/belt/process.js';
2
2
  import { z } from 'zod';
3
3
  import { load_package_json } from './package_json.js';
4
+ import { Git_Origin, git_pull } from './git.js';
4
5
  export const Args = z
5
6
  .object({
6
7
  _: z.array(z.string(), { description: 'names of deps to exclude from the upgrade' }).default([]),
8
+ origin: Git_Origin.describe('git origin to deploy to').default('origin'),
9
+ force: z.boolean({ description: 'if true, print out the planned upgrades' }).default(false),
7
10
  dry: z.boolean({ description: 'if true, print out the planned upgrades' }).default(false),
8
11
  })
9
12
  .strict();
@@ -11,17 +14,22 @@ export const task = {
11
14
  summary: 'upgrade deps',
12
15
  Args,
13
16
  run: async ({ args, log, invoke_task }) => {
14
- const { _, dry } = args;
17
+ const { _, origin, force, dry } = args;
18
+ // TODO maybe a different task that pulls and does other things, like `gro ready`
19
+ await git_pull(origin);
15
20
  const package_json = await load_package_json();
16
21
  const deps = to_deps(package_json).filter((d) => !_.includes(d.key));
17
22
  const upgrade_items = to_upgrade_items(deps);
23
+ log.info(`upgrading:`, upgrade_items.join(' '));
24
+ const install_args = ['install'].concat(upgrade_items);
18
25
  if (dry) {
26
+ install_args.push('--dry-run');
19
27
  log.info(`deps`, deps);
20
- log.info(`upgrade_items`, upgrade_items);
21
- return;
22
28
  }
23
- log.info(`upgrading:`, upgrade_items.join(' '));
24
- await spawn('npm', ['i'].concat(upgrade_items));
29
+ if (force) {
30
+ install_args.push('--force');
31
+ }
32
+ await spawn('npm', install_args);
25
33
  await invoke_task('sync');
26
34
  },
27
35
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ryanatkn/gro",
3
- "version": "0.112.5",
3
+ "version": "0.113.1",
4
4
  "description": "task runner and toolkit extending SvelteKit",
5
5
  "icon": "🌰",
6
6
  "public": true,
@@ -18,10 +18,8 @@
18
18
  "type": "git",
19
19
  "url": "git+https://github.com/ryanatkn/gro.git"
20
20
  },
21
- "bugs": {
22
- "url": "https://github.com/ryanatkn/gro/issues",
23
- "email": "mail@ryanatkn.com"
24
- },
21
+ "bugs": "https://github.com/ryanatkn/gro/issues",
22
+ "funding": "https://www.ryanatkn.com/funding",
25
23
  "type": "module",
26
24
  "engines": {
27
25
  "node": ">=20.10"
@@ -46,10 +44,10 @@
46
44
  "dist"
47
45
  ],
48
46
  "dependencies": {
49
- "@ryanatkn/belt": "^0.20.8",
47
+ "@ryanatkn/belt": "^0.20.10",
50
48
  "chokidar": "^3.6.0",
51
49
  "dotenv": "^16.4.5",
52
- "es-module-lexer": "^1.4.2",
50
+ "es-module-lexer": "^1.5.0",
53
51
  "kleur": "^4.1.5",
54
52
  "mri": "^1.2.0",
55
53
  "prettier": "^3.2.5",
@@ -67,21 +65,21 @@
67
65
  "@changesets/changelog-git": "^0.2.0",
68
66
  "@changesets/types": "^6.0.0",
69
67
  "@ryanatkn/eslint-config": "^0.1.0",
70
- "@ryanatkn/fuz": "^0.91.3",
68
+ "@ryanatkn/fuz": "^0.92.0",
71
69
  "@sveltejs/adapter-static": "^3.0.1",
72
70
  "@sveltejs/kit": "^2.5.4",
73
71
  "@sveltejs/package": "^2.3.0",
74
72
  "@sveltejs/vite-plugin-svelte": "^3.0.2",
75
73
  "@types/fs-extra": "^11.0.4",
76
74
  "@types/node": "^20.11.30",
77
- "@typescript-eslint/eslint-plugin": "^7.3.1",
78
- "@typescript-eslint/parser": "^7.3.1",
75
+ "@typescript-eslint/eslint-plugin": "^7.4.0",
76
+ "@typescript-eslint/parser": "^7.4.0",
79
77
  "esbuild": "^0.19.0",
80
78
  "eslint": "^8.57.0",
81
79
  "eslint-plugin-svelte": "^2.35.1",
82
80
  "svelte": "^4.2.12",
83
81
  "svelte-check": "^3.6.8",
84
- "typescript": "^5.4.2",
82
+ "typescript": "^5.4.3",
85
83
  "uvu": "^0.5.6"
86
84
  },
87
85
  "eslintConfig": {