vovk-cli 0.0.1-draft.326 → 0.0.1-draft.327
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/dist/bundle/index.mjs +1 -0
- package/dist/generate/generate.mjs +2 -0
- package/dist/generate/writeOneClientFile.d.mts +2 -1
- package/dist/generate/writeOneClientFile.mjs +1 -2
- package/dist/getProjectInfo/getConfig/index.d.mts +1 -0
- package/dist/getProjectInfo/getConfig/index.mjs +1 -0
- package/dist/types.d.mts +2 -0
- package/package.json +1 -1
package/dist/bundle/index.mjs
CHANGED
|
@@ -30,6 +30,7 @@ export async function bundle({ projectInfo, fullSchema, cliBundleOptions, }) {
|
|
|
30
30
|
package: bundleConfig.package,
|
|
31
31
|
readme: bundleConfig.readme,
|
|
32
32
|
cliGenerateOptions: {
|
|
33
|
+
origin: cliBundleOptions?.origin ?? bundleConfig.origin,
|
|
33
34
|
openapiSpec: cliBundleOptions?.openapiSpec,
|
|
34
35
|
openapiGetModuleName: cliBundleOptions?.openapiGetModuleName,
|
|
35
36
|
openapiGetMethodName: cliBundleOptions?.openapiGetMethodName,
|
|
@@ -173,6 +173,7 @@ export async function generate({ isEnsuringClient = false, isBundle = false, pro
|
|
|
173
173
|
isVovkProject,
|
|
174
174
|
vovkCliPackage,
|
|
175
175
|
isBundle,
|
|
176
|
+
origin: cliGenerateOptions?.origin ?? templateDef.origin ?? config.origin,
|
|
176
177
|
});
|
|
177
178
|
const outAbsoluteDir = path.resolve(cwd, outCwdRelativeDir);
|
|
178
179
|
return {
|
|
@@ -258,6 +259,7 @@ export async function generate({ isEnsuringClient = false, isBundle = false, pro
|
|
|
258
259
|
isVovkProject,
|
|
259
260
|
vovkCliPackage,
|
|
260
261
|
isBundle,
|
|
262
|
+
origin: cliGenerateOptions?.origin ?? templateDef.origin ?? config.origin,
|
|
261
263
|
});
|
|
262
264
|
return {
|
|
263
265
|
written,
|
|
@@ -5,7 +5,7 @@ import type { ClientTemplateFile } from './getClientTemplateFiles.mjs';
|
|
|
5
5
|
import type { ClientImports } from './getTemplateClientImports.mjs';
|
|
6
6
|
import type { Segment } from '../locateSegments.mjs';
|
|
7
7
|
export declare function normalizeOutTemplatePath(out: string, packageJson: PackageJson): string;
|
|
8
|
-
export default function writeOneClientFile({ cwd, projectInfo, clientTemplateFile, fullSchema, prettifyClient, segmentName, imports, templateContent, matterResult: { data, content }, package: packageJson, readme, isEnsuringClient, outCwdRelativeDir, templateDef, locatedSegments, isNodeNextResolution, hasMixins, isVovkProject, vovkCliPackage, isBundle, }: {
|
|
8
|
+
export default function writeOneClientFile({ cwd, projectInfo, clientTemplateFile, fullSchema, prettifyClient, segmentName, imports, templateContent, matterResult: { data, content }, package: packageJson, readme, isEnsuringClient, outCwdRelativeDir, templateDef, locatedSegments, isNodeNextResolution, hasMixins, isVovkProject, vovkCliPackage, isBundle, origin, }: {
|
|
9
9
|
cwd: string;
|
|
10
10
|
projectInfo: ProjectInfo;
|
|
11
11
|
clientTemplateFile: ClientTemplateFile;
|
|
@@ -31,6 +31,7 @@ export default function writeOneClientFile({ cwd, projectInfo, clientTemplateFil
|
|
|
31
31
|
isVovkProject: boolean;
|
|
32
32
|
vovkCliPackage: PackageJson;
|
|
33
33
|
isBundle: boolean;
|
|
34
|
+
origin: string | null;
|
|
34
35
|
}): Promise<{
|
|
35
36
|
written: boolean;
|
|
36
37
|
}>;
|
|
@@ -11,9 +11,8 @@ import { compileJSONSchemaToTypeScriptType } from '../utils/compileJSONSchemaToT
|
|
|
11
11
|
export function normalizeOutTemplatePath(out, packageJson) {
|
|
12
12
|
return out.replace('[package_name]', packageJson.name?.replace(/-/g, '_') ?? 'my_package_name');
|
|
13
13
|
}
|
|
14
|
-
export default async function writeOneClientFile({ cwd, projectInfo, clientTemplateFile, fullSchema, prettifyClient, segmentName, imports, templateContent, matterResult: { data, content }, package: packageJson, readme, isEnsuringClient, outCwdRelativeDir, templateDef, locatedSegments, isNodeNextResolution, hasMixins, isVovkProject, vovkCliPackage, isBundle, }) {
|
|
14
|
+
export default async function writeOneClientFile({ cwd, projectInfo, clientTemplateFile, fullSchema, prettifyClient, segmentName, imports, templateContent, matterResult: { data, content }, package: packageJson, readme, isEnsuringClient, outCwdRelativeDir, templateDef, locatedSegments, isNodeNextResolution, hasMixins, isVovkProject, vovkCliPackage, isBundle, origin, }) {
|
|
15
15
|
const { config, apiRoot } = projectInfo;
|
|
16
|
-
const origin = templateDef?.origin ?? config.origin ?? null;
|
|
17
16
|
const { templateFilePath, relativeDir } = clientTemplateFile;
|
|
18
17
|
const locatedSegmentsByName = _.keyBy(locatedSegments, 'segmentName');
|
|
19
18
|
const outPath = normalizeOutTemplatePath(path.resolve(cwd, outCwdRelativeDir, typeof segmentName === 'string' ? segmentName || ROOT_SEGMENT_FILE_NAME : '', relativeDir, path.basename(templateFilePath).replace('.ejs', '')), packageJson);
|
|
@@ -56,6 +56,7 @@ export default function getConfig({ configPath, cwd }: {
|
|
|
56
56
|
requires?: Record<string, string>;
|
|
57
57
|
tsClientOutDir?: string;
|
|
58
58
|
dontDeleteTsClientOutDirAfter?: boolean;
|
|
59
|
+
origin?: string;
|
|
59
60
|
package?: import("type-fest").PackageJson;
|
|
60
61
|
readme?: {
|
|
61
62
|
banner?: string;
|
|
@@ -43,6 +43,7 @@ export default async function getConfig({ configPath, cwd }) {
|
|
|
43
43
|
outDir: conf.segmentedClient?.outDir ?? path.join(srcRoot ?? '.', 'client'),
|
|
44
44
|
},
|
|
45
45
|
bundle: {
|
|
46
|
+
origin: conf.bundle?.origin,
|
|
46
47
|
tsClientOutDir: conf.bundle?.tsClientOutDir ?? 'tmp_prebundle',
|
|
47
48
|
dontDeleteTsClientOutDirAfter: conf.bundle?.dontDeleteTsClientOutDirAfter ?? false,
|
|
48
49
|
requires: {
|
package/dist/types.d.mts
CHANGED
|
@@ -17,6 +17,7 @@ export interface GenerateOptions {
|
|
|
17
17
|
prettify?: boolean;
|
|
18
18
|
configPath?: string;
|
|
19
19
|
schemaPath?: string;
|
|
20
|
+
origin?: string;
|
|
20
21
|
openapiSpec?: string[];
|
|
21
22
|
openapiGetModuleName?: string[];
|
|
22
23
|
openapiGetMethodName?: string[];
|
|
@@ -39,6 +40,7 @@ export interface BundleOptions extends Partial<Pick<VovkStrictConfig['bundle'],
|
|
|
39
40
|
config?: string;
|
|
40
41
|
schema?: string;
|
|
41
42
|
outDir?: string;
|
|
43
|
+
origin?: string;
|
|
42
44
|
openapiSpec?: string[];
|
|
43
45
|
openapiGetModuleName?: string[];
|
|
44
46
|
openapiGetMethodName?: string[];
|