Skip to content

Commit f930b6d

Browse files
Remove unused files (#1444)
* feat: add fallow dev-dependency and script * feat: add fallow CI gate workflow * docs: document fallow CI gate and cleanup * fix(review): harden fallow workflow base ref and concurrency * chore: add fallow config and ignore cache dir * feat: report fallow health score in CI * refactor(plugin-https): extract server logging helpers * test(plugin-https): parameterize server URL assertions * chore(plugin-https): drop dead dep, ignore metadata false-positive * docs(plugin-https): note portSuffix number-branch is shared-formatter * test(plugin-https): cover utils and configure branches to 100% * refactor(plugin-https): clear lint warnings (statements, Function type) * fix(typescript-tests): use IncomingMessage for createServers handler * fix(vitest): add coverage thresholds for statements, branches, functions, and lines * chore(fallow): update ignorePatterns in .fallowrc.json and enhance handling of false positives in CONTRIBUTING.md * feat: comment fallow health score on PRs (sticky) * feat: richer fallow health PR comment with penalty breakdown * chore(fallow): ignore verified false-positive deps * chore: remove unused dependencies * chore(fallow): ignore site workspace * chore(fallow): ignore cross-workspace false-positive deps * chore(fallow): analyze docs-index via dynamicallyLoaded * docs: dynamicallyLoaded rationale for docs-index * ci: use fallow-rs/fallow@v2 action * ci: post fallow health comment with distinct id * ci: report fallow health repo-wide with hotspots and targets * ci: restore hand-rolled health comment, action for gate * ci: trim fallow workflow comments to why-only * ci: enhance type definitions and improve error handling in server actions * fix(plugin-https): type startServer via public ActionHandler * fix(plugin-https): type terminus opts concretely * fix(plugin-https): move utils types to internal.d.ts * test(plugin-https): assert preboot called once * test: drop commented-out code in https spec * fix(review): harden fallow workflow, extract health script - pin fallow-rs/fallow to commit SHA (holds write token) - extract inline node -e to scripts/fallow-health-comment.js, drop dead GITHUB_OUTPUT write - scope sticky-comment lookup to bot author; skip on find failure (no dup comment) - drop redundant actions/cache step (setup-node cache:pnpm covers it) - correct portSuffix number-branch comment (unreachable for https/http2, not a no-op) * fix(review): scope fallow to next, tidy temp files & test comments * test(plugin-https): data-driven shape test, drop dupe boilerplate * test(create-gasket-app): drop unused template-test gasket.js fixture * test(create-gasket-app): drop unused template-test mock fixtures * test: remove unused mock fixtures and orphaned files * test(create-gasket-app): revive lapsed with-spinner test * chore(fallow): mark runtime-loaded files as dynamicallyLoaded * fix(create-gasket-app): type spinner errors as string[] * chore(react-intl): drop unused intl devDependency * fix: record spinner errors on create context --------- Co-authored-by: Kawika Bader <ekbader@gmail.com>
1 parent 43c7212 commit f930b6d

25 files changed

Lines changed: 144 additions & 315 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"create-gasket-app": patch
3+
---
4+
5+
fix spinner error stacks recorded on create context, not wrapper args

.fallowrc.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@
88
"site/**"
99
],
1010
"dynamicallyLoaded": [
11-
"scripts/generate-docs-index/**"
11+
"scripts/generate-docs-index/**",
12+
"packages/gasket-plugin-nextjs/lib/noop-replacement.mjs",
13+
"packages/gasket-plugin-dynamic-plugins/test/__mocks__/plugin-custom.js",
14+
"syncpack.config.cjs"
1215
],
1316
"ignoreDependencies": [
1417
"@babel/plugin-transform-runtime",

packages/create-gasket-app/lib/internal.d.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,7 @@ export function wrapWithSpinner(
5757
label: string,
5858
task: SpinnerTask,
5959
options?: SpinnerOptions
60-
): (context: { context: SpinnerContext['context'] } & {
61-
errors?: Error[]
62-
}) => Promise<void>;
60+
): (args: { gasket?: Gasket; context: SpinnerContext['context'] }) => Promise<void>;
6361

6462
/**
6563
* Wraps a task with a spinner, using both gasket and context.
@@ -85,9 +83,7 @@ export function spinnerAction(params: {
8583
spinner?: Ora
8684
}): Promise<void>;
8785

88-
export function execute(params: { gasket: Gasket, context: PartialCreateContext } & {
89-
errors?: Error[]
90-
}): Promise<void>;
86+
export function execute(args: { gasket?: Gasket; context: PartialCreateContext }): Promise<void>;
9187

9288
/** sacaffold/actions */
9389

