@d-zero/create-frontend 5.0.0-beta.1 → 5.0.0-beta.11
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/CHANGELOG.md +53 -0
- package/README.md +51 -0
- package/command.js +33 -0
- package/index.spec.js +45 -33
- package/libraries.js +53 -0
- package/package.json +6 -6
- package/plopfile.js +71 -33
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,59 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [5.0.0-beta.11](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.10...v5.0.0-beta.11) (2025-10-20)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **create-frontend:** improve command execution and add volta setup ([e54a526](https://github.com/d-zero-dev/frontend-env/commit/e54a526da7629a9b86fb6d5a53f0aaba72118d9b))
|
|
11
|
+
|
|
12
|
+
# [5.0.0-beta.10](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.9...v5.0.0-beta.10) (2025-10-20)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **create-frontend:** correct file extension from .cjs to .js in blocks data path ([b425f76](https://github.com/d-zero-dev/frontend-env/commit/b425f76b9fb51302a0b26f0149407787679f33ac))
|
|
17
|
+
|
|
18
|
+
### Features
|
|
19
|
+
|
|
20
|
+
- **create-frontend:** add gitignore rewrite functionality ([e2a6e75](https://github.com/d-zero-dev/frontend-env/commit/e2a6e75ad6d58416cee8b35642ccdc542532ab73))
|
|
21
|
+
- **create-frontend:** add library copying functionality for baserCMS projects ([8e73300](https://github.com/d-zero-dev/frontend-env/commit/8e73300a730aa7dcdcc2f19bb57b99eb5f4d561c))
|
|
22
|
+
- **create-frontend:** update project type options and remove unused blocks.html ([b003628](https://github.com/d-zero-dev/frontend-env/commit/b00362847c11493ab14f8c87c01f9577563f2e07))
|
|
23
|
+
- **scaffold:** add baserCMS-specific meta template and conditional inclusion ([885fe35](https://github.com/d-zero-dev/frontend-env/commit/885fe352ecb692cd1ccf3ca4ee1d82749193a60d))
|
|
24
|
+
|
|
25
|
+
# [5.0.0-beta.9](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.8...v5.0.0-beta.9) (2025-10-05)
|
|
26
|
+
|
|
27
|
+
**Note:** Version bump only for package @d-zero/create-frontend
|
|
28
|
+
|
|
29
|
+
# [5.0.0-beta.8](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.7...v5.0.0-beta.8) (2025-10-05)
|
|
30
|
+
|
|
31
|
+
**Note:** Version bump only for package @d-zero/create-frontend
|
|
32
|
+
|
|
33
|
+
# [5.0.0-beta.7](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.6...v5.0.0-beta.7) (2025-10-03)
|
|
34
|
+
|
|
35
|
+
**Note:** Version bump only for package @d-zero/create-frontend
|
|
36
|
+
|
|
37
|
+
# [5.0.0-beta.6](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.5...v5.0.0-beta.6) (2025-10-03)
|
|
38
|
+
|
|
39
|
+
**Note:** Version bump only for package @d-zero/create-frontend
|
|
40
|
+
|
|
41
|
+
# [5.0.0-beta.5](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.4...v5.0.0-beta.5) (2025-09-17)
|
|
42
|
+
|
|
43
|
+
**Note:** Version bump only for package @d-zero/create-frontend
|
|
44
|
+
|
|
45
|
+
# [5.0.0-beta.4](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.3...v5.0.0-beta.4) (2025-08-14)
|
|
46
|
+
|
|
47
|
+
**Note:** Version bump only for package @d-zero/create-frontend
|
|
48
|
+
|
|
49
|
+
# [5.0.0-beta.3](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.2...v5.0.0-beta.3) (2025-07-11)
|
|
50
|
+
|
|
51
|
+
**Note:** Version bump only for package @d-zero/create-frontend
|
|
52
|
+
|
|
53
|
+
# [5.0.0-beta.2](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.1...v5.0.0-beta.2) (2025-07-11)
|
|
54
|
+
|
|
55
|
+
### Features
|
|
56
|
+
|
|
57
|
+
- **scaffold:** introduce @burger-editor/local for local development ([1524937](https://github.com/d-zero-dev/frontend-env/commit/15249370d68aeeb9c5b20d7c29dd4c8dfc0d000e))
|
|
58
|
+
|
|
6
59
|
# [5.0.0-beta.1](https://github.com/d-zero-dev/frontend-env/compare/v5.0.0-beta.0...v5.0.0-beta.1) (2025-07-01)
|
|
7
60
|
|
|
8
61
|
**Note:** Version bump only for package @d-zero/create-frontend
|
package/README.md
CHANGED
|
@@ -14,4 +14,55 @@ npx @d-zero/create-frontend
|
|
|
14
14
|
yarn create @d-zero/frontend
|
|
15
15
|
```
|
|
16
16
|
|
|
17
|
+
### オプション
|
|
18
|
+
|
|
19
|
+
| オプション | 短縮形 | 説明 | デフォルト値 |
|
|
20
|
+
| ----------- | ------ | ------------------------------------------------------------------------------ | ------------------------- |
|
|
21
|
+
| `--type` | `-t` | プロジェクトのタイプを指定します。指定した場合、対話モードはスキップされます。 | `static` |
|
|
22
|
+
| `--dir` | `-d` | 出力先ディレクトリを指定します。 | `.`(現在のディレクトリ) |
|
|
23
|
+
| `--install` | - | スキャフォールディング後にyarnで依存関係をインストールします。 | `true` |
|
|
24
|
+
|
|
25
|
+
#### プロジェクトタイプ
|
|
26
|
+
|
|
27
|
+
##### `static` - 静的サイト
|
|
28
|
+
|
|
29
|
+
- **用途**: 静的なWebサイトの開発
|
|
30
|
+
- **特徴**:
|
|
31
|
+
- [BurgerEditor Local App](https://github.com/d-zero-dev/BurgerEditor) v4 が組み込まれており、ローカル環境でのビジュアル編集が可能
|
|
32
|
+
- [Eleventy](https://www.11ty.dev/) による静的サイトジェネレーター
|
|
33
|
+
- **開発コマンド**:
|
|
34
|
+
- `yarn dev`: 開発サーバー起動(http://localhost:8080/)
|
|
35
|
+
- `yarn bge`: BurgerEditor Local App 起動(http://localhost:8100/)
|
|
36
|
+
- `yarn build`: 本番用ビルド
|
|
37
|
+
|
|
38
|
+
##### `basercms4` - baserCMS v4
|
|
39
|
+
|
|
40
|
+
- **用途**: [baserCMS](https://basercms.net/) v4 のテーマ開発
|
|
41
|
+
- **特徴**:
|
|
42
|
+
- BurgerEditor v2 対応のテーマファイル
|
|
43
|
+
- baserCMS 固有のテンプレート構造
|
|
44
|
+
- jQuery および関連ライブラリが自動で依存関係に追加
|
|
45
|
+
- baserCMS のテンプレート変数やヘルパー関数に対応
|
|
46
|
+
- BurgerEditor のブロック定義ファイル(`bge-blocks-v2.html`)を使用
|
|
47
|
+
- **追加される依存関係**:
|
|
48
|
+
- `jquery`: 最新版
|
|
49
|
+
- `jquery-colorbox`: v1.5
|
|
50
|
+
|
|
51
|
+
### 使用例
|
|
52
|
+
|
|
53
|
+
```shell
|
|
54
|
+
# 対話モードで実行
|
|
55
|
+
npx @d-zero/create-frontend
|
|
56
|
+
|
|
57
|
+
# 静的サイトプロジェクトを指定ディレクトリに作成し、依存関係をインストール
|
|
58
|
+
npx @d-zero/create-frontend --type static --dir ./my-project --install
|
|
59
|
+
|
|
60
|
+
# baserCMS v4プロジェクトを作成(依存関係のインストールはスキップ)
|
|
61
|
+
yarn create @d-zero/frontend --type basercms4 --dir ./my-cms --no-install
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### 注意事項
|
|
65
|
+
|
|
66
|
+
オプションを指定せずにコマンドを実行すると、対話モードが開始され、プロジェクトを段階的に設定できます。
|
|
67
|
+
|
|
17
68
|
インストールで展開されるファイルは[`@d-zero/scaffold`](https://github.com/d-zero-dev/frontend-env/blob/main/packages/%40d-zero/scaffold/)に格納されています。
|
package/command.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* @param {string} commandName
|
|
6
|
+
* @param {string[]} args
|
|
7
|
+
* @param {string} cwd
|
|
8
|
+
* @returns {Promise<number>}
|
|
9
|
+
*/
|
|
10
|
+
export async function command(commandName, args, cwd = process.cwd()) {
|
|
11
|
+
return new Promise((resolve, reject) => {
|
|
12
|
+
const child = spawn(commandName, args, {
|
|
13
|
+
cwd,
|
|
14
|
+
stdio: 'inherit',
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
child.on('exit', (code) => {
|
|
18
|
+
if (code === 0) {
|
|
19
|
+
resolve(code);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
reject(code);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
child.on('error', (error) => {
|
|
26
|
+
reject(error);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
process.on('SIGINT', () => {
|
|
30
|
+
child.kill('SIGINT');
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
}
|
package/index.spec.js
CHANGED
|
@@ -56,6 +56,7 @@ describe('CLI', () => {
|
|
|
56
56
|
`✔ ++ ${dir}/eslint.config.js`,
|
|
57
57
|
`✔ ++ ${dir}/eleventy.config.mjs`,
|
|
58
58
|
`✔ ++ ${dir}/cspell.json`,
|
|
59
|
+
`✔ ++ ${dir}/burgereditor.config.js`,
|
|
59
60
|
`✔ ++ ${dir}/README.md`,
|
|
60
61
|
`✔ ++ ${dir}/CHANGELOG.md`,
|
|
61
62
|
`✔ ++ ${dir}/.yarnrc.yml`,
|
|
@@ -68,25 +69,12 @@ describe('CLI', () => {
|
|
|
68
69
|
`✔ ++ ${dir}/.npmignore`,
|
|
69
70
|
`✔ ++ ${dir}/.gitignore`,
|
|
70
71
|
`✔ ++ ${dir}/.editorconfig`,
|
|
71
|
-
`✔ ++ ${dir}
|
|
72
|
-
`✔ ++ ${dir}/.clineignore`,
|
|
73
|
-
`✔ ++ ${dir}/ai-tasks/page-to-burger.md`,
|
|
74
|
-
`✔ ++ ${dir}/ai-tasks/create-page.md`,
|
|
75
|
-
`✔ ++ ${dir}/ai-tasks/create-component.md`,
|
|
72
|
+
`✔ ++ ${dir}/htdocs/files/images/sample.png`,
|
|
76
73
|
`✔ ++ ${dir}/__info/print.txt`,
|
|
77
74
|
`✔ ++ ${dir}/__assets/htdocs/index.pug`,
|
|
75
|
+
`✔ ++ ${dir}/__assets/htdocs/sample/index.html`,
|
|
78
76
|
`✔ ++ ${dir}/__assets/htdocs/js/script.ts`,
|
|
79
77
|
`✔ ++ ${dir}/__assets/htdocs/css/style.css`,
|
|
80
|
-
`✔ ++ ${dir}/__assets/htdocs/css/bge_style.css`,
|
|
81
|
-
`✔ ++ ${dir}/__assets/htdocs/__tmpl/index.pug`,
|
|
82
|
-
`✔ ++ ${dir}/__assets/htdocs/__tmpl/302_form_complete.pug`,
|
|
83
|
-
`✔ ++ ${dir}/__assets/htdocs/__tmpl/301_form_confirm.pug`,
|
|
84
|
-
`✔ ++ ${dir}/__assets/htdocs/__tmpl/300_form_input.pug`,
|
|
85
|
-
`✔ ++ ${dir}/__assets/htdocs/__tmpl/210_blog_index.pug`,
|
|
86
|
-
`✔ ++ ${dir}/__assets/htdocs/__tmpl/200_blog_index.pug`,
|
|
87
|
-
`✔ ++ ${dir}/__assets/htdocs/__tmpl/100_sub.pug`,
|
|
88
|
-
`✔ ++ ${dir}/__assets/htdocs/__tmpl/000_home.pug`,
|
|
89
|
-
`✔ ++ ${dir}/__assets/htdocs/__tmpl/.markuplintrc`,
|
|
90
78
|
`✔ ++ ${dir}/__assets/_libs/.markuplintrc`,
|
|
91
79
|
`✔ ++ ${dir}/__assets/_libs/style/general/img.css`,
|
|
92
80
|
`✔ ++ ${dir}/__assets/_libs/style/general/button.css`,
|
|
@@ -95,12 +83,17 @@ describe('CLI', () => {
|
|
|
95
83
|
`✔ ++ ${dir}/__assets/_libs/style/base/root.css`,
|
|
96
84
|
`✔ ++ ${dir}/__assets/_libs/script/index.ts`,
|
|
97
85
|
`✔ ++ ${dir}/__assets/_libs/mixin/meta.pug`,
|
|
86
|
+
`✔ ++ ${dir}/__assets/_libs/mixin/meta-basercms.pug`,
|
|
87
|
+
`✔ ++ ${dir}/__assets/_libs/layouts/sub.pug`,
|
|
88
|
+
`✔ ++ ${dir}/__assets/_libs/layouts/home.pug`,
|
|
98
89
|
`✔ ++ ${dir}/__assets/_libs/img/bg-repeat-01.gif`,
|
|
99
90
|
`✔ ++ ${dir}/__assets/_libs/img/bg-arrow.svg`,
|
|
91
|
+
`✔ ++ ${dir}/__assets/_libs/data/titlelist.js`,
|
|
100
92
|
`✔ ++ ${dir}/__assets/_libs/data/data.yml`,
|
|
93
|
+
`✔ ++ ${dir}/__assets/_libs/data/breadcrumbs.js`,
|
|
101
94
|
`✔ ++ ${dir}/__assets/_libs/data/blocks.js`,
|
|
102
|
-
`✔ ++ ${dir}/__assets/_libs/data/blocks.html`,
|
|
103
95
|
`✔ ++ ${dir}/__assets/_libs/data/bge-blocks.html`,
|
|
96
|
+
`✔ ++ ${dir}/__assets/_libs/data/bge-blocks-v2.html`,
|
|
104
97
|
`✔ ++ ${dir}/__assets/_libs/data/.markuplintrc`,
|
|
105
98
|
`✔ ++ ${dir}/__assets/_libs/component/c-title-page.pug`,
|
|
106
99
|
`✔ ++ ${dir}/__assets/_libs/component/c-title-page.css`,
|
|
@@ -129,13 +122,14 @@ describe('CLI', () => {
|
|
|
129
122
|
`✔ ++ ${dir}/.vscode/settings.json`,
|
|
130
123
|
`✔ ++ ${dir}/.vscode/extensions.json`,
|
|
131
124
|
`✔ ++ ${dir}/.husky/pre-commit`,
|
|
132
|
-
'✔ Install dependencies
|
|
125
|
+
'✔ Install dependencies skipped',
|
|
126
|
+
'✔ Finalize finalized',
|
|
133
127
|
]);
|
|
134
128
|
});
|
|
135
129
|
|
|
136
|
-
test('npx --type
|
|
130
|
+
test('npx --type basercms4', async ({ tmpDir, task }) => {
|
|
137
131
|
const dir = path.join(tmpDir, getName(task));
|
|
138
|
-
const actual = await cliTest(dir, '
|
|
132
|
+
const actual = await cliTest(dir, 'basercms4');
|
|
139
133
|
expect(actual).toStrictEqual([
|
|
140
134
|
`✔ ++ ${dir}/tsconfig.json`,
|
|
141
135
|
`✔ ++ ${dir}/prh.yaml`,
|
|
@@ -145,6 +139,7 @@ describe('CLI', () => {
|
|
|
145
139
|
`✔ ++ ${dir}/eslint.config.js`,
|
|
146
140
|
`✔ ++ ${dir}/eleventy.config.mjs`,
|
|
147
141
|
`✔ ++ ${dir}/cspell.json`,
|
|
142
|
+
`✔ ++ ${dir}/burgereditor.config.js`,
|
|
148
143
|
`✔ ++ ${dir}/README.md`,
|
|
149
144
|
`✔ ++ ${dir}/CHANGELOG.md`,
|
|
150
145
|
`✔ ++ ${dir}/.yarnrc.yml`,
|
|
@@ -157,24 +152,30 @@ describe('CLI', () => {
|
|
|
157
152
|
`✔ ++ ${dir}/.npmignore`,
|
|
158
153
|
`✔ ++ ${dir}/.gitignore`,
|
|
159
154
|
`✔ ++ ${dir}/.editorconfig`,
|
|
160
|
-
`✔ ++ ${dir}
|
|
161
|
-
`✔ ++ ${dir}
|
|
162
|
-
`✔ ++ ${dir}/
|
|
163
|
-
`✔ ++ ${dir}/ai-tasks/create-page.md`,
|
|
164
|
-
`✔ ++ ${dir}/ai-tasks/create-component.md`,
|
|
155
|
+
`✔ ++ ${dir}/htdocs/files/images/sample.png`,
|
|
156
|
+
`✔ ++ ${dir}/htdocs/__tmpl/__burger_editor/js/bge_modules/bge_functions.min.js`,
|
|
157
|
+
`✔ ++ ${dir}/htdocs/__tmpl/__burger_editor/img/bg-sample.png`,
|
|
165
158
|
`✔ ++ ${dir}/__info/print.txt`,
|
|
166
159
|
`✔ ++ ${dir}/__assets/htdocs/index.pug`,
|
|
160
|
+
`✔ ++ ${dir}/__assets/htdocs/sample/index.html`,
|
|
167
161
|
`✔ ++ ${dir}/__assets/htdocs/js/script.ts`,
|
|
168
162
|
`✔ ++ ${dir}/__assets/htdocs/css/style.css`,
|
|
169
163
|
`✔ ++ ${dir}/__assets/htdocs/css/bge_style.css`,
|
|
170
164
|
`✔ ++ ${dir}/__assets/htdocs/__tmpl/index.pug`,
|
|
171
165
|
`✔ ++ ${dir}/__assets/htdocs/__tmpl/302_form_complete.pug`,
|
|
166
|
+
`✔ ++ ${dir}/__assets/htdocs/__tmpl/302_form_complete.json`,
|
|
172
167
|
`✔ ++ ${dir}/__assets/htdocs/__tmpl/301_form_confirm.pug`,
|
|
168
|
+
`✔ ++ ${dir}/__assets/htdocs/__tmpl/301_form_confirm.json`,
|
|
173
169
|
`✔ ++ ${dir}/__assets/htdocs/__tmpl/300_form_input.pug`,
|
|
170
|
+
`✔ ++ ${dir}/__assets/htdocs/__tmpl/300_form_input.json`,
|
|
174
171
|
`✔ ++ ${dir}/__assets/htdocs/__tmpl/210_blog_index.pug`,
|
|
172
|
+
`✔ ++ ${dir}/__assets/htdocs/__tmpl/210_blog_index.json`,
|
|
175
173
|
`✔ ++ ${dir}/__assets/htdocs/__tmpl/200_blog_index.pug`,
|
|
174
|
+
`✔ ++ ${dir}/__assets/htdocs/__tmpl/200_blog_index.json`,
|
|
176
175
|
`✔ ++ ${dir}/__assets/htdocs/__tmpl/100_sub.pug`,
|
|
176
|
+
`✔ ++ ${dir}/__assets/htdocs/__tmpl/100_sub.json`,
|
|
177
177
|
`✔ ++ ${dir}/__assets/htdocs/__tmpl/000_home.pug`,
|
|
178
|
+
`✔ ++ ${dir}/__assets/htdocs/__tmpl/000_home.json`,
|
|
178
179
|
`✔ ++ ${dir}/__assets/htdocs/__tmpl/.markuplintrc`,
|
|
179
180
|
`✔ ++ ${dir}/__assets/_libs/.markuplintrc`,
|
|
180
181
|
`✔ ++ ${dir}/__assets/_libs/style/general/img.css`,
|
|
@@ -184,12 +185,17 @@ describe('CLI', () => {
|
|
|
184
185
|
`✔ ++ ${dir}/__assets/_libs/style/base/root.css`,
|
|
185
186
|
`✔ ++ ${dir}/__assets/_libs/script/index.ts`,
|
|
186
187
|
`✔ ++ ${dir}/__assets/_libs/mixin/meta.pug`,
|
|
188
|
+
`✔ ++ ${dir}/__assets/_libs/mixin/meta-basercms.pug`,
|
|
189
|
+
`✔ ++ ${dir}/__assets/_libs/layouts/sub.pug`,
|
|
190
|
+
`✔ ++ ${dir}/__assets/_libs/layouts/home.pug`,
|
|
187
191
|
`✔ ++ ${dir}/__assets/_libs/img/bg-repeat-01.gif`,
|
|
188
192
|
`✔ ++ ${dir}/__assets/_libs/img/bg-arrow.svg`,
|
|
193
|
+
`✔ ++ ${dir}/__assets/_libs/data/titlelist.js`,
|
|
189
194
|
`✔ ++ ${dir}/__assets/_libs/data/data.yml`,
|
|
195
|
+
`✔ ++ ${dir}/__assets/_libs/data/breadcrumbs.js`,
|
|
190
196
|
`✔ ++ ${dir}/__assets/_libs/data/blocks.js`,
|
|
191
|
-
`✔ ++ ${dir}/__assets/_libs/data/blocks.html`,
|
|
192
197
|
`✔ ++ ${dir}/__assets/_libs/data/bge-blocks.html`,
|
|
198
|
+
`✔ ++ ${dir}/__assets/_libs/data/bge-blocks-v2.html`,
|
|
193
199
|
`✔ ++ ${dir}/__assets/_libs/data/.markuplintrc`,
|
|
194
200
|
`✔ ++ ${dir}/__assets/_libs/component/c-title-page.pug`,
|
|
195
201
|
`✔ ++ ${dir}/__assets/_libs/component/c-title-page.css`,
|
|
@@ -218,7 +224,8 @@ describe('CLI', () => {
|
|
|
218
224
|
`✔ ++ ${dir}/.vscode/settings.json`,
|
|
219
225
|
`✔ ++ ${dir}/.vscode/extensions.json`,
|
|
220
226
|
`✔ ++ ${dir}/.husky/pre-commit`,
|
|
221
|
-
'✔ Install dependencies
|
|
227
|
+
'✔ Install dependencies skipped',
|
|
228
|
+
'✔ Finalize finalized',
|
|
222
229
|
]);
|
|
223
230
|
});
|
|
224
231
|
|
|
@@ -234,6 +241,7 @@ describe('CLI', () => {
|
|
|
234
241
|
`✔ ++ ${dir}/eslint.config.js`,
|
|
235
242
|
`✔ ++ ${dir}/eleventy.config.mjs`,
|
|
236
243
|
`✔ ++ ${dir}/cspell.json`,
|
|
244
|
+
`✔ ++ ${dir}/burgereditor.config.js`,
|
|
237
245
|
`✔ ++ ${dir}/README.md`,
|
|
238
246
|
`✔ ++ ${dir}/CHANGELOG.md`,
|
|
239
247
|
`✔ ++ ${dir}/.yarnrc.yml`,
|
|
@@ -246,13 +254,10 @@ describe('CLI', () => {
|
|
|
246
254
|
`✔ ++ ${dir}/.npmignore`,
|
|
247
255
|
`✔ ++ ${dir}/.gitignore`,
|
|
248
256
|
`✔ ++ ${dir}/.editorconfig`,
|
|
249
|
-
`✔ ++ ${dir}
|
|
250
|
-
`✔ ++ ${dir}/.clineignore`,
|
|
251
|
-
`✔ ++ ${dir}/ai-tasks/page-to-burger.md`,
|
|
252
|
-
`✔ ++ ${dir}/ai-tasks/create-page.md`,
|
|
253
|
-
`✔ ++ ${dir}/ai-tasks/create-component.md`,
|
|
257
|
+
`✔ ++ ${dir}/htdocs/files/images/sample.png`,
|
|
254
258
|
`✔ ++ ${dir}/__info/print.txt`,
|
|
255
259
|
`✔ ++ ${dir}/__assets/htdocs/index.pug`,
|
|
260
|
+
`✔ ++ ${dir}/__assets/htdocs/sample/index.html`,
|
|
256
261
|
`✔ ++ ${dir}/__assets/htdocs/js/script.ts`,
|
|
257
262
|
`✔ ++ ${dir}/__assets/htdocs/css/style.css`,
|
|
258
263
|
`✔ ++ ${dir}/__assets/_libs/.markuplintrc`,
|
|
@@ -263,11 +268,17 @@ describe('CLI', () => {
|
|
|
263
268
|
`✔ ++ ${dir}/__assets/_libs/style/base/root.css`,
|
|
264
269
|
`✔ ++ ${dir}/__assets/_libs/script/index.ts`,
|
|
265
270
|
`✔ ++ ${dir}/__assets/_libs/mixin/meta.pug`,
|
|
271
|
+
`✔ ++ ${dir}/__assets/_libs/mixin/meta-basercms.pug`,
|
|
272
|
+
`✔ ++ ${dir}/__assets/_libs/layouts/sub.pug`,
|
|
273
|
+
`✔ ++ ${dir}/__assets/_libs/layouts/home.pug`,
|
|
266
274
|
`✔ ++ ${dir}/__assets/_libs/img/bg-repeat-01.gif`,
|
|
267
275
|
`✔ ++ ${dir}/__assets/_libs/img/bg-arrow.svg`,
|
|
276
|
+
`✔ ++ ${dir}/__assets/_libs/data/titlelist.js`,
|
|
268
277
|
`✔ ++ ${dir}/__assets/_libs/data/data.yml`,
|
|
278
|
+
`✔ ++ ${dir}/__assets/_libs/data/breadcrumbs.js`,
|
|
269
279
|
`✔ ++ ${dir}/__assets/_libs/data/blocks.js`,
|
|
270
|
-
`✔ ++ ${dir}/__assets/_libs/data/blocks.html`,
|
|
280
|
+
`✔ ++ ${dir}/__assets/_libs/data/bge-blocks.html`,
|
|
281
|
+
`✔ ++ ${dir}/__assets/_libs/data/bge-blocks-v2.html`,
|
|
271
282
|
`✔ ++ ${dir}/__assets/_libs/data/.markuplintrc`,
|
|
272
283
|
`✔ ++ ${dir}/__assets/_libs/component/c-title-page.pug`,
|
|
273
284
|
`✔ ++ ${dir}/__assets/_libs/component/c-title-page.css`,
|
|
@@ -296,7 +307,8 @@ describe('CLI', () => {
|
|
|
296
307
|
`✔ ++ ${dir}/.vscode/settings.json`,
|
|
297
308
|
`✔ ++ ${dir}/.vscode/extensions.json`,
|
|
298
309
|
`✔ ++ ${dir}/.husky/pre-commit`,
|
|
299
|
-
'✔ Install dependencies
|
|
310
|
+
'✔ Install dependencies skipped',
|
|
311
|
+
'✔ Finalize finalized',
|
|
300
312
|
]);
|
|
301
313
|
});
|
|
302
314
|
});
|
package/libraries.js
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
const basercms4Libraries = [
|
|
5
|
+
{
|
|
6
|
+
from: 'node_modules/jquery/dist/jquery.min.js',
|
|
7
|
+
to: 'htdocs/js/jquery.min.js',
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
from: 'node_modules/jquery-colorbox/example3/colorbox.css',
|
|
11
|
+
to: 'htdocs/__tmpl/__burger_editor/css/colorbox.css',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
from: 'node_modules/jquery-colorbox/example3/images/loading.gif',
|
|
15
|
+
to: 'htdocs/__tmpl/__burger_editor/css/images/loading.gif',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
from: 'node_modules/jquery-colorbox/example3/images/controls.png',
|
|
19
|
+
to: 'htdocs/__tmpl/__burger_editor/css/images/controls.png',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
from: 'node_modules/jquery-colorbox/jquery.colorbox-min.js',
|
|
23
|
+
to: 'htdocs/__tmpl/__burger_editor/js/bge_modules/jquery.colorbox-min.js',
|
|
24
|
+
},
|
|
25
|
+
];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
*
|
|
29
|
+
* @param type
|
|
30
|
+
* @param dest
|
|
31
|
+
*/
|
|
32
|
+
export async function copyLibraries(type, dest) {
|
|
33
|
+
dest = path.isAbsolute(dest) ? dest : path.resolve(process.cwd(), dest);
|
|
34
|
+
let libraries = [];
|
|
35
|
+
switch (type) {
|
|
36
|
+
case 'basercms4': {
|
|
37
|
+
libraries = basercms4Libraries;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
for (const library of libraries) {
|
|
43
|
+
const from = path.join(dest, library.from);
|
|
44
|
+
const dist = path.join(dest, library.to);
|
|
45
|
+
const dir = path.dirname(dist);
|
|
46
|
+
const stats = await fs.stat(from).catch(() => null);
|
|
47
|
+
if (!stats?.isFile()) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
await fs.mkdir(dir, { recursive: true });
|
|
51
|
+
await fs.copyFile(from, dist);
|
|
52
|
+
}
|
|
53
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@d-zero/create-frontend",
|
|
3
|
-
"version": "5.0.0-beta.
|
|
3
|
+
"version": "5.0.0-beta.11",
|
|
4
4
|
"description": "Create a new frontend project from a scaffolding template",
|
|
5
5
|
"repository": "https://github.com/d-zero-dev/frontend-env.git",
|
|
6
6
|
"author": "D-ZERO Co., Ltd.",
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
"create-dzero-frontend": "./index.js"
|
|
14
14
|
},
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@d-zero/scaffold": "5.0.0-beta.
|
|
16
|
+
"@d-zero/scaffold": "5.0.0-beta.11",
|
|
17
17
|
"glob": "11.0.3",
|
|
18
18
|
"i18n-js": "4.5.1",
|
|
19
19
|
"ignore": "7.0.5",
|
|
20
|
-
"meow": "
|
|
21
|
-
"plop": "4.0.
|
|
20
|
+
"meow": "14.0.0",
|
|
21
|
+
"plop": "4.0.2"
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
|
-
"@types/glob": "
|
|
24
|
+
"@types/glob": "9.0.0",
|
|
25
25
|
"execa": "9.6.0"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "be7194ca289ccc884cb4f83e8f8d0b3d81742e0a"
|
|
28
28
|
}
|
package/plopfile.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { spawn } from 'node:child_process';
|
|
2
1
|
import fs from 'node:fs';
|
|
3
2
|
import path from 'node:path';
|
|
4
3
|
import { argv } from 'node:process';
|
|
@@ -7,6 +6,8 @@ import { globSync } from 'glob';
|
|
|
7
6
|
import ignore from 'ignore';
|
|
8
7
|
import meow from 'meow';
|
|
9
8
|
|
|
9
|
+
import { command } from './command.js';
|
|
10
|
+
import { copyLibraries } from './libraries.js';
|
|
10
11
|
import { t } from './locale.js';
|
|
11
12
|
import { readFileSafe } from './read-file-safe.js';
|
|
12
13
|
|
|
@@ -35,7 +36,7 @@ const cli = meow(
|
|
|
35
36
|
type: {
|
|
36
37
|
type: 'string',
|
|
37
38
|
shortFlag: 't',
|
|
38
|
-
default: '
|
|
39
|
+
default: 'static',
|
|
39
40
|
},
|
|
40
41
|
dir: {
|
|
41
42
|
type: 'string',
|
|
@@ -78,8 +79,8 @@ export default function (plop) {
|
|
|
78
79
|
'*.test.*',
|
|
79
80
|
])
|
|
80
81
|
.add(
|
|
81
|
-
// BurgerEditor
|
|
82
|
-
cli.flags.type
|
|
82
|
+
// BurgerEditor for baserCMS
|
|
83
|
+
cli.flags.type.startsWith('basercms') ? [] : ['**/bge_style.css'],
|
|
83
84
|
)
|
|
84
85
|
.add(
|
|
85
86
|
// static
|
|
@@ -94,33 +95,25 @@ export default function (plop) {
|
|
|
94
95
|
}),
|
|
95
96
|
);
|
|
96
97
|
|
|
97
|
-
plop.setActionType('Install dependencies', (answers) => {
|
|
98
|
+
plop.setActionType('Install dependencies', async (answers) => {
|
|
98
99
|
const { dest, doInstall } = answerToConfig(answers);
|
|
100
|
+
if (doInstall) {
|
|
101
|
+
await installDependencies(dest);
|
|
102
|
+
return 'success';
|
|
103
|
+
}
|
|
104
|
+
return 'skipped';
|
|
105
|
+
});
|
|
99
106
|
|
|
100
|
-
|
|
101
|
-
|
|
107
|
+
plop.setActionType('Finalize', async (answers) => {
|
|
108
|
+
const { dest, type, doInstall } = answerToConfig(answers);
|
|
102
109
|
if (doInstall) {
|
|
103
|
-
|
|
104
|
-
cwd: path.resolve(process.cwd(), dest),
|
|
105
|
-
stdio: 'inherit',
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
child.on('exit', (code) => {
|
|
109
|
-
if (code === 0) {
|
|
110
|
-
resolve(': success');
|
|
111
|
-
} else {
|
|
112
|
-
reject(new Error('Failed to install dependencies'));
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
process.on('SIGINT', () => {
|
|
117
|
-
child.kill('SIGINT');
|
|
118
|
-
});
|
|
119
|
-
} else {
|
|
120
|
-
resolve(': skipped');
|
|
110
|
+
rewriteDotGitignore(dest);
|
|
121
111
|
}
|
|
122
112
|
|
|
123
|
-
|
|
113
|
+
if (type.startsWith('basercms')) {
|
|
114
|
+
await copyLibraries(type, dest);
|
|
115
|
+
}
|
|
116
|
+
return 'finalized';
|
|
124
117
|
});
|
|
125
118
|
|
|
126
119
|
plop.setGenerator('basic', {
|
|
@@ -132,13 +125,12 @@ export default function (plop) {
|
|
|
132
125
|
message: t`What's the type of project?`,
|
|
133
126
|
choices: [
|
|
134
127
|
{
|
|
135
|
-
name: 'Static',
|
|
128
|
+
name: 'Static Site (with BurgerEditor Local App)',
|
|
136
129
|
value: 'static',
|
|
137
130
|
},
|
|
138
|
-
'CMS (WordPress etc.)',
|
|
139
131
|
{
|
|
140
|
-
name: '
|
|
141
|
-
value: '
|
|
132
|
+
name: 'baserCMS v4 (with BurgerEditor v2)',
|
|
133
|
+
value: 'basercms4',
|
|
142
134
|
},
|
|
143
135
|
],
|
|
144
136
|
default: cli.flags.type,
|
|
@@ -195,12 +187,22 @@ export default function (plop) {
|
|
|
195
187
|
delete pkg.license;
|
|
196
188
|
delete pkg.publishConfig;
|
|
197
189
|
delete pkg.files;
|
|
190
|
+
if (config.type.startsWith('basercms')) {
|
|
191
|
+
pkg.dependencies['jquery'] = 'latest';
|
|
192
|
+
pkg.dependencies['jquery-colorbox'] = '1.5';
|
|
193
|
+
}
|
|
198
194
|
content = JSON.stringify(pkg, null, '\t');
|
|
199
195
|
break;
|
|
200
196
|
}
|
|
201
|
-
case '__assets/_libs/data/blocks.
|
|
202
|
-
if (config.type === '
|
|
203
|
-
content = content.replace(
|
|
197
|
+
case '__assets/_libs/data/blocks.js': {
|
|
198
|
+
if (config.type === 'basercms4') {
|
|
199
|
+
content = content.replace('bge-blocks.html', 'bge-blocks-v2.html');
|
|
200
|
+
}
|
|
201
|
+
break;
|
|
202
|
+
}
|
|
203
|
+
case '__assets/_libs/mixin/meta.pug': {
|
|
204
|
+
if (!config.type.startsWith('basercms')) {
|
|
205
|
+
content = content.replace('\ninclude meta-basercms.pug', '');
|
|
204
206
|
}
|
|
205
207
|
break;
|
|
206
208
|
}
|
|
@@ -221,6 +223,9 @@ export default function (plop) {
|
|
|
221
223
|
{
|
|
222
224
|
type: 'Install dependencies',
|
|
223
225
|
},
|
|
226
|
+
{
|
|
227
|
+
type: 'Finalize',
|
|
228
|
+
},
|
|
224
229
|
];
|
|
225
230
|
},
|
|
226
231
|
});
|
|
@@ -237,3 +242,36 @@ function answerToConfig(answers) {
|
|
|
237
242
|
|
|
238
243
|
return { type, dest, doInstall };
|
|
239
244
|
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
*
|
|
248
|
+
* @param dest
|
|
249
|
+
*/
|
|
250
|
+
async function installDependencies(dest) {
|
|
251
|
+
await command('volta', ['setup']).catch((error) => {
|
|
252
|
+
// eslint-disable-next-line no-console
|
|
253
|
+
console.error(error);
|
|
254
|
+
});
|
|
255
|
+
await command('yarn', ['install'], path.resolve(process.cwd(), dest)).catch(
|
|
256
|
+
() => new Error('Failed to install dependencies'),
|
|
257
|
+
);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
*
|
|
262
|
+
* @param dest
|
|
263
|
+
*/
|
|
264
|
+
function rewriteDotGitignore(dest) {
|
|
265
|
+
let gitignore = readFileSafe(path.resolve(dest, '.gitignore'));
|
|
266
|
+
if (gitignore == null) {
|
|
267
|
+
return;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// Remove after `# Document Root` section
|
|
271
|
+
const documentRootSection = gitignore.indexOf('\n# Document Root\n');
|
|
272
|
+
if (documentRootSection !== -1) {
|
|
273
|
+
gitignore = gitignore.slice(0, documentRootSection);
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
return fs.writeFileSync(path.resolve(dest, '.gitignore'), gitignore);
|
|
277
|
+
}
|