vovk-cli 0.0.1-draft.115 → 0.0.1-draft.116
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.
|
@@ -5,16 +5,18 @@ export default async function getConfig({ clientOutDir, configPath, cwd, }) {
|
|
|
5
5
|
const { configAbsolutePaths, error, userConfig } = await getUserConfig({ configPath, cwd });
|
|
6
6
|
const conf = userConfig ?? {};
|
|
7
7
|
const srcRoot = await getRelativeSrcRoot({ cwd });
|
|
8
|
-
const validateOnClientImport = env.VOVK_VALIDATE_ON_CLIENT_PATH ?? conf.
|
|
9
|
-
const fetcherImport = env.VOVK_FETCHER_PATH ?? conf.
|
|
10
|
-
const createRPCImport = env.VOVK_CREATE_RPC_PATH ?? conf.
|
|
11
|
-
const defaultClientTemplates = ['
|
|
8
|
+
const validateOnClientImport = env.VOVK_VALIDATE_ON_CLIENT_PATH ?? conf.imports?.validateOnClient ?? null;
|
|
9
|
+
const fetcherImport = env.VOVK_FETCHER_PATH ?? conf.imports?.fetcher ?? 'vovk';
|
|
10
|
+
const createRPCImport = env.VOVK_CREATE_RPC_PATH ?? conf.imports?.createRPC ?? 'vovk';
|
|
11
|
+
const defaultClientTemplates = ['module', 'main'];
|
|
12
12
|
const config = {
|
|
13
13
|
emitConfig: [],
|
|
14
14
|
modulesDir: env.VOVK_MODULES_DIR ?? conf.modulesDir ?? './' + [srcRoot, 'modules'].filter(Boolean).join('/'),
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
imports: {
|
|
16
|
+
fetcher: typeof fetcherImport === 'string' ? [fetcherImport] : fetcherImport,
|
|
17
|
+
validateOnClient: typeof validateOnClientImport === 'string' ? [validateOnClientImport] : (validateOnClientImport ?? null),
|
|
18
|
+
createRPC: typeof createRPCImport === 'string' ? [createRPCImport, 'vovk'] : createRPCImport,
|
|
19
|
+
},
|
|
18
20
|
schemaOutDir: env.VOVK_SCHEMA_OUT_DIR ?? conf.schemaOutDir ?? './.vovk-schema',
|
|
19
21
|
clientOutDir: clientOutDir ?? env.VOVK_CLIENT_OUT_DIR ?? conf.clientOutDir ?? './node_modules/.vovk-client',
|
|
20
22
|
origin: (env.VOVK_ORIGIN ?? conf.origin ?? '').replace(/\/$/, ''), // Remove trailing slash
|
|
@@ -25,7 +27,7 @@ export default async function getConfig({ clientOutDir, configPath, cwd, }) {
|
|
|
25
27
|
devHttps: (env.VOVK_DEV_HTTPS ? !!env.VOVK_DEV_HTTPS : null) ?? conf.devHttps ?? false,
|
|
26
28
|
generateFrom: typeof conf.generateFrom === 'function'
|
|
27
29
|
? conf.generateFrom(defaultClientTemplates)
|
|
28
|
-
: (conf.generateFrom ??
|
|
30
|
+
: (conf.generateFrom ?? defaultClientTemplates),
|
|
29
31
|
templates: {
|
|
30
32
|
service: 'vovk-cli/templates/service.ejs',
|
|
31
33
|
controller: 'vovk-cli/templates/controller.ejs',
|
|
@@ -21,14 +21,14 @@ export default async function getProjectInfo({ port: givenPort, clientOutDir, co
|
|
|
21
21
|
}
|
|
22
22
|
const getImportPath = (p) => (p.startsWith('.') ? path.relative(config.clientOutDir, p) : p);
|
|
23
23
|
const clientImports = {
|
|
24
|
-
fetcher: getImportPath(config.
|
|
25
|
-
createRPC: getImportPath(config.
|
|
26
|
-
validateOnClient: config.
|
|
24
|
+
fetcher: getImportPath(config.imports.fetcher[0]),
|
|
25
|
+
createRPC: getImportPath(config.imports.createRPC[0]),
|
|
26
|
+
validateOnClient: config.imports.validateOnClient ? getImportPath(config.imports.validateOnClient[0]) : null,
|
|
27
27
|
module: {
|
|
28
|
-
fetcher: getImportPath(config.
|
|
29
|
-
createRPC: getImportPath(config.
|
|
30
|
-
validateOnClient: config.
|
|
31
|
-
? getImportPath(config.
|
|
28
|
+
fetcher: getImportPath(config.imports.fetcher[1] ?? config.imports.fetcher[0]),
|
|
29
|
+
createRPC: getImportPath(config.imports.createRPC[1] ?? config.imports.createRPC[0]),
|
|
30
|
+
validateOnClient: config.imports.validateOnClient
|
|
31
|
+
? getImportPath(config.imports.validateOnClient[1] ?? config.imports.validateOnClient[0])
|
|
32
32
|
: null,
|
|
33
33
|
},
|
|
34
34
|
};
|
|
@@ -16,7 +16,8 @@ export default async function createConfig({ root, log, options: { validationLib
|
|
|
16
16
|
service: 'vovk-cli/templates/service.ejs',
|
|
17
17
|
};
|
|
18
18
|
if (validationLibrary) {
|
|
19
|
-
config.
|
|
19
|
+
config.imports ??= {};
|
|
20
|
+
config.imports.validateOnClient =
|
|
20
21
|
{
|
|
21
22
|
'vovk-dto': `vovk-dto/validateOnClient.js`,
|
|
22
23
|
}[validationLibrary] ?? 'vovk-ajv';
|
|
@@ -29,7 +30,8 @@ export default async function createConfig({ root, log, options: { validationLib
|
|
|
29
30
|
}
|
|
30
31
|
}
|
|
31
32
|
if (reactQuery) {
|
|
32
|
-
config.
|
|
33
|
+
config.imports ??= {};
|
|
34
|
+
config.imports.createRPC = 'vovk-react-query';
|
|
33
35
|
}
|
|
34
36
|
config.templates = templates;
|
|
35
37
|
const configStr = await prettify(`/** @type {import('vovk-cli').VovkConfig} */
|
package/dist/init/index.mjs
CHANGED
|
@@ -176,18 +176,18 @@ export class Init {
|
|
|
176
176
|
updateScripts =
|
|
177
177
|
updateScripts ??
|
|
178
178
|
(await select({
|
|
179
|
-
message: 'Do you want to update
|
|
179
|
+
message: 'Do you want to update "dev" NPM script at package.json?',
|
|
180
180
|
default: 'implicit',
|
|
181
181
|
choices: [
|
|
182
182
|
{
|
|
183
183
|
name: 'Yes, use "concurrently" implicitly',
|
|
184
184
|
value: 'implicit',
|
|
185
|
-
description: `The
|
|
185
|
+
description: `The script will use "concurrently" API to run "next dev" and "vovk dev" commands together and automatically find an available port ${chalk.whiteBright.bold(`"${getDevScript(pkgJson, 'implicit')}"`)}`,
|
|
186
186
|
},
|
|
187
187
|
{
|
|
188
188
|
name: 'Yes, use "concurrently" explicitly',
|
|
189
189
|
value: 'explicit',
|
|
190
|
-
description: `The
|
|
190
|
+
description: `The script will use pre-defined PORT variable and run "next dev" and "vovk dev" as "concurrently" CLI arguments ${chalk.whiteBright.bold(`"${getDevScript(pkgJson, 'explicit')}"`)}`,
|
|
191
191
|
},
|
|
192
192
|
{
|
|
193
193
|
name: 'No',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VovkStrictConfig } from 'vovk';
|
|
2
2
|
export type Segment = {
|
|
3
3
|
routeFilePath: string;
|
|
4
4
|
segmentName: string;
|
|
@@ -7,5 +7,5 @@ export type Segment = {
|
|
|
7
7
|
export default function locateSegments({ dir, rootDir, config, }: {
|
|
8
8
|
dir: string;
|
|
9
9
|
rootDir?: string;
|
|
10
|
-
config:
|
|
10
|
+
config: VovkStrictConfig | null;
|
|
11
11
|
}): Promise<Segment[]>;
|
package/dist/new/render.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { VovkStrictConfig } from 'vovk';
|
|
2
2
|
import type { VovkModuleRenderResult } from '../types.mjs';
|
|
3
3
|
export default function render(codeTemplate: string, { config, withService, segmentName, moduleName, empty, templateFileName, }: {
|
|
4
4
|
cwd: string;
|
|
5
|
-
config:
|
|
5
|
+
config: VovkStrictConfig;
|
|
6
6
|
withService: boolean;
|
|
7
7
|
segmentName: string;
|
|
8
8
|
moduleName: string;
|
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.116",
|
|
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.109"
|
|
39
39
|
},
|
|
40
40
|
"optionalDependencies": {
|
|
41
41
|
"vovk-python-client": "*"
|