Skip to content

Commit 5b88011

Browse files
committed
remove logger
1 parent 504192e commit 5b88011

File tree

4 files changed

+4
-44
lines changed

4 files changed

+4
-44
lines changed

bun.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,6 @@
757757
"js-yaml": "^4.1.0",
758758
"miniflare": "^4.20250525.0",
759759
"ora": "^6.2.0",
760-
"picocolors": "^1.1.1",
761760
"prompts": "^2.4.2",
762761
"zod": "^3.25.42",
763762
},

packages/cli/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
"zod": "^3.25.42",
1717
"chokidar": "^4.0.1",
1818
"miniflare": "^4.20250525.0",
19-
"@1password/op-js": "^0.1.13",
20-
"picocolors": "^1.1.1"
19+
"@1password/op-js": "^0.1.13"
2120
},
2221
"devDependencies": {
2322
"@gitbook/tsconfig": "*",

packages/cli/src/logger.ts

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

packages/cli/src/openapi/publish.ts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import * as fs from 'fs';
22
import * as api from '@gitbook/api';
33
import { getAPIClient } from '../remote';
4-
import { logger } from '../logger';
54

65
/**
76
* Publish an OpenAPI specification to GitBook from a URL.
@@ -69,35 +68,31 @@ async function readOpenAPIFile(filePath: string): Promise<string> {
6968
return fileContent;
7069
} catch (error) {
7170
if (error instanceof Error && 'code' in error && error.code === 'ENOENT') {
72-
logger.error(`OpenAPI specification file not found: ${filePath}`);
73-
process.exit(1);
71+
throw new Error(`OpenAPI specification file not found: ${filePath}`);
7472
}
7573
throw error;
7674
}
7775
}
7876

79-
8077
const OPENAPISPEC_SLUG_REGEX = new RegExp(api.OPEN_APISPEC_SLUG_PATTERN);
8178
/**
8279
* Validate the OpenAPI specification slug.
8380
* It should match the pattern and be between the minimum and maximum length.
8481
*/
8582
function validateSlug(specSlug: string) {
8683
if (!OPENAPISPEC_SLUG_REGEX.test(specSlug)) {
87-
logger.error(
84+
throw new Error(
8885
`Invalid OpenAPI specification slug, must match pattern: ${api.OPEN_APISPEC_SLUG_PATTERN}`,
8986
);
90-
process.exit(1);
9187
}
9288

9389
if (
9490
specSlug.length < api.OPEN_APISPEC_SLUG_MIN_LENGTH ||
9591
specSlug.length > api.OPEN_APISPEC_SLUG_MAX_LENGTH
9692
) {
97-
logger.error(
93+
throw new Error(
9894
`Invalid OpenAPI specification slug, must be between ${api.OPEN_APISPEC_SLUG_MIN_LENGTH} and ${api.OPEN_APISPEC_SLUG_MAX_LENGTH} characters`,
9995
);
100-
process.exit(1);
10196
}
10297

10398
return specSlug;

0 commit comments

Comments
 (0)