create-blocklet 0.4.76 → 0.4.78

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.
@@ -0,0 +1,5 @@
1
+ const rimraf = require('rimraf');
2
+
3
+ console.log('clean .blocklet folder');
4
+ rimraf.sync('.blocklet');
5
+ console.log('clean .blocklet folder done!');
@@ -0,0 +1,33 @@
1
+ /* eslint-disable no-console */
2
+ import { execSync } from 'child_process';
3
+ import { $, chalk, fs } from 'zx';
4
+
5
+ execSync('bumpp --no-tag --no-commit --no-push package.json', { stdio: 'inherit' });
6
+
7
+ const { version } = await fs.readJSON('package.json');
8
+
9
+ let newChangelog = '';
10
+
11
+ try {
12
+ const gitRes = await $`git log --pretty=format:"- %s" "master"...HEAD`;
13
+ newChangelog = gitRes.stdout.trim();
14
+ } catch {
15
+ console.error(chalk.redBright('Could not get git log, please write changelog manually.'));
16
+ }
17
+
18
+ const now = new Date();
19
+ const currentDate = `${now.getFullYear()}-${now.getMonth() + 1}-${now.getDate()}`;
20
+ const title = `## ${version} (${currentDate})`;
21
+
22
+ await fs.ensureFile('CHANGELOG.md');
23
+ const oldChangelog = await fs.readFile('CHANGELOG.md', 'utf8');
24
+ const changelog = [title, newChangelog, oldChangelog].filter((item) => !!item).join('\n\n');
25
+ await fs.writeFile('CHANGELOG.md', changelog);
26
+
27
+ console.log(`\nNow you can make adjustments to ${chalk.cyan('CHANGELOG.md')}. Then press enter to continue.`);
28
+
29
+ process.stdin.setRawMode(true);
30
+ process.stdin.resume();
31
+ process.stdin.on('data', process.exit.bind(process, 0));
32
+
33
+ await fs.writeFileSync('version', version);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-blocklet",
3
- "version": "0.4.76",
3
+ "version": "0.4.78",
4
4
  "exports": "./index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:blocklet/create-blocklet.git",
@@ -6,7 +6,7 @@
6
6
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
7
  <link rel="stylesheet" href="./styles/style.css" />
8
8
  <title>HTML Template</title>
9
- <script src="__meta__.js"></script>
9
+ <script src="__blocklet__.js"></script>
10
10
  </head>
11
11
  <body>
12
12
  <div id="app">
@@ -12,7 +12,7 @@ function MyApp({ Component, pageProps }) {
12
12
  <meta name="theme-color" content="#4F6AF5" />
13
13
  <meta name="description" content="Web site created using create-blocklet" />
14
14
  </Head>
15
- <Script src="__meta__.js" />
15
+ <Script src="__blocklet__.js" />
16
16
  <Component {...pageProps} />
17
17
  </>
18
18
  );
@@ -74,7 +74,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
74
74
  Bump version at first.
75
75
 
76
76
  ```shell
77
- make bump-version
77
+ npm run bump-version
78
78
  ```
79
79
 
80
80
  Then config blocklet store url.
@@ -114,7 +114,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
114
114
  Bump version at first.
115
115
 
116
116
  ```shell
117
- make bump-version
117
+ npm run bump-version
118
118
  ```
119
119
 
120
120
  Push your code to Github main/master branch, or make a pull request to the main/master branch.
@@ -8,8 +8,8 @@
8
8
  "lint:fix": "npm run lint -- --fix",
9
9
  "start": "npm-run-all --parallel start:*",
10
10
  "start:client": "vite --host",
11
- "start:api": "NODE_ENV=development nodemon api/index.js -w api",
12
- "clean": "rm -rf .blocklet",
11
+ "start:api": "cross-env NODE_ENV=development nodemon api/index.js -w api",
12
+ "clean": "node scripts/build-clean.js",
13
13
  "bundle": "npm run bundle:client && npm run bundle:api",
14
14
  "bundle:client": "vite build",
15
15
  "bundle:api": "npm run clean && blocklet bundle --zip --create-release",
@@ -17,7 +17,8 @@
17
17
  "upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
18
18
  "deploy:child": "npm run bundle && blocklet deploy .blocklet/bundle --app-did=<%= did %>",
19
19
  "dev:child": "blocklet dev --component --app-did=<%= did %>",
20
- "prepare": "husky install"
20
+ "prepare": "husky install",
21
+ "bump-version": "zx scripts/bump-version.mjs"
21
22
  },
