vovk-cli 0.0.1-draft.284 → 0.0.1-draft.289
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/index.cjs.ejs +1 -1
- package/client-templates/cjs/index.d.cts.ejs +1 -1
- package/client-templates/mixins/mixins.d.ts.ejs +1 -1
- package/client-templates/mjs/index.d.mts.ejs +1 -1
- package/client-templates/mjs/index.mjs.ejs +1 -1
- package/client-templates/readme/README.md.ejs +2 -1
- package/client-templates/schemaCjs/schema.cjs.ejs +1 -1
- package/client-templates/schemaCjs/schema.d.cts.ejs +1 -1
- package/client-templates/schemaTs/schema.ts.ejs +1 -1
- package/client-templates/ts/index.ts.ejs +1 -1
- package/dist/generate/generate.mjs +3 -1
- package/dist/generate/writeOneClientFile.d.mts +2 -1
- package/dist/generate/writeOneClientFile.mjs +13 -1
- package/dist/getProjectInfo/index.d.mts +3 -0
- package/dist/getProjectInfo/index.mjs +3 -0
- package/dist/index.mjs +3 -3
- package/dist/init/index.mjs +2 -2
- package/package.json +16 -16
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
<%-
|
|
2
|
+
<%- t.getFirstLineBanner() %>
|
|
3
3
|
import type { VovkClientFetcher } from 'vovk';
|
|
4
4
|
import type { fetcher } from '<%= t.imports.module.fetcher %>';
|
|
5
5
|
import type { createRPC } from '<%= t.imports.module.createRPC %>';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<%-
|
|
1
|
+
<%- t.getFirstLineBanner() %>
|
|
2
2
|
import type { VovkRequest, VovkStreamAsyncIterable, KnownAny } from 'vovk';
|
|
3
3
|
|
|
4
4
|
<% const mixins = Object.values(t.schema.segments).filter((segment) => segment.emitSchema && segment.segmentType === 'mixin'); %>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
<%-
|
|
2
|
+
<%- t.getFirstLineBanner() %>
|
|
3
3
|
import type { VovkClientFetcher } from 'vovk';
|
|
4
4
|
import type { fetcher } from '<%= t.imports.module.fetcher %>';
|
|
5
5
|
import type { createRPC } from '<%= t.imports.module.createRPC %>';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
<%- t.getFirstLineBanner('html') %>
|
|
1
2
|
<%- t.readme.banner %>
|
|
2
3
|
|
|
3
|
-
# <%= t.package.name %> v<%= t.package.version %>  
|
|
4
|
+
# <%= t.package.name %> v<%= t.package.version %> [](https://www.typescriptlang.org/) [](https://vovk.dev)
|
|
4
5
|
|
|
5
6
|
<%- t.package.description ? `> ${t.package.description}` : '' %>
|
|
6
7
|
|
|
@@ -90,7 +90,7 @@ export async function generate({ isEnsuringClient = false, projectInfo, forceNot
|
|
|
90
90
|
// sort segments by name to avoid unnecessary rendering
|
|
91
91
|
segments: Object.fromEntries(Object.entries(fullSchema.segments).sort(([a], [b]) => a.localeCompare(b))),
|
|
92
92
|
};
|
|
93
|
-
const { config, cwd, log, srcRoot, packageJson: rootPackageJson } = projectInfo;
|
|
93
|
+
const { config, cwd, log, srcRoot, packageJson: rootPackageJson, vovkCliPackage } = projectInfo;
|
|
94
94
|
const allOpenAPIMixins = {
|
|
95
95
|
...config.openApiMixins,
|
|
96
96
|
...cliOptionsToOpenAPIMixins(cliGenerateOptions ?? {}),
|
|
@@ -170,6 +170,7 @@ export async function generate({ isEnsuringClient = false, projectInfo, forceNot
|
|
|
170
170
|
isNodeNextResolution,
|
|
171
171
|
hasMixins,
|
|
172
172
|
isVovkProject,
|
|
173
|
+
vovkCliPackage,
|
|
173
174
|
});
|
|
174
175
|
const outAbsoluteDir = path.resolve(cwd, outCwdRelativeDir);
|
|
175
176
|
return {
|
|
@@ -250,6 +251,7 @@ export async function generate({ isEnsuringClient = false, projectInfo, forceNot
|
|
|
250
251
|
isNodeNextResolution,
|
|
251
252
|
hasMixins,
|
|
252
253
|
isVovkProject,
|
|
254
|
+
vovkCliPackage,
|
|
253
255
|
});
|
|
254
256
|
return {
|
|
255
257
|
written,
|
|
@@ -4,7 +4,7 @@ import type { ProjectInfo } from '../getProjectInfo/index.mjs';
|
|
|
4
4
|
import type { ClientTemplateFile } from './getClientTemplateFiles.mjs';
|
|
5
5
|
import type { ClientImports } from './getTemplateClientImports.mjs';
|
|
6
6
|
import type { Segment } from '../locateSegments.mjs';
|
|
7
|
-
export default function writeOneClientFile({ cwd, projectInfo, clientTemplateFile, fullSchema, prettifyClient, segmentName, imports, templateContent, matterResult: { data, content }, package: packageJson, readme, isEnsuringClient, outCwdRelativeDir, origin, templateDef, locatedSegments, isNodeNextResolution, hasMixins, isVovkProject, }: {
|
|
7
|
+
export default function writeOneClientFile({ cwd, projectInfo, clientTemplateFile, fullSchema, prettifyClient, segmentName, imports, templateContent, matterResult: { data, content }, package: packageJson, readme, isEnsuringClient, outCwdRelativeDir, origin, templateDef, locatedSegments, isNodeNextResolution, hasMixins, isVovkProject, vovkCliPackage, }: {
|
|
8
8
|
cwd: string;
|
|
9
9
|
projectInfo: ProjectInfo;
|
|
10
10
|
clientTemplateFile: ClientTemplateFile;
|
|
@@ -29,6 +29,7 @@ export default function writeOneClientFile({ cwd, projectInfo, clientTemplateFil
|
|
|
29
29
|
isNodeNextResolution: boolean;
|
|
30
30
|
hasMixins: boolean;
|
|
31
31
|
isVovkProject: boolean;
|
|
32
|
+
vovkCliPackage: PackageJson;
|
|
32
33
|
}): Promise<{
|
|
33
34
|
written: boolean;
|
|
34
35
|
}>;
|
|
@@ -8,7 +8,7 @@ import TOML from '@iarna/toml';
|
|
|
8
8
|
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
|
-
export default async function writeOneClientFile({ cwd, projectInfo, clientTemplateFile, fullSchema, prettifyClient, segmentName, imports, templateContent, matterResult: { data, content }, package: packageJson, readme, isEnsuringClient, outCwdRelativeDir, origin, templateDef, locatedSegments, isNodeNextResolution, hasMixins, isVovkProject, }) {
|
|
11
|
+
export default async function writeOneClientFile({ cwd, projectInfo, clientTemplateFile, fullSchema, prettifyClient, segmentName, imports, templateContent, matterResult: { data, content }, package: packageJson, readme, isEnsuringClient, outCwdRelativeDir, origin, templateDef, locatedSegments, isNodeNextResolution, hasMixins, isVovkProject, vovkCliPackage, }) {
|
|
12
12
|
const { config, apiRoot } = projectInfo;
|
|
13
13
|
const { templateFilePath, relativeDir } = clientTemplateFile;
|
|
14
14
|
const locatedSegmentsByName = _.keyBy(locatedSegments, 'segmentName');
|
|
@@ -17,6 +17,17 @@ export default async function writeOneClientFile({ cwd, projectInfo, clientTempl
|
|
|
17
17
|
// If you still see this text, the client is not generated yet because of an unknown problem.
|
|
18
18
|
// Feel free to report an issue at https://github.com/finom/vovk/issues`;
|
|
19
19
|
placeholder = outPath.endsWith('.py') ? placeholder.replace(/\/\//g, '#') : placeholder;
|
|
20
|
+
const getFirstLineBanner = (type = 'c') => {
|
|
21
|
+
const text = `auto-generated by vovk-cli ${vovkCliPackage.version} at ${new Date().toISOString()}`;
|
|
22
|
+
switch (type) {
|
|
23
|
+
case 'html':
|
|
24
|
+
return `<!-- ${text} -->`;
|
|
25
|
+
case 'py':
|
|
26
|
+
return `# ${text}`;
|
|
27
|
+
case 'c':
|
|
28
|
+
return `// ${text}`;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
20
31
|
// Data for the EJS templates:
|
|
21
32
|
const t = {
|
|
22
33
|
_, // lodash
|
|
@@ -33,6 +44,7 @@ export default async function writeOneClientFile({ cwd, projectInfo, clientTempl
|
|
|
33
44
|
compileJSONSchemaToTypeScriptType,
|
|
34
45
|
YAML,
|
|
35
46
|
TOML,
|
|
47
|
+
getFirstLineBanner,
|
|
36
48
|
nodeNextResolutionExt: {
|
|
37
49
|
ts: isNodeNextResolution ? '.ts' : '',
|
|
38
50
|
js: isNodeNextResolution ? '.js' : '',
|
|
@@ -10,6 +10,9 @@ export default function getProjectInfo({ port: givenPort, cwd, configPath, srcRo
|
|
|
10
10
|
apiRoot: string;
|
|
11
11
|
apiDirAbsolutePath: string | null;
|
|
12
12
|
srcRoot: string | null;
|
|
13
|
+
vovkCliPackage: {
|
|
14
|
+
version: string;
|
|
15
|
+
};
|
|
13
16
|
config: import("vovk").VovkStrictConfig;
|
|
14
17
|
packageJson: import("type-fest").PackageJson;
|
|
15
18
|
log: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import getConfig from './getConfig/index.mjs';
|
|
3
3
|
import { getPackageJson } from '../utils/getPackageJson.mjs';
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
4
5
|
export default async function getProjectInfo({ port: givenPort, cwd = process.cwd(), configPath, srcRootRequired = true, } = {}) {
|
|
5
6
|
const port = givenPort?.toString() ?? process.env.PORT ?? '3000';
|
|
6
7
|
// Make PORT available to the config file at getConfig
|
|
@@ -18,12 +19,14 @@ export default async function getProjectInfo({ port: givenPort, cwd = process.cw
|
|
|
18
19
|
if (configAbsolutePaths.length > 1) {
|
|
19
20
|
log.warn(`Multiple config files found. Using the first one: ${configAbsolutePaths[0]}`);
|
|
20
21
|
}
|
|
22
|
+
const vovkCliPackage = JSON.parse(await readFile(path.join(import.meta.dirname, '../../package.json'), 'utf-8'));
|
|
21
23
|
return {
|
|
22
24
|
cwd,
|
|
23
25
|
port,
|
|
24
26
|
apiRoot,
|
|
25
27
|
apiDirAbsolutePath,
|
|
26
28
|
srcRoot,
|
|
29
|
+
vovkCliPackage,
|
|
27
30
|
config,
|
|
28
31
|
packageJson,
|
|
29
32
|
log,
|
package/dist/index.mjs
CHANGED
|
@@ -13,8 +13,8 @@ import { newComponents } from './new/index.mjs';
|
|
|
13
13
|
import { initProgram } from './initProgram.mjs';
|
|
14
14
|
import { getProjectFullSchema } from './generate/getProjectFullSchema.mjs';
|
|
15
15
|
const program = new Command();
|
|
16
|
-
const
|
|
17
|
-
program.name('vovk').description('Vovk CLI').version(
|
|
16
|
+
const vovkCliPackage = JSON.parse(readFileSync(path.join(import.meta.dirname, '../package.json'), 'utf-8'));
|
|
17
|
+
program.name('vovk').description('Vovk CLI').version(vovkCliPackage.version);
|
|
18
18
|
initProgram(program.command('init'));
|
|
19
19
|
program
|
|
20
20
|
.command('dev')
|
|
@@ -56,7 +56,7 @@ program
|
|
|
56
56
|
},
|
|
57
57
|
},
|
|
58
58
|
], {
|
|
59
|
-
|
|
59
|
+
killOthersOn: ['failure', 'success'],
|
|
60
60
|
prefix: 'none',
|
|
61
61
|
successCondition: 'first',
|
|
62
62
|
});
|
package/dist/init/index.mjs
CHANGED
|
@@ -22,10 +22,10 @@ export class Init {
|
|
|
22
22
|
const dependencies = ['vovk', 'vovk-client', 'vovk-ajv', 'openapi3-ts'];
|
|
23
23
|
const devDependencies = ['vovk-cli'];
|
|
24
24
|
if (lang?.includes('py')) {
|
|
25
|
-
|
|
25
|
+
devDependencies.push('vovk-python');
|
|
26
26
|
}
|
|
27
27
|
if (lang?.includes('rs')) {
|
|
28
|
-
|
|
28
|
+
devDependencies.push('vovk-rust');
|
|
29
29
|
}
|
|
30
30
|
// delete older config files
|
|
31
31
|
if (configPaths.length) {
|
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.289",
|
|
4
4
|
"bin": {
|
|
5
5
|
"vovk": "./dist/index.mjs"
|
|
6
6
|
},
|
|
@@ -35,43 +35,43 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://vovk.dev",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"vovk": "^3.0.0-draft.
|
|
38
|
+
"vovk": "^3.0.0-draft.321"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"vovk-python": "^0.0.1-draft.
|
|
41
|
+
"vovk-python": "^0.0.1-draft.46"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@iarna/toml": "^2.2.5",
|
|
45
|
-
"@inquirer/prompts": "^7.
|
|
45
|
+
"@inquirer/prompts": "^7.6.0",
|
|
46
46
|
"@npmcli/package-json": "^6.2.0",
|
|
47
|
-
"@rollup/plugin-commonjs": "^28.0.
|
|
47
|
+
"@rollup/plugin-commonjs": "^28.0.6",
|
|
48
48
|
"@rollup/plugin-json": "^6.1.0",
|
|
49
49
|
"@rollup/plugin-node-resolve": "^16.0.1",
|
|
50
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
50
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
51
51
|
"@types/json-schema": "^7.0.15",
|
|
52
52
|
"chalk": "^5.4.1",
|
|
53
53
|
"chokidar": "^4.0.3",
|
|
54
54
|
"clone-deep": "^4.0.1",
|
|
55
55
|
"commander": "^13.1.0",
|
|
56
|
-
"concurrently": "^9.
|
|
57
|
-
"dotenv": "^
|
|
56
|
+
"concurrently": "^9.2.0",
|
|
57
|
+
"dotenv": "^17.2.0",
|
|
58
58
|
"ejs": "^3.1.10",
|
|
59
59
|
"get-tsconfig": "^4.10.1",
|
|
60
|
-
"glob": "^11.0.
|
|
60
|
+
"glob": "^11.0.3",
|
|
61
61
|
"gray-matter": "^4.0.3",
|
|
62
62
|
"inflection": "^3.0.2",
|
|
63
63
|
"jsonc-parser": "^3.3.1",
|
|
64
64
|
"lodash": "^4.17.21",
|
|
65
65
|
"loglevel": "^1.9.2",
|
|
66
|
-
"openapi3-ts": "^4.
|
|
66
|
+
"openapi3-ts": "^4.5.0",
|
|
67
67
|
"pluralize": "^8.0.0",
|
|
68
|
-
"prettier": "^3.
|
|
69
|
-
"rollup": "^4.
|
|
68
|
+
"prettier": "^3.6.2",
|
|
69
|
+
"rollup": "^4.44.2",
|
|
70
70
|
"tar-stream": "^3.1.7",
|
|
71
71
|
"ts-morph": "^26.0.0",
|
|
72
|
-
"tsdown": "^0.12.
|
|
72
|
+
"tsdown": "^0.12.9",
|
|
73
73
|
"type-fest": "^4.41.0",
|
|
74
|
-
"undici": "^7.
|
|
74
|
+
"undici": "^7.11.0",
|
|
75
75
|
"vovk-openapi": "^0.0.1-draft.112",
|
|
76
76
|
"yaml": "^2.8.0"
|
|
77
77
|
},
|
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
"@types/pluralize": "^0.0.33",
|
|
84
84
|
"@types/tar-stream": "^3.1.4",
|
|
85
85
|
"concat-stream": "^2.0.0",
|
|
86
|
-
"create-next-app": "^15.3.
|
|
86
|
+
"create-next-app": "^15.3.5",
|
|
87
87
|
"node-pty": "^1.0.0",
|
|
88
|
-
"zod": "^4.0.
|
|
88
|
+
"zod": "^4.0.5"
|
|
89
89
|
}
|
|
90
90
|
}
|