scripting-cli 1.1.3 → 1.1.5
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/index.js +15 -5
- package/package.json +1 -1
- package/src/index.ts +15 -5
package/dist/index.js
CHANGED
|
@@ -162,7 +162,7 @@ function startServer(port) {
|
|
|
162
162
|
});
|
|
163
163
|
watcher
|
|
164
164
|
.on('change', (filePath) => {
|
|
165
|
-
if (filePath.match(/\.(js(x)?|ts(x)
|
|
165
|
+
if (filePath.match(/\.(js(x)?|ts(x)?|json|md|txt)$/)) {
|
|
166
166
|
// send file content md5 hash to client
|
|
167
167
|
// const content = fs.readFileSync(filePath, 'utf-8');
|
|
168
168
|
fs_1.default.readFile(filePath, 'utf-8', (err, content) => {
|
|
@@ -234,8 +234,13 @@ function startServer(port) {
|
|
|
234
234
|
ack({
|
|
235
235
|
success: true,
|
|
236
236
|
});
|
|
237
|
-
|
|
238
|
-
|
|
237
|
+
// Open the entry file in VSCode after a delay
|
|
238
|
+
// to ensure the response is sent. Because the open file command
|
|
239
|
+
// may suspend the response and cause the client to not receive the ack.
|
|
240
|
+
setTimeout(() => {
|
|
241
|
+
const entryFilePath = path_1.default.join(scriptDir, "index.tsx");
|
|
242
|
+
tryOpenFileInVSCode(entryFilePath);
|
|
243
|
+
}, 1000);
|
|
239
244
|
}
|
|
240
245
|
catch (e) {
|
|
241
246
|
console.log(chalk_1.default.red(`Error: ${e}`));
|
|
@@ -296,8 +301,13 @@ function startServer(port) {
|
|
|
296
301
|
scriptFiles,
|
|
297
302
|
});
|
|
298
303
|
createWatcher(data.scriptName);
|
|
299
|
-
|
|
300
|
-
|
|
304
|
+
// Open the entry file in VSCode after a delay
|
|
305
|
+
// to ensure the response is sent. Because the open file command
|
|
306
|
+
// may suspend the response and cause the client to not receive the ack.
|
|
307
|
+
setTimeout(() => {
|
|
308
|
+
const entryFilePath = path_1.default.join(scriptDir, "index.tsx");
|
|
309
|
+
tryOpenFileInVSCode(entryFilePath);
|
|
310
|
+
}, 1000);
|
|
301
311
|
}
|
|
302
312
|
catch (e) {
|
|
303
313
|
ack({
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -166,7 +166,7 @@ function startServer(port?: number) {
|
|
|
166
166
|
|
|
167
167
|
watcher
|
|
168
168
|
.on('change', (filePath) => {
|
|
169
|
-
if (filePath.match(/\.(js(x)?|ts(x)
|
|
169
|
+
if (filePath.match(/\.(js(x)?|ts(x)?|json|md|txt)$/)) {
|
|
170
170
|
// send file content md5 hash to client
|
|
171
171
|
// const content = fs.readFileSync(filePath, 'utf-8');
|
|
172
172
|
fs.readFile(filePath, 'utf-8', (err, content) => {
|
|
@@ -261,8 +261,13 @@ function startServer(port?: number) {
|
|
|
261
261
|
success: true,
|
|
262
262
|
});
|
|
263
263
|
|
|
264
|
-
|
|
265
|
-
|
|
264
|
+
// Open the entry file in VSCode after a delay
|
|
265
|
+
// to ensure the response is sent. Because the open file command
|
|
266
|
+
// may suspend the response and cause the client to not receive the ack.
|
|
267
|
+
setTimeout(() => {
|
|
268
|
+
const entryFilePath = path.join(scriptDir, "index.tsx")
|
|
269
|
+
tryOpenFileInVSCode(entryFilePath);
|
|
270
|
+
}, 1000);
|
|
266
271
|
|
|
267
272
|
} catch (e) {
|
|
268
273
|
console.log(chalk.red(`Error: ${e}`));
|
|
@@ -343,8 +348,13 @@ function startServer(port?: number) {
|
|
|
343
348
|
|
|
344
349
|
createWatcher(data.scriptName);
|
|
345
350
|
|
|
346
|
-
|
|
347
|
-
|
|
351
|
+
// Open the entry file in VSCode after a delay
|
|
352
|
+
// to ensure the response is sent. Because the open file command
|
|
353
|
+
// may suspend the response and cause the client to not receive the ack.
|
|
354
|
+
setTimeout(() => {
|
|
355
|
+
const entryFilePath = path.join(scriptDir, "index.tsx")
|
|
356
|
+
tryOpenFileInVSCode(entryFilePath);
|
|
357
|
+
}, 1000);
|
|
348
358
|
|
|
349
359
|
} catch (e) {
|
|
350
360
|
ack({
|