vovk 0.2.3-beta.111 → 0.2.3-beta.112
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/cli/index.js +3 -3
- package/cli/lib/parseCommandLineArgs.js +2 -2
- package/cli/server.js +5 -8
- package/package.json +1 -1
package/cli/index.js
CHANGED
|
@@ -7,7 +7,7 @@ const getAvailablePort = require('./lib/getAvailablePort');
|
|
|
7
7
|
const getVars = require('./getVars');
|
|
8
8
|
const parseCommandLineArgs = require('./lib/parseCommandLineArgs');
|
|
9
9
|
|
|
10
|
-
const { command, flags,
|
|
10
|
+
const { command, flags, restArgs } = parseCommandLineArgs();
|
|
11
11
|
const {
|
|
12
12
|
config = path.join(process.cwd(), 'vovk.config.js'), // Path to vovk.config.js
|
|
13
13
|
project = process.cwd(), // Path to Next.js project
|
|
@@ -36,7 +36,7 @@ if (command === 'dev') {
|
|
|
36
36
|
command: `node ${__dirname}/server.js`,
|
|
37
37
|
name: 'Vovk',
|
|
38
38
|
},
|
|
39
|
-
{ command: `cd ${project} && npx next dev ${
|
|
39
|
+
{ command: `cd ${project} && npx next dev ${restArgs}`, name: 'Next' },
|
|
40
40
|
],
|
|
41
41
|
env
|
|
42
42
|
).catch((e) => console.error(e));
|
|
@@ -57,7 +57,7 @@ if (command === 'dev') {
|
|
|
57
57
|
command: `node ${__dirname}/server.js --once`,
|
|
58
58
|
name: 'Vovk',
|
|
59
59
|
},
|
|
60
|
-
{ command: `cd ${project} && npx next build ${
|
|
60
|
+
{ command: `cd ${project} && npx next build ${restArgs}`, name: 'Next' },
|
|
61
61
|
],
|
|
62
62
|
env
|
|
63
63
|
).catch((e) => console.error(e));
|
|
@@ -33,9 +33,9 @@ function parseCommandLineArgs() {
|
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
const
|
|
36
|
+
const restArgs = unparsedArgs.join(' ');
|
|
37
37
|
|
|
38
|
-
return { command, flags,
|
|
38
|
+
return { command, flags, restArgs };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
module.exports = parseCommandLineArgs;
|
package/cli/server.js
CHANGED
|
@@ -2,17 +2,14 @@
|
|
|
2
2
|
const http = require('http');
|
|
3
3
|
const fs = require('fs/promises');
|
|
4
4
|
const path = require('path');
|
|
5
|
-
const
|
|
6
|
-
const { hideBin } = require('yargs/helpers');
|
|
5
|
+
const parseCommandLineArgs = require('./lib/parseCommandLineArgs');
|
|
7
6
|
const generateClient = require('./generateClient');
|
|
8
7
|
const getVars = require('./getVars');
|
|
9
8
|
const isEqual = require('./lib/isEqual');
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
// @ts-expect-error yargs
|
|
13
|
-
const argv = yargs(hideBin(process.argv)).argv;
|
|
10
|
+
const { flags } = parseCommandLineArgs();
|
|
14
11
|
|
|
15
|
-
const once =
|
|
12
|
+
const { once, config } = /** @type {{ once?: boolean; config: string }} */ (flags);
|
|
16
13
|
|
|
17
14
|
const metadataPath = path.join(__dirname, '../../../.vovk.json');
|
|
18
15
|
|
|
@@ -43,7 +40,7 @@ let vars;
|
|
|
43
40
|
const startPinging = () => {
|
|
44
41
|
clearInterval(pingInterval);
|
|
45
42
|
pingInterval = setInterval(() => {
|
|
46
|
-
vars = vars ?? getVars(
|
|
43
|
+
vars = vars ?? getVars(config);
|
|
47
44
|
let prefix = vars.VOVK_PREFIX;
|
|
48
45
|
prefix = prefix.startsWith('http://')
|
|
49
46
|
? prefix
|
|
@@ -75,7 +72,7 @@ const server = http.createServer((req, res) => {
|
|
|
75
72
|
/** @type {{ metadata?: import('../src') }} */
|
|
76
73
|
const { metadata } = JSON.parse(body); // Parse the JSON data
|
|
77
74
|
const metadataWritten = metadata ? await writeMetadata(metadata) : { written: false, path: metadataPath };
|
|
78
|
-
vars = vars ?? getVars(
|
|
75
|
+
vars = vars ?? getVars(config);
|
|
79
76
|
const codeWritten = await generateClient(vars);
|
|
80
77
|
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
81
78
|
res.end('JSON data received and file created');
|