vovk-cli 0.0.1-draft.397 → 0.0.1-draft.398
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/client-templates/{cjs → cjsBase}/index.cjs.ejs +0 -2
- package/client-templates/{cjs → cjsBase}/index.d.cts.ejs +0 -1
- package/client-templates/{mjs → mjsBase}/index.d.mts.ejs +0 -1
- package/client-templates/{mjs → mjsBase}/index.mjs.ejs +1 -2
- package/client-templates/schemaCjs/schema.cjs.ejs +1 -1
- package/client-templates/{ts → tsBase}/index.ts.ejs +1 -8
- package/dist/bundle/index.mjs +1 -1
- package/dist/generate/writeOneClientFile.mjs +1 -1
- package/dist/getProjectInfo/getConfig/getTemplateDefs.d.mts +3 -0
- package/dist/getProjectInfo/getConfig/getTemplateDefs.mjs +27 -9
- package/dist/getProjectInfo/getMetaSchema.d.mts +85 -1
- package/dist/getProjectInfo/getMetaSchema.mjs +5 -18
- package/package.json +2 -2
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<%- t.getFirstLineBanner() %>
|
|
2
2
|
const { createRPC } = require('<%= t.commonImports.createRPC %>');
|
|
3
3
|
const { schema } = require('./schema.cjs');
|
|
4
|
-
const { openapi } = require('./openapi.cjs');
|
|
5
4
|
<% Object.entries(t.reExports).forEach(([reExportWhatCommaDivisible, reExportFrom]) => {
|
|
6
5
|
reExportWhatCommaDivisible.split(/\s*,\s*/).forEach((reExportWhat) => { %>
|
|
7
6
|
exports['<%= reExportWhat.split(/\s+as\s+/)[1] ?? reExportWhat %>'] = require('<%= reExportFrom %>')['<%= reExportWhat.split(/\s+as\s+/)[0] %>'];
|
|
@@ -17,4 +16,3 @@ exports.<%= rpcModuleName %> = createRPC(
|
|
|
17
16
|
<% })
|
|
18
17
|
}) %>
|
|
19
18
|
exports.schema = schema;
|
|
20
|
-
exports.openapi = openapi;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<%- t.getFirstLineBanner() %>
|
|
2
2
|
import { createRPC } from '<%= t.commonImports.module.createRPC %>';
|
|
3
3
|
import { schema } from './schema.cjs';
|
|
4
|
-
import { openapi } from './openapi.cjs';
|
|
5
4
|
<% Object.entries(t.reExports).forEach(([reExportWhat, reExportFrom]) => { %>
|
|
6
5
|
export { <%= reExportWhat %> } from '<%= reExportFrom %>';
|
|
7
6
|
<% }) %>
|
|
@@ -16,4 +15,4 @@ export const <%= rpcModuleName %> = createRPC(
|
|
|
16
15
|
});
|
|
17
16
|
});
|
|
18
17
|
%>
|
|
19
|
-
export { schema
|
|
18
|
+
export { schema };
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<% if(t.isVovkProject) { %>
|
|
3
3
|
const meta = require('./<%= t.schemaOutDir %>/_meta.json');
|
|
4
4
|
<% } else { %>
|
|
5
|
-
const meta = <%- JSON.stringify(t.
|
|
5
|
+
const meta = <%- JSON.stringify(t.schema.meta, null, 2) %>;
|
|
6
6
|
<% } %>
|
|
7
7
|
|
|
8
8
|
<% if(t.hasMixins) { %>
|
|
@@ -2,13 +2,6 @@
|
|
|
2
2
|
import type { VovkFetcher } from 'vovk';
|
|
3
3
|
import { createRPC } from '<%= t.commonImports.module.createRPC %>';
|
|
4
4
|
import { schema } from './schema<%= t.nodeNextResolutionExt.ts %>';
|
|
5
|
-
<% if(t.isBundle) { %>
|
|
6
|
-
import { openapi } from './openapi<%= t.nodeNextResolutionExt.ts %>';
|
|
7
|
-
<% } else { %>
|
|
8
|
-
// import { openapi } from './openapi<%= t.nodeNextResolutionExt.ts %>';
|
|
9
|
-
// TODO: This is a temporary fix for https://github.com/rolldown/tsdown/issues/528#issuecomment-3476284358
|
|
10
|
-
import openapi from './openapi.json' with { type: "json" };
|
|
11
|
-
<% } %>
|
|
12
5
|
<% Object.values(t.schema.segments).filter((segment) => segment.emitSchema).forEach((segment, i) => { if(segment.segmentType !== 'mixin') { %>
|
|
13
6
|
import type { Controllers as Controllers<%= i %> } from "<%= t.segmentMeta[segment.segmentName].segmentImportPath %>";
|
|
14
7
|
<% }
|
|
@@ -28,7 +21,7 @@ export const <%= rpcModuleName %> = createRPC<<%= segment.segmentType === 'mixin
|
|
|
28
21
|
);
|
|
29
22
|
<% })
|
|
30
23
|
}) %>
|
|
31
|
-
export { schema
|
|
24
|
+
export { schema };
|
|
32
25
|
<% if (t.hasMixins) { %>
|
|
33
26
|
export { Mixins };
|
|
34
27
|
<% } %>
|
package/dist/bundle/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ export async function bundle({ projectInfo, fullSchema, cliBundleOptions, }) {
|
|
|
33
33
|
openapiRootUrl: cliBundleOptions?.openapiRootUrl,
|
|
34
34
|
openapiMixinName: cliBundleOptions?.openapiMixinName,
|
|
35
35
|
openapiFallback: cliBundleOptions?.openapiFallback,
|
|
36
|
-
composedFrom: [BuiltInTemplateName.
|
|
36
|
+
composedFrom: [BuiltInTemplateName.tsBase],
|
|
37
37
|
composedOut: prebundleOutDirAbsolute,
|
|
38
38
|
composedOnly: true,
|
|
39
39
|
composedIncludeSegments: cliBundleOptions.includeSegments ?? bundleConfig.includeSegments,
|
|
@@ -84,7 +84,7 @@ templateContent, matterResult: { data, content }, openAPIObject, package: packag
|
|
|
84
84
|
segmentName: sName,
|
|
85
85
|
isBundle,
|
|
86
86
|
outCwdRelativeDir,
|
|
87
|
-
outputConfigs: [templateDef.outputConfig ?? {}],
|
|
87
|
+
outputConfigs: [projectConfig[configKey].outputConfig ?? {}, templateDef.outputConfig ?? {}],
|
|
88
88
|
});
|
|
89
89
|
const imports = configKey === 'composedClient' ? clientImports['composedClient'] : clientImports['segmentedClient'][sName];
|
|
90
90
|
return [sName, imports];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export var BuiltInTemplateName;
|
|
2
2
|
(function (BuiltInTemplateName) {
|
|
3
3
|
// ts/js
|
|
4
|
+
BuiltInTemplateName["tsBase"] = "tsBase";
|
|
5
|
+
BuiltInTemplateName["cjsBase"] = "cjsBase";
|
|
6
|
+
BuiltInTemplateName["mjsBase"] = "mjsBase";
|
|
4
7
|
BuiltInTemplateName["ts"] = "ts";
|
|
5
8
|
BuiltInTemplateName["cjs"] = "cjs";
|
|
6
9
|
BuiltInTemplateName["mjs"] = "mjs";
|
|
@@ -44,30 +47,45 @@ export default function getTemplateDefs(userTemplateDefs = {}) {
|
|
|
44
47
|
[BuiltInTemplateName.openapiJson]: {
|
|
45
48
|
templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.openapiJson}/`,
|
|
46
49
|
},
|
|
47
|
-
[BuiltInTemplateName.
|
|
48
|
-
templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.
|
|
50
|
+
[BuiltInTemplateName.tsBase]: {
|
|
51
|
+
templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.tsBase}/`,
|
|
49
52
|
requires: {
|
|
50
53
|
[BuiltInTemplateName.schemaTs]: './',
|
|
51
|
-
[BuiltInTemplateName.openapiTs]: './',
|
|
52
54
|
[BuiltInTemplateName.mixins]: './', // used conditionally if OpenAPI mixins are used
|
|
53
55
|
},
|
|
54
56
|
},
|
|
55
|
-
[BuiltInTemplateName.
|
|
56
|
-
templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.
|
|
57
|
+
[BuiltInTemplateName.cjsBase]: {
|
|
58
|
+
templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.cjsBase}/`,
|
|
57
59
|
requires: {
|
|
58
60
|
[BuiltInTemplateName.schemaCjs]: './',
|
|
59
|
-
[BuiltInTemplateName.openapiCjs]: './',
|
|
60
61
|
[BuiltInTemplateName.mixins]: './', // used conditionally if OpenAPI mixins are used
|
|
61
62
|
},
|
|
62
63
|
},
|
|
63
|
-
[BuiltInTemplateName.
|
|
64
|
-
templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.
|
|
64
|
+
[BuiltInTemplateName.mjsBase]: {
|
|
65
|
+
templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.mjsBase}/`,
|
|
65
66
|
requires: {
|
|
66
67
|
[BuiltInTemplateName.schemaCjs]: './',
|
|
67
|
-
[BuiltInTemplateName.openapiCjs]: './',
|
|
68
68
|
[BuiltInTemplateName.mixins]: './', // used conditionally if OpenAPI mixins are used
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
|
+
[BuiltInTemplateName.ts]: {
|
|
72
|
+
requires: {
|
|
73
|
+
[BuiltInTemplateName.tsBase]: './',
|
|
74
|
+
[BuiltInTemplateName.openapiTs]: './',
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
[BuiltInTemplateName.cjs]: {
|
|
78
|
+
requires: {
|
|
79
|
+
[BuiltInTemplateName.cjsBase]: './',
|
|
80
|
+
[BuiltInTemplateName.openapiCjs]: './',
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
[BuiltInTemplateName.mjs]: {
|
|
84
|
+
requires: {
|
|
85
|
+
[BuiltInTemplateName.mjsBase]: './',
|
|
86
|
+
[BuiltInTemplateName.openapiCjs]: './',
|
|
87
|
+
},
|
|
88
|
+
},
|
|
71
89
|
[BuiltInTemplateName.schemaTs]: {
|
|
72
90
|
templatePath: `vovk-cli/client-templates/${BuiltInTemplateName.schemaTs}/`,
|
|
73
91
|
},
|
|
@@ -2,6 +2,90 @@ import { VovkSchemaIdEnum, type VovkStrictConfig } from 'vovk';
|
|
|
2
2
|
export default function getMetaSchema({ config }: {
|
|
3
3
|
config: VovkStrictConfig;
|
|
4
4
|
}): {
|
|
5
|
-
config: VovkStrictConfig;
|
|
6
5
|
$schema: VovkSchemaIdEnum;
|
|
6
|
+
config: Pick<VovkStrictConfig, keyof {
|
|
7
|
+
$schema?: typeof VovkSchemaIdEnum.CONFIG | (string & {});
|
|
8
|
+
exposeConfigKeys?: boolean | (keyof VovkStrictConfig | (string & {}))[];
|
|
9
|
+
schemaOutDir?: string;
|
|
10
|
+
modulesDir?: string;
|
|
11
|
+
rootEntry?: string;
|
|
12
|
+
logLevel?: "error" | "trace" | "debug" | "info" | "warn" | (string & {});
|
|
13
|
+
libs?: {
|
|
14
|
+
ajv?: import("vovk").KnownAny;
|
|
15
|
+
[key: string]: import("vovk").KnownAny;
|
|
16
|
+
};
|
|
17
|
+
devHttps?: boolean;
|
|
18
|
+
composedClient?: {
|
|
19
|
+
enabled?: boolean;
|
|
20
|
+
outDir?: string;
|
|
21
|
+
fromTemplates?: string[];
|
|
22
|
+
prettifyClient?: boolean;
|
|
23
|
+
outputConfig?: import("vovk").VovkOutputConfig<{
|
|
24
|
+
fetcher?: string | [string, string] | [string];
|
|
25
|
+
validateOnClient?: string | [string, string] | [string] | null;
|
|
26
|
+
createRPC?: string | [string, string] | [string];
|
|
27
|
+
}>;
|
|
28
|
+
} & ({
|
|
29
|
+
excludeSegments?: never;
|
|
30
|
+
includeSegments?: string[];
|
|
31
|
+
} | {
|
|
32
|
+
excludeSegments?: string[];
|
|
33
|
+
includeSegments?: never;
|
|
34
|
+
});
|
|
35
|
+
segmentedClient?: {
|
|
36
|
+
enabled?: boolean;
|
|
37
|
+
outDir?: string;
|
|
38
|
+
fromTemplates?: string[];
|
|
39
|
+
prettifyClient?: boolean;
|
|
40
|
+
outputConfig?: import("vovk").VovkOutputConfig<{
|
|
41
|
+
fetcher?: string | [string, string] | [string];
|
|
42
|
+
validateOnClient?: string | [string, string] | [string] | null;
|
|
43
|
+
createRPC?: string | [string, string] | [string];
|
|
44
|
+
}>;
|
|
45
|
+
} & ({
|
|
46
|
+
excludeSegments?: never;
|
|
47
|
+
includeSegments?: string[];
|
|
48
|
+
} | {
|
|
49
|
+
excludeSegments?: string[];
|
|
50
|
+
includeSegments?: never;
|
|
51
|
+
});
|
|
52
|
+
bundle?: {
|
|
53
|
+
requires?: Record<string, string>;
|
|
54
|
+
prebundleOutDir?: string;
|
|
55
|
+
keepPrebundleDir?: boolean;
|
|
56
|
+
outDir?: string;
|
|
57
|
+
build: (options: {
|
|
58
|
+
outDir: string;
|
|
59
|
+
prebundleDir: string;
|
|
60
|
+
entry: string;
|
|
61
|
+
}) => Promise<void>;
|
|
62
|
+
outputConfig?: import("vovk").VovkOutputConfig<{
|
|
63
|
+
fetcher?: string | [string, string] | [string];
|
|
64
|
+
validateOnClient?: string | [string, string] | [string] | null;
|
|
65
|
+
createRPC?: string | [string, string] | [string];
|
|
66
|
+
}>;
|
|
67
|
+
} & ({
|
|
68
|
+
excludeSegments?: never;
|
|
69
|
+
includeSegments?: string[];
|
|
70
|
+
} | {
|
|
71
|
+
excludeSegments?: string[];
|
|
72
|
+
includeSegments?: never;
|
|
73
|
+
});
|
|
74
|
+
clientTemplateDefs?: Record<string, import("vovk/types").ClientTemplateDef>;
|
|
75
|
+
rootSegmentModulesDirName?: string;
|
|
76
|
+
moduleTemplates?: {
|
|
77
|
+
service?: string;
|
|
78
|
+
controller?: string;
|
|
79
|
+
[key: string]: string | undefined;
|
|
80
|
+
};
|
|
81
|
+
outputConfig?: import("vovk").VovkOutputConfig<{
|
|
82
|
+
fetcher?: string | [string, string] | [string];
|
|
83
|
+
validateOnClient?: string | [string, string] | [string] | null;
|
|
84
|
+
createRPC?: string | [string, string] | [string];
|
|
85
|
+
}> & {
|
|
86
|
+
segments?: Record<string, import("vovk/types").VovkSegmentConfig>;
|
|
87
|
+
};
|
|
88
|
+
}> | {
|
|
89
|
+
$schema: VovkSchemaIdEnum;
|
|
90
|
+
};
|
|
7
91
|
};
|
|
@@ -1,25 +1,12 @@
|
|
|
1
1
|
import { VovkSchemaIdEnum } from 'vovk';
|
|
2
2
|
import pick from 'lodash/pick.js';
|
|
3
|
-
import mapValues from 'lodash/mapValues.js';
|
|
4
|
-
import omit from 'lodash/omit.js';
|
|
5
3
|
export default function getMetaSchema({ config }) {
|
|
6
4
|
return {
|
|
7
5
|
$schema: VovkSchemaIdEnum.META,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
: {}),
|
|
23
|
-
},
|
|
6
|
+
config: config
|
|
7
|
+
? pick(config, [...config.exposeConfigKeys, '$schema'])
|
|
8
|
+
: {
|
|
9
|
+
$schema: VovkSchemaIdEnum.CONFIG,
|
|
10
|
+
},
|
|
24
11
|
};
|
|
25
12
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vovk-cli",
|
|
3
|
-
"version": "0.0.1-draft.
|
|
3
|
+
"version": "0.0.1-draft.398",
|
|
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.
|
|
38
|
+
"vovk": "^3.0.0-draft.474",
|
|
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",
|