vovk 0.2.3-beta.64 → 0.2.3-beta.66
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/server.js +8 -10
- package/package.json +1 -1
package/cli/server.js
CHANGED
|
@@ -91,19 +91,17 @@ const server = http.createServer((req, res) => {
|
|
|
91
91
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
92
92
|
req.on('end', async () => {
|
|
93
93
|
try {
|
|
94
|
-
// eslint-disable-next-line no-console
|
|
95
|
-
console.log(body);
|
|
96
94
|
const { metadata, PORT } = JSON.parse(body); // Parse the JSON data
|
|
97
|
-
const metadataWritten = await writeMetadata(metadata);
|
|
98
|
-
// eslint-disable-next-line no-console
|
|
99
|
-
console.log({ metadata, PORT });
|
|
95
|
+
const metadataWritten = metadata ? await writeMetadata(metadata) : false;
|
|
100
96
|
const codeWritten = await generateClient(vars);
|
|
101
97
|
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
|
102
98
|
res.end('JSON data received and file created');
|
|
103
|
-
if (metadataWritten
|
|
104
|
-
console.info(' 🐺 JSON metadata received
|
|
105
|
-
}
|
|
106
|
-
|
|
99
|
+
if (metadataWritten) {
|
|
100
|
+
console.info(' 🐺 JSON metadata received');
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (codeWritten) {
|
|
104
|
+
console.info(' 🐺 Client generated');
|
|
107
105
|
}
|
|
108
106
|
|
|
109
107
|
if (PORT && !once) {
|
|
@@ -113,7 +111,7 @@ const server = http.createServer((req, res) => {
|
|
|
113
111
|
if (once && metadata) server.close();
|
|
114
112
|
} catch (err) {
|
|
115
113
|
res.writeHead(400, { 'Content-Type': 'text/plain' });
|
|
116
|
-
res.end(
|
|
114
|
+
res.end(err.message ?? 'Error');
|
|
117
115
|
console.error(' ❌ ' + err.message);
|
|
118
116
|
|
|
119
117
|
if (once) server.close();
|