-
Notifications
You must be signed in to change notification settings - Fork 5
脚本工程
坏黑 edited this page May 26, 2022
·
1 revision
如果只能运行独立的脚本文件,那么 Artifex 还无法胜任生产环境。因此 Artifex 定义了工程规范:
Artifex
├── scripts -- 脚本目录
│ ├── test -- 工程目录
│ │ ├── @components -- 工程组件
│ │ ├── @default -- 工程资源
│ │ ├── test.kts -- 工程脚本
│ │ └── project.yml -- 工程文件
│ ├── test_2 -- 工程目录
│ │ ├── @components -- 工程组件
│ │ │ └── i18n.kts -- 工程脚本
│ │ ├── @default -- 工程资源
│ │ │ └── i18n
│ │ │ ├── en_US.yml
│ │ │ └── zh_CN.yml
│ │ ├── test_2.kts -- 工程脚本
│ │ ├── project.yml -- 工程文件
...
通过识别 project.yml
文件定义当前目录为 Artifex 脚本工程;
# 名称
# 将作为配置文件目录名称
name: TestProject
# 脚本入口(服务器启动时按顺序自动运行)
# 优先在当前目录下搜索,若不存在则尝试从脚本根目录(Artifex/scripts)下搜索
main:
- test.kts
# 自动挂载
auto-mount: true
所有位于工程目录下的脚本均无法通过 /artifex run
命令运行,您仅可通过 /artifex project
命令控制整个脚本工程,例如 /artifex project run test
。
脚本工程的运行机理与独立脚本文件基本相同,但由 Artifex 提供的部分组件仅允许脚本工程使用。