Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Upgrade dependencies #373

Merged
merged 7 commits into from
Aug 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Upgrade for clipanion return type changes
  • Loading branch information
kitten committed Aug 18, 2024
commit d4dce61ab53b0d20bbf368e9c1d260724e76719b
3 changes: 2 additions & 1 deletion packages/cli-utils/src/commands/check/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as t from 'typanion';
import { Command, Option } from 'clipanion';

import { exitCode } from '../../utils/error';
import { initTTY } from '../../term';
import { run } from './runner';

Expand Down Expand Up @@ -30,6 +31,6 @@ export class CheckCommand extends Command {
tsconfig: this.tsconfig,
})
);
return process.exitCode || (typeof result === 'object' ? result.exit : 0);
return exitCode() || (typeof result === 'object' ? result.exit : 0);
}
}
3 changes: 2 additions & 1 deletion packages/cli-utils/src/commands/doctor/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Command } from 'clipanion';
import { exitCode } from '../../utils/error';
import { initTTY } from '../../term';
import { run } from './runner';

Expand All @@ -7,6 +8,6 @@ export class DoctorCommand extends Command {

async execute() {
const result = await initTTY().start(run());
return process.exitCode || (typeof result === 'object' ? result.exit : 0);
return exitCode() || (typeof result === 'object' ? result.exit : 0);
}
}
3 changes: 2 additions & 1 deletion packages/cli-utils/src/commands/generate-output/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Command, Option } from 'clipanion';

import type { OutputOptions } from './runner';
import { exitCode } from '../../utils/error';
import { initTTY } from '../../term';
import { run } from './runner';

Expand Down Expand Up @@ -36,7 +37,7 @@ export class GenerateOutputCommand extends Command {
tsconfig: this.tsconfig,
})
);
return process.exitCode || (typeof result === 'object' ? result.exit : 0);
return exitCode() || (typeof result === 'object' ? result.exit : 0);
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/cli-utils/src/commands/generate-persisted/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Command, Option } from 'clipanion';

import type { PersistedOptions } from './runner';
import { exitCode } from '../../utils/error';
import { initTTY } from '../../term';
import { run } from './runner';

Expand Down Expand Up @@ -35,7 +36,7 @@ export class GeneratePersisted extends Command {
tsconfig: this.tsconfig,
})
);
return process.exitCode || (typeof result === 'object' ? result.exit : 0);
return exitCode() || (typeof result === 'object' ? result.exit : 0);
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/cli-utils/src/commands/generate-schema/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as t from 'typanion';
import { Command, Option } from 'clipanion';

import { exitCode } from '../../utils/error';
import type { SchemaOptions } from './runner';
import { initTTY } from '../../term';
import { run } from './runner';
Expand Down Expand Up @@ -53,7 +54,7 @@ export class GenerateSchema extends Command {
tsconfig: this.tsconfig,
})
);
return process.exitCode || (typeof result === 'object' ? result.exit : 0);
return exitCode() || (typeof result === 'object' ? result.exit : 0);
}
}

Expand Down
3 changes: 2 additions & 1 deletion packages/cli-utils/src/commands/turbo/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Command, Option } from 'clipanion';

import type { TurboOptions } from './runner';
import { exitCode } from '../../utils/error';
import { initTTY } from '../../term';
import { run } from './runner';

Expand Down Expand Up @@ -30,7 +31,7 @@ export class TurboCommand extends Command {
tsconfig: this.tsconfig,
})
);
return process.exitCode || (typeof result === 'object' ? result.exit : 0);
return exitCode() || (typeof result === 'object' ? result.exit : 0);
}
}

Expand Down
5 changes: 5 additions & 0 deletions packages/cli-utils/src/utils/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,8 @@ export class TadaError extends Error {
this.name = 'TadaError';
}
}

export const exitCode = () => {
const { exitCode } = process;
return typeof exitCode === 'string' ? parseInt(exitCode, 10) || 0 : exitCode;
};