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 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 && ['Makefile', 'version', '_npmrc', '_editorconfig', '_gitignore'].includes(file)) {
274
+ // 如果选择多个模板,每个子 package 中 只会包含必要的 文件
275
+ if (mainBlocklet && !['screenshots', 'public', 'logo.png', '_prettierrc'].includes(file)) {
278
276
  continue;
279
277
  }
280
- // react 相关的模板使用通用的 eslintrc.js 文件
281
- if (!fuzzyQuery(['react', 'react-gun'], templateName) && file === '_eslintrc.js') {
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 = finalTemplateName;
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
@@ -7,7 +7,7 @@ export function copy(src, dest) {
7
7
  if (stat.isDirectory()) {
8
8
  copyDir(src, dest);
9
9
  } else {
10
- fs.copyFileSync(src, dest);
10
+ fs.copySync(src, dest);
11
11
  }
12
12
  }
13
13
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-blocklet",
3
- "version": "0.4.50",
3
+ "version": "0.4.52",
4
4
  "exports": "./index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:blocklet/create-blocklet.git",
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "name": "root",
3
+ "version": "0.1.1",
3
4
  "private": true,
4
5
  "workspaces": [
5
6
  "blocklets/*"
@@ -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 packages/*/package.json plugins/*/package.json', { stdio: 'inherit' });
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 = '';
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: '@arcblock/eslint-config',
4
+ globals: {
5
+ logger: true,
6
+ },
7
+ };
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ root: true,
3
+ extends: '@arcblock/eslint-config',
4
+ globals: {
5
+ logger: true,
6
+ },
7
+ };
@@ -4,7 +4,7 @@ description: A Blocklet Server blocklet
4
4
  keywords:
5
5
  - blocklet
6
6
  - solidjs
7
- group: static
7
+ group: dapp
8
8
  did: ''
9
9
  main: dist
10
10
  author:
@@ -32,7 +32,7 @@
32
32
  "npm-run-all": "^4.1.5",
33
33
  "prettier": "^2.7.1",
34
34
  "vite": "^3.1.2",
35
- "vite-plugin-blocklet": "^0.4.50",
35
+ "vite-plugin-blocklet": "^0.4.52",
36
36
  "vite-plugin-html": "^3.2.0",
37
37
  "vite-plugin-solid": "^2.3.3"
38
38
  },
@@ -18,7 +18,7 @@ export default defineConfig(async ({ mode }) => {
18
18
  },
19
19
  },
20
20
  }),
21
- createBlockletPlugin({ version: 2 }),
21
+ createBlockletPlugin(),
22
22
  ],
23
23
  build: {
24
24
  target: 'esnext',
@@ -26,7 +26,7 @@
26
26
  "lint-staged": "^12.5.0",
27
27
  "prettier": "^2.7.1",
28
28
  "vite": "^3.1.2",
29
- "vite-plugin-blocklet": "^0.4.50",
29
+ "vite-plugin-blocklet": "^0.4.52",
30
30
  "vite-plugin-html": "^3.2.0",
31
31
  "vite-plugin-solid": "^2.3.3"
32
32
  },
@@ -17,7 +17,7 @@ export default defineConfig(async ({ mode }) => {
17
17
  },
18
18
  },
19
19
  }),
20
- createBlockletPlugin({ version: 2 }),
20
+ createBlockletPlugin(),
21
21
  ],
22
22
  build: {
23
23
  target: 'esnext',
@@ -4,7 +4,7 @@ description: A Blocklet Server blocklet
4
4
  keywords:
5
5
  - blocklet
6
6
  - svelte
7
- group: static
7
+ group: dapp
8
8
  did: ''
9
9
  main: dist
10
10
  author:
@@ -46,7 +46,7 @@
46
46
  "prettier": "^2.7.1",
47
47
  "svelte": "^3.50.1",
48
48
  "vite": "^3.1.2",
49
- "vite-plugin-blocklet": "^0.4.50",
49
+ "vite-plugin-blocklet": "^0.4.52",
50
50
  "vite-plugin-html": "^3.2.0"
51
51
  },
52
52
  "lint-staged": {
@@ -19,7 +19,7 @@ export default defineConfig(async ({ mode }) => {
19
19
  },
20
20
  },
21
21
  }),
22
- createBlockletPlugin({ version: 2 }),
22
+ createBlockletPlugin(),
23
23
  ],
24
24
  server: {
25
25
  proxy: {
@@ -27,7 +27,7 @@
27
27
  "prettier": "^2.7.1",
28
28
  "svelte": "^3.50.1",
29
29
  "vite": "^3.1.2",
30
- "vite-plugin-blocklet": "^0.4.50",
30
+ "vite-plugin-blocklet": "^0.4.52",
31
31
  "vite-plugin-html": "^3.2.0"
32
32
  },
33
33
  "lint-staged": {
@@ -18,7 +18,7 @@ export default defineConfig(async ({ mode }) => {
18
18
  },
19
19
  },
20
20
  }),
21
- createBlockletPlugin({ version: 2 }),
21
+ createBlockletPlugin(),
22
22
  ],
23
23
  };
24
24
  });
@@ -49,7 +49,7 @@
49
49
  "npm-run-all": "^4.1.5",
50
50
  "prettier": "^2.7.1",
51
51
  "vite": "^3.1.2",
52
- "vite-plugin-blocklet": "^0.4.50"
52
+ "vite-plugin-blocklet": "^0.4.52"
53
53
  },
54
54
  "lint-staged": {
55
55
  "*.{mjs,js,vue}": [
@@ -19,7 +19,7 @@ export default defineConfig(async ({ mode }) => {
19
19
  },
20
20
  },
21
21
  }),
22
- createBlockletPlugin({ version: 2 }),
22
+ createBlockletPlugin(),
23
23
  ],
24
24
  server: {
25
25
  proxy: {
@@ -28,7 +28,7 @@
28
28
  "lint-staged": "^12.5.0",
29
29
  "prettier": "^2.7.1",
30
30
  "vite": "^3.1.2",
31
- "vite-plugin-blocklet": "^0.4.50",
31
+ "vite-plugin-blocklet": "^0.4.52",
32
32
  "vite-plugin-html": "^3.2.0"
33
33
  },
34
34
  "lint-staged": {
@@ -18,7 +18,7 @@ export default defineConfig(async ({ mode }) => {
18
18
  },
19
19
  },
20
20
  }),
21
- createBlockletPlugin({ version: 2 }),
21
+ createBlockletPlugin(),
22
22
  ],
23
23
  };
24
24
  });