vovk-cli 0.0.1-draft.394 → 0.0.1-draft.396

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.
@@ -9,7 +9,7 @@ import segment<%= i %> from './<%= t.schemaOutDir %>/<%= segment.segmentName ||
9
9
  <% if(t.isVovkProject) { %>
10
10
  import meta from './<%= t.schemaOutDir %>/_meta.json' with { type: "json" };
11
11
  <% } else { %>
12
- const meta = <%- JSON.stringify(t.publicMeta, null, 2) %>;
12
+ const meta = <%- JSON.stringify(t.schema.meta, null, 2) %>;
13
13
  <% } %>
14
14
  const segments = {<% Object.values(t.schema.segments).filter((segment) => segment.emitSchema && segment.segmentType !== 'mixin').forEach((segment, i) => { %>
15
15
  '<%= segment.segmentName %>': segment<%= i %>,<% }) %>
@@ -31,6 +31,8 @@ export async function bundle({ projectInfo, fullSchema, cliBundleOptions, }) {
31
31
  openapiGetModuleName: cliBundleOptions?.openapiGetModuleName,
32
32
  openapiGetMethodName: cliBundleOptions?.openapiGetMethodName,
33
33
  openapiRootUrl: cliBundleOptions?.openapiRootUrl,
34
+ openapiMixinName: cliBundleOptions?.openapiMixinName,
35
+ openapiFallback: cliBundleOptions?.openapiFallback,
34
36
  composedFrom: [BuiltInTemplateName.ts],
35
37
  composedOut: prebundleOutDirAbsolute,
36
38
  composedOnly: true,
@@ -285,7 +285,6 @@ export class VovkDev {
285
285
  segments: this.#schemaSegments,
286
286
  meta: getMetaSchema({
287
287
  config: this.#projectInfo.config,
288
- useexposeConfigKeys: false,
289
288
  }),
290
289
  };
291
290
  return generate({
@@ -7,7 +7,6 @@ export default async function writeMetaJson(schemaOutAbsolutePath, projectInfo)
7
7
  const metaJsonPath = path.join(schemaOutAbsolutePath, META_FILE_NAME + '.json');
8
8
  const metaStr = JSON.stringify(getMetaSchema({
9
9
  config: projectInfo.config,
10
- useexposeConfigKeys: true,
11
10
  }), null, 2);
12
11
  const existingStr = await fs.readFile(metaJsonPath, 'utf-8').catch(() => null);
13
12
  if (existingStr !== metaStr) {
@@ -21,7 +21,7 @@ export default async function ensureClient(projectInfo, locatedSegments) {
21
21
  fullSchema: {
22
22
  $schema: VovkSchemaIdEnum.SCHEMA,
23
23
  segments: getEmptySegmentRecordSchema(locatedSegments.map(({ segmentName }) => segmentName)),
24
- meta: getMetaSchema({ config: projectInfo.config, useexposeConfigKeys: false }),
24
+ meta: getMetaSchema({ config: projectInfo.config }),
25
25
  },
26
26
  locatedSegments,
27
27
  });
@@ -11,7 +11,6 @@ export async function getProjectFullSchema({ schemaOutAbsolutePath, isNextInstal
11
11
  segments: {},
12
12
  meta: getMetaSchema({
13
13
  config,
14
- useexposeConfigKeys: false,
15
14
  }),
16
15
  };
17
16
  const isEmptyLogOrWarn = isNextInstalled ? log.warn : log.debug;
@@ -9,7 +9,6 @@ import prettify from '../utils/prettify.mjs';
9
9
  import { ROOT_SEGMENT_FILE_NAME } from '../dev/writeOneSegmentSchemaFile.mjs';
10
10
  import { compileJSONSchemaToTypeScriptType } from '../utils/compileJSONSchemaToTypeScriptType.mjs';
11
11
  import getTemplateClientImports from './getTemplateClientImports.mjs';
12
- import getMetaSchema from '../getProjectInfo/getMetaSchema.mjs';
13
12
  export function normalizeOutTemplatePath(out, packageJson) {
14
13
  return out.replace('[package_name]', packageJson.name?.replace(/-/g, '_') ?? 'my_package_name');
15
14
  }
@@ -61,7 +60,6 @@ templateContent, matterResult: { data, content }, openAPIObject, package: packag
61
60
  YAML,
62
61
  TOML,
63
62
  getFirstLineBanner,
64
- publicMeta: getMetaSchema({ config: projectConfig, useexposeConfigKeys: true }),
65
63
  nodeNextResolutionExt: {
66
64
  ts: isNodeNextResolution ? '.ts' : '',
67
65
  js: isNodeNextResolution ? '.js' : '',
@@ -86,7 +86,7 @@ export default async function getConfig({ configPath, cwd, logLevel, }) {
86
86
  config.exposeConfigKeys = conf.exposeConfigKeys;
87
87
  } // else it's false and exposeConfigKeys already is []
88
88
  if (!userConfig) {
89
- log.warn(`Unable to load config at ${chalkHighlightThing(cwd)}. Using default values. ${error ?? ''}`);
89
+ log.warn(`Unable to load config at ${chalkHighlightThing(cwd + '/')}. Using default values. ${error ?? ''}`);
90
90
  }
91
91
  return { config, srcRoot, configAbsolutePaths, userConfig, log };
92
92
  }
@@ -1,7 +1,6 @@
1
1
  import { VovkSchemaIdEnum, type VovkStrictConfig } from 'vovk';
2
- export default function getMetaSchema({ config, useexposeConfigKeys, }: {
2
+ export default function getMetaSchema({ config }: {
3
3
  config: VovkStrictConfig;
4
- useexposeConfigKeys: boolean;
5
4
  }): {
6
5
  config: VovkStrictConfig;
7
6
  $schema: VovkSchemaIdEnum;
@@ -2,26 +2,24 @@ import { VovkSchemaIdEnum } from 'vovk';
2
2
  import pick from 'lodash/pick.js';
3
3
  import mapValues from 'lodash/mapValues.js';
4
4
  import omit from 'lodash/omit.js';
5
- export default function getMetaSchema({ config, useexposeConfigKeys, }) {
5
+ export default function getMetaSchema({ config }) {
6
6
  return {
7
7
  $schema: VovkSchemaIdEnum.META,
8
8
  ...{
9
- config: useexposeConfigKeys
10
- ? (config
11
- ? pick({
12
- ...config,
13
- outputConfig: config.outputConfig
14
- ? {
15
- ...config.outputConfig,
16
- // TODO: Dirty fix! Need to think of a better way to avoid emission of mixins.
17
- segments: config.outputConfig.segments
18
- ? mapValues(config.outputConfig.segments, (segment) => omit(segment, ['openAPIMixin']))
19
- : undefined,
20
- }
21
- : undefined,
22
- }, [...config.exposeConfigKeys, '$schema'])
23
- : {})
24
- : config,
9
+ config: (config
10
+ ? pick({
11
+ ...config,
12
+ outputConfig: config.outputConfig
13
+ ? {
14
+ ...config.outputConfig,
15
+ // TODO: Dirty fix! Need to think of a better way to avoid emission of mixins.
16
+ segments: config.outputConfig.segments
17
+ ? mapValues(config.outputConfig.segments, (segment) => omit(segment, ['openAPIMixin']))
18
+ : undefined,
19
+ }
20
+ : undefined,
21
+ }, [...config.exposeConfigKeys, '$schema'])
22
+ : {}),
25
23
  },
26
24
  };
27
25
  }
package/dist/index.mjs CHANGED
@@ -94,13 +94,13 @@ program
94
94
  .option('--schema, --schema-path <path>', 'path to schema folder (default: ./.vovk-schema)')
95
95
  .option('--config, --config-path <config>', 'path to config file')
96
96
  .option('--origin <url>', 'set the origin URL for the generated client')
97
- .option('--watch [s]', 'watch for changes in schema or openapi spec and regenerate client; accepts a number in seconds to throttle the watcher or make an HTTP request to the OpenAPI spec URL')
98
- .option('--openapi, --openapi-spec <openapi_path_or_urls...>', 'use OpenAPI schema for client generation')
99
- .option('--openapi-module-name, --openapi-get-module-name <names...>', 'module names corresponding to the index of --openapi option')
100
- .option('--openapi-method-name, --openapi-get-method-name <names...>', 'method names corresponding to the index of --openapi option')
97
+ .option('--watch [s]', 'watch for changes in schema or openapi spec and regenerate client; accepts a number in seconds to throttle the watcher or make an HTTP request to the OpenAPI spec URLs')
98
+ .option('--openapi, --openapi-spec <openapi_path_or_urls...>', 'use OpenAPI mixins for client generation')
99
+ .option('--openapi-module-name, --openapi-get-module-name <names...>', 'module name strategies corresponding to the index of --openapi option')
100
+ .option('--openapi-method-name, --openapi-get-method-name <names...>', 'method name strategies corresponding to the index of --openapi option')
101
101
  .option('--openapi-root-url <urls...>', 'root URLs corresponding to the index of --openapi option')
102
102
  .option('--openapi-mixin-name <names...>', 'mixin names corresponding to the index of --openapi option')
103
- .option('--openapi-fallback <paths...>', 'save OpenAPI spec and use it as a fallback if URL is not available')
103
+ .option('--openapi-fallback <paths...>', 'save OpenAPI spec corresponding to the index of --openapi option to a local file and use it as a fallback if URL is not available')
104
104
  .option('--log-level <level>', 'set the log level')
105
105
  .action(async (cliGenerateOptions) => {
106
106
  const projectInfo = await getProjectInfo({
@@ -126,10 +126,12 @@ program
126
126
  .option('--schema, --schema-path <path>', 'path to schema folder (default: .vovk-schema)')
127
127
  .option('--config, --config-path <config>', 'path to config file')
128
128
  .option('--origin <url>', 'set the origin URL for the generated client')
129
- .option('--openapi, --openapi-spec <openapi_path_or_urls...>', 'use OpenAPI schema instead of Vovk schema')
130
- .option('--openapi-get-module-name <names...>', 'module names corresponding to the index of --openapi option')
131
- .option('--openapi-get-method-name <names...>', 'method names corresponding to the index of --openapi option')
129
+ .option('--openapi, --openapi-spec <openapi_path_or_urls...>', 'use OpenAPI mixins for client generation')
130
+ .option('--openapi-module-name, --openapi-get-module-name <names...>', 'module name strategies corresponding to the index of --openapi option')
131
+ .option('--openapi-method-name, --openapi-get-method-name <names...>', 'method name strategies corresponding to the index of --openapi option')
132
132
  .option('--openapi-root-url <urls...>', 'root URLs corresponding to the index of --openapi option')
133
+ .option('--openapi-mixin-name <names...>', 'mixin names corresponding to the index of --openapi option')
134
+ .option('--openapi-fallback <paths...>', 'save OpenAPI spec corresponding to the index of --openapi option to a local file and use it as a fallback if URL is not available')
133
135
  .option('--log-level <level>', 'set the log level')
134
136
  .action(async (cliBundleOptions) => {
135
137
  const projectInfo = await getProjectInfo({
package/dist/types.d.mts CHANGED
@@ -50,6 +50,7 @@ export interface BundleOptions extends Partial<Pick<VovkStrictConfig['bundle'],
50
50
  openapiGetMethodName?: string[];
51
51
  openapiRootUrl?: string[];
52
52
  openapiMixinName?: string[];
53
+ openapiFallback?: string[];
53
54
  logLevel?: LogLevelNames;
54
55
  }
55
56
  export interface InitOptions {
@@ -1,5 +1,6 @@
1
1
  import fs from 'node:fs/promises';
2
2
  import path from 'node:path';
3
+ import chalkHighlightThing from './chalkHighlightThing.mjs';
3
4
  let cachedPromise;
4
5
  export function getPackageJson(cwd, log) {
5
6
  const pkgPath = path.join(cwd, 'package.json');
@@ -12,7 +13,7 @@ export function getPackageJson(cwd, log) {
12
13
  .then((content) => JSON.parse(content))
13
14
  .catch(() => {
14
15
  cachedPromise = undefined;
15
- log.warn(`Failed to read package.json at ${pkgPath}. Using a fallback.`);
16
+ log.warn(`Unable to load package.json at ${chalkHighlightThing(pkgPath)}. Using an empty fallback.`);
16
17
  return {
17
18
  name: 'unknown',
18
19
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk-cli",
3
- "version": "0.0.1-draft.394",
3
+ "version": "0.0.1-draft.396",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },
@@ -35,11 +35,11 @@
35
35
  },
36
36
  "homepage": "https://vovk.dev",
37
37
  "peerDependencies": {
38
- "vovk": "^3.0.0-draft.470",
39
- "vovk-ajv": "^0.0.0-draft.112",
40
- "vovk-client": "^0.0.4-draft.139",
41
- "vovk-python": "^0.0.1-draft.81",
42
- "vovk-rust": "^0.0.1-draft.67"
38
+ "vovk": "^3.0.0-draft.472",
39
+ "vovk-ajv": "^0.0.0-draft.113",
40
+ "vovk-client": "^0.0.4-draft.140",
41
+ "vovk-python": "^0.0.1-draft.82",
42
+ "vovk-rust": "^0.0.1-draft.68"
43
43
  },
44
44
  "optionalDependencies": {
45
45
  "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.44"
@@ -83,10 +83,7 @@
83
83
  "create-next-app": "^15.5.4",
84
84
  "http-server": "^14.1.1",
85
85
  "node-pty": "^1.0.0",
86
- "tsdown": "^0.15.12",
86
+ "tsdown": "^0.16.0",
87
87
  "zod": "^4.1.11"
88
- },
89
- "overrides": {
90
- "rolldown-plugin-dts": "0.17.3"
91
88
  }
92
89
  }