@mirascript/cli 0.1.62-alpha.15 → 0.1.62-alpha.20
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 +60 -0
- package/package.json +8 -3
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @mirascript/cli
|
|
2
|
+
|
|
3
|
+
`@mirascript/cli` 是 MiraScript 的命令行工具,提供脚本执行和代码格式化能力,对外暴露 `mirascript` 可执行命令。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add -D @mirascript/cli
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
或直接在工作区中调用:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
pnpm --filter @mirascript/cli build
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 命令概览
|
|
18
|
+
|
|
19
|
+
### 运行脚本
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
mirascript run examples/01_hello_world.mira
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
支持的常用选项:
|
|
26
|
+
|
|
27
|
+
- `-e, --eval <script>`:直接执行内联脚本
|
|
28
|
+
- `-t, --template`:以模板模式执行
|
|
29
|
+
- `-v, --variable <key=value>`:注入全局变量,可重复使用
|
|
30
|
+
- `--timeout <ms>`:设置执行超时,`0` 表示不限制
|
|
31
|
+
|
|
32
|
+
示例:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
mirascript run -e "1 + 2"
|
|
36
|
+
mirascript run --template template.miratpl
|
|
37
|
+
mirascript run -v name=world examples/11_interpolation.mira
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 格式化脚本
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
mirascript format examples/**/*.mira
|
|
44
|
+
mirascript format --write examples/**/*.mira
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
支持从标准输入读取:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cat script.mira | mirascript format -
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## 开发
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
pnpm --filter @mirascript/cli build
|
|
57
|
+
pnpm --filter @mirascript/cli watch
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
该包依赖 `@mirascript/mirascript` 与 `@mirascript/bindings`,因此本地开发前应先完成工作区依赖安装。
|
package/package.json
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mirascript/cli",
|
|
3
|
-
"version": "0.1.62-alpha.
|
|
3
|
+
"version": "0.1.62-alpha.20",
|
|
4
4
|
"author": "CloudPSS",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "Cli for MiraScript, an expression based scripting language.",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/CloudPSS/MiraScript.git",
|
|
10
|
+
"directory": "packages/cli"
|
|
11
|
+
},
|
|
7
12
|
"type": "module",
|
|
8
13
|
"main": "./dist/index.js",
|
|
9
14
|
"bin": {
|
|
@@ -25,8 +30,8 @@
|
|
|
25
30
|
"ansi-styles": "^6.2.3",
|
|
26
31
|
"commander": "^14.0.3",
|
|
27
32
|
"supports-color": "^10.2.2",
|
|
28
|
-
"@mirascript/bindings": "~0.1.62-alpha.
|
|
29
|
-
"@mirascript/mirascript": "~0.1.62-alpha.
|
|
33
|
+
"@mirascript/bindings": "~0.1.62-alpha.20",
|
|
34
|
+
"@mirascript/mirascript": "~0.1.62-alpha.20"
|
|
30
35
|
},
|
|
31
36
|
"devDependencies": {
|
|
32
37
|
"@types/node": "^25.6.0",
|