@meloniwastaken/prri-jira-viewer 1.0.0 → 1.0.2
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/bin/cli.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { createInterface } from 'readline';
|
|
4
3
|
import { spawn } from 'child_process';
|
|
5
4
|
import { fileURLToPath } from 'url';
|
|
6
5
|
import { dirname, join } from 'path';
|
|
@@ -8,76 +7,39 @@ import { dirname, join } from 'path';
|
|
|
8
7
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
9
8
|
const serverPath = join(__dirname, '..', 'server.js');
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
finalToken = await ask(rl, ' API Token: ');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
rl.close();
|
|
39
|
-
|
|
40
|
-
if (!finalEmail || !finalToken) {
|
|
41
|
-
console.error('\n Errore: email e token sono obbligatori.\n');
|
|
42
|
-
process.exit(1);
|
|
43
|
-
}
|
|
10
|
+
const port = process.env.PORT || 3000;
|
|
11
|
+
|
|
12
|
+
const env = {
|
|
13
|
+
...process.env,
|
|
14
|
+
JIRA_URL: process.env.JIRA_URL || 'https://regcam-projectmgm.atlassian.net',
|
|
15
|
+
PORT: String(port),
|
|
16
|
+
NODE_ENV: 'production',
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
console.log(`\n PRRI Jira Sprint Viewer`);
|
|
20
|
+
console.log(` Avvio server su http://localhost:${port} ...`);
|
|
21
|
+
|
|
22
|
+
const child = spawn(process.execPath, [serverPath], {
|
|
23
|
+
env,
|
|
24
|
+
stdio: 'inherit',
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
// Wait for server to start, then open browser
|
|
28
|
+
setTimeout(async () => {
|
|
29
|
+
try {
|
|
30
|
+
const open = (await import('open')).default;
|
|
31
|
+
await open(`http://localhost:${port}`);
|
|
32
|
+
} catch {
|
|
33
|
+
console.log(` Apri il browser su http://localhost:${port}`);
|
|
44
34
|
}
|
|
35
|
+
}, 1500);
|
|
45
36
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
console.log(`\n Avvio server su http://localhost:${port} ...`);
|
|
56
|
-
|
|
57
|
-
const child = spawn(process.execPath, [serverPath], {
|
|
58
|
-
env,
|
|
59
|
-
stdio: 'inherit',
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// Wait for server to start, then open browser
|
|
63
|
-
setTimeout(async () => {
|
|
64
|
-
try {
|
|
65
|
-
const open = (await import('open')).default;
|
|
66
|
-
await open(`http://localhost:${port}`);
|
|
67
|
-
} catch {
|
|
68
|
-
console.log(` Apri il browser su http://localhost:${port}`);
|
|
69
|
-
}
|
|
70
|
-
}, 1500);
|
|
71
|
-
|
|
72
|
-
// Clean shutdown
|
|
73
|
-
const shutdown = () => {
|
|
74
|
-
child.kill();
|
|
75
|
-
process.exit(0);
|
|
76
|
-
};
|
|
77
|
-
process.on('SIGINT', shutdown);
|
|
78
|
-
process.on('SIGTERM', shutdown);
|
|
79
|
-
|
|
80
|
-
child.on('exit', (code) => process.exit(code || 0));
|
|
81
|
-
}
|
|
37
|
+
// Clean shutdown
|
|
38
|
+
const shutdown = () => {
|
|
39
|
+
child.kill();
|
|
40
|
+
process.exit(0);
|
|
41
|
+
};
|
|
42
|
+
process.on('SIGINT', shutdown);
|
|
43
|
+
process.on('SIGTERM', shutdown);
|
|
82
44
|
|
|
83
|
-
|
|
45
|
+
child.on('exit', (code) => process.exit(code || 0));
|