Skip to content

Commit

Permalink
refactor(config): better config page order category
Browse files Browse the repository at this point in the history
  • Loading branch information
oeyoews committed Oct 3, 2024
1 parent d3a114a commit 78f8bcb
Show file tree
Hide file tree
Showing 58 changed files with 327 additions and 241 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Changelog

* `2.3.0`: 优化配置分组
* `2.2.2`: 重新添加 delimiter config
* `2.2.1`: 补全支持声音触发
* `2.2.0`: support sound
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"registry": "https://registry.npmjs.org"
},
"license": "MIT",
"version": "2.2.2",
"version": "2.3.0",
"packageManager": "pnpm@9.0.6",
"scripts": {
"update:config": " pnpm ts-node scripts/generateConfig.ts",
Expand Down
16 changes: 11 additions & 5 deletions scripts/generateConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,17 @@ interface IConfigFields {
description: I18n;
template: 'input-switch' | 'input';
text: string;
// ---
disable: boolean;
category: string;
}

const templatePrefix =
'$:/plugins/oeyoews/tiddlywiki-codemirror-6/ui/templates/settings/';

const tiddlersInfo = Object.entries(tiddlers) as unknown as Array<
[string, IConfigFields]
>;
const tiddlersInfo = Object.entries(tiddlers).filter(
(i) => !i[1].disable
) as unknown as Array<[string, IConfigFields]>;

const dir = path.join(
'src',
Expand All @@ -43,14 +46,15 @@ let multidcontentEn = 'title: $:/language/codemirror6/\n\n';
// zh
let multidcontentZH = 'title: $:/language/codemirror6/zh/\n\n';

tiddlersInfo.forEach(([title, fields]) => {
tiddlersInfo.forEach(([title, fields], index) => {
// TODO: update caption
let {
caption,
icon = '📝',
description = caption,
template,
text = 'no'
text = 'no',
category = 'general'
} = fields;

const captionEn =
Expand All @@ -72,6 +76,8 @@ caption-zh: {{$:/language/codemirror6/zh/${title}/caption}}
description: {{$:/language/codemirror6/${title}/description}}
description-zh: {{$:/language/codemirror6/zh/${title}/description}}
settings-template: ${templatePrefix}${template}
id: ${index + 1}
settings-group: ${category}
${text}`;

Expand Down
Loading

0 comments on commit 78f8bcb

Please sign in to comment.