create-blocklet 0.4.50 → 0.4.52
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/index.js +7 -15
- package/lib/utils.js +1 -1
- package/package.json +1 -1
- package/templates/monorepo/package.json +1 -0
- package/templates/monorepo/scripts/bump-version.mjs +16 -2
- package/{common/_eslintrc.js → templates/react-dapp/.eslintrc.js} +0 -0
- package/templates/react-gun-dapp/.eslintrc.js +7 -0
- package/templates/react-static/.eslintrc.js +7 -0
- package/templates/solidjs-dapp/blocklet.yml +1 -1
- package/templates/solidjs-dapp/package.json +1 -1
- package/templates/solidjs-dapp/vite.config.js +1 -1
- package/templates/solidjs-static/package.json +1 -1
- package/templates/solidjs-static/vite.config.js +1 -1
- package/templates/svelte-dapp/blocklet.yml +1 -1
- package/templates/svelte-dapp/package.json +1 -1
- package/templates/svelte-dapp/vite.config.js +1 -1
- package/templates/svelte-static/package.json +1 -1
- package/templates/svelte-static/vite.config.js +1 -1
- package/templates/vue-dapp/package.json +1 -1
- package/templates/vue-dapp/vite.config.js +1 -1
- package/templates/vue-static/package.json +1 -1
- package/templates/vue-static/vite.config.js +1 -1
package/index.js
CHANGED
|
@@ -117,8 +117,6 @@ const templates = [
|
|
|
117
117
|
|
|
118
118
|
const renameFiles = {
|
|
119
119
|
_gitignore: '.gitignore',
|
|
120
|
-
'_eslintrc.js': '.eslintrc.js',
|
|
121
|
-
_eslintignore: '.eslintignore',
|
|
122
120
|
_npmrc: '.npmrc',
|
|
123
121
|
_editorconfig: '.editorconfig',
|
|
124
122
|
_prettierrc: '.prettierrc',
|
|
@@ -273,21 +271,15 @@ async function init() {
|
|
|
273
271
|
const commonDir = path.join(__dirname, 'common');
|
|
274
272
|
const commonFiles = fs.readdirSync(commonDir);
|
|
275
273
|
for (const file of commonFiles) {
|
|
276
|
-
//
|
|
277
|
-
if (mainBlocklet && ['
|
|
274
|
+
// 如果选择多个模板,每个子 package 中 只会包含必要的 文件
|
|
275
|
+
if (mainBlocklet && !['screenshots', 'public', 'logo.png', '_prettierrc'].includes(file)) {
|
|
278
276
|
continue;
|
|
279
277
|
}
|
|
280
|
-
//
|
|
281
|
-
if (
|
|
278
|
+
// xmark 相关的模板不添加 .husky
|
|
279
|
+
if (fuzzyQuery(['blocklet-page', 'doc-site'], templateName) && ['.husky'].includes(file)) {
|
|
282
280
|
// eslint-disable-next-line no-continue
|
|
283
281
|
continue;
|
|
284
282
|
}
|
|
285
|
-
// xmark 相关的模板不添加 .eslintignore 和 .includes
|
|
286
|
-
if (fuzzyQuery(['blocklet-page', 'doc-site'], templateName) && ['_eslintignore', '.husky'].includes(file)) {
|
|
287
|
-
// eslint-disable-next-line no-continue
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
// 如果选中了多个模板,则要将 common file copy 到项目 root 目录下的 blocklets 中
|
|
291
283
|
const targetPath = renameFiles[file]
|
|
292
284
|
? path.join(root, mainBlocklet ? `blocklets/${templateName}` : '', renameFiles[file])
|
|
293
285
|
: path.join(root, mainBlocklet ? `blocklets/${templateName}` : '', file);
|
|
@@ -306,15 +298,15 @@ async function init() {
|
|
|
306
298
|
|
|
307
299
|
modifyPackage(
|
|
308
300
|
(pkg) => {
|
|
309
|
-
pkg.name = finalTemplateName;
|
|
301
|
+
pkg.name = mainBlocklet ? finalTemplateName : name;
|
|
310
302
|
},
|
|
311
303
|
templateDir,
|
|
312
304
|
templateName
|
|
313
305
|
);
|
|
314
306
|
modifyBlockletYaml(
|
|
315
307
|
(yamlConfig) => {
|
|
316
|
-
yamlConfig.name = finalTemplateName;
|
|
317
|
-
yamlConfig.title =
|
|
308
|
+
yamlConfig.name = mainBlocklet ? finalTemplateName : name;
|
|
309
|
+
yamlConfig.title = mainBlocklet ? templateName : name;
|
|
318
310
|
},
|
|
319
311
|
templateDir,
|
|
320
312
|
templateName
|
package/lib/utils.js
CHANGED
package/package.json
CHANGED
|
@@ -1,12 +1,26 @@
|
|
|
1
1
|
/* eslint-disable no-console */
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
|
-
import { $, chalk, fs } from 'zx';
|
|
3
|
+
import { $, chalk, fs, path, YAML } from 'zx';
|
|
4
4
|
|
|
5
5
|
// or use pnpm to bump version: `pnpm -r --filter {packages/*, themes/*} -- pnpm version`
|
|
6
|
-
execSync('bumpp package.json
|
|
6
|
+
execSync('bumpp package.json blocklets/*/package.json', { stdio: 'inherit' });
|
|
7
7
|
|
|
8
8
|
const { version } = await fs.readJSON('package.json');
|
|
9
9
|
|
|
10
|
+
(async () => {
|
|
11
|
+
console.log(chalk.greenBright(`[info]: start to modify blocklets version to ${version}`));
|
|
12
|
+
const dirPath = path.join(__dirname, '../blocklets');
|
|
13
|
+
let pathList = await fs.readdirSync(dirPath);
|
|
14
|
+
pathList = pathList.map((item) => `${dirPath}/${item}/blocklet.yml`);
|
|
15
|
+
for (const ymlPath of pathList) {
|
|
16
|
+
const blockletYaml = await fs.readFileSync(ymlPath, 'utf8');
|
|
17
|
+
const yamlConfig = YAML.parse(blockletYaml);
|
|
18
|
+
yamlConfig.version = version;
|
|
19
|
+
fs.writeFileSync(ymlPath, YAML.stringify(yamlConfig, 2));
|
|
20
|
+
}
|
|
21
|
+
console.log(chalk.greenBright('[info]: all blocklets version modified.'));
|
|
22
|
+
})();
|
|
23
|
+
|
|
10
24
|
console.log(`\nNow you can make adjustments to ${chalk.cyan('CHANGELOG.md')}. Then press enter to continue.`);
|
|
11
25
|
|
|
12
26
|
let newChangelog = '';
|
|
File without changes
|