packages/create-gasket-app/lib/scaffold/with-spinner.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ import ora from 'ora';
66
*/
77
function wrapWithSpinner(label, task, { startSpinner = true } = {}) {
88
/** @type {import('../internal.js').execute} */
9-
async function execute(context) {
9+
async function execute(args) {
10+
const { context } = args;
1011
const spinner = ora(label);
1112
if (startSpinner) spinner.start();
1213

1314
try {
14-
await task({ ...context, spinner });
15+
await task({ ...args, spinner });
1516
if (spinner.isSpinning) spinner.succeed();
1617
} catch (error) {
1718
spinner.fail();
1819
context.errors = context.errors || [];
19-
context.errors.push(error.stack);
20+
context.errors.push(error.stack ?? String(error));
2021
throw error;
2122
}
2223
}

packages/create-gasket-app/test/__mocks__/@gasket/template-test/package.json

Lines changed: 0 additions & 16 deletions
This file was deleted.

packages/create-gasket-app/test/__mocks__/@gasket/template-test/template/README.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

packages/create-gasket-app/test/__mocks__/@gasket/template-test/template/gasket.js

Lines changed: 0 additions & 11 deletions
This file was deleted.

packages/create-gasket-app/test/__mocks__/@gasket/template-test/template/package.json

Lines changed: 0 additions & 21 deletions
This file was deleted.

packages/create-gasket-app/test/unit/scaffold/with-spinner.js

Lines changed: 0 additions & 140 deletions
This file was deleted.
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
const mockStartStub = vi.fn();
2+
const mockSucceedStub = vi.fn();
3+
const mockWarnStub = vi.fn();
4+
const mockFailStub = vi.fn();
5+
const mockOraStub = vi.fn();
6+
7+
vi.mock('ora', () => ({ default: mockOraStub }));
8+
9+
const { withSpinner, withGasketSpinner } = await import('../../../lib/scaffold/with-spinner.js');
10+
11+
describe('with-spinner', () => {
12+
let mockContext, mockTask, mockLabel, mockSpinner;
13+
14+
beforeEach(() => {
15+
mockLabel = 'mockAction';
16+
mockTask = vi.fn();
17+
18+
mockContext = {
19+
appName: 'my-app',
20+
dest: '/some/path/my-app',
21+
warnings: [],
22+
errors: []
23+
};
24+
25+
mockSpinner = {
26+
succeed: mockSucceedStub,
27+
warn: mockWarnStub,
28+
fail: mockFailStub
29+
};
30+
mockSpinner.start = () => {
31+
mockSpinner.isSpinning = true;
32+
mockStartStub();
33+
};
34+
35+
mockOraStub.mockReturnValue(mockSpinner);
36+
});
37+
38+
afterEach(() => {
39+
vi.clearAllMocks();
40+
});
41+
42+
describe('withSpinner', () => {
43+
it('returns a wrapped async function', () => {
44+
const result = withSpinner(mockLabel, mockTask);
45+
expect(result.constructor.name).toBe('AsyncFunction');
46+
});
47+
48+
it('exposes the wrapped task', () => {
49+
const result = withSpinner(mockLabel, mockTask);
50+
expect(typeof result.wrapped).toBe('function');
51+
});
52+
53+
it('instantiates spinner with label', async () => {
54+
const action = withSpinner(mockLabel, mockTask);
55+
await action({ context: mockContext });
56+
expect(mockOraStub).toHaveBeenCalledWith(mockLabel);
57+
});
58+
59+
it('starts the spinner by default', async () => {
60+
const action = withSpinner(mockLabel, mockTask);
61+
await action({ context: mockContext });
62+
expect(mockStartStub).toHaveBeenCalled();
63+
});
64+
65+
it('does not start spinner if disabled', async () => {
66+
const action = withSpinner(mockLabel, mockTask, { startSpinner: false });
67+
await action({ context: mockContext });
68+
expect(mockStartStub).not.toHaveBeenCalled();
69+
});
70+
71+
it('passes context and spinner to the task', async () => {
72+
const action = withSpinner(mockLabel, mockTask);
73+
await action({ context: mockContext });
74+
expect(mockTask).toHaveBeenCalledWith({ context: mockContext, spinner: mockSpinner });
75+
});
76+
77+
it('succeeds the spinner when started', async () => {
78+
const action = withSpinner(mockLabel, mockTask);
79+
await action({ context: mockContext });
80+
expect(mockSucceedStub).toHaveBeenCalled();
81+
});
82+
83+
it('does not succeed the spinner if not started', async () => {
84+
const action = withSpinner(mockLabel, mockTask, { startSpinner: false });
85+
await action({ context: mockContext });
86+
expect(mockSucceedStub).not.toHaveBeenCalled();
87+
});
88+
89+
it('fails the spinner on error', async () => {
90+
mockTask.mockRejectedValue(new Error('bad stuff'));
91+
const action = withSpinner(mockLabel, mockTask);
92+
await expect(action({ context: mockContext })).rejects.toThrow('bad stuff');
93+
expect(mockFailStub).toHaveBeenCalled();
94+
});
95+
96+
it('rethrows the originating error', async () => {
97+
const mockError = new Error('bad stuff');
98+
mockTask.mockRejectedValue(mockError);
99+
const action = withSpinner(mockLabel, mockTask);
100+
await expect(action({ context: mockContext })).rejects.toEqual(mockError);
101+
});
102+
103+
it('records the error stack for reporting', async () => {
104+
const mockError = new Error('bad stuff');
105+
mockTask.mockRejectedValue(mockError);
106+
const action = withSpinner(mockLabel, mockTask);
107+
await expect(action({ context: mockContext })).rejects.toThrow();
108+
expect(mockContext.errors).toContain(mockError.stack);
109+
});
110+
});
111+
112+
describe('withGasketSpinner', () => {
113+
it('returns a wrapped async function', () => {
114+
const result = withGasketSpinner(mockLabel, mockTask);
115+
expect(result.constructor.name).toBe('AsyncFunction');
116+
});
117+
118+
it('passes gasket, context, and spinner to the task', async () => {
119+
const mockGasket = { name: 'gasket' };
120+
const action = withGasketSpinner(mockLabel, mockTask);
121+
await action({ gasket: mockGasket, context: mockContext });
122+
expect(mockTask).toHaveBeenCalledWith({
123+
gasket: mockGasket,
124+
context: mockContext,
125+
spinner: mockSpinner
126+
});
127+
});
128+
});
129+
});

0 commit comments

Comments
 (0)