scripting-cli 1.1.6 → 1.1.8

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.
@@ -33,15 +33,18 @@ function startServer(port) {
33
33
  console.log(`Server listening on ${chalk_1.default.bold.blue(address)}\nYou can select this server in the Scripting app to connect.\n`);
34
34
  console.log(`Alternatively, you can ${chalk_1.default.green.bold("use the Scripting app to scan")} the QR code and connect: `);
35
35
  qrcode_terminal_1.default.generate(address, { small: true });
36
- bonjour.publish({
36
+ const service = bonjour.publish({
37
37
  name: 'Scripting-service',
38
38
  type: 'http',
39
39
  port: PORT
40
40
  });
41
41
  process.on('SIGINT', () => {
42
- bonjour.unpublishAll(() => {
43
- console.log('Server stopped');
44
- process.exit();
42
+ service.stop(() => {
43
+ bonjour.unpublishAll(() => {
44
+ bonjour.destroy();
45
+ console.log('Bonjour services have been shut down properly.');
46
+ process.exit(0);
47
+ });
45
48
  });
46
49
  });
47
50
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scripting-cli",
3
- "version": "1.1.6",
3
+ "version": "1.1.8",
4
4
  "description": "This plugin integrates the desktop editor synchronization feature of the Scripting app.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -38,16 +38,19 @@ export function startServer(port?: number) {
38
38
  console.log(`Alternatively, you can ${chalk.green.bold("use the Scripting app to scan")} the QR code and connect: `);
39
39
  qrcode.generate(address, { small: true });
40
40
 
41
- bonjour.publish({
41
+ const service = bonjour.publish({
42
42
  name: 'Scripting-service',
43
43
  type: 'http',
44
44
  port: PORT
45
45
  });
46
46
 
47
47
  process.on('SIGINT', () => {
48
- bonjour.unpublishAll(() => {
49
- console.log('Server stopped');
50
- process.exit();
48
+ service.stop(() => {
49
+ bonjour.unpublishAll(() => {
50
+ bonjour.destroy();
51
+ console.log('Bonjour services have been shut down properly.');
52
+ process.exit(0);
53
+ });
51
54
  });
52
55
  });
53
56
 
package/src/util.ts CHANGED
@@ -114,5 +114,5 @@ export async function writeDtsFiles(files: Record<string, string>) {
114
114
 
115
115
  export function getRelativePath(from: string, to: string) {
116
116
  const relativePath = path.relative(from, to);
117
- return relativePath.replace("\\", "/");
118
- }
117
+ return relativePath.replaceAll("\\", "/");
118
+ }