22
23
  "lint-staged": {
23
24
  "*.{mjs,js,jsx,ts,tsx}": [
@@ -57,11 +58,14 @@
57
58
  "express-history-api-fallback": "^2.2.1",
58
59
  "react": "^18.2.0",
59
60
  "react-dom": "^18.2.0",
60
- "react-router-dom": "^6.4.2"
61
+ "react-router-dom": "^6.4.2",
62
+ "rimraf": "^3.0.2"
61
63
  },
62
64
  "devDependencies": {
63
65
  "@arcblock/eslint-config": "^0.2.3",
64
66
  "@vitejs/plugin-react": "^2.1.0",
67
+ "bumpp": "^8.2.1",
68
+ "cross-env": "^7.0.3",
65
69
  "eslint": "^8.25.0",
66
70
  "husky": "^8.0.1",
67
71
  "lint-staged": "^12.5.0",
@@ -70,8 +74,9 @@
70
74
  "npm-run-all": "^4.1.5",
71
75
  "prettier": "^2.7.1",
72
76
  "vite": "^3.1.8",
73
- "vite-plugin-blocklet": "^0.4.76",
77
+ "vite-plugin-blocklet": "^0.4.78",
74
78
  "vite-plugin-html": "^3.2.0",
75
- "vite-plugin-svgr": "^2.2.2"
79
+ "vite-plugin-svgr": "^2.2.2",
80
+ "zx": "^7.1.1"
76
81
  }
77
82
  }
@@ -70,7 +70,7 @@
70
70
  "npm-run-all": "^4.1.5",
71
71
  "prettier": "^2.7.1",
72
72
  "vite": "^3.1.8",
73
- "vite-plugin-blocklet": "^0.4.76",
73
+ "vite-plugin-blocklet": "^0.4.78",
74
74
  "vite-plugin-html": "^3.2.0",
75
75
  "vite-plugin-svgr": "^2.2.2"
76
76
  }
@@ -50,7 +50,7 @@
50
50
  "lint-staged": "^12.5.0",
51
51
  "prettier": "^2.7.1",
52
52
  "vite": "^3.1.8",
53
- "vite-plugin-blocklet": "^0.4.76",
53
+ "vite-plugin-blocklet": "^0.4.78",
54
54
  "vite-plugin-html": "^3.2.0",
55
55
  "vite-plugin-svgr": "^2.2.2"
56
56
  }
@@ -32,7 +32,7 @@
32
32
  "npm-run-all": "^4.1.5",
33
33
  "prettier": "^2.7.1",
34
34
  "vite": "^3.1.8",
35
- "vite-plugin-blocklet": "^0.4.76",
35
+ "vite-plugin-blocklet": "^0.4.78",
36
36
  "vite-plugin-html": "^3.2.0",
37
37
  "vite-plugin-solid": "^2.3.9"
38
38
  },
@@ -26,7 +26,7 @@
26
26
  "lint-staged": "^12.5.0",
27
27
  "prettier": "^2.7.1",
28
28
  "vite": "^3.1.8",
29
- "vite-plugin-blocklet": "^0.4.76",
29
+ "vite-plugin-blocklet": "^0.4.78",
30
30
  "vite-plugin-html": "^3.2.0",
31
31
  "vite-plugin-solid": "^2.3.9"
32
32
  },
@@ -46,7 +46,7 @@
46
46
  "prettier": "^2.7.1",
47
47
  "svelte": "^3.52.0",
48
48
  "vite": "^3.1.8",
49
- "vite-plugin-blocklet": "^0.4.76",
49
+ "vite-plugin-blocklet": "^0.4.78",
50
50
  "vite-plugin-html": "^3.2.0"
51
51
  },
52
52
  "lint-staged": {
@@ -27,7 +27,7 @@
27
27
  "prettier": "^2.7.1",
28
28
  "svelte": "^3.52.0",
29
29
  "vite": "^3.1.8",
30
- "vite-plugin-blocklet": "^0.4.76",
30
+ "vite-plugin-blocklet": "^0.4.78",
31
31
  "vite-plugin-html": "^3.2.0"
32
32
  },
33
33
  "lint-staged": {
@@ -49,7 +49,7 @@
49
49
  "npm-run-all": "^4.1.5",
50
50
  "prettier": "^2.7.1",
51
51
  "vite": "^3.1.8",
52
- "vite-plugin-blocklet": "^0.4.76"
52
+ "vite-plugin-blocklet": "^0.4.78"
53
53
  },
54
54
  "lint-staged": {
55
55
  "*.{mjs,js,vue}": [
@@ -28,7 +28,7 @@
28
28
  "lint-staged": "^12.5.0",
29
29
  "prettier": "^2.7.1",
30
30
  "vite": "^3.1.8",
31
- "vite-plugin-blocklet": "^0.4.76",
31
+ "vite-plugin-blocklet": "^0.4.78",
32
32
  "vite-plugin-html": "^3.2.0"
33
33
  },
34
34
  "lint-staged": {
@@ -7,7 +7,7 @@
7
7
  <meta name="theme-color" content="#4F6AF5" />
8
8
  <meta name="description" content="Web site created using create-blocklet" />
9
9
  <title><%= htmlWebpackPlugin.options.title %></title>
10
- <script src="__meta__.js"></script>
10
+ <script src="__blocklet__.js"></script>
11
11
  </head>
12
12
  <body>
13
13
  <noscript>You need to enable JavaScript to run this app.</noscript>
@@ -7,7 +7,7 @@
7
7
  <meta name="theme-color" content="#4F6AF5" />
8
8
  <meta name="description" content="Web site created using create-blocklet" />
9
9
  <title><%= htmlWebpackPlugin.options.title %></title>
10
- <script src="__meta__.js"></script>
10
+ <script src="__blocklet__.js"></script>
11
11
  </head>
12
12
  <body>
13
13
  <noscript>You need to enable JavaScript to run this app.</noscript>