vovk 0.2.3-beta.100 → 0.2.3-beta.101

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.
Files changed (2) hide show
  1. package/cli/server.js +7 -9
  2. package/package.json +1 -1
package/cli/server.js CHANGED
@@ -36,19 +36,17 @@ void writeEmptyMetadata();
36
36
  /** @type {NodeJS.Timeout} */
37
37
  let pingInterval;
38
38
 
39
- /** @type {import('../src').VovkEnv} */
40
- let vars;
41
-
42
39
  /** @type {(port: string) => void} */
43
40
  const startPinging = (PORT) => {
44
41
  clearInterval(pingInterval);
45
42
  pingInterval = setInterval(() => {
46
43
  process.env.PORT = PORT;
47
- vars = vars ?? getVars(argv.config);
44
+ const vars = getVars(argv.config);
48
45
  let prefix = vars.VOVK_PREFIX;
49
- prefix = prefix.startsWith('http://')
50
- ? prefix
51
- : `http://localhost:${PORT}/${prefix.startsWith('/') ? prefix.slice(1) : prefix}`;
46
+ prefix =
47
+ prefix.startsWith('http://') || prefix.startsWith('https://')
48
+ ? prefix
49
+ : `http://localhost:${PORT}/${prefix.startsWith('/') ? prefix.slice(1) : prefix}`;
52
50
  const endpoint = `${prefix.endsWith('/') ? prefix.slice(0, -1) : prefix}/__ping`;
53
51
  // Create the HTTP GET request
54
52
  const req = http.get(endpoint, () => {
@@ -73,11 +71,11 @@ const server = http.createServer((req, res) => {
73
71
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
74
72
  req.on('end', async () => {
75
73
  try {
76
- /** @type {{ metadata: object; PORT: string }} */
74
+ /** @type {{ metadata?: import('../src').VovkMetadata; PORT?: string }} */
77
75
  const { metadata, PORT } = JSON.parse(body); // Parse the JSON data
78
76
  const metadataWritten = metadata ? await writeMetadata(metadata) : { written: false, path: metadataPath };
79
77
  process.env.PORT = PORT;
80
- vars = vars ?? getVars(argv.config);
78
+ const vars = getVars(argv.config);
81
79
  const codeWritten = await generateClient(vars);
82
80
  res.writeHead(200, { 'Content-Type': 'text/plain' });
83
81
  res.end('JSON data received and file created');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vovk",
3
- "version": "0.2.3-beta.100",
3
+ "version": "0.2.3-beta.101",
4
4
  "description": "Structural add-on for Next.js",
5
5
  "bin": "./cli/index.js",
6
6
  "scripts": {