vovk-cli 0.0.1-draft.395 → 0.0.1-draft.397

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 %>,<% }) %>
@@ -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
  });
@@ -146,7 +146,11 @@ export async function generate({ isEnsuringClient = false, isBundle = false, pro
146
146
  config: projectInfo.config,
147
147
  rootEntry: config.rootEntry,
148
148
  schema: fullSchema,
149
- outputConfigs: [templateDef.outputConfig ?? {}, { origin: cliGenerateOptions?.origin }],
149
+ outputConfigs: [
150
+ config.composedClient.outputConfig ?? {},
151
+ templateDef.outputConfig ?? {},
152
+ { origin: cliGenerateOptions?.origin },
153
+ ],
150
154
  projectPackageJson,
151
155
  isBundle,
152
156
  segmentName: null,
@@ -234,7 +238,11 @@ export async function generate({ isEnsuringClient = false, isBundle = false, pro
234
238
  schema: fullSchema,
235
239
  rootEntry: config.rootEntry,
236
240
  segmentName,
237
- outputConfigs: [templateDef.outputConfig ?? {}, { origin: cliGenerateOptions?.origin }],
241
+ outputConfigs: [
242
+ config.segmentedClient.outputConfig ?? {},
243
+ templateDef.outputConfig ?? {},
244
+ { origin: cliGenerateOptions?.origin },
245
+ ],
238
246
  isBundle,
239
247
  projectPackageJson,
240
248
  });
@@ -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' : '',
@@ -25,6 +25,11 @@ export default function getConfig({ configPath, cwd, logLevel, }: {
25
25
  outDir?: string;
26
26
  fromTemplates?: string[];
27
27
  prettifyClient?: boolean;
28
+ outputConfig?: import("vovk").VovkOutputConfig<{
29
+ fetcher?: string | [string, string] | [string];
30
+ validateOnClient?: string | [string, string] | [string] | null;
31
+ createRPC?: string | [string, string] | [string];
32
+ }>;
28
33
  } & ({
29
34
  excludeSegments?: never;
30
35
  includeSegments?: string[];
@@ -37,6 +42,11 @@ export default function getConfig({ configPath, cwd, logLevel, }: {
37
42
  outDir?: string;
38
43
  fromTemplates?: string[];
39
44
  prettifyClient?: boolean;
45
+ outputConfig?: import("vovk").VovkOutputConfig<{
46
+ fetcher?: string | [string, string] | [string];
47
+ validateOnClient?: string | [string, string] | [string] | null;
48
+ createRPC?: string | [string, string] | [string];
49
+ }>;
40
50
  } & ({
41
51
  excludeSegments?: never;
42
52
  includeSegments?: string[];
@@ -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
  }
@@ -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.395",
3
+ "version": "0.0.1-draft.397",
4
4
  "bin": {
5
5
  "vovk": "./dist/index.mjs"
6
6
  },
@@ -35,7 +35,7 @@
35
35
  },
36
36
  "homepage": "https://vovk.dev",
37
37
  "peerDependencies": {
38
- "vovk": "^3.0.0-draft.471",
38
+ "vovk": "^3.0.0-draft.473",
39
39
  "vovk-ajv": "^0.0.0-draft.113",
40
40
  "vovk-client": "^0.0.4-draft.140",
41
41
  "vovk-python": "^0.0.1-draft.82",