scripting-cli 1.1.6 → 1.1.7
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/start_server.js +7 -4
- package/package.json +1 -1
- package/src/start_server.ts +7 -4
package/dist/start_server.js
CHANGED
|
@@ -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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
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
package/src/start_server.ts
CHANGED
|
@@ -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
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
|