Skip to content

Commit dae0748

Browse files
committed
chore: formatting
1 parent b26c7e9 commit dae0748

File tree

7 files changed

+21
-46
lines changed

7 files changed

+21
-46
lines changed

src/lib/adapters/cli-adapter.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,8 +360,7 @@ export class CLIAdapter implements InstallerAdapter {
360360
// Periodic status updates with elapsed time
361361
this.agentUpdateInterval = setInterval(() => {
362362
const elapsed = Math.round((Date.now() - (this.agentStartTime ?? Date.now())) / 1000);
363-
const timeStr =
364-
elapsed >= 60 ? `${Math.floor(elapsed / 60)}m ${elapsed % 60}s` : `${elapsed}s`;
363+
const timeStr = elapsed >= 60 ? `${Math.floor(elapsed / 60)}m ${elapsed % 60}s` : `${elapsed}s`;
365364
const detail = this.lastFileOperation ?? 'Working';
366365
this.spinner?.message(`${detail} (${timeStr})`);
367366
}, 2000);

src/lib/installer-core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ export const installerMachine = setup({
288288
const hasPostInstallError = !!context.postInstallError;
289289
const summary = hasPostInstallError
290290
? `Installation completed but post-install failed: ${context.postInstallError}`
291-
: context.agentSummary ?? 'WorkOS AuthKit installed successfully!';
291+
: (context.agentSummary ?? 'WorkOS AuthKit installed successfully!');
292292
context.emitter.emit('complete', { success: !hasPostInstallError, summary });
293293
},
294294
},

src/lib/port-detection.spec.ts

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -25,45 +25,33 @@ describe('port-detection', () => {
2525

2626
describe('detectPort for nextjs', () => {
2727
it('detects port from -p flag in dev script', () => {
28-
mockReadFileSync.mockReturnValue(
29-
JSON.stringify({ scripts: { dev: 'next dev -p 4000' } }),
30-
);
28+
mockReadFileSync.mockReturnValue(JSON.stringify({ scripts: { dev: 'next dev -p 4000' } }));
3129
expect(detectPort('nextjs', '/test')).toBe(4000);
3230
});
3331

3432
it('detects port from --port flag in dev script', () => {
35-
mockReadFileSync.mockReturnValue(
36-
JSON.stringify({ scripts: { dev: 'next dev --port 5000' } }),
37-
);
33+
mockReadFileSync.mockReturnValue(JSON.stringify({ scripts: { dev: 'next dev --port 5000' } }));
3834
expect(detectPort('nextjs', '/test')).toBe(5000);
3935
});
4036

4137
it('detects port from --port= flag in dev script', () => {
42-
mockReadFileSync.mockReturnValue(
43-
JSON.stringify({ scripts: { dev: 'next dev --port=3123' } }),
44-
);
38+
mockReadFileSync.mockReturnValue(JSON.stringify({ scripts: { dev: 'next dev --port=3123' } }));
4539
expect(detectPort('nextjs', '/test')).toBe(3123);
4640
});
4741

4842
it('detects PORT=NNNN inline env var in dev script', () => {
49-
mockReadFileSync.mockReturnValue(
50-
JSON.stringify({ scripts: { dev: 'PORT=3123 next dev' } }),
51-
);
43+
mockReadFileSync.mockReturnValue(JSON.stringify({ scripts: { dev: 'PORT=3123 next dev' } }));
5244
expect(detectPort('nextjs', '/test')).toBe(3123);
5345
});
5446

5547
it('prefers -p flag over PORT= env var', () => {
56-
mockReadFileSync.mockReturnValue(
57-
JSON.stringify({ scripts: { dev: 'PORT=4000 next dev -p 5000' } }),
58-
);
48+
mockReadFileSync.mockReturnValue(JSON.stringify({ scripts: { dev: 'PORT=4000 next dev -p 5000' } }));
5949
expect(detectPort('nextjs', '/test')).toBe(5000);
6050
});
6151

6252
it('falls back to .env file PORT when no script port', () => {
6353
// First call: package.json (no port in script)
64-
mockReadFileSync.mockReturnValueOnce(
65-
JSON.stringify({ scripts: { dev: 'next dev' } }),
66-
);
54+
mockReadFileSync.mockReturnValueOnce(JSON.stringify({ scripts: { dev: 'next dev' } }));
6755
// Second call: .env.local
6856
mockReadFileSync.mockReturnValueOnce('PORT=3123\nOTHER_VAR=foo');
6957

@@ -72,9 +60,7 @@ describe('port-detection', () => {
7260

7361
it('falls back to default 3000 when no port found anywhere', () => {
7462
// package.json - no port
75-
mockReadFileSync.mockReturnValueOnce(
76-
JSON.stringify({ scripts: { dev: 'next dev' } }),
77-
);
63+
mockReadFileSync.mockReturnValueOnce(JSON.stringify({ scripts: { dev: 'next dev' } }));
7864
// All .env files throw (don't exist)
7965
mockReadFileSync.mockImplementation(() => {
8066
throw new Error('ENOENT');

src/lib/post-install.spec.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,10 @@ describe('post-install', () => {
3030
cwd: '/test/dir',
3131
stdio: 'ignore',
3232
});
33-
expect(mockExecFileSync).toHaveBeenCalledWith(
34-
'git',
35-
['commit', '-m', 'feat: add WorkOS AuthKit'],
36-
{ cwd: '/test/dir', stdio: ['ignore', 'pipe', 'pipe'] },
37-
);
33+
expect(mockExecFileSync).toHaveBeenCalledWith('git', ['commit', '-m', 'feat: add WorkOS AuthKit'], {
34+
cwd: '/test/dir',
35+
stdio: ['ignore', 'pipe', 'pipe'],
36+
});
3837
});
3938

4039
it('throws with stderr when commit fails from pre-commit hook', () => {
@@ -83,9 +82,7 @@ describe('post-install', () => {
8382
throw error;
8483
});
8584

86-
expect(() => stageAndCommit('feat: add WorkOS', '/test/dir')).toThrow(
87-
/Git commit failed: signal SIGTERM/,
88-
);
85+
expect(() => stageAndCommit('feat: add WorkOS', '/test/dir')).toThrow(/Git commit failed: signal SIGTERM/);
8986
});
9087
});
9188

src/lib/post-install.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ export function stageAndCommit(message: string, cwd: string): void {
2020
const execError = error as { stderr?: Buffer; stdout?: Buffer; message?: string };
2121
const stderr = execError.stderr?.toString() ?? '';
2222
const stdout = execError.stdout?.toString() ?? '';
23-
throw new Error(
24-
`Git commit failed${stderr ? `:\n${stderr}` : stdout ? `:\n${stdout}` : `: ${execError.message}`}`,
25-
);
23+
throw new Error(`Git commit failed${stderr ? `:\n${stderr}` : stdout ? `:\n${stdout}` : `: ${execError.message}`}`);
2624
}
2725
}
2826

src/steps/upload-environment-variables/index.spec.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,21 +58,15 @@ describe('uploadEnvironmentVariablesStep', () => {
5858

5959
it('warns about existing WorkOS vars before prompting', async () => {
6060
mockDetect.mockResolvedValue(true);
61-
mockCheckExistingVars.mockResolvedValue([
62-
'WORKOS_API_KEY',
63-
'WORKOS_CLIENT_ID',
64-
'NODE_ENV',
65-
]);
61+
mockCheckExistingVars.mockResolvedValue(['WORKOS_API_KEY', 'WORKOS_CLIENT_ID', 'NODE_ENV']);
6662
mockClack.select.mockResolvedValue(false);
6763

6864
await uploadEnvironmentVariablesStep(
6965
{ WORKOS_API_KEY: 'sk_test' },
7066
{ integration: 'nextjs', options: { installDir: '/test' } as any },
7167
);
7268

73-
expect(mockClack.log.warn).toHaveBeenCalledWith(
74-
expect.stringContaining('WORKOS_API_KEY, WORKOS_CLIENT_ID'),
75-
);
69+
expect(mockClack.log.warn).toHaveBeenCalledWith(expect.stringContaining('WORKOS_API_KEY, WORKOS_CLIENT_ID'));
7670
});
7771

7872
it('does not warn when no existing WorkOS vars', async () => {

src/steps/upload-environment-variables/index.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,10 @@ export const uploadEnvironmentVariablesStep = async (
5353
{
5454
value: true,
5555
label: 'Yes',
56-
hint: existingWorkosVars.length > 0
57-
? `Upload to ${provider.name} (some vars already exist)`
58-
: `Upload the environment variables to ${provider.name}`,
56+
hint:
57+
existingWorkosVars.length > 0
58+
? `Upload to ${provider.name} (some vars already exist)`
59+
: `Upload the environment variables to ${provider.name}`,
5960
},
6061
{
6162
value: false,

0 commit comments

Comments
 (0)