@backstage/repo-tools 0.3.2-next.1 → 0.3.3-next.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/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @backstage/repo-tools
2
2
 
3
+ ## 0.3.3-next.0
4
+
5
+ ### Patch Changes
6
+
7
+ - ebeb77586975: Update `schema openapi generate` command to now create a default router that can be imported and used directly.
8
+ - Updated dependencies
9
+ - @backstage/cli-common@0.1.12
10
+ - @backstage/cli-node@0.1.2
11
+ - @backstage/errors@1.2.1
12
+
13
+ ## 0.3.2
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies
18
+ - @backstage/errors@1.2.1
19
+ - @backstage/cli-node@0.1.2
20
+ - @backstage/cli-common@0.1.12
21
+
3
22
  ## 0.3.2-next.1
4
23
 
5
24
  ### Patch Changes
@@ -38,8 +38,12 @@ async function generate(directoryPath, config) {
38
38
  // ******************************************************************
39
39
  // * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. *
40
40
  // ******************************************************************
41
-
42
- export default ${JSON.stringify(yaml, null, 2)} as const;`
41
+ import {createValidatedOpenApiRouter} from '@backstage/backend-openapi-utils';
42
+ export const spec = ${JSON.stringify(yaml, null, 2)} as const;
43
+ export const createOpenApiRouter = async (
44
+ options?: Parameters<typeof createValidatedOpenApiRouter>['1'],
45
+ ) => createValidatedOpenApiRouter<typeof spec>(spec, options);
46
+ `
43
47
  );
44
48
  await exec(`yarn backstage-cli package lint --fix ${tsPath}`);
45
49
  if (await paths.paths.resolveTargetRoot("node_modules/.bin/prettier")) {
@@ -72,4 +76,4 @@ async function bulkCommand(paths = []) {
72
76
  }
73
77
 
74
78
  exports.bulkCommand = bulkCommand;
75
- //# sourceMappingURL=generate-6f0190dd.cjs.js.map
79
+ //# sourceMappingURL=generate-242d2277.cjs.js.map
@@ -50,10 +50,10 @@ async function verify(directoryPath) {
50
50
  throw new Error(`No \`${constants.TS_SCHEMA_PATH}\` file found.`);
51
51
  }
52
52
  const schema = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(path.resolve(path.join(directoryPath, constants.TS_MODULE)));
53
- if (!schema.default) {
54
- throw new Error(`\`${constants.TS_SCHEMA_PATH}\` needs to have a default export.`);
53
+ if (!schema.spec) {
54
+ throw new Error(`\`${constants.TS_SCHEMA_PATH}\` needs to have a 'spec' export.`);
55
55
  }
56
- if (!lodash.isEqual(schema.default, yaml)) {
56
+ if (!lodash.isEqual(schema.spec, yaml)) {
57
57
  const path$1 = path.relative(paths.paths.targetRoot, directoryPath);
58
58
  throw new Error(
59
59
  `\`${constants.YAML_SCHEMA_PATH}\` and \`${constants.TS_SCHEMA_PATH}\` do not match. Please run \`yarn backstage-repo-tools schema openapi generate ${path$1}\` to regenerate \`${constants.TS_SCHEMA_PATH}\`.`
@@ -79,4 +79,4 @@ async function bulkCommand(paths = []) {
79
79
  }
80
80
 
81
81
  exports.bulkCommand = bulkCommand;
82
- //# sourceMappingURL=verify-46e56357.cjs.js.map
82
+ //# sourceMappingURL=verify-8fe63985.cjs.js.map
package/dist/index.cjs.js CHANGED
@@ -49,10 +49,10 @@ function registerSchemaCommand(program) {
49
49
  const openApiCommand = command.command("openapi [command]").description("Tooling for OpenApi schema");
50
50
  openApiCommand.command("verify [paths...]").description(
51
51
  "Verify that all OpenAPI schemas are valid and have a matching `schemas/openapi.generated.ts` file."
52
- ).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/verify-46e56357.cjs.js'); }).then((m) => m.bulkCommand)));
52
+ ).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/verify-8fe63985.cjs.js'); }).then((m) => m.bulkCommand)));
53
53
  openApiCommand.command("generate [paths...]").description(
54
54
  "Generates a Typescript file from an OpenAPI yaml spec. For use with the `@backstage/backend-openapi-utils` ApiRouter type."
55
- ).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/generate-6f0190dd.cjs.js'); }).then((m) => m.bulkCommand)));
55
+ ).action(lazy(() => Promise.resolve().then(function () { return require('./cjs/generate-242d2277.cjs.js'); }).then((m) => m.bulkCommand)));
56
56
  openApiCommand.command("lint [paths...]").description("Lint OpenAPI schemas.").option(
57
57
  "--strict",
58
58
  "Fail on any linting severity messages, not just errors."
@@ -101,7 +101,7 @@ function lazy(getActionFunc) {
101
101
  };
102
102
  }
103
103
 
104
- var version = "0.3.2-next.1";
104
+ var version = "0.3.3-next.0";
105
105
 
106
106
  const main = (argv) => {
107
107
  commander.program.name("backstage-repo-tools").version(version);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@backstage/repo-tools",
3
3
  "description": "CLI for Backstage repo tooling ",
4
- "version": "0.3.2-next.1",
4
+ "version": "0.3.3-next.0",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -33,8 +33,8 @@
33
33
  "@apidevtools/swagger-parser": "^10.1.0",
34
34
  "@apisyouwonthate/style-guide": "^1.4.0",
35
35
  "@backstage/cli-common": "^0.1.12",
36
- "@backstage/cli-node": "^0.1.2-next.1",
37
- "@backstage/errors": "^1.2.1-next.0",
36
+ "@backstage/cli-node": "^0.1.2",
37
+ "@backstage/errors": "^1.2.1",
38
38
  "@manypkg/get-packages": "^1.1.3",
39
39
  "@microsoft/api-documenter": "^7.19.27",
40
40
  "@microsoft/api-extractor": "^7.33.7",
@@ -57,7 +57,7 @@
57
57
  "ts-node": "^10.0.0"
58
58
  },
59
59
  "devDependencies": {
60
- "@backstage/cli": "^0.22.9-next.1",
60
+ "@backstage/cli": "^0.22.10-next.0",
61
61
  "@backstage/types": "^1.1.0",
62
62
  "@types/is-glob": "^4.0.2",
63
63
  "@types/mock-fs": "^4.13.0",