Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(plugin-packer): update plugin manifest validator #3146

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/plugin-manifest-validator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ When you are configuring your project, you would better set the $schema property
We recommend setting the $schema property to the following URI in your manifest.json:

```
https://raw.githubusercontent.com/kintone/js-sdk/%40kintone/plugin-manifest-validator%4010.2.0/packages/plugin-manifest-validator/manifest-schema.json
https://raw.githubusercontent.com/kintone/js-sdk/%40kintone/plugin-manifest-validator%4010.3.0/packages/plugin-manifest-validator/manifest-schema.json
```

Note: Add or update the $schema property at the top of the manifest.json.
Expand Down
17 changes: 13 additions & 4 deletions packages/plugin-manifest-validator/examples/manifest.json
Original file line number Diff line number Diff line change
@@ -1,26 +1,35 @@
{
"$schema": "https://raw.githubusercontent.com/kintone/js-sdk/%40kintone/plugin-manifest-validator%4010.2.0/packages/plugin-manifest-validator/manifest-schema.json",
"$schema": "https://raw.githubusercontent.com/kintone/js-sdk/%40kintone/plugin-manifest-validator%4010.3.0/packages/plugin-manifest-validator/manifest-schema.json",
"manifest_version": 1,
"version": 1,
"type": "APP",
"name": {
"ja": "サンプルプラグイン",
"en": "sample plugin",
"zh": "插件的例子",
"es": "complemento de muestra"
"zh-TW": "插件的例子",
"es": "complemento de muestra",
"pt-BR": "complemento de amostra",
"th": "ปลั๊กอินตัวอย่าง"
},
"description": {
"ja": "これはサンプルプラグインです。",
"en": "This is sample plugin.",
"zh": "这是插件的例子",
"es": "Este es un complemento de muestra."
"zh-TW": "這是插件的例子",
"es": "Este es un complemento de muestra.",
"pt-BR": "Este é um complemento de amostra.",
"th": "นี่คือปลั๊กอินตัวอย่าง"
},
"icon": "image/icon.png",
"homepage_url": {
"ja": "http://sample_cybozu.jp",
"en": "http://sample_cybozu.com",
"zh": "http://sample_cybozu.cn",
"es": "http://sample_cybozu.es"
"zh-TW": "http://sample_cybozu.tw",
"es": "http://sample_cybozu.es",
"pt-BR": "http://sample_cybozu.br",
"th": "http://sample_cybozu.th"
},
"desktop": {
"js": ["js/customize.js", "https://example.com/js/customize.js"],
Expand Down
9 changes: 9 additions & 0 deletions packages/plugin-manifest-validator/manifest-schema.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@ export interface KintonePluginManifestJson {
ja?: string;
en: string;
zh?: string;
"zh-TW"?: string;
es?: string;
th?: string;
"pt-BR"?: string;
};
description?: {
ja?: string;
en: string;
zh?: string;
"zh-TW"?: string;
es?: string;
th?: string;
"pt-BR"?: string;
};
/**
* internal only
Expand All @@ -35,7 +41,10 @@ export interface KintonePluginManifestJson {
ja?: string;
en?: string;
zh?: string;
"zh-TW"?: string;
es?: string;
th?: string;
"pt-BR"?: string;
};
desktop?: {
js?: Resources;
Expand Down
102 changes: 102 additions & 0 deletions packages/plugin-manifest-validator/manifest-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,21 @@
"warn": true
}
},
"zh-TW": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"requiredProperties": {
"items": [
{
"homepage_url": {
"properties": ["zh-TW"]
}
}
],
"warn": true
}
},
"es": {
"type": "string",
"minLength": 1,
Expand All @@ -91,6 +106,36 @@
],
"warn": true
}
},
"th": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"requiredProperties": {
"items": [
{
"homepage_url": {
"properties": ["th"]
}
}
],
"warn": true
}
},
"pt-BR": {
"type": "string",
"minLength": 1,
"maxLength": 64,
"requiredProperties": {
"items": [
{
"homepage_url": {
"properties": ["pt-BR"]
}
}
],
"warn": true
}
}
},
"required": ["en"]
Expand All @@ -114,10 +159,25 @@
"minLength": 1,
"maxLength": 200
},
"zh-TW": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"es": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"th": {
"type": "string",
"minLength": 1,
"maxLength": 200
},
"pt-BR": {
"type": "string",
"minLength": 1,
"maxLength": 200
}
},
"required": ["en"]
Expand Down Expand Up @@ -176,6 +236,20 @@
]
}
},
"zh-TW": {
"type": "string",
"minLength": 1,
"format": "http-url",
"requiredProperties": {
"items": [
{
"name": {
"properties": ["zh-TW"]
}
}
]
}
},
"es": {
"type": "string",
"minLength": 1,
Expand All @@ -189,6 +263,34 @@
}
]
}
},
"th": {
"type": "string",
"minLength": 1,
"format": "http-url",
"requiredProperties": {
"items": [
{
"name": {
"properties": ["th"]
}
}
]
}
},
"pt-BR": {
"type": "string",
"minLength": 1,
"format": "http-url",
"requiredProperties": {
"items": [
{
"name": {
"properties": ["pt-BR"]
}
}
]
}
}
}
},
Expand Down
19 changes: 14 additions & 5 deletions packages/plugin-manifest-validator/src/__tests__/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -515,11 +515,14 @@ describe("validator", () => {

describe("supported language", () => {
it.each`
languageCode | name | description | homepage_url
${"ja"} | ${"名前"} | ${"説明"} | ${"https://example.com/ja"}
${"en"} | ${"name"} | ${"desc"} | ${"https://example.com/en"}
${"zh"} | ${"名称"} | ${"描述"} | ${"https://example.com/zh"}
${"es"} | ${"nombre"} | ${"desc"} | ${"https://example.com/es"}
languageCode | name | description | homepage_url
${"ja"} | ${"名前"} | ${"説明"} | ${"https://example.com/ja"}
${"en"} | ${"name"} | ${"desc"} | ${"https://example.com/en"}
${"zh"} | ${"名称"} | ${"描述"} | ${"https://example.com/zh"}
${"zh-TW"} | ${"名称"} | ${"描述"} | ${"https://example.com/zh-TW"}
${"es"} | ${"nombre"} | ${"desc"} | ${"https://example.com/es"}
${"th"} | ${"ชื่อ"} | ${"คำอธิบาย"} | ${"https://example.com/th"}
${"pt-BR"} | ${"nome"} | ${"descrição"} | ${"https://example.com/pt-BR"}
`(
`should return no error when the supported language is specified: $languageCode`,
({ languageCode, name, description, homepage_url }) => {
Expand Down Expand Up @@ -555,7 +558,10 @@ describe("validator", () => {
${"ja"} | ${"名前"}
${"en"} | ${"name"}
${"zh"} | ${"名称"}
${"zh-TW"} | ${"名称"}
${"es"} | ${"nombre"}
${"th"} | ${"ชื่อ"}
${"pt-BR"} | ${"nome"}
`(
`should return warnings when the name of the language "$languageCode" is specified and homepage_url is missing`,
({ languageCode, name }) => {
Expand Down Expand Up @@ -587,7 +593,10 @@ describe("validator", () => {
languageCode | homepage_url
${"ja"} | ${"https://example.com/ja"}
${"zh"} | ${"https://example.com/zh"}
${"zh-TW"} | ${"https://example.com/zh-TW"}
${"es"} | ${"https://example.com/es"}
${"th"} | ${"https://example.com/th"}
${"pt-BR"} | ${"https://example.com/pt-BR"}
`(
`should return errors when the homepage_url of the language "$languageCode" is specified and name is missing`,
({ languageCode, homepage_url }) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,30 @@
"name": {
"ja": "サンプルプラグイン",
"en": "sample plugin",
"zh": "插件的例子"
"zh": "插件的例子",
"zh-TW": "插件的例子",
"es": "complemento de muestra",
"pt-BR": "complemento de amostra",
"th": "ปลั๊กอินตัวอย่าง"
},
"description": {
"ja": "これはサンプルプラグインです。",
"en": "This is sample plugin.",
"zh": "这是插件的例子"
"zh": "这是插件的例子",
"zh-TW": "這是插件的例子",
"es": "Este es un complemento de muestra.",
"pt-BR": "Este é um complemento de amostra.",
"th": "นี่คือปลั๊กอินตัวอย่าง"
},
"icon": "image/icon.png",
"homepage_url": {
"ja": "http://jp.example.com",
"en": "http://en.example.com",
"zh": "http://zh.example.com"
"zh": "http://zh.example.com",
"zh-TW": "http://zh-TW.example.com",
"es": "http://es.example.com",
"pt-BR": "http://pt-BR.example.com",
"th": "http://th.example.com"
},
"desktop": {
"js": ["js/desktop.js", "https://example.com/js/desktop.js"],
Expand Down
1 change: 1 addition & 0 deletions packages/plugin-packer/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ module.exports = {
zlib: require.resolve("browserify-zlib"),
stream: require.resolve("stream-browserify"),
constants: require.resolve("constants-browserify"),
vm: false,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

パッケージできることを確認できたため、フォールバックは vm: false にしています。

},
},
plugins: [
Expand Down
Loading