vovk 0.2.3-beta.62 → 0.2.3-beta.64

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.
@@ -29,6 +29,7 @@ function concurrent(commands, env) {
29
29
  if (code !== 0) {
30
30
  processes.forEach((p) => p.name !== name && p.process.kill('SIGINT'));
31
31
  processes = [];
32
+ process.stdout.write('\n');
32
33
  return reject(new Error(`Process ${name} exited with code ${code}`));
33
34
  }
34
35
 
package/cli/server.js CHANGED
@@ -13,6 +13,8 @@ const argv = yargs(hideBin(process.argv)).argv;
13
13
 
14
14
  const once = argv.once ?? false;
15
15
 
16
+ const metadataPath = path.join(__dirname, '../../../.vovk.json');
17
+
16
18
  const isEqual = (obj1, obj2) => {
17
19
  if (obj1 === obj2) {
18
20
  return true;
@@ -38,14 +40,22 @@ const isEqual = (obj1, obj2) => {
38
40
  return true;
39
41
  };
40
42
 
41
- const writeMetadata = async (metadataPath, metadata) => {
43
+ const writeMetadata = async (metadata) => {
42
44
  await fs.mkdir(path.dirname(metadataPath), { recursive: true });
43
- const existingMetadata = await fs.readFile(metadataPath, 'utf-8').catch(() => '{}');
45
+ const existingMetadata = await fs.readFile(metadataPath, 'utf-8').catch(() => 'null');
44
46
  if (isEqual(JSON.parse(existingMetadata), metadata)) return false;
45
47
  await fs.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
46
48
  return true;
47
49
  };
48
50
 
51
+ const writeEmptyMetadata = async () => {
52
+ await fs.mkdir(path.dirname(metadataPath), { recursive: true });
53
+ const existingMetadata = await fs.readFile(metadataPath, 'utf-8').catch(() => null);
54
+ if (!existingMetadata) await fs.writeFile(metadataPath, '{}');
55
+ };
56
+
57
+ void writeEmptyMetadata();
58
+
49
59
  let pingInterval;
50
60
 
51
61
  const vars = getVars(argv.vovkrc, false);
@@ -81,10 +91,12 @@ const server = http.createServer((req, res) => {
81
91
  // eslint-disable-next-line @typescript-eslint/no-misused-promises
82
92
  req.on('end', async () => {
83
93
  try {
94
+ // eslint-disable-next-line no-console
95
+ console.log(body);
84
96
  const { metadata, PORT } = JSON.parse(body); // Parse the JSON data
85
- const filePath = path.join(__dirname, '../../../.vovk.json');
86
- const metadataWritten = await writeMetadata(filePath, metadata);
87
-
97
+ const metadataWritten = await writeMetadata(metadata);
98
+ // eslint-disable-next-line no-console
99
+ console.log({ metadata, PORT });
88
100
  const codeWritten = await generateClient(vars);
89
101
  res.writeHead(200, { 'Content-Type': 'text/plain' });
90
102
  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.62",
3
+ "version": "0.2.3-beta.64",
4
4
  "description": "Structural add-on for Next.js",
5
5
  "bin": "./cli/index.js",
6
6
  "scripts": {