@wagq/wa-cli 0.6.5 → 0.6.10

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/README.md CHANGED
@@ -17,7 +17,8 @@
17
17
  wa server [path]
18
18
  ```
19
19
  可选参数
20
- -P 指定端口
20
+ -P 3000 指定端口
21
+ -S true 开启https
21
22
 
22
23
  - 转换 xlsx 文件为多语言配置
23
24
  wa xlsx2Config [path] [name] [ext]
@@ -1,13 +1,31 @@
1
1
  const { spawn } = require('node:child_process'); // 使用 node: 前缀明确使用核心模块
2
+ const Prompt = require("inquirer");
2
3
 
3
- const server = (filePath, argv) => {
4
+ // 可以在https://www.toolhelper.cn/SSL/SSLGenerate生成
5
+ const sslQuestions = () => [
6
+ {
7
+ type: "input",
8
+ name: "cert",
9
+ default: "cert.pem",
10
+ message: `证书地址(完整的绝对路径)`,
11
+ },
12
+ {
13
+ type: "input",
14
+ name: "private",
15
+ default: "private.key",
16
+ message: `私钥地址(完整的绝对路径)`,
17
+ },
18
+ ];
19
+
20
+ const server = async(filePath, argv) => {
4
21
  const https = argv.https ?? false;
5
22
  const port = argv.port ?? 3000;
6
23
 
7
24
  try {
8
25
  const args = [filePath, '-p', port.toString()];
9
- if (https) {
10
- args.push('-S', '-C', 'cert.pem', '-K', 'key.pem');
26
+ if (https === 'true') {
27
+ const { cert, private } = await Prompt.default.prompt(sslQuestions());
28
+ args.push('-S', '-C', `${cert}`, '-K', `${private}`);
11
29
  }
12
30
 
13
31
  const child = spawn('npx', ['http-server', ...args], {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wagq/wa-cli",
3
- "version": "0.6.5",
3
+ "version": "0.6.10",
4
4
  "description": "wa的脚手架",
5
5
  "main": "index.js",
6
6
  "scripts": {