vovk-cli 0.0.1-draft.34 → 0.0.1-draft.36
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/dev/index.mjs
CHANGED
|
@@ -130,8 +130,8 @@ export class VovkDev {
|
|
|
130
130
|
this.#projectInfo = await getProjectInfo();
|
|
131
131
|
if (!isInitial) {
|
|
132
132
|
log.info('Config file has been updated');
|
|
133
|
-
isInitial = false;
|
|
134
133
|
}
|
|
134
|
+
isInitial = false;
|
|
135
135
|
await this.#modulesWatcher?.close();
|
|
136
136
|
await this.#segmentWatcher?.close();
|
|
137
137
|
this.#watchModules();
|
|
@@ -165,6 +165,7 @@ export class VovkDev {
|
|
|
165
165
|
await ensureClient(this.#projectInfo);
|
|
166
166
|
// automatically watches segments and modules
|
|
167
167
|
this.#watchConfig();
|
|
168
|
+
log.info('Vovk Dev Watcher is ready');
|
|
168
169
|
}
|
|
169
170
|
#processControllerChange = async (filePath) => {
|
|
170
171
|
const { log } = this.#projectInfo;
|
package/dist/generateClient.mjs
CHANGED
|
@@ -3,11 +3,9 @@ import fs from 'node:fs/promises';
|
|
|
3
3
|
import formatLoggedSegmentName from './utils/formatLoggedSegmentName.mjs';
|
|
4
4
|
import prettify from './utils/prettify.mjs';
|
|
5
5
|
export default async function generateClient(projectInfo, segments, segmentsSchema) {
|
|
6
|
-
console.log('generateClient');
|
|
7
6
|
const { config, cwd, log, validateOnClientImportPath, apiEntryPoint, fetcherClientImportPath, schemaOutImportPath } = projectInfo;
|
|
8
7
|
const now = Date.now();
|
|
9
8
|
const clientoOutDirAbsolutePath = path.join(cwd, config.clientOutDir);
|
|
10
|
-
console.log('schemaOutImportPath', schemaOutImportPath);
|
|
11
9
|
let dts = `// auto-generated
|
|
12
10
|
/* eslint-disable */
|
|
13
11
|
import type { clientizeController } from 'vovk/client';
|
|
@@ -15,7 +15,7 @@ export default async function getConfig({ clientOutDir, cwd }) {
|
|
|
15
15
|
origin: (env.VOVK_ORIGIN ?? conf.origin ?? '').replace(/\/$/, ''), // Remove trailing slash
|
|
16
16
|
rootEntry: env.VOVK_ROOT_ENTRY ?? conf.rootEntry ?? 'api',
|
|
17
17
|
rootSegmentModulesDirName: env.VOVK_ROOT_SEGMENT_MODULES_DIR_NAME ?? conf.rootSegmentModulesDirName ?? '',
|
|
18
|
-
logLevel: env.VOVK_LOG_LEVEL ?? conf.logLevel ?? '
|
|
18
|
+
logLevel: env.VOVK_LOG_LEVEL ?? conf.logLevel ?? 'info',
|
|
19
19
|
prettifyClient: (env.VOVK_PRETTIFY_CLIENT ? !!env.VOVK_PRETTIFY_CLIENT : null) ?? conf.prettifyClient ?? false,
|
|
20
20
|
devHttps: (env.VOVK_DEV_HTTPS ? !!env.VOVK_DEV_HTTPS : null) ?? conf.devHttps ?? false,
|
|
21
21
|
templates: {
|
|
@@ -8,7 +8,6 @@ export default async function getProjectInfo({ port: givenPort, clientOutDir, cw
|
|
|
8
8
|
const { config, srcRoot, configAbsolutePaths, userConfig, error } = await getConfig({ clientOutDir, cwd });
|
|
9
9
|
const apiEntryPoint = `${config.origin ?? ''}/${config.rootEntry}`;
|
|
10
10
|
const apiDir = path.join(srcRoot, 'app', config.rootEntry);
|
|
11
|
-
console.log('config', config);
|
|
12
11
|
const schemaOutImportPath = path.relative(config.clientOutDir, config.schemaOutDir).replace(/\\/g, '/'); // windows fix
|
|
13
12
|
const fetcherClientImportPath = config.fetcher.startsWith('.')
|
|
14
13
|
? path.relative(config.clientOutDir, config.fetcher)
|
package/dist/index.mjs
CHANGED
|
@@ -66,14 +66,10 @@ program
|
|
|
66
66
|
.description('Generate client')
|
|
67
67
|
.option('--client-out <path>', 'Path to output directory')
|
|
68
68
|
.action(async (options) => {
|
|
69
|
-
console.log('GENERATE');
|
|
70
69
|
const projectInfo = await getProjectInfo({ clientOutDir: options.clientOut });
|
|
71
|
-
console.log('projectInfo', projectInfo);
|
|
72
70
|
const { cwd, config, apiDir } = projectInfo;
|
|
73
71
|
const segments = await locateSegments(apiDir);
|
|
74
|
-
console.log('segments', segments);
|
|
75
72
|
const schemaOutAbsolutePath = path.join(cwd, config.schemaOutDir);
|
|
76
|
-
console.log('schemaOutAbsolutePath', schemaOutAbsolutePath);
|
|
77
73
|
const schemaImportUrl = pathToFileURL(path.join(schemaOutAbsolutePath, 'index.js')).href;
|
|
78
74
|
const schema = await import(schemaImportUrl);
|
|
79
75
|
await generateClient(projectInfo, segments, schema.default);
|
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.36",
|
|
4
4
|
"bin": {
|
|
5
5
|
"vovk": "./dist/index.mjs"
|
|
6
6
|
},
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
},
|
|
37
37
|
"homepage": "https://vovk.dev",
|
|
38
38
|
"peerDependencies": {
|
|
39
|
-
"vovk": "^3.0.0-draft.
|
|
39
|
+
"vovk": "^3.0.0-draft.33"
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@inquirer/prompts": "^7.1.0",
|