@scalar/cli 0.2.305 → 0.2.306
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/mock/MockCommand.js +4 -11
- package/dist/commands/share/ShareCommand.js +4 -12
- package/dist/index.js +1 -4
- package/dist/package.json.js +1 -1
- package/dist/src/commands/bundle/BundleCommand.d.ts.map +1 -1
- package/dist/src/commands/check/CheckCommand.d.ts.map +1 -1
- package/dist/src/commands/format/FormatCommand.d.ts.map +1 -1
- package/dist/src/commands/mock/MockCommand.d.ts.map +1 -1
- package/dist/src/commands/share/ShareCommand.d.ts.map +1 -1
- package/dist/src/commands/validate/ValidateCommand.d.ts.map +1 -1
- package/dist/src/utils/getFileOrUrl.d.ts.map +1 -1
- package/dist/src/utils/getHtmlDocument.d.ts.map +1 -1
- package/dist/src/utils/getMethodColor.d.ts.map +1 -1
- package/dist/src/utils/getOperationByMethodAndPath.d.ts.map +1 -1
- package/dist/src/utils/isUrl.d.ts.map +1 -1
- package/dist/src/utils/printSpecificationBanner.d.ts.map +1 -1
- package/dist/src/utils/useGivenFileOrConfiguration.d.ts.map +1 -1
- package/dist/src/utils/watchFile.d.ts.map +1 -1
- package/dist/tests/invoke-cli.d.ts +1 -4
- package/dist/tests/invoke-cli.d.ts.map +1 -1
- package/dist/utils/isUrl.js +1 -2
- package/package.json +8 -8
|
@@ -35,9 +35,7 @@ function MockCommand() {
|
|
|
35
35
|
if (watch) {
|
|
36
36
|
await watchFile(input, async () => {
|
|
37
37
|
const newResult = await loadOpenApiFile(input);
|
|
38
|
-
const specificationHasChanged = newResult?.specification &&
|
|
39
|
-
JSON.stringify(specification) !==
|
|
40
|
-
JSON.stringify(newResult.specification);
|
|
38
|
+
const specificationHasChanged = newResult?.specification && JSON.stringify(specification) !== JSON.stringify(newResult.specification);
|
|
41
39
|
if (specificationHasChanged) {
|
|
42
40
|
console.log(kleur.bold().white('[INFO]'), kleur.grey('OpenAPI file modified'));
|
|
43
41
|
printSpecificationBanner({
|
|
@@ -92,8 +90,7 @@ async function bootServer({ specification, port, }) {
|
|
|
92
90
|
function printAvailablePaths(specification) {
|
|
93
91
|
console.log(kleur.bold().white('Available Paths'));
|
|
94
92
|
console.log();
|
|
95
|
-
if (specification?.paths === undefined ||
|
|
96
|
-
Object.keys(specification?.paths).length === 0) {
|
|
93
|
+
if (specification?.paths === undefined || Object.keys(specification?.paths).length === 0) {
|
|
97
94
|
console.log(kleur.bold().yellow('[WARN]'), kleur.grey('Couldn’t find any paths in the OpenAPI file.'));
|
|
98
95
|
}
|
|
99
96
|
// loop through all paths
|
|
@@ -107,18 +104,14 @@ function printAvailablePaths(specification) {
|
|
|
107
104
|
if (specification.paths[path][method] === undefined) {
|
|
108
105
|
continue;
|
|
109
106
|
}
|
|
110
|
-
console.log(`${kleur
|
|
111
|
-
.bold()[getMethodColor(method)](method.toUpperCase().padEnd(6))} ${kleur.grey(`${path}`)}`);
|
|
107
|
+
console.log(`${kleur.bold()[getMethodColor(method)](method.toUpperCase().padEnd(6))} ${kleur.grey(`${path}`)}`);
|
|
112
108
|
}
|
|
113
109
|
}
|
|
114
110
|
console.log();
|
|
115
111
|
}
|
|
116
112
|
function onRequest({ context, operation, }) {
|
|
117
113
|
const { method } = context.req;
|
|
118
|
-
console.log(`${kleur
|
|
119
|
-
.bold()[getMethodColor(method)](method.toUpperCase().padEnd(6))} ${kleur.grey(`${context.req.path}`)}`, `${kleur.grey('→')} ${operation?.operationId
|
|
120
|
-
? kleur.white(operation.operationId)
|
|
121
|
-
: kleur.red('[ERROR] 404 Not Found')}`);
|
|
114
|
+
console.log(`${kleur.bold()[getMethodColor(method)](method.toUpperCase().padEnd(6))} ${kleur.grey(`${context.req.path}`)}`, `${kleur.grey('→')} ${operation?.operationId ? kleur.white(operation.operationId) : kleur.red('[ERROR] 404 Not Found')}`);
|
|
122
115
|
}
|
|
123
116
|
|
|
124
117
|
export { MockCommand };
|
|
@@ -25,19 +25,11 @@ function ShareCommand() {
|
|
|
25
25
|
const { id, token: newToken } = data;
|
|
26
26
|
console.log(kleur.bold().green('Your OpenAPI file is public.'));
|
|
27
27
|
console.log();
|
|
28
|
-
console.log(`${kleur.green('➜')} ${kleur
|
|
29
|
-
|
|
30
|
-
.white('API Reference:'.padEnd(14))} ${kleur.cyan(`https://sandbox.scalar.com/p/${id}`)}`);
|
|
31
|
-
console.log(`${kleur.grey('➜')} ${kleur
|
|
32
|
-
.bold()
|
|
33
|
-
.grey('Editor:'.padEnd(14))} ${kleur.cyan(`https://sandbox.scalar.com/e/${id}`)}`);
|
|
28
|
+
console.log(`${kleur.green('➜')} ${kleur.bold().white('API Reference:'.padEnd(14))} ${kleur.cyan(`https://sandbox.scalar.com/p/${id}`)}`);
|
|
29
|
+
console.log(`${kleur.grey('➜')} ${kleur.bold().grey('Editor:'.padEnd(14))} ${kleur.cyan(`https://sandbox.scalar.com/e/${id}`)}`);
|
|
34
30
|
console.log();
|
|
35
|
-
console.log(`${kleur.grey('➜')} ${kleur
|
|
36
|
-
|
|
37
|
-
.grey('OpenAPI JSON:'.padEnd(14))} ${kleur.cyan(`https://sandbox.scalar.com/files/${id}/openapi.json`)}`);
|
|
38
|
-
console.log(`${kleur.grey('➜')} ${kleur
|
|
39
|
-
.bold()
|
|
40
|
-
.grey('OpenAPI YAML:'.padEnd(14))} ${kleur.cyan(`https://sandbox.scalar.com/files/${id}/openapi.yaml`)}`);
|
|
31
|
+
console.log(`${kleur.grey('➜')} ${kleur.bold().grey('OpenAPI JSON:'.padEnd(14))} ${kleur.cyan(`https://sandbox.scalar.com/files/${id}/openapi.json`)}`);
|
|
32
|
+
console.log(`${kleur.grey('➜')} ${kleur.bold().grey('OpenAPI YAML:'.padEnd(14))} ${kleur.cyan(`https://sandbox.scalar.com/files/${id}/openapi.yaml`)}`);
|
|
41
33
|
console.log();
|
|
42
34
|
console.log(kleur.white('Use the token to update the existing sandbox:'));
|
|
43
35
|
console.log();
|
package/dist/index.js
CHANGED
|
@@ -12,10 +12,7 @@ import { ShareCommand } from './commands/share/ShareCommand.js';
|
|
|
12
12
|
import { CheckCommand } from './commands/check/CheckCommand.js';
|
|
13
13
|
|
|
14
14
|
const program = new Command();
|
|
15
|
-
program
|
|
16
|
-
.name('@scalar/cli')
|
|
17
|
-
.description('CLI to work with your OpenAPI files')
|
|
18
|
-
.version(version);
|
|
15
|
+
program.name('@scalar/cli').description('CLI to work with your OpenAPI files').version(version);
|
|
19
16
|
/** display help in case of error */
|
|
20
17
|
program.showHelpAfterError();
|
|
21
18
|
program.addCommand(InitCommand());
|
package/dist/package.json.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BundleCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/bundle/BundleCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"BundleCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/bundle/BundleCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,wBAAgB,aAAa,YA8C5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/check/CheckCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC;;GAEG;AACH,wBAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"CheckCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/check/CheckCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAQnC;;GAEG;AACH,wBAAgB,YAAY,YA6D3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormatCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/format/FormatCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AASnC,wBAAgB,aAAa,
|
|
1
|
+
{"version":3,"file":"FormatCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/format/FormatCommand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AASnC,wBAAgB,aAAa,YA4C5B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MockCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/mock/MockCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;
|
|
1
|
+
{"version":3,"file":"MockCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/mock/MockCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAOnC,wBAAgB,WAAW,YAsF1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ShareCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/share/ShareCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,wBAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"ShareCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/share/ShareCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAKnC,wBAAgB,YAAY,YAiE3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidateCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/validate/ValidateCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC;;GAEG;AACH,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"ValidateCommand.d.ts","sourceRoot":"","sources":["../../../../src/commands/validate/ValidateCommand.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC;;GAEG;AACH,wBAAgB,eAAe,YAoD9B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFileOrUrl.d.ts","sourceRoot":"","sources":["../../../src/utils/getFileOrUrl.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"getFileOrUrl.d.ts","sourceRoot":"","sources":["../../../src/utils/getFileOrUrl.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAsB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkBjE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getHtmlDocument.d.ts","sourceRoot":"","sources":["../../../src/utils/getHtmlDocument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAEpD,wBAAgB,eAAe,
|
|
1
|
+
{"version":3,"file":"getHtmlDocument.d.ts","sourceRoot":"","sources":["../../../src/utils/getHtmlDocument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAEpD,wBAAgB,eAAe,CAAC,aAAa,EAAE,OAAO,CAAC,QAAQ,EAAE,KAAK,UAAQ,UAoC7E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getMethodColor.d.ts","sourceRoot":"","sources":["../../../src/utils/getMethodColor.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,
|
|
1
|
+
{"version":3,"file":"getMethodColor.d.ts","sourceRoot":"","sources":["../../../src/utils/getMethodColor.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,CAAA;AAEvH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GASQ,UAAU,CAC9D"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getOperationByMethodAndPath.d.ts","sourceRoot":"","sources":["../../../src/utils/getOperationByMethodAndPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"getOperationByMethodAndPath.d.ts","sourceRoot":"","sources":["../../../src/utils/getOperationByMethodAndPath.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAIvF,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,uGAiCjG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isUrl.d.ts","sourceRoot":"","sources":["../../../src/utils/isUrl.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,
|
|
1
|
+
{"version":3,"file":"isUrl.d.ts","sourceRoot":"","sources":["../../../src/utils/isUrl.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"printSpecificationBanner.d.ts","sourceRoot":"","sources":["../../../src/utils/printSpecificationBanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAGpD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAA;CAC1B,
|
|
1
|
+
{"version":3,"file":"printSpecificationBanner.d.ts","sourceRoot":"","sources":["../../../src/utils/printSpecificationBanner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAGpD,wBAAgB,wBAAwB,CAAC,MAAM,EAAE;IAC/C,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAA;CAC1B,QA2BA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useGivenFileOrConfiguration.d.ts","sourceRoot":"","sources":["../../../src/utils/useGivenFileOrConfiguration.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,uBAAuB,CAAA;AAE/C,wBAAgB,2BAA2B,CAAC,IAAI,CAAC,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useGivenFileOrConfiguration.d.ts","sourceRoot":"","sources":["../../../src/utils/useGivenFileOrConfiguration.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,WAAW,uBAAuB,CAAA;AAE/C,wBAAgB,2BAA2B,CAAC,IAAI,CAAC,EAAE,MAAM,OA+BxD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchFile.d.ts","sourceRoot":"","sources":["../../../src/utils/watchFile.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,wBAAsB,SAAS,
|
|
1
|
+
{"version":3,"file":"watchFile.d.ts","sourceRoot":"","sources":["../../../src/utils/watchFile.ts"],"names":[],"mappings":"AAMA;;GAEG;AACH,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,IAAI,EAAE,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,iBAgCpG"}
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { createLogsMatcher } from './matcher';
|
|
2
2
|
type CreateLogsMatcherReturn = ReturnType<typeof createLogsMatcher>;
|
|
3
|
-
export type InvokeResult = [
|
|
4
|
-
exitCode: number,
|
|
5
|
-
logsMatcher: CreateLogsMatcherReturn
|
|
6
|
-
];
|
|
3
|
+
export type InvokeResult = [exitCode: number, logsMatcher: CreateLogsMatcherReturn];
|
|
7
4
|
export declare function ScalarCli(): {
|
|
8
5
|
setCwd: (_cwd: string) => any;
|
|
9
6
|
invoke: (args: Array<string>) => InvokeResult;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke-cli.d.ts","sourceRoot":"","sources":["../../tests/invoke-cli.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAI7C,KAAK,uBAAuB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA;AACnE,MAAM,MAAM,YAAY,GAAG
|
|
1
|
+
{"version":3,"file":"invoke-cli.d.ts","sourceRoot":"","sources":["../../tests/invoke-cli.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAI7C,KAAK,uBAAuB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAA;AACnE,MAAM,MAAM,YAAY,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,uBAAuB,CAAC,CAAA;AAEnF,wBAAgB,SAAS;mBAIN,MAAM;mBAIN,KAAK,CAAC,MAAM,CAAC,KAAG,YAAY;EAsB9C"}
|
package/dist/utils/isUrl.js
CHANGED
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Check if the input is a URL.
|
|
3
3
|
*/
|
|
4
4
|
function isUrl(text) {
|
|
5
|
-
return
|
|
6
|
-
(text.startsWith('http://') || text.startsWith('https://')));
|
|
5
|
+
return typeof text === 'string' && (text.startsWith('http://') || text.startsWith('https://'));
|
|
7
6
|
}
|
|
8
7
|
|
|
9
8
|
export { isUrl };
|
package/package.json
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"swagger",
|
|
17
17
|
"cli"
|
|
18
18
|
],
|
|
19
|
-
"version": "0.2.
|
|
19
|
+
"version": "0.2.306",
|
|
20
20
|
"engines": {
|
|
21
21
|
"node": ">=18"
|
|
22
22
|
},
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
"hono": "^4.6.5",
|
|
45
45
|
"kleur": "^4.1.5",
|
|
46
46
|
"prettyjson": "^1.2.5",
|
|
47
|
-
"@scalar/api-reference": "1.25.
|
|
48
|
-
"@scalar/config": "0.1.
|
|
49
|
-
"@scalar/
|
|
50
|
-
"@scalar/openapi-
|
|
51
|
-
"@scalar/
|
|
52
|
-
"@scalar/openapi-
|
|
47
|
+
"@scalar/api-reference": "1.25.123",
|
|
48
|
+
"@scalar/config": "0.1.3",
|
|
49
|
+
"@scalar/mock-server": "0.2.115",
|
|
50
|
+
"@scalar/openapi-types": "0.1.9",
|
|
51
|
+
"@scalar/oas-utils": "0.2.108",
|
|
52
|
+
"@scalar/openapi-parser": "0.10.9",
|
|
53
53
|
"@scalar/void-server": "2.0.15"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"rollup-plugin-delete": "^2.0.0",
|
|
62
62
|
"strip-ansi": "^7.1.0",
|
|
63
63
|
"tslib": "^2.6.2",
|
|
64
|
-
"@scalar/build-tooling": "0.1.
|
|
64
|
+
"@scalar/build-tooling": "0.1.15"
|
|
65
65
|
},
|
|
66
66
|
"scripts": {
|
|
67
67
|
"@scalar/cli": "pnpm vite-node src/index.ts",
|