steedos-validate-package

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Steedos Package Validation | 软件包校验

Steedos Package Validation | 软件包校验

After creating or modifying a Steedos package, run the validator to check all files.
在创建或修改Steedos软件包后,运行校验工具检查所有文件。

Installation | 安装

Installation | 安装

Add to your project's
package.json
:
json
{
  "devDependencies": {
    "@steedos/validate": "latest"
  },
  "scripts": {
    "validate": "steedos-validate"
  }
}
Then install:
bash
yarn add --dev @steedos/validate
添加到项目的
package.json
文件中:
json
{
  "devDependencies": {
    "@steedos/validate": "latest"
  },
  "scripts": {
    "validate": "steedos-validate"
  }
}
然后执行安装:
bash
yarn add --dev @steedos/validate

or

or

npm install --save-dev @steedos/validate
undefined
npm install --save-dev @steedos/validate
undefined

Usage | 使用方法

Usage | 使用方法

bash
undefined
bash
undefined

Validate a single package

校验单个软件包

yarn validate steedos-packages/my-package
yarn validate steedos-packages/my-package

Or use npx without installing

或无需安装直接使用npx

npx @steedos/validate steedos-packages/my-package
npx @steedos/validate steedos-packages/my-package

JSON output (for CI)

JSON格式输出(适用于CI环境)

yarn validate steedos-packages/my-package --json
undefined
yarn validate steedos-packages/my-package --json
undefined

What is Validated | 校验内容

What is Validated | 校验内容

Package Structure

软件包结构

  • package.json
    exists with
    main: package.service.js
  • package.service.js
    contains
    packageLoader
    /
    namespace
    /
    packageInfo
  • package.json
    文件必须存在,且包含
    main: package.service.js
  • package.service.js
    需包含
    packageLoader
    /
    namespace
    /
    packageInfo

Object Files (
.object.yml
)

对象文件(
.object.yml

  • Required fields:
    name
    ,
    label
    ,
    icon
  • name
    must match folder name
  • icon
    should be a valid SLDS icon name
  • Object must have a
    name
    field or
    is_name
    field among its fields
  • 必填字段:
    name
    label
    icon
  • name
    必须与文件夹名称匹配
  • icon
    应为有效的SLDS图标名称
  • 对象必须在其字段中包含
    name
    字段或
    is_name
    字段

Field Files (
.field.yml
)

字段文件(
.field.yml

  • Required fields:
    name
    ,
    type
    ,
    label
  • name
    must match filename (without
    .field.yml
    )
  • type
    must be a valid Steedos field type
  • select
    /
    lookup
    /
    summary
    /
    formula
    fields require additional properties
  • 必填字段:
    name
    type
    label
  • name
    必须与文件名(不含
    .field.yml
    后缀)匹配
  • type
    必须为有效的Steedos字段类型
  • select
    /
    lookup
    /
    summary
    /
    formula
    类型字段需要额外属性

Trigger Files (
.trigger.yml
)

触发器文件(
.trigger.yml

  • Required fields:
    name
    ,
    listenTo
    ,
    when
    ,
    type
    ,
    isEnabled
    ,
    handler
  • type
    must be
    "code"
  • when
    must be a valid hook name
  • Triggers must be in
    triggers/
    folder, not inside
    objects/
  • 必填字段:
    name
    listenTo
    when
    type
    isEnabled
    handler
  • type
    必须为
    "code"
  • when
    必须为有效的钩子名称
  • 触发器必须放在
    triggers/
    文件夹中,不能放在
    objects/

Function Files (
.function.yml
)

函数文件(
.function.yml

  • Required fields:
    name
    ,
    objectApiName
    ,
    isEnabled
    ,
    is_rest
    ,
    script
  • Functions must be in
    functions/
    folder, not inside
    objects/
  • 必填字段:
    name
    objectApiName
    isEnabled
    is_rest
    script
  • 函数必须放在
    functions/
    文件夹中,不能放在
    objects/

Button Files (
.button.yml
)

按钮文件(
.button.yml

  • Required fields:
    name
    ,
    label
    ,
    on
    ,
    amis_schema
  • type
    must be
    "amis_button"
  • amis_schema
    root node
    type
    must be
    "service"
  • label_zh
    is not allowed (use i18n instead)
  • Exception: Standard button overrides (e.g.
    standard_delete
    ) only need
    visible: false
  • 必填字段:
    name
    label
    on
    amis_schema
  • type
    必须为
    "amis_button"
  • amis_schema
    的根节点
    type
    必须为
    "service"
  • 不允许使用
    label_zh
    (请改用国际化方案)
  • 例外情况:标准按钮重写(如
    standard_delete
    )仅需设置
    visible: false

Listview Files (
.listview.yml
)

列表视图文件(
.listview.yml

  • Required fields:
    name
    ,
    label
  • 必填字段:
    name
    label

Permission Files (
.permission.yml
)

权限文件(
.permission.yml

  • Required:
    name
    or
    permission_set_id
  • 必填:
    name
    permission_set_id

App Files (
.app.yml
)

应用文件(
.app.yml

  • Required fields:
    name
    ,
    code
  • Should have non-empty
    tabs
  • 必填字段:
    name
    code
  • 应包含非空的
    tabs

Tab Files (
.tab.yml
)

标签页文件(
.tab.yml

  • Required fields:
    name
    ,
    label
  • 必填字段:
    name
    label

Page Files

页面文件

  • .page.yml
    and
    .page.amis.json
    must appear in pairs
  • .page.yml
    .page.amis.json
    必须成对出现

Common Errors | 常见错误

Common Errors | 常见错误

ErrorFix
button.amis-root-service
Wrap amis_schema with
{"type":"service","body":{...}}
trigger.location
Move trigger files to
main/default/triggers/
function.location
Move function files to
main/default/functions/
field.name-mismatch
File name must match
name
field value
button.no-label_zh
Remove
label_zh
, use i18n translation files instead
page.missing-amis
Create matching
.page.amis.json
file
错误修复方法
button.amis-root-service
将amis_schema用
{"type":"service","body":{...}}
包裹
trigger.location
将触发器文件移至
main/default/triggers/
function.location
将函数文件移至
main/default/functions/
field.name-mismatch
文件名必须与
name
字段值匹配
button.no-label_zh
删除
label_zh
,改用国际化翻译文件
page.missing-amis
创建对应的
.page.amis.json
文件