vovk-cli 0.0.1-draft.156 → 0.0.1-draft.158
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
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs/promises';
|
|
3
3
|
import { build } from 'tsdown';
|
|
4
|
+
import groupBy from 'lodash/groupBy.js';
|
|
4
5
|
import generate from '../generate/index.mjs';
|
|
5
6
|
import { BuiltInTemplateName } from '../getProjectInfo/getConfig/getTemplateDefs.mjs';
|
|
6
7
|
import chalkHighlightThing from '../utils/chalkHighlightThing.mjs';
|
|
@@ -31,7 +32,8 @@ export default async function bundle({ projectInfo, fullSchema, }) {
|
|
|
31
32
|
outDir,
|
|
32
33
|
sourcemap: bundleConfig.sourcemap,
|
|
33
34
|
});
|
|
34
|
-
|
|
35
|
+
const outDirAbsolute = path.resolve(cwd, outDir);
|
|
36
|
+
log.info(`Bundled index.ts to ${chalkHighlightThing(outDirAbsolute)}`);
|
|
35
37
|
await build({
|
|
36
38
|
entry: path.join(tsFullClientOutAbsoluteDirInput, './fullSchema.ts'),
|
|
37
39
|
dts: true,
|
|
@@ -41,29 +43,20 @@ export default async function bundle({ projectInfo, fullSchema, }) {
|
|
|
41
43
|
clean: false,
|
|
42
44
|
sourcemap: bundleConfig.sourcemap,
|
|
43
45
|
});
|
|
44
|
-
log.
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
fullFrom.push(BuiltInTemplateName.readme);
|
|
48
|
-
}
|
|
49
|
-
if (!bundleConfig.noPackage) {
|
|
50
|
-
fullFrom.push(BuiltInTemplateName.packageJson);
|
|
51
|
-
}
|
|
52
|
-
if (fullFrom.length) {
|
|
46
|
+
log.info(`Bundled fullSchema.ts to ${chalkHighlightThing(outDirAbsolute)}`);
|
|
47
|
+
const requiresGroup = groupBy(Object.entries(bundleConfig.requires), ([, relativeOutDir]) => relativeOutDir);
|
|
48
|
+
for (const [relativePath, group] of Object.entries(requiresGroup)) {
|
|
53
49
|
await generate({
|
|
54
50
|
isEnsuringClient: false,
|
|
55
51
|
projectInfo,
|
|
56
52
|
forceNothingWrittenLog: true,
|
|
57
53
|
fullSchema,
|
|
58
54
|
cliGenerateOptions: {
|
|
59
|
-
fullFrom,
|
|
60
|
-
fullOut: outDir,
|
|
55
|
+
fullFrom: group.map(([templateName]) => templateName),
|
|
56
|
+
fullOut: path.resolve(outDir, relativePath),
|
|
61
57
|
},
|
|
62
58
|
});
|
|
63
59
|
}
|
|
64
|
-
else {
|
|
65
|
-
log.debug('No README or package.json generated');
|
|
66
|
-
}
|
|
67
60
|
if (!bundleConfig.dontDeleteTsClientOutDirAfter) {
|
|
68
61
|
await fs.rm(tsFullClientOutAbsoluteDirInput, { recursive: true, force: true });
|
|
69
62
|
log.debug(`Deleted temporary TypeScript client output directory: ${chalkHighlightThing(tsFullClientOutAbsoluteDirInput)}`);
|
|
@@ -71,5 +64,5 @@ export default async function bundle({ projectInfo, fullSchema, }) {
|
|
|
71
64
|
else {
|
|
72
65
|
log.debug(`Temporary TypeScript client output directory not deleted: ${chalkHighlightThing(tsFullClientOutAbsoluteDirInput)}`);
|
|
73
66
|
}
|
|
74
|
-
log.info(`Bundled TypeScript client to ${
|
|
67
|
+
log.info(`Bundled TypeScript client to ${outDirAbsolute}`);
|
|
75
68
|
}
|
|
@@ -3,7 +3,7 @@ import camelCase from 'lodash/camelCase.js';
|
|
|
3
3
|
import getLogger from '../../utils/getLogger.mjs';
|
|
4
4
|
import getUserConfig from '../getUserConfig.mjs';
|
|
5
5
|
import getRelativeSrcRoot from '../getRelativeSrcRoot.mjs';
|
|
6
|
-
import getTemplateDefs from './getTemplateDefs.mjs';
|
|
6
|
+
import getTemplateDefs, { BuiltInTemplateName } from './getTemplateDefs.mjs';
|
|
7
7
|
import { SchemaIdEnum } from '../../enums.mjs';
|
|
8
8
|
export default async function getConfig({ cliGenerateOptions, cliBundleOptions, cwd, }) {
|
|
9
9
|
const { configAbsolutePaths, error, userConfig } = await getUserConfig({
|
|
@@ -22,7 +22,7 @@ export default async function getConfig({ cliGenerateOptions, cliBundleOptions,
|
|
|
22
22
|
validateOnClient: typeof validateOnClientImport === 'string'
|
|
23
23
|
? [validateOnClientImport]
|
|
24
24
|
: (validateOnClientImport ?? null),
|
|
25
|
-
createRPC: typeof createRPCImport === 'string' ? [createRPCImport,
|
|
25
|
+
createRPC: typeof createRPCImport === 'string' ? [createRPCImport, createRPCImport] : createRPCImport,
|
|
26
26
|
};
|
|
27
27
|
const config = {
|
|
28
28
|
$schema: SchemaIdEnum.CONFIG,
|
|
@@ -47,9 +47,11 @@ export default async function getConfig({ cliGenerateOptions, cliBundleOptions,
|
|
|
47
47
|
outDir: cliBundleOptions?.outDir ?? conf.bundle?.outDir ?? 'dist',
|
|
48
48
|
tsClientOutDir: cliBundleOptions?.tsClientOutDir ?? conf.bundle?.tsClientOutDir ?? '.tmp-ts-rpc',
|
|
49
49
|
dontDeleteTsClientOutDirAfter: cliBundleOptions?.dontDeleteTsClientOutDirAfter ?? conf.bundle?.dontDeleteTsClientOutDirAfter ?? false,
|
|
50
|
-
noReadme: cliBundleOptions?.noReadme ?? conf.bundle?.noReadme ?? false,
|
|
51
|
-
noPackage: cliBundleOptions?.noPackage ?? conf.bundle?.noPackage ?? false,
|
|
52
50
|
sourcemap: cliBundleOptions?.sourcemap ?? conf.bundle?.sourcemap ?? false,
|
|
51
|
+
requires: {
|
|
52
|
+
[BuiltInTemplateName.readme]: '.',
|
|
53
|
+
[BuiltInTemplateName.packageJson]: '.',
|
|
54
|
+
},
|
|
53
55
|
},
|
|
54
56
|
modulesDir: env.VOVK_MODULES_DIR ?? conf.modulesDir ?? './' + [srcRoot, 'modules'].filter(Boolean).join('/'),
|
|
55
57
|
schemaOutDir: env.VOVK_SCHEMA_OUT_DIR ?? conf.schemaOutDir ?? './.vovk-schema',
|
package/dist/types.d.mts
CHANGED
|
@@ -21,7 +21,7 @@ export interface GenerateOptions {
|
|
|
21
21
|
segmentedOut?: string;
|
|
22
22
|
segmentedOnly?: boolean;
|
|
23
23
|
}
|
|
24
|
-
export interface BundleOptions extends Partial<VovkStrictConfig['bundle']
|
|
24
|
+
export interface BundleOptions extends Partial<Omit<VovkStrictConfig['bundle'], 'requires'>> {
|
|
25
25
|
config?: string;
|
|
26
26
|
}
|
|
27
27
|
export interface InitOptions {
|
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.158",
|
|
4
4
|
"bin": {
|
|
5
5
|
"vovk": "./dist/index.mjs"
|
|
6
6
|
},
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
},
|
|
36
36
|
"homepage": "https://vovk.dev",
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"vovk": "^3.0.0-draft.
|
|
38
|
+
"vovk": "^3.0.0-draft.128"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"vovk-python-client": "^0.0.1-draft.
|
|
41
|
+
"vovk-python-client": "^0.0.1-draft.24"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@inquirer/prompts": "^7.5.1",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"tsdown": "^0.11.7",
|
|
68
68
|
"type-fest": "^4.41.0",
|
|
69
69
|
"undici": "^7.9.0",
|
|
70
|
-
"vovk-openapi": "^0.0.1-draft.
|
|
70
|
+
"vovk-openapi": "^0.0.1-draft.74"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/concat-stream": "^2.0.3",
|