@easydocs/cli 0.4.2 → 0.5.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.
Files changed (2) hide show
  1. package/dist/index.js +2 -13
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  // src/index.ts
4
- import { createDB, getAllEndpoints, getEndpointsByProject, findOrCreateProject } from "@easydocs/core";
4
+ import { createDB, getAllEndpoints, getEndpointsByProject, findOrCreateProject, buildFullSpec } from "@easydocs/core";
5
5
  import { capture } from "@easydocs/core";
6
6
  import { createServer } from "http";
7
7
  import { createRequire } from "module";
@@ -101,18 +101,7 @@ async function runExport(args2) {
101
101
  } else {
102
102
  endpoints = await getAllEndpoints(db);
103
103
  }
104
- const spec = {
105
- openapi: "3.0.3",
106
- info: { title: projectSlug ?? "API Documentation", version: "1.0.0" },
107
- paths: endpoints.reduce((acc, e) => {
108
- if (!e.path || !e.method) return acc;
109
- const activeSpec = e.isManuallyEdited && e.manualSpec ? e.manualSpec : e.spec;
110
- if (!activeSpec) return acc;
111
- if (!acc[e.path]) acc[e.path] = {};
112
- acc[e.path][e.method.toLowerCase()] = activeSpec;
113
- return acc;
114
- }, {})
115
- };
104
+ const spec = buildFullSpec(endpoints, projectSlug ?? void 0);
116
105
  process.stdout.write(format === "yaml" ? yaml.dump(spec) : JSON.stringify(spec, null, 2));
117
106
  }
118
107
  async function runProxy(args2) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@easydocs/cli",
3
- "version": "0.4.2",
3
+ "version": "0.5.0",
4
4
  "files": [
5
5
  "dist",
6
6
  "README.md"
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "dependencies": {
14
14
  "js-yaml": "^4.1.0",
15
- "@easydocs/core": "0.4.2"
15
+ "@easydocs/core": "0.5.0"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@types/js-yaml": "^4.0.9",