poon-choi 1.0.0 → 1.0.1
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/.output/nitro.json +1 -1
- package/.output/server/index.mjs +11 -11
- package/bin/cli.ts +40 -14
- package/package.json +2 -2
package/.output/nitro.json
CHANGED
package/.output/server/index.mjs
CHANGED
|
@@ -13,35 +13,35 @@ var public_assets_data_default = {
|
|
|
13
13
|
"/assets/about-D4e6L2RX.js": {
|
|
14
14
|
"type": "text/javascript; charset=utf-8",
|
|
15
15
|
"etag": "\"2d3-K/Mk8Xwun59XEuZOXW4FszGlmCo\"",
|
|
16
|
-
"mtime": "2026-11-
|
|
16
|
+
"mtime": "2026-11-16T10:04:07.361Z",
|
|
17
17
|
"size": 723,
|
|
18
18
|
"path": "../public/assets/about-D4e6L2RX.js"
|
|
19
19
|
},
|
|
20
|
-
"/assets/routes-BgrRSMVP.js": {
|
|
21
|
-
"type": "text/javascript; charset=utf-8",
|
|
22
|
-
"etag": "\"9cab-F1HqYvl8HqsqA3IdMdtqy0sjW/4\"",
|
|
23
|
-
"mtime": "2026-11-16T07:39:53.238Z",
|
|
24
|
-
"size": 40107,
|
|
25
|
-
"path": "../public/assets/routes-BgrRSMVP.js"
|
|
26
|
-
},
|
|
27
20
|
"/assets/index-B6P0kA2f.css": {
|
|
28
21
|
"type": "text/css; charset=utf-8",
|
|
29
22
|
"etag": "\"ebc-+E2ER+la0niWYHOeTJb/km1hZ3g\"",
|
|
30
|
-
"mtime": "2026-11-
|
|
23
|
+
"mtime": "2026-11-16T10:04:07.362Z",
|
|
31
24
|
"size": 3772,
|
|
32
25
|
"path": "../public/assets/index-B6P0kA2f.css"
|
|
33
26
|
},
|
|
27
|
+
"/assets/routes-BgrRSMVP.js": {
|
|
28
|
+
"type": "text/javascript; charset=utf-8",
|
|
29
|
+
"etag": "\"9cab-F1HqYvl8HqsqA3IdMdtqy0sjW/4\"",
|
|
30
|
+
"mtime": "2026-11-16T10:04:07.361Z",
|
|
31
|
+
"size": 40107,
|
|
32
|
+
"path": "../public/assets/routes-BgrRSMVP.js"
|
|
33
|
+
},
|
|
34
34
|
"/assets/styles-DqQrEVt_.css": {
|
|
35
35
|
"type": "text/css; charset=utf-8",
|
|
36
36
|
"etag": "\"65ac-bZPVDa9/uqOQex/J0MEvk6xdijI\"",
|
|
37
|
-
"mtime": "2026-11-
|
|
37
|
+
"mtime": "2026-11-16T10:04:07.362Z",
|
|
38
38
|
"size": 26028,
|
|
39
39
|
"path": "../public/assets/styles-DqQrEVt_.css"
|
|
40
40
|
},
|
|
41
41
|
"/assets/index-CdiJXXIG.js": {
|
|
42
42
|
"type": "text/javascript; charset=utf-8",
|
|
43
43
|
"etag": "\"54f38-+c8k8UEQVPFuHY4Mod+ogEthzBI\"",
|
|
44
|
-
"mtime": "2026-11-
|
|
44
|
+
"mtime": "2026-11-16T10:04:07.361Z",
|
|
45
45
|
"size": 347960,
|
|
46
46
|
"path": "../public/assets/index-CdiJXXIG.js"
|
|
47
47
|
}
|
package/bin/cli.ts
CHANGED
|
@@ -2,17 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
// vite dev --port 3000
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import net from 'node:net';
|
|
6
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
6
7
|
import { parseArgs, styleText } from 'node:util';
|
|
7
8
|
import pkg from '../package.json' with { type: 'json' };
|
|
9
|
+
import { join } from 'node:path';
|
|
8
10
|
|
|
9
11
|
// console.log('pkg:', pkg);
|
|
10
12
|
|
|
11
13
|
const { version, name, description } = pkg;
|
|
12
14
|
|
|
15
|
+
const check = (port: number) =>
|
|
16
|
+
new Promise((res) => {
|
|
17
|
+
const s = net.createServer();
|
|
18
|
+
s.once('error', (e) => res(e.code === 'EADDRINUSE'));
|
|
19
|
+
s.once('listening', () => s.close(() => res(false)));
|
|
20
|
+
s.listen(port);
|
|
21
|
+
});
|
|
22
|
+
|
|
13
23
|
main();
|
|
14
24
|
|
|
15
|
-
function main() {
|
|
25
|
+
async function main() {
|
|
16
26
|
const { values } = parseArgs({
|
|
17
27
|
options: {
|
|
18
28
|
port: {
|
|
@@ -24,10 +34,10 @@ function main() {
|
|
|
24
34
|
short: 'v',
|
|
25
35
|
type: 'boolean',
|
|
26
36
|
},
|
|
27
|
-
help
|
|
37
|
+
help: {
|
|
28
38
|
short: 'h',
|
|
29
39
|
type: 'boolean',
|
|
30
|
-
}
|
|
40
|
+
},
|
|
31
41
|
},
|
|
32
42
|
});
|
|
33
43
|
|
|
@@ -35,12 +45,15 @@ function main() {
|
|
|
35
45
|
|
|
36
46
|
const port = Number(values.port);
|
|
37
47
|
// validate port in a valid range
|
|
38
|
-
const valid = port >= 1024 && port <= 65535
|
|
48
|
+
const valid = port >= 1024 && port <= 65535;
|
|
49
|
+
|
|
39
50
|
if (!valid) {
|
|
40
|
-
console.error(
|
|
41
|
-
|
|
51
|
+
console.error(
|
|
52
|
+
`Invalid port number ${values.port}, should be between 1024 and 65535`
|
|
53
|
+
);
|
|
54
|
+
process.exitCode = 1;
|
|
42
55
|
|
|
43
|
-
return
|
|
56
|
+
return;
|
|
44
57
|
}
|
|
45
58
|
|
|
46
59
|
if (values.version || values.help) {
|
|
@@ -50,25 +63,38 @@ function main() {
|
|
|
50
63
|
|
|
51
64
|
console.log(`\n${name} v${version}\n\n---\n`);
|
|
52
65
|
|
|
53
|
-
|
|
66
|
+
if (await check(port)) {
|
|
67
|
+
console.error(
|
|
68
|
+
'port',
|
|
69
|
+
styleText('red', values.port),
|
|
70
|
+
'in use, try another one.'
|
|
71
|
+
);
|
|
72
|
+
process.exitCode = 1;
|
|
73
|
+
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const dirname = import.meta.dirname;
|
|
78
|
+
|
|
79
|
+
spawnSync('node', [join(dirname, '../.output/server/index.mjs')], {
|
|
54
80
|
stdio: 'inherit',
|
|
55
|
-
shell: true,
|
|
81
|
+
// shell: true,
|
|
56
82
|
env: {
|
|
57
83
|
...process.env,
|
|
58
84
|
PORT: values.port,
|
|
59
|
-
}
|
|
60
|
-
})
|
|
85
|
+
},
|
|
86
|
+
});
|
|
61
87
|
}
|
|
62
88
|
|
|
63
89
|
function printHelp(verbose: boolean) {
|
|
64
90
|
console.log(`\n${name} v${version}`);
|
|
65
91
|
|
|
66
92
|
if (!verbose) {
|
|
67
|
-
return
|
|
93
|
+
return;
|
|
68
94
|
}
|
|
69
95
|
|
|
70
96
|
console.log();
|
|
71
|
-
console.log('>', styleText('green', description), '\n')
|
|
97
|
+
console.log('>', styleText('green', description), '\n');
|
|
72
98
|
|
|
73
99
|
console.log('Usage: npx poon-choi [options]');
|
|
74
100
|
console.log();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "poon-choi",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "poon-choi 🍲 is a wechat-cover-studio: a cover mosaic tool to generate wechat (2.35:1) cover image using multiple images.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"pub:minor": "npm version minor",
|
|
22
22
|
"pub:major": "npm version major",
|
|
23
23
|
"preversion": "cd wechat-cover-studio && npm test && npm run build",
|
|
24
|
-
"postversion": "npm publish && git
|
|
24
|
+
"postversion": "npm publish && git push && git push --tags"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {},
|
|
27
27
|
"devDependencies": {},
|