astro-spec 0.0.0-reserved → 1.0.0
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/LICENSE +21 -0
- package/README.md +22 -0
- package/dist/bin.mjs +42 -0
- package/package.json +37 -12
- package/index.js +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 otoneko.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# astro-spec
|
|
2
|
+
|
|
3
|
+
> Command line tools for astro-spec
|
|
4
|
+
|
|
5
|
+
One command for the tools of [astro-spec](https://github.com/betterlib/astro-spec), which turns the Zod schemas of your Astro Actions into an OpenAPI document.
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install --save-dev astro-spec
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
| Command | Does the same as | Description |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `astro-spec client openapi.json --out src/api-client.ts` | [`astro-spec-client`](../client#readme) | Generate a typed client for your actions. |
|
|
14
|
+
| `astro-spec diff old.json openapi.json` | [`astro-spec-diff`](../diff#readme) | Exit with status 1 when the new document breaks clients of the old one. |
|
|
15
|
+
|
|
16
|
+
Run `astro-spec COMMAND --help` for the options of a command.
|
|
17
|
+
|
|
18
|
+
To serve the document itself, add the [`@astro-spec/openapi`](../openapi#readme) integration to your Astro config.
|
|
19
|
+
|
|
20
|
+
## License
|
|
21
|
+
|
|
22
|
+
[MIT](https://github.com/betterlib/astro-spec/blob/main/LICENSE)
|
package/dist/bin.mjs
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { runClientCli } from "@astro-spec/client";
|
|
3
|
+
import { runDiffCli } from "@astro-spec/diff";
|
|
4
|
+
// package.json
|
|
5
|
+
var version = "1.0.0";
|
|
6
|
+
// src/bin.ts
|
|
7
|
+
const HELP = `Usage: astro-spec COMMAND [OPTIONS]
|
|
8
|
+
|
|
9
|
+
Commands:
|
|
10
|
+
client Generate a typed client for Astro Actions from an OpenAPI document
|
|
11
|
+
diff Exit with status 1 when an OpenAPI document breaks clients of an older one
|
|
12
|
+
|
|
13
|
+
Run astro-spec COMMAND --help for the options of a command.
|
|
14
|
+
|
|
15
|
+
-h, --help Show this help
|
|
16
|
+
-v, --version Show the version
|
|
17
|
+
`;
|
|
18
|
+
const [command, ...args] = process.argv.slice(2);
|
|
19
|
+
try {
|
|
20
|
+
switch (command) {
|
|
21
|
+
case "client":
|
|
22
|
+
await runClientCli(args);
|
|
23
|
+
break;
|
|
24
|
+
case "diff":
|
|
25
|
+
if (await runDiffCli(args)) process.exitCode = 1;
|
|
26
|
+
break;
|
|
27
|
+
case void 0:
|
|
28
|
+
case "-h":
|
|
29
|
+
case "--help":
|
|
30
|
+
process.stdout.write(HELP);
|
|
31
|
+
break;
|
|
32
|
+
case "-v":
|
|
33
|
+
case "--version":
|
|
34
|
+
process.stdout.write(`${version}\n`);
|
|
35
|
+
break;
|
|
36
|
+
default: throw new Error(`Unknown command: ${command}\n\n${HELP}`);
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
process.stderr.write(`${error instanceof Error ? error.message : String(error)}\n`);
|
|
40
|
+
process.exitCode = command === "diff" ? 2 : 1;
|
|
41
|
+
}
|
|
42
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "astro-spec",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"
|
|
7
|
-
"
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Command line tools for astro-spec: generate a typed client and detect breaking changes in the OpenAPI document of your Astro Actions",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"astro",
|
|
7
|
+
"openapi",
|
|
8
|
+
"astro-actions",
|
|
9
|
+
"cli"
|
|
10
|
+
],
|
|
11
|
+
"homepage": "https://github.com/betterlib/astro-spec/tree/main/packages/astro-spec#readme",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/betterlib/astro-spec/issues"
|
|
14
|
+
},
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/betterlib/astro-spec.git",
|
|
18
|
+
"directory": "packages/astro-spec"
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"author": "otoneko.",
|
|
22
|
+
"type": "module",
|
|
23
|
+
"bin": {
|
|
24
|
+
"astro-spec": "./dist/bin.mjs"
|
|
8
25
|
},
|
|
9
26
|
"files": [
|
|
10
|
-
"
|
|
27
|
+
"dist"
|
|
11
28
|
],
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
29
|
+
"engines": {
|
|
30
|
+
"node": ">=22.12.0"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@astro-spec/client": "1.0.0",
|
|
34
|
+
"@astro-spec/diff": "1.0.0"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public",
|
|
38
|
+
"provenance": true
|
|
39
|
+
},
|
|
40
|
+
"scripts": {
|
|
41
|
+
"build": "tsdown",
|
|
42
|
+
"typecheck": "tsc --noEmit"
|
|
18
43
|
}
|
|
19
44
|
}
|
package/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = console.log("astro-spec is reserved for otoneko.");
|