vovk-cli 0.0.1-draft.3 → 0.0.1-draft.300
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/LICENSE +1 -1
- package/README.md +29 -1
- package/client-templates/cjs/index.cjs.ejs +19 -0
- package/client-templates/cjs/index.d.cts.ejs +25 -0
- package/client-templates/mixins/mixins.d.ts.ejs +64 -0
- package/client-templates/mixins/mixins.json.ejs +1 -0
- package/client-templates/mjs/index.d.mts.ejs +25 -0
- package/client-templates/mjs/index.mjs.ejs +23 -0
- package/client-templates/packageJson/package.json.ejs +1 -0
- package/client-templates/readme/README.md.ejs +38 -0
- package/client-templates/schemaCjs/schema.cjs.ejs +26 -0
- package/client-templates/schemaCjs/schema.d.cts.ejs +10 -0
- package/client-templates/schemaJson/schema.json.ejs +1 -0
- package/client-templates/schemaTs/schema.ts.ejs +35 -0
- package/client-templates/ts/index.ts.ejs +33 -0
- package/dist/bundle/index.d.mts +8 -0
- package/dist/bundle/index.mjs +90 -0
- package/dist/dev/diffSegmentSchema.d.mts +36 -0
- package/dist/{watcher/diffSchema.mjs → dev/diffSegmentSchema.mjs} +4 -12
- package/dist/{watcher → dev}/ensureSchemaFiles.d.mts +3 -0
- package/dist/{watcher → dev}/ensureSchemaFiles.mjs +17 -21
- package/dist/dev/index.d.mts +9 -0
- package/dist/dev/index.mjs +388 -0
- package/dist/dev/logDiffResult.d.mts +3 -0
- package/dist/dev/logDiffResult.mjs +57 -0
- package/dist/dev/writeMetaJson.d.mts +2 -0
- package/dist/dev/writeMetaJson.mjs +17 -0
- package/dist/dev/writeOneSegmentSchemaFile.d.mts +12 -0
- package/dist/dev/writeOneSegmentSchemaFile.mjs +32 -0
- package/dist/generate/ensureClient.d.mts +3 -0
- package/dist/generate/ensureClient.mjs +32 -0
- package/dist/generate/generate.d.mts +15 -0
- package/dist/generate/generate.mjs +291 -0
- package/dist/generate/getClientTemplateFiles.d.mts +20 -0
- package/dist/generate/getClientTemplateFiles.mjs +89 -0
- package/dist/generate/getProjectFullSchema.d.mts +7 -0
- package/dist/generate/getProjectFullSchema.mjs +65 -0
- package/dist/generate/getTemplateClientImports.d.mts +18 -0
- package/dist/generate/getTemplateClientImports.mjs +38 -0
- package/dist/generate/index.d.mts +33 -0
- package/dist/generate/index.mjs +189 -0
- package/dist/generate/mergePackages.d.mts +7 -0
- package/dist/generate/mergePackages.mjs +55 -0
- package/dist/generate/writeOneClientFile.d.mts +36 -0
- package/dist/generate/writeOneClientFile.mjs +120 -0
- package/dist/getProjectInfo/getConfig/getConfigAbsolutePaths.d.mts +5 -0
- package/dist/getProjectInfo/{getConfigAbsolutePaths.mjs → getConfig/getConfigAbsolutePaths.mjs} +6 -3
- package/dist/getProjectInfo/{getRelativeSrcRoot.d.mts → getConfig/getRelativeSrcRoot.d.mts} +1 -1
- package/dist/getProjectInfo/getConfig/getRelativeSrcRoot.mjs +12 -0
- package/dist/getProjectInfo/getConfig/getTemplateDefs.d.mts +16 -0
- package/dist/getProjectInfo/getConfig/getTemplateDefs.mjs +98 -0
- package/dist/getProjectInfo/{getUserConfig.d.mts → getConfig/getUserConfig.d.mts} +3 -2
- package/dist/getProjectInfo/{getUserConfig.mjs → getConfig/getUserConfig.mjs} +7 -5
- package/dist/getProjectInfo/{importUncachedModule.mjs → getConfig/importUncachedModule.mjs} +1 -5
- package/dist/getProjectInfo/{importUncachedModuleWorker.mjs → getConfig/importUncachedModuleWorker.mjs} +0 -1
- package/dist/getProjectInfo/getConfig/index.d.mts +120 -0
- package/dist/getProjectInfo/getConfig/index.mjs +94 -0
- package/dist/getProjectInfo/index.d.mts +12 -9
- package/dist/getProjectInfo/index.mjs +22 -23
- package/dist/index.d.mts +2 -24
- package/dist/index.mjs +106 -69
- package/dist/init/checkTSConfigForExperimentalDecorators.mjs +2 -2
- package/dist/init/createConfig.d.mts +3 -4
- package/dist/init/createConfig.mjs +22 -16
- package/dist/init/getTemplateFilesFromPackage.d.mts +2 -1
- package/dist/init/getTemplateFilesFromPackage.mjs +13 -9
- package/dist/init/index.d.mts +2 -3
- package/dist/init/index.mjs +119 -138
- package/dist/init/installDependencies.d.mts +4 -1
- package/dist/init/installDependencies.mjs +6 -4
- package/dist/init/logUpdateDependenciesError.d.mts +13 -0
- package/dist/init/logUpdateDependenciesError.mjs +51 -0
- package/dist/init/updateDependenciesWithoutInstalling.d.mts +3 -2
- package/dist/init/updateDependenciesWithoutInstalling.mjs +50 -15
- package/dist/init/updateNPMScripts.d.mts +3 -1
- package/dist/init/updateNPMScripts.mjs +10 -7
- package/dist/init/updateTypeScriptConfig.d.mts +4 -1
- package/dist/init/updateTypeScriptConfig.mjs +13 -9
- package/dist/initProgram.d.mts +2 -0
- package/dist/initProgram.mjs +22 -0
- package/dist/locateSegments.d.mts +8 -1
- package/dist/locateSegments.mjs +16 -6
- package/dist/new/addClassToSegmentCode.d.mts +1 -2
- package/dist/new/addClassToSegmentCode.mjs +9 -5
- package/dist/new/addCommonTerms.mjs +1 -0
- package/dist/new/index.d.mts +2 -2
- package/dist/new/index.mjs +14 -3
- package/dist/new/newModule.d.mts +7 -2
- package/dist/new/newModule.mjs +61 -35
- package/dist/new/newSegment.d.mts +4 -2
- package/dist/new/newSegment.mjs +22 -13
- package/dist/new/render.d.mts +9 -9
- package/dist/new/render.mjs +38 -13
- package/dist/types.d.mts +73 -28
- package/dist/utils/compileJSONSchemaToTypeScriptType.d.mts +5 -0
- package/dist/utils/compileJSONSchemaToTypeScriptType.mjs +9 -0
- package/dist/utils/compileTs.d.mts +12 -0
- package/dist/utils/compileTs.mjs +261 -0
- package/dist/utils/debounceWithArgs.d.mts +2 -2
- package/dist/utils/debounceWithArgs.mjs +24 -9
- package/dist/utils/formatLoggedSegmentName.d.mts +3 -1
- package/dist/utils/formatLoggedSegmentName.mjs +4 -3
- package/dist/utils/getAvailablePort.mjs +3 -2
- package/dist/utils/getFileSystemEntryType.mjs +1 -1
- package/dist/utils/getPackageJson.d.mts +3 -0
- package/dist/utils/getPackageJson.mjs +22 -0
- package/dist/utils/getPublicModuleNameFromPath.d.mts +4 -0
- package/dist/utils/getPublicModuleNameFromPath.mjs +9 -0
- package/dist/utils/normalizeOpenAPIMixins.d.mts +7 -0
- package/dist/utils/normalizeOpenAPIMixins.mjs +67 -0
- package/dist/utils/pickSegmentFullSchema.d.mts +3 -0
- package/dist/utils/pickSegmentFullSchema.mjs +15 -0
- package/dist/utils/removeUnlistedDirectories.d.mts +10 -0
- package/dist/utils/removeUnlistedDirectories.mjs +61 -0
- package/dist/utils/resolveAbsoluteModulePath.d.mts +2 -0
- package/dist/utils/resolveAbsoluteModulePath.mjs +32 -0
- package/module-templates/controller.ts.ejs +56 -0
- package/module-templates/service.ts.ejs +28 -0
- package/package.json +42 -21
- package/dist/generateClient.d.mts +0 -7
- package/dist/generateClient.mjs +0 -97
- package/dist/getProjectInfo/directoryExists.d.mts +0 -1
- package/dist/getProjectInfo/directoryExists.mjs +0 -10
- package/dist/getProjectInfo/getConfig.d.mts +0 -11
- package/dist/getProjectInfo/getConfig.mjs +0 -29
- package/dist/getProjectInfo/getConfigAbsolutePaths.d.mts +0 -4
- package/dist/getProjectInfo/getRelativeSrcRoot.mjs +0 -12
- package/dist/postinstall.d.mts +0 -1
- package/dist/postinstall.mjs +0 -22
- package/dist/watcher/diffSchema.d.mts +0 -43
- package/dist/watcher/index.d.mts +0 -6
- package/dist/watcher/index.mjs +0 -295
- package/dist/watcher/isMetadataEmpty.d.mts +0 -2
- package/dist/watcher/isMetadataEmpty.mjs +0 -4
- package/dist/watcher/logDiffResult.d.mts +0 -3
- package/dist/watcher/logDiffResult.mjs +0 -90
- package/dist/watcher/writeOneSchemaFile.d.mts +0 -11
- package/dist/watcher/writeOneSchemaFile.mjs +0 -27
- package/templates/controller.ejs +0 -50
- package/templates/service.ejs +0 -7
- package/templates/worker.ejs +0 -1
- package/templates_old/MyThingController.c.only.template.ts +0 -32
- package/templates_old/MyThingController.c.template.ts +0 -34
- package/templates_old/MyThingService.s.template.ts +0 -18
- package/templates_old/controller.ejs +0 -85
- package/templates_old/service.ejs +0 -9
- package/templates_old/worker.ejs +0 -9
- package/templates_old/zod/MyThingController.c.only.template.ts +0 -32
- package/templates_old/zod/MyThingController.c.template.ts +0 -39
- package/templates_old/zod/MyThingService.s.template.ts +0 -18
- /package/dist/getProjectInfo/{importUncachedModule.d.mts → getConfig/importUncachedModule.d.mts} +0 -0
- /package/dist/getProjectInfo/{importUncachedModuleWorker.d.mts → getConfig/importUncachedModuleWorker.d.mts} +0 -0
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import { VovkSchemaIdEnum, type VovkStrictConfig } from 'vovk';
|
|
2
|
+
export default function getConfig({ configPath, cwd }: {
|
|
3
|
+
configPath?: string;
|
|
4
|
+
cwd: string;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
config: VovkStrictConfig;
|
|
7
|
+
srcRoot: string | null;
|
|
8
|
+
configAbsolutePaths: string[];
|
|
9
|
+
userConfig: {
|
|
10
|
+
$schema?: typeof VovkSchemaIdEnum.CONFIG | string;
|
|
11
|
+
emitConfig?: boolean | (keyof VovkStrictConfig | string)[];
|
|
12
|
+
schemaOutDir?: string;
|
|
13
|
+
composedClient?: ({
|
|
14
|
+
enabled?: boolean;
|
|
15
|
+
outDir?: string;
|
|
16
|
+
fromTemplates?: string[];
|
|
17
|
+
} & ({
|
|
18
|
+
excludeSegments?: never;
|
|
19
|
+
includeSegments?: string[];
|
|
20
|
+
} | {
|
|
21
|
+
excludeSegments?: string[];
|
|
22
|
+
includeSegments?: never;
|
|
23
|
+
})) & {
|
|
24
|
+
package?: import("type-fest").PackageJson;
|
|
25
|
+
readme?: {
|
|
26
|
+
banner?: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
segmentedClient?: ({
|
|
30
|
+
enabled?: boolean;
|
|
31
|
+
outDir?: string;
|
|
32
|
+
fromTemplates?: string[];
|
|
33
|
+
} & ({
|
|
34
|
+
excludeSegments?: never;
|
|
35
|
+
includeSegments?: string[];
|
|
36
|
+
} | {
|
|
37
|
+
excludeSegments?: string[];
|
|
38
|
+
includeSegments?: never;
|
|
39
|
+
})) & {
|
|
40
|
+
packages?: Record<string, import("type-fest").PackageJson>;
|
|
41
|
+
readmes?: Record<string, {
|
|
42
|
+
banner?: string;
|
|
43
|
+
}>;
|
|
44
|
+
};
|
|
45
|
+
bundle?: {
|
|
46
|
+
outDir?: string;
|
|
47
|
+
requires?: Record<string, string>;
|
|
48
|
+
tsClientOutDir?: string;
|
|
49
|
+
dontDeleteTsClientOutDirAfter?: boolean;
|
|
50
|
+
sourcemap?: boolean;
|
|
51
|
+
package?: import("type-fest").PackageJson;
|
|
52
|
+
readme?: {
|
|
53
|
+
banner?: string;
|
|
54
|
+
};
|
|
55
|
+
} & ({
|
|
56
|
+
excludeSegments?: never;
|
|
57
|
+
includeSegments?: string[];
|
|
58
|
+
} | {
|
|
59
|
+
excludeSegments?: string[];
|
|
60
|
+
includeSegments?: never;
|
|
61
|
+
});
|
|
62
|
+
imports?: {
|
|
63
|
+
fetcher?: string | [string, string] | [string];
|
|
64
|
+
validateOnClient?: string | [string, string] | [string];
|
|
65
|
+
createRPC?: string | [string, string] | [string];
|
|
66
|
+
};
|
|
67
|
+
modulesDir?: string;
|
|
68
|
+
rootEntry?: string;
|
|
69
|
+
origin?: string;
|
|
70
|
+
rootSegmentModulesDirName?: string;
|
|
71
|
+
logLevel?: "error" | "trace" | "debug" | "info" | "warn";
|
|
72
|
+
prettifyClient?: boolean;
|
|
73
|
+
devHttps?: boolean;
|
|
74
|
+
clientTemplateDefs?: Record<string, import("vovk/mjs/types").ClientTemplateDef>;
|
|
75
|
+
moduleTemplates?: {
|
|
76
|
+
service?: string;
|
|
77
|
+
controller?: string;
|
|
78
|
+
[key: string]: string | undefined;
|
|
79
|
+
};
|
|
80
|
+
libs?: {
|
|
81
|
+
ajv: import("vovk").KnownAny;
|
|
82
|
+
[key: string]: import("vovk").KnownAny;
|
|
83
|
+
};
|
|
84
|
+
segmentConfig?: false | {
|
|
85
|
+
[x: string]: {
|
|
86
|
+
origin?: string;
|
|
87
|
+
rootEntry?: string;
|
|
88
|
+
segmentNameOverride?: string;
|
|
89
|
+
reExports?: Record<string, string>;
|
|
90
|
+
};
|
|
91
|
+
};
|
|
92
|
+
openApiMixins?: {
|
|
93
|
+
[mixinName: string]: {
|
|
94
|
+
source: {
|
|
95
|
+
file: string;
|
|
96
|
+
} | {
|
|
97
|
+
url: string;
|
|
98
|
+
fallback?: string;
|
|
99
|
+
} | {
|
|
100
|
+
object: import("openapi3-ts/oas31").OpenAPIObject;
|
|
101
|
+
};
|
|
102
|
+
package?: import("type-fest").PackageJson;
|
|
103
|
+
readme?: {
|
|
104
|
+
banner?: string;
|
|
105
|
+
};
|
|
106
|
+
apiRoot?: string;
|
|
107
|
+
getModuleName?: "nestjs-operation-id" | (string & {}) | "api" | import("vovk/mjs/types").GetOpenAPINameFn;
|
|
108
|
+
getMethodName?: "nestjs-operation-id" | "camel-case-operation-id" | "auto" | import("vovk/mjs/types").GetOpenAPINameFn;
|
|
109
|
+
errorMessageKey?: string;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
} | null;
|
|
113
|
+
log: {
|
|
114
|
+
info: (msg: string) => void;
|
|
115
|
+
warn: (msg: string) => void;
|
|
116
|
+
error: (msg: string) => void;
|
|
117
|
+
debug: (msg: string) => void;
|
|
118
|
+
raw: import("loglevel").RootLogger;
|
|
119
|
+
};
|
|
120
|
+
}>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { VovkSchemaIdEnum } from 'vovk';
|
|
3
|
+
import getLogger from '../../utils/getLogger.mjs';
|
|
4
|
+
import getUserConfig from './getUserConfig.mjs';
|
|
5
|
+
import getRelativeSrcRoot from './getRelativeSrcRoot.mjs';
|
|
6
|
+
import getTemplateDefs, { BuiltInTemplateName } from './getTemplateDefs.mjs';
|
|
7
|
+
import { normalizeOpenAPIMixins } from '../../utils/normalizeOpenAPIMixins.mjs';
|
|
8
|
+
import chalkHighlightThing from '../../utils/chalkHighlightThing.mjs';
|
|
9
|
+
export default async function getConfig({ configPath, cwd }) {
|
|
10
|
+
const { configAbsolutePaths, error, userConfig } = await getUserConfig({
|
|
11
|
+
configPath,
|
|
12
|
+
cwd,
|
|
13
|
+
});
|
|
14
|
+
const conf = userConfig ?? {};
|
|
15
|
+
const env = process.env;
|
|
16
|
+
const clientTemplateDefs = getTemplateDefs(conf.clientTemplateDefs);
|
|
17
|
+
const srcRoot = await getRelativeSrcRoot({ cwd });
|
|
18
|
+
const validateOnClientImport = conf.imports?.validateOnClient ?? null;
|
|
19
|
+
const fetcherImport = conf.imports?.fetcher ?? 'vovk';
|
|
20
|
+
const createRPCImport = conf.imports?.createRPC ?? 'vovk';
|
|
21
|
+
const imports = {
|
|
22
|
+
fetcher: typeof fetcherImport === 'string' ? [fetcherImport] : fetcherImport,
|
|
23
|
+
validateOnClient: typeof validateOnClientImport === 'string'
|
|
24
|
+
? [validateOnClientImport]
|
|
25
|
+
: (validateOnClientImport ?? null),
|
|
26
|
+
createRPC: typeof createRPCImport === 'string' ? [createRPCImport] : createRPCImport,
|
|
27
|
+
};
|
|
28
|
+
const config = {
|
|
29
|
+
$schema: VovkSchemaIdEnum.CONFIG,
|
|
30
|
+
clientTemplateDefs,
|
|
31
|
+
imports,
|
|
32
|
+
emitConfig: [],
|
|
33
|
+
composedClient: {
|
|
34
|
+
...conf.composedClient,
|
|
35
|
+
enabled: conf.composedClient?.enabled ?? true,
|
|
36
|
+
fromTemplates: conf.composedClient?.fromTemplates ?? ['mjs', 'cjs'],
|
|
37
|
+
outDir: conf.composedClient?.outDir ?? './node_modules/.vovk-client',
|
|
38
|
+
},
|
|
39
|
+
segmentedClient: {
|
|
40
|
+
...conf.segmentedClient,
|
|
41
|
+
enabled: conf.segmentedClient?.enabled ?? false,
|
|
42
|
+
fromTemplates: conf.segmentedClient?.fromTemplates ?? ['ts'],
|
|
43
|
+
outDir: conf.segmentedClient?.outDir ?? path.join(srcRoot ?? '.', 'client'),
|
|
44
|
+
},
|
|
45
|
+
bundle: {
|
|
46
|
+
outDir: conf.bundle?.outDir ?? 'dist',
|
|
47
|
+
tsClientOutDir: conf.bundle?.tsClientOutDir ?? 'tmp_ts_rpc',
|
|
48
|
+
dontDeleteTsClientOutDirAfter: conf.bundle?.dontDeleteTsClientOutDirAfter ?? false,
|
|
49
|
+
sourcemap: conf.bundle?.sourcemap ?? false,
|
|
50
|
+
requires: {
|
|
51
|
+
[BuiltInTemplateName.readme]: '.',
|
|
52
|
+
[BuiltInTemplateName.packageJson]: '.',
|
|
53
|
+
},
|
|
54
|
+
package: {},
|
|
55
|
+
readme: {},
|
|
56
|
+
...conf.bundle,
|
|
57
|
+
},
|
|
58
|
+
modulesDir: conf.modulesDir ?? path.join(srcRoot ?? '.', 'modules'),
|
|
59
|
+
schemaOutDir: env.VOVK_SCHEMA_OUT_DIR ?? conf.schemaOutDir ?? './.vovk-schema',
|
|
60
|
+
origin: (env.VOVK_ORIGIN ?? conf.origin ?? '').replace(/\/$/, ''), // Remove trailing slash
|
|
61
|
+
rootEntry: env.VOVK_ROOT_ENTRY ?? conf.rootEntry ?? 'api',
|
|
62
|
+
rootSegmentModulesDirName: conf.rootSegmentModulesDirName ?? '',
|
|
63
|
+
logLevel: env.VOVK_LOG_LEVEL ?? conf.logLevel ?? 'info',
|
|
64
|
+
prettifyClient: (env.VOVK_PRETTIFY_CLIENT ? !!env.VOVK_PRETTIFY_CLIENT : null) ?? conf.prettifyClient ?? false,
|
|
65
|
+
devHttps: (env.VOVK_DEV_HTTPS ? !!env.VOVK_DEV_HTTPS : null) ?? conf.devHttps ?? false,
|
|
66
|
+
moduleTemplates: {
|
|
67
|
+
service: 'vovk-cli/module-templates/service.ts.ejs',
|
|
68
|
+
controller: 'vovk-cli/module-templates/controller.ts.ejs',
|
|
69
|
+
...conf.moduleTemplates,
|
|
70
|
+
},
|
|
71
|
+
libs: conf.libs ?? {},
|
|
72
|
+
segmentConfig: conf.segmentConfig ?? {},
|
|
73
|
+
openApiMixins: {},
|
|
74
|
+
};
|
|
75
|
+
if (typeof conf.emitConfig === 'undefined') {
|
|
76
|
+
config.emitConfig = ['$schema', 'libs'];
|
|
77
|
+
}
|
|
78
|
+
else if (conf.emitConfig === true) {
|
|
79
|
+
config.emitConfig = Object.keys(config);
|
|
80
|
+
}
|
|
81
|
+
else if (Array.isArray(conf.emitConfig)) {
|
|
82
|
+
config.emitConfig = conf.emitConfig;
|
|
83
|
+
} // else it's false and emitConfig already is []
|
|
84
|
+
const log = getLogger(config.logLevel);
|
|
85
|
+
config.openApiMixins = await normalizeOpenAPIMixins({
|
|
86
|
+
mixinModules: conf.openApiMixins ?? {},
|
|
87
|
+
cwd,
|
|
88
|
+
log,
|
|
89
|
+
});
|
|
90
|
+
if (!userConfig) {
|
|
91
|
+
log.warn(`Unable to load config at ${chalkHighlightThing(cwd)}. Using default values. ${error ?? ''}`);
|
|
92
|
+
}
|
|
93
|
+
return { config, srcRoot, configAbsolutePaths, userConfig, log };
|
|
94
|
+
}
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
export type ProjectInfo = Awaited<ReturnType<typeof getProjectInfo>>;
|
|
2
|
-
export default function getProjectInfo({ port: givenPort,
|
|
2
|
+
export default function getProjectInfo({ port: givenPort, cwd, configPath, srcRootRequired, }?: {
|
|
3
3
|
port?: number;
|
|
4
|
-
clientOutDir?: string;
|
|
5
4
|
cwd?: string;
|
|
5
|
+
configPath?: string;
|
|
6
|
+
srcRootRequired?: boolean;
|
|
6
7
|
}): Promise<{
|
|
7
8
|
cwd: string;
|
|
8
9
|
port: string;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
srcRoot: string;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
config:
|
|
10
|
+
apiRoot: string;
|
|
11
|
+
apiDirAbsolutePath: string | null;
|
|
12
|
+
srcRoot: string | null;
|
|
13
|
+
vovkCliPackage: {
|
|
14
|
+
version: string;
|
|
15
|
+
};
|
|
16
|
+
config: import("vovk").VovkStrictConfig;
|
|
17
|
+
packageJson: import("type-fest").PackageJson;
|
|
18
|
+
isNextInstalled: boolean;
|
|
16
19
|
log: {
|
|
17
20
|
info: (msg: string) => void;
|
|
18
21
|
warn: (msg: string) => void;
|
|
@@ -1,37 +1,36 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import getConfig from './getConfig.mjs';
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import getConfig from './getConfig/index.mjs';
|
|
3
|
+
import { getPackageJson } from '../utils/getPackageJson.mjs';
|
|
4
|
+
import { readFile } from 'node:fs/promises';
|
|
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
|
|
7
8
|
process.env.PORT = port;
|
|
8
|
-
const { config, srcRoot, configAbsolutePaths,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const
|
|
9
|
+
const { config, srcRoot, configAbsolutePaths, log } = await getConfig({
|
|
10
|
+
configPath,
|
|
11
|
+
cwd,
|
|
12
|
+
});
|
|
13
|
+
const packageJson = await getPackageJson(cwd, log);
|
|
14
|
+
const isNextInstalled = !!packageJson?.dependencies?.next || !!packageJson?.devDependencies?.next;
|
|
15
|
+
if (srcRootRequired && !srcRoot) {
|
|
16
|
+
throw new Error(`Could not find app router directory at ${cwd}. Check Next.js docs for more info.`);
|
|
17
|
+
}
|
|
18
|
+
const apiRoot = `${config.origin ?? ''}/${config.rootEntry}`;
|
|
19
|
+
const apiDirAbsolutePath = srcRoot ? path.resolve(cwd, srcRoot, 'app', config.rootEntry) : null;
|
|
19
20
|
if (configAbsolutePaths.length > 1) {
|
|
20
21
|
log.warn(`Multiple config files found. Using the first one: ${configAbsolutePaths[0]}`);
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
log.error(`Error reading config file at ${configAbsolutePaths[0]}: ${error?.message ?? 'Unknown Error'}`);
|
|
24
|
-
}
|
|
23
|
+
const vovkCliPackage = JSON.parse(await readFile(path.join(import.meta.dirname, '../../package.json'), 'utf-8'));
|
|
25
24
|
return {
|
|
26
25
|
cwd,
|
|
27
26
|
port,
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
apiRoot,
|
|
28
|
+
apiDirAbsolutePath,
|
|
30
29
|
srcRoot,
|
|
31
|
-
|
|
32
|
-
fetcherClientImportPath,
|
|
33
|
-
validateOnClientImportPath,
|
|
30
|
+
vovkCliPackage,
|
|
34
31
|
config,
|
|
32
|
+
packageJson,
|
|
33
|
+
isNextInstalled,
|
|
35
34
|
log,
|
|
36
35
|
};
|
|
37
36
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,26 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { Command } from 'commander';
|
|
3
|
-
import type { LogLevelNames } from 'loglevel';
|
|
4
|
-
import type { VovkConfig, VovkEnv } from './types.mjs';
|
|
5
2
|
import 'dotenv/config';
|
|
6
|
-
|
|
7
|
-
export
|
|
8
|
-
yes?: boolean;
|
|
9
|
-
logLevel: LogLevelNames;
|
|
10
|
-
useNpm?: boolean;
|
|
11
|
-
useYarn?: boolean;
|
|
12
|
-
usePnpm?: boolean;
|
|
13
|
-
useBun?: boolean;
|
|
14
|
-
skipInstall?: boolean;
|
|
15
|
-
updateTsConfig?: boolean;
|
|
16
|
-
updateScripts?: 'implicit' | 'explicit';
|
|
17
|
-
validationLibrary?: string | null;
|
|
18
|
-
validateOnClient?: boolean;
|
|
19
|
-
dryRun?: boolean;
|
|
20
|
-
channel?: 'latest' | 'beta' | 'dev';
|
|
21
|
-
}
|
|
22
|
-
export interface NewOptions {
|
|
23
|
-
dryRun: boolean;
|
|
24
|
-
}
|
|
25
|
-
declare const program: Command;
|
|
26
|
-
export declare function initProgram(p: typeof program, command: string): Command;
|
|
3
|
+
import type { VovkEnv } from './types.mjs';
|
|
4
|
+
export type { VovkEnv };
|
package/dist/index.mjs
CHANGED
|
@@ -1,53 +1,64 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import path from 'path';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { readFileSync } from 'node:fs';
|
|
4
|
+
import 'dotenv/config';
|
|
3
5
|
import { Command } from 'commander';
|
|
4
|
-
import { readFileSync } from 'fs';
|
|
5
6
|
import concurrently from 'concurrently';
|
|
6
7
|
import getAvailablePort from './utils/getAvailablePort.mjs';
|
|
7
8
|
import getProjectInfo from './getProjectInfo/index.mjs';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
import '
|
|
9
|
+
import { VovkGenerate } from './generate/index.mjs';
|
|
10
|
+
import { bundle } from './bundle/index.mjs';
|
|
11
|
+
import { VovkDev } from './dev/index.mjs';
|
|
12
|
+
import { newComponents } from './new/index.mjs';
|
|
13
|
+
import { initProgram } from './initProgram.mjs';
|
|
14
|
+
import { getProjectFullSchema } from './generate/getProjectFullSchema.mjs';
|
|
14
15
|
const program = new Command();
|
|
15
|
-
const
|
|
16
|
-
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
|
+
initProgram(program.command('init'));
|
|
17
19
|
program
|
|
18
20
|
.command('dev')
|
|
19
|
-
.
|
|
20
|
-
.
|
|
21
|
-
.
|
|
22
|
-
.
|
|
23
|
-
.
|
|
21
|
+
.alias('d')
|
|
22
|
+
.description('start schema watcher (optional flag --next-dev to start it with Next.js)')
|
|
23
|
+
.argument('[nextArgs...]', 'extra arguments for the dev command')
|
|
24
|
+
.option('--next-dev', 'start schema watcher and Next.js with automatic port allocation')
|
|
25
|
+
.option('--exit', 'kill the processe when schema and client is generated')
|
|
26
|
+
.option('--schema-out <path>', 'path to schema output directory (default: .vovk-schema)')
|
|
27
|
+
.action(async (nextArgs, options) => {
|
|
28
|
+
const { nextDev, exit = false, schemaOut } = options;
|
|
24
29
|
const portAttempts = 30;
|
|
25
|
-
const PORT = !
|
|
30
|
+
const PORT = !nextDev
|
|
26
31
|
? process.env.PORT
|
|
27
32
|
: process.env.PORT ||
|
|
28
33
|
(await getAvailablePort(3000, portAttempts, 0, (failedPort, tryingPort) =>
|
|
29
34
|
// eslint-disable-next-line no-console
|
|
30
|
-
console.warn(`🐺
|
|
31
|
-
throw new Error(`🐺 ❌ Failed to find available
|
|
35
|
+
console.warn(`🐺 Port ${failedPort} is in use, trying ${tryingPort} instead.`)).catch(() => {
|
|
36
|
+
throw new Error(`🐺 ❌ Failed to find an available port after ${portAttempts} attempts`);
|
|
32
37
|
}));
|
|
33
38
|
if (!PORT) {
|
|
34
39
|
throw new Error('🐺 ❌ PORT env variable is required');
|
|
35
40
|
}
|
|
36
|
-
if (
|
|
41
|
+
if (nextDev) {
|
|
37
42
|
const { result } = concurrently([
|
|
38
43
|
{
|
|
39
|
-
command: `
|
|
40
|
-
name: 'Vovk.ts Schema Watcher',
|
|
41
|
-
env: Object.assign({ PORT, __VOVK_START_WATCHER_IN_STANDALONE_MODE__: 'true' }, options.clientOut ? { VOVK_CLIENT_OUT_DIR: options.clientOut } : {}),
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
command: `npx next dev ${command.args.join(' ')}`,
|
|
44
|
+
command: `npx next dev ${nextArgs.join(' ')}`,
|
|
45
45
|
name: 'Next.js Development Server',
|
|
46
46
|
env: { PORT },
|
|
47
47
|
},
|
|
48
|
+
{
|
|
49
|
+
command: `node ${import.meta.dirname}/dev/index.mjs`,
|
|
50
|
+
name: 'Vovk Dev Watcher',
|
|
51
|
+
env: {
|
|
52
|
+
PORT,
|
|
53
|
+
__VOVK_START_WATCHER_IN_STANDALONE_MODE__: 'true',
|
|
54
|
+
__VOVK_SCHEMA_OUT_FLAG__: schemaOut ?? '',
|
|
55
|
+
__VOVK_EXIT__: exit ? 'true' : 'false',
|
|
56
|
+
},
|
|
57
|
+
},
|
|
48
58
|
], {
|
|
49
|
-
|
|
59
|
+
killOthersOn: ['failure', 'success'],
|
|
50
60
|
prefix: 'none',
|
|
61
|
+
successCondition: 'first',
|
|
51
62
|
});
|
|
52
63
|
try {
|
|
53
64
|
await result;
|
|
@@ -57,61 +68,87 @@ program
|
|
|
57
68
|
}
|
|
58
69
|
}
|
|
59
70
|
else {
|
|
60
|
-
void new
|
|
71
|
+
void new VovkDev({ schemaOut }).start({ exit });
|
|
61
72
|
}
|
|
62
73
|
});
|
|
63
74
|
program
|
|
64
75
|
.command('generate')
|
|
65
|
-
.
|
|
66
|
-
.
|
|
67
|
-
.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
76
|
+
.alias('g')
|
|
77
|
+
.description('generate RPC client from schema')
|
|
78
|
+
.option('--out, --composed-out <path>', 'path to output directory for composed client')
|
|
79
|
+
.option('--from, --composed-from <templates...>', 'client template names for composed client')
|
|
80
|
+
.option('--include, --composed-include-segments <segments...>', 'include segments in composed client')
|
|
81
|
+
.option('--exclude, --composed-exclude-segments <segments...>', 'exclude segments in composed client')
|
|
82
|
+
.option('--composed-only', 'generate only composed client even if segmented client is enabled')
|
|
83
|
+
.option('--segmented-only', 'generate only segmented client even if composed client is enabled')
|
|
84
|
+
.option('--segmented-out <path>', 'path to output directory for segmented client')
|
|
85
|
+
.option('--segmented-from <templates...>', 'client template names for segmented client')
|
|
86
|
+
.option('--segmented-include-segments <segments...>', 'include segments in segmented client')
|
|
87
|
+
.option('--segmented-exclude-segments <segments...>', 'exclude segments in segmented client')
|
|
88
|
+
.option('--prettify', 'prettify output files')
|
|
89
|
+
.option('--schema, --schema-path <path>', 'path to schema folder (default: ./.vovk-schema)')
|
|
90
|
+
.option('--config, --config-path <config>', 'path to config file')
|
|
91
|
+
.option('--force-ts-standalone', 'force TypeScript standalone mode (Next.js environment will be ignored, by default it\'s "true" for non-Next.js directories)')
|
|
92
|
+
.option('--watch <s>', 'watch for changes in schema or openapi spec and regenerate client; accepts a number in seconds to throttle the watcher or make an HTTP request to the OpenAPI spec URL')
|
|
93
|
+
.option('--openapi, --openapi-spec <openapi_path_or_urls...>', 'use OpenAPI schema instead of Vovk schema')
|
|
94
|
+
.option('--openapi-get-module-name <names...>', 'module names corresponding to the index of --openapi option')
|
|
95
|
+
.option('--openapi-get-method-name <names...>', 'method names corresponding to the index of --openapi option')
|
|
96
|
+
.option('--openapi-root-url <urls...>', 'root URLs corresponding to the index of --openapi option')
|
|
97
|
+
.action(async (cliGenerateOptions) => {
|
|
98
|
+
const projectInfo = await getProjectInfo({ configPath: cliGenerateOptions.configPath, srcRootRequired: false });
|
|
99
|
+
await new VovkGenerate({
|
|
100
|
+
projectInfo,
|
|
101
|
+
forceNothingWrittenLog: true,
|
|
102
|
+
cliGenerateOptions,
|
|
103
|
+
}).start();
|
|
104
|
+
});
|
|
105
|
+
program
|
|
106
|
+
.command('bundle')
|
|
107
|
+
.alias('b')
|
|
108
|
+
.description('generate TypeScrtipt RPC and bundle it')
|
|
109
|
+
.option('--out, --out-dir <path>', 'path to output directory for bundle')
|
|
110
|
+
.option('--include, --include-segments <segments...>', 'include segments')
|
|
111
|
+
.option('--exclude, --exclude-segments <segments...>', 'exclude segments')
|
|
112
|
+
.option('--ts-client-out-dir <path>', 'path to output directory for TypeScript client')
|
|
113
|
+
.option('--dont-delete-ts-client-out-dir-after', 'do not delete TypeScript client output directory after bundling')
|
|
114
|
+
.option('--config <config>', 'path to config file')
|
|
115
|
+
.option('--schema <path>', 'path to schema folder (default: .vovk-schema)')
|
|
116
|
+
.option('--sourcemap', 'generate sourcemaps')
|
|
117
|
+
.option('--force-ts-standalone', 'force TypeScript standalone mode (Next.js environment will be ignored, by default it\'s "true" for non-Next.js directories)')
|
|
118
|
+
.option('--openapi, --openapi-spec <openapi_path_or_urls...>', 'use OpenAPI schema instead of Vovk schema')
|
|
119
|
+
.option('--openapi-get-module-name <names...>', 'module names corresponding to the index of --openapi option')
|
|
120
|
+
.option('--openapi-get-method-name <names...>', 'method names corresponding to the index of --openapi option')
|
|
121
|
+
.option('--openapi-root-url <urls...>', 'root URLs corresponding to the index of --openapi option')
|
|
122
|
+
.action(async (cliBundleOptions) => {
|
|
123
|
+
const projectInfo = await getProjectInfo({ configPath: cliBundleOptions.config, srcRootRequired: false });
|
|
124
|
+
const { cwd, config, log, isNextInstalled } = projectInfo;
|
|
125
|
+
const fullSchema = await getProjectFullSchema({
|
|
126
|
+
schemaOutAbsolutePath: path.resolve(cwd, cliBundleOptions?.schema ?? config.schemaOutDir),
|
|
127
|
+
log,
|
|
128
|
+
isNextInstalled,
|
|
129
|
+
});
|
|
130
|
+
await bundle({
|
|
131
|
+
projectInfo,
|
|
132
|
+
fullSchema,
|
|
133
|
+
cliBundleOptions,
|
|
134
|
+
});
|
|
74
135
|
});
|
|
75
|
-
// reused at vovk-init
|
|
76
|
-
export function initProgram(p, command) {
|
|
77
|
-
return p
|
|
78
|
-
.command(command + '[prefix]')
|
|
79
|
-
.description('Initialize Vovk project')
|
|
80
|
-
.option('-Y, --yes', 'Skip all prompts and use default values')
|
|
81
|
-
.option('--log-level <level>', 'Set log level', 'info')
|
|
82
|
-
.option('--use-npm', 'Use npm as package manager')
|
|
83
|
-
.option('--use-yarn', 'Use yarn as package manager')
|
|
84
|
-
.option('--use-pnpm', 'Use pnpm as package manager')
|
|
85
|
-
.option('--use-bun', 'Use bun as package manager')
|
|
86
|
-
.option('--skip-install', 'Skip installing dependencies')
|
|
87
|
-
.option('--update-ts-config', 'Update tsconfig.json')
|
|
88
|
-
.option('--update-scripts <mode>', 'Update package.json scripts (implicit or explicit)')
|
|
89
|
-
.option('--validation-library <library>', 'Validation library to use ("vovk-zod", "vovk-yup", "vovk-dto" or another). Set to "none" to skip validation')
|
|
90
|
-
.option('--validate-on-client', 'Validate on client')
|
|
91
|
-
.option('--dry-run', 'Do not write files to disk')
|
|
92
|
-
.option('--channel <channel>', 'Channel to use for fetching packages', 'latest')
|
|
93
|
-
.action((prefix = '.', options) => new Init().main(prefix, options));
|
|
94
|
-
}
|
|
95
|
-
initProgram(program, 'init ');
|
|
96
136
|
program
|
|
97
137
|
.command('new [components...]')
|
|
98
138
|
.alias('n')
|
|
99
|
-
.description('
|
|
100
|
-
.option('--
|
|
101
|
-
.
|
|
139
|
+
.description('create new components. "vovk new [...components] [segmentName/]moduleName" to create a new module or "vovk new segment [segmentName]" to create a new segment')
|
|
140
|
+
.option('-o, --overwrite', 'overwrite existing files')
|
|
141
|
+
.option('--template, --templates <templates...>', 'override config template; accepts an array of strings that correspond the order of the components')
|
|
142
|
+
.option('--dir <dirname>', 'override dirName in template file; relative to the root of the project')
|
|
143
|
+
.option('--empty', 'create an empty module')
|
|
144
|
+
.option('--no-segment-update', 'do not update segment files when creating a new module')
|
|
145
|
+
.option('--dry-run', 'do not write files to disk')
|
|
146
|
+
.option('--static', 'if the segment is static')
|
|
147
|
+
.action((components, newOptions) => newComponents(components, newOptions));
|
|
102
148
|
program
|
|
103
149
|
.command('help')
|
|
104
150
|
.description('Show help message')
|
|
105
151
|
.action(() => program.help());
|
|
106
|
-
/*
|
|
107
|
-
TODO
|
|
108
|
-
vovk new segment [segmentName]
|
|
109
|
-
vovk new controller service [segmentName/]moduleName
|
|
110
|
-
vovk new c s w [segmentName/]moduleName
|
|
111
|
-
|
|
112
|
-
vovk c s w userApi/user
|
|
113
|
-
vovk new c s w user
|
|
114
|
-
*/
|
|
115
152
|
program.parse(process.argv);
|
|
116
153
|
if (!process.argv.slice(2).length) {
|
|
117
154
|
program.outputHelp();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs/promises';
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
3
|
import * as jsonc from 'jsonc-parser';
|
|
4
4
|
export default async function checkTSConfigForExperimentalDecorators(root) {
|
|
5
5
|
const tsconfigPath = path.resolve(root, 'tsconfig.json');
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type getLogger from '../utils/getLogger.mjs';
|
|
2
|
-
import type { InitOptions } from '../
|
|
3
|
-
export default function createConfig({ root, log,
|
|
2
|
+
import type { InitOptions } from '../types.mjs';
|
|
3
|
+
export default function createConfig({ root, log, options: { validationLibrary, reactQuery, lang, channel, dryRun }, }: {
|
|
4
4
|
root: string;
|
|
5
5
|
log: ReturnType<typeof getLogger>;
|
|
6
|
-
dryRun
|
|
7
|
-
options: Pick<InitOptions, 'validationLibrary' | 'validateOnClient'>;
|
|
6
|
+
options: Pick<InitOptions, 'validationLibrary' | 'reactQuery' | 'lang' | 'channel' | 'dryRun'>;
|
|
8
7
|
}): Promise<{
|
|
9
8
|
configAbsolutePath: string;
|
|
10
9
|
}>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import getFileSystemEntryType, { FileSystemEntryType } from '../utils/getFileSystemEntryType.mjs';
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
4
3
|
import getTemplateFilesFromPackage from './getTemplateFilesFromPackage.mjs';
|
|
5
4
|
import prettify from '../utils/prettify.mjs';
|
|
6
|
-
|
|
5
|
+
import getFileSystemEntryType, { FileSystemEntryType } from '../utils/getFileSystemEntryType.mjs';
|
|
6
|
+
export default async function createConfig({ root, log, options: { validationLibrary, reactQuery, lang, channel, dryRun }, }) {
|
|
7
7
|
const config = {};
|
|
8
8
|
const dotConfigPath = path.join(root, '.config');
|
|
9
9
|
const dir = (await getFileSystemEntryType(dotConfigPath)) === FileSystemEntryType.DIRECTORY ? dotConfigPath : root;
|
|
@@ -11,26 +11,32 @@ export default async function createConfig({ root, log, dryRun, options: { valid
|
|
|
11
11
|
.readFile(path.join(root, 'package.json'), 'utf-8')
|
|
12
12
|
.then((content) => JSON.parse(content).type === 'module');
|
|
13
13
|
const configAbsolutePath = path.join(dir, isModule ? 'vovk.config.mjs' : 'vovk.config.js');
|
|
14
|
-
const
|
|
15
|
-
controller: 'vovk-cli/templates/controller.ejs',
|
|
16
|
-
service: 'vovk-cli/templates/service.ejs',
|
|
17
|
-
worker: 'vovk-cli/templates/worker.ejs',
|
|
14
|
+
const moduleTemplates = {
|
|
15
|
+
controller: 'vovk-cli/module-templates/controller.ts.ejs',
|
|
16
|
+
service: 'vovk-cli/module-templates/service.ts.ejs',
|
|
18
17
|
};
|
|
18
|
+
config.imports ??= {};
|
|
19
|
+
config.imports.validateOnClient = validationLibrary === 'vovk-dto' ? 'vovk-dto/validateOnClient' : 'vovk-ajv';
|
|
19
20
|
if (validationLibrary) {
|
|
20
|
-
config.validationLibrary = validationLibrary;
|
|
21
|
-
if (validateOnClient) {
|
|
22
|
-
config.validateOnClient = `${validationLibrary}/validateOnClient`;
|
|
23
|
-
}
|
|
24
21
|
try {
|
|
25
|
-
const validationTemplates = await getTemplateFilesFromPackage(validationLibrary);
|
|
26
|
-
Object.assign(
|
|
22
|
+
const validationTemplates = await getTemplateFilesFromPackage(validationLibrary, channel);
|
|
23
|
+
Object.assign(moduleTemplates, validationTemplates);
|
|
27
24
|
}
|
|
28
25
|
catch (error) {
|
|
29
26
|
log.warn(`Failed to fetch validation library templates: ${error.message}`);
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
if (lang?.length) {
|
|
30
|
+
config.composedClient ??= {};
|
|
31
|
+
config.composedClient.fromTemplates = ['mjs', 'cjs', ...lang];
|
|
32
|
+
}
|
|
33
|
+
if (reactQuery) {
|
|
34
|
+
config.imports ??= {};
|
|
35
|
+
config.imports.createRPC = 'vovk-react-query';
|
|
36
|
+
}
|
|
37
|
+
config.moduleTemplates = moduleTemplates;
|
|
38
|
+
const configStr = await prettify(`// @ts-check
|
|
39
|
+
/** @type {import('vovk').VovkConfig} */
|
|
34
40
|
const config = ${JSON.stringify(config, null, 2)};
|
|
35
41
|
${isModule ? '\nexport default config;' : 'module.exports = config;'}`, configAbsolutePath);
|
|
36
42
|
if (!dryRun)
|