Skip to content

Commit 5398f74

Browse files
committed
feat: rework some interfaces and upgrade fuz_util
1 parent c2d357f commit 5398f74

18 files changed

Lines changed: 119 additions & 97 deletions

.changeset/sunny-olives-attack.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@fuzdev/fuz_gitops': minor
3+
---
4+
5+
feat: rework some interfaces and upgrade fuz_util

package-lock.json

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"peerDependencies": {
3232
"@fuzdev/fuz_css": ">=0.56.0",
3333
"@fuzdev/fuz_ui": ">=0.190.0",
34-
"@fuzdev/fuz_util": ">=0.54.0",
34+
"@fuzdev/fuz_util": ">=0.57.0",
3535
"@fuzdev/gro": ">=0.197.0",
3636
"@sveltejs/kit": "^2",
3737
"svelte": "^5",
@@ -42,8 +42,8 @@
4242
"@fuzdev/fuz_code": "^0.45.1",
4343
"@fuzdev/fuz_css": "^0.58.0",
4444
"@fuzdev/fuz_ui": "^0.191.4",
45-
"@fuzdev/fuz_util": "^0.56.0",
46-
"@fuzdev/gro": "^0.197.3",
45+
"@fuzdev/fuz_util": "^0.57.0",
46+
"@fuzdev/gro": "^0.198.0",
4747
"@jridgewell/trace-mapping": "^0.3.31",
4848
"@ryanatkn/eslint-config": "^0.11.0",
4949
"@sveltejs/acorn-typescript": "^1.0.9",

src/lib/changeset_reader.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export const read_changesets = async (
118118

119119
for (const file of changeset_files) {
120120
const filepath = join(changesets_dir, file);
121-
const changeset = await parse_changeset_file(filepath, log);
121+
const changeset = await parse_changeset_file(filepath, log);
122122
if (changeset) {
123123
changesets.push(changeset);
124124
}

src/lib/dependency_updater.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export const update_all_repos = async (
226226
if (updates.size === 0) continue;
227227

228228
try {
229-
await update_package_json(repo, updates, {strategy, log, git_ops, fs_ops});
229+
await update_package_json(repo, updates, {strategy, log, git_ops, fs_ops});
230230
updated_count++;
231231
log?.info(` Updated ${updates.size} dependencies in ${repo.library.name}`);
232232
} catch (error) {

src/lib/fetch_repo_data.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import {fetch_github_check_runs, fetch_github_pull_requests} from './github.js';
66
import type {RepoJson} from './repo.svelte.js';
77
import type {LocalRepo} from './local_repo.js';
88

9-
10-
119
/**
1210
* Fetches GitHub metadata (CI status, PRs) for all repos.
1311
*

src/lib/git_operations.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {spawn_out} from '@fuzdev/fuz_util/process.js';
1+
import {spawn_out, spawn_result_to_message} from '@fuzdev/fuz_util/process.js';
22
import type {SpawnOptions} from 'node:child_process';
33
import {
44
git_check_clean_workspace as gro_git_check_clean_workspace,
@@ -20,7 +20,9 @@ export const git_add = async (
2020
const file_list = Array.isArray(files) ? files : [files];
2121
const {result, stderr} = await spawn_out('git', ['add', ...file_list], options);
2222
if (!result.ok) {
23-
throw Error(`git_add failed with code ${result.code}${stderr ? ': ' + stderr.trim() : ''}`);
23+
throw Error(
24+
`git_add failed with ${spawn_result_to_message(result)}${stderr ? ': ' + stderr.trim() : ''}`,
25+
);
2426
}
2527
};
2628

@@ -30,7 +32,9 @@ export const git_add = async (
3032
export const git_commit = async (message: string, options?: SpawnOptions): Promise<void> => {
3133
const {result, stderr} = await spawn_out('git', ['commit', '-m', message], options);
3234
if (!result.ok) {
33-
throw Error(`git_commit failed with code ${result.code}${stderr ? ': ' + stderr.trim() : ''}`);
35+
throw Error(
36+
`git_commit failed with ${spawn_result_to_message(result)}${stderr ? ': ' + stderr.trim() : ''}`,
37+
);
3438
}
3539
};
3640

@@ -59,7 +63,7 @@ export const git_tag = async (
5963
const {result, stderr} = await spawn_out('git', args, options);
6064
if (!result.ok) {
6165
throw Error(
62-
`git_tag failed for tag '${tag_name}' with code ${result.code}${stderr ? ': ' + stderr.trim() : ''}`,
66+
`git_tag failed for tag '${tag_name}' with ${spawn_result_to_message(result)}${stderr ? ': ' + stderr.trim() : ''}`,
6367
);
6468
}
6569
};
@@ -75,7 +79,7 @@ export const git_push_tag = async (
7579
const {result, stderr} = await spawn_out('git', ['push', origin, tag_name], options);
7680
if (!result.ok) {
7781
throw Error(
78-
`git_push_tag failed for tag '${tag_name}' with code ${result.code}${stderr ? ': ' + stderr.trim() : ''}`,
82+
`git_push_tag failed for tag '${tag_name}' with ${spawn_result_to_message(result)}${stderr ? ': ' + stderr.trim() : ''}`,
7983
);
8084
}
8185
};
@@ -122,7 +126,9 @@ export const git_stash = async (message?: string, options?: SpawnOptions): Promi
122126

123127
const {result, stderr} = await spawn_out('git', args, options);
124128
if (!result.ok) {
125-
throw Error(`git_stash failed with code ${result.code}${stderr ? ': ' + stderr.trim() : ''}`);
129+
throw Error(
130+
`git_stash failed with ${spawn_result_to_message(result)}${stderr ? ': ' + stderr.trim() : ''}`,
131+
);
126132
}
127133
};
128134

@@ -133,7 +139,7 @@ export const git_stash_pop = async (options?: SpawnOptions): Promise<void> => {
133139
const {result, stderr} = await spawn_out('git', ['stash', 'pop'], options);
134140
if (!result.ok) {
135141
throw Error(
136-
`git_stash_pop failed with code ${result.code}${stderr ? ': ' + stderr.trim() : ''}`,
142+
`git_stash_pop failed with ${spawn_result_to_message(result)}${stderr ? ': ' + stderr.trim() : ''}`,
137143
);
138144
}
139145
};

src/lib/gitops_run.task.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export const task: Task<Args> = {
7575
repo_name,
7676
repo_dir,
7777
status: success ? 'success' : 'failure',
78-
exit_code: spawned.result.code ?? 0,
78+
exit_code: spawned.result.kind === 'exited' ? spawned.result.code : 0,
7979
stdout: spawned.stdout || '',
8080
stderr: spawned.stderr || '',
8181
duration_ms,

src/lib/local_repo.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ export const local_repos_load = async ({
296296
// Sequential loading (original behavior)
297297
const loaded: Array<LocalRepo> = [];
298298
for (const local_repo_path of local_repo_paths) {
299-
loaded.push(await local_repo_load({local_repo_path, log, git_ops, npm_ops}));
299+
loaded.push(await local_repo_load({local_repo_path, log, git_ops, npm_ops}));
300300
}
301301
return loaded;
302302
}
@@ -383,7 +383,7 @@ const download_repos = async ({
383383
const resolved: Array<LocalRepoPath> = [];
384384
for (const {repo_config, repo_git_ssh_url} of local_repos_missing) {
385385
log?.info(`cloning repo ${repo_git_ssh_url} to ${repos_dir}`);
386-
const clone_result = await spawn_out('git', ['clone', repo_git_ssh_url], {cwd: repos_dir});
386+
const clone_result = await spawn_out('git', ['clone', repo_git_ssh_url], {cwd: repos_dir});
387387
if (!clone_result.result.ok) {
388388
throw new TaskError(
389389
`Failed to clone repo ${repo_git_ssh_url} to ${repos_dir}${clone_result.stderr ? ': ' + clone_result.stderr.trim() : ''}`,
@@ -397,7 +397,7 @@ const download_repos = async ({
397397
}
398398
// Always install dependencies after cloning
399399
log?.info(`installing dependencies for newly cloned repo ${local_repo.repo_dir}`);
400-
const install_result = await npm_ops.install({cwd: local_repo.repo_dir});
400+
const install_result = await npm_ops.install({cwd: local_repo.repo_dir});
401401
if (!install_result.ok) {
402402
throw new TaskError(
403403
`Failed to install dependencies in ${local_repo.repo_dir}: ${install_result.message}${install_result.stderr ? `\n${install_result.stderr}` : ''}`,

src/lib/multi_repo_publisher.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ import {
1616
} from './gitops_constants.js';
1717
import {install_with_cache_healing} from './npm_install_helpers.js';
1818

19-
20-
2119
export interface PublishingOptions {
2220
wetrun: boolean;
2321
update_deps: boolean;

0 commit comments

Comments
 (0)