create-blocklet 0.2.5 → 0.2.9
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/common/.github/workflows/main.yml +5 -5
- package/common/.prettierrc +1 -0
- package/common/Makefile +1 -1
- package/common/_gitignore +1 -0
- package/index.js +35 -21
- package/lib/abtnode.js +8 -8
- package/lib/index.js +0 -0
- package/package.json +1 -1
- package/template-dapp/react/README.md +23 -23
- package/template-dapp/vue/README.md +24 -24
- package/template-dapp/vue/blocklet.yml +11 -1
- package/template-dapp/vue2/.env +1 -0
- package/template-dapp/vue2/README.md +147 -0
- package/template-dapp/vue2/babel.config.js +3 -0
- package/template-dapp/vue2/blocklet.md +3 -0
- package/template-dapp/vue2/blocklet.yml +60 -0
- package/template-dapp/vue2/package.json +68 -0
- package/template-dapp/vue2/public/index.html +24 -0
- package/template-dapp/vue2/server/hooks/pre-start.js +33 -0
- package/template-dapp/vue2/server/index.js +55 -0
- package/template-dapp/vue2/server/libs/auth.js +31 -0
- package/template-dapp/vue2/server/libs/env.js +12 -0
- package/template-dapp/vue2/server/libs/logger.js +3 -0
- package/template-dapp/vue2/server/middlewares/user.js +10 -0
- package/template-dapp/vue2/server/routes/index.js +6 -0
- package/template-dapp/vue2/src/App.vue +22 -0
- package/template-dapp/vue2/src/assets/logo.png +0 -0
- package/template-dapp/vue2/src/components/HelloWorld.vue +74 -0
- package/template-dapp/vue2/src/libs/api.js +14 -0
- package/template-dapp/vue2/src/main.js +10 -0
- package/template-dapp/vue2/src/pages/About.vue +13 -0
- package/template-dapp/vue2/src/pages/Home.vue +37 -0
- package/template-dapp/vue2/src/router.js +24 -0
- package/template-dapp/vue2/vue.config.js +11 -0
- package/template-static/react/README.md +24 -24
- package/template-static/vue/README.md +24 -24
- package/template-static/vue/index.html +3 -3
- package/template-static/vue2/.env +1 -0
- package/template-static/vue2/README.md +147 -0
- package/template-static/vue2/babel.config.js +3 -0
- package/template-static/vue2/blocklet.md +3 -0
- package/template-static/vue2/blocklet.yml +50 -0
- package/template-static/vue2/package.json +48 -0
- package/template-static/vue2/public/index.html +24 -0
- package/template-static/vue2/src/App.vue +22 -0
- package/template-static/vue2/src/assets/logo.png +0 -0
- package/template-static/vue2/src/components/HelloWorld.vue +74 -0
- package/template-static/vue2/src/main.js +10 -0
- package/template-static/vue2/src/pages/About.vue +13 -0
- package/template-static/vue2/src/pages/Home.vue +20 -0
- package/template-static/vue2/src/router.js +24 -0
- package/template-static/vue2/vue.config.js +6 -0
- package/CHANGELOG.md +0 -62
|
@@ -27,10 +27,10 @@ jobs:
|
|
|
27
27
|
skip-upload: false
|
|
28
28
|
skip-deploy: false
|
|
29
29
|
bundle-command: yarn bundle
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
access-key: ${{ secrets.STAGING_NODE_ACCESS_KEY }}
|
|
34
|
-
access-secret: ${{ secrets.STAGING_NODE_ACCESS_SECRET }}
|
|
30
|
+
store-endpoint: ${{ secrets.STORE_ENDPOINT_STAGING }}
|
|
31
|
+
store-access-token: ${{ secrets.STORE_ACCESS_TOKEN_STAGING }}
|
|
32
|
+
server-endpoint: ${{ secrets.STAGING_NODE_ENDPOINT }}
|
|
33
|
+
server-access-key: ${{ secrets.STAGING_NODE_ACCESS_KEY }}
|
|
34
|
+
server-access-secret: ${{ secrets.STAGING_NODE_ACCESS_SECRET }}
|
|
35
35
|
slack-webhook: ${{ secrets.SLACK_WEBHOOK }}
|
|
36
36
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
package/common/.prettierrc
CHANGED
package/common/Makefile
CHANGED
package/common/_gitignore
CHANGED
package/index.js
CHANGED
|
@@ -40,6 +40,11 @@ const TYPES = [
|
|
|
40
40
|
display: 'vue3 + vite',
|
|
41
41
|
color: green,
|
|
42
42
|
},
|
|
43
|
+
{
|
|
44
|
+
name: 'vue2',
|
|
45
|
+
display: 'vue2 + @vue/cli',
|
|
46
|
+
color: green,
|
|
47
|
+
},
|
|
43
48
|
],
|
|
44
49
|
},
|
|
45
50
|
{
|
|
@@ -56,6 +61,11 @@ const TYPES = [
|
|
|
56
61
|
display: 'vue3 + vite',
|
|
57
62
|
color: green,
|
|
58
63
|
},
|
|
64
|
+
{
|
|
65
|
+
name: 'vue2',
|
|
66
|
+
display: 'vue2 + @vue/cli',
|
|
67
|
+
color: green,
|
|
68
|
+
},
|
|
59
69
|
],
|
|
60
70
|
},
|
|
61
71
|
];
|
|
@@ -189,43 +199,43 @@ async function init() {
|
|
|
189
199
|
await echoBrand();
|
|
190
200
|
await echoDocument();
|
|
191
201
|
|
|
192
|
-
console.log('Checking
|
|
202
|
+
console.log('Checking blocklet server runtime environment...', '\n');
|
|
193
203
|
|
|
194
204
|
const isAbtnodeInstalled = checkAbtnodeInstalled();
|
|
195
205
|
const isSatisfiedVersion = checkSatisfiedVersion();
|
|
196
206
|
const isAbtnodeRunning = checkAbtnodeRunning();
|
|
197
207
|
|
|
198
208
|
if (!isAbtnodeInstalled) {
|
|
199
|
-
// 未安装
|
|
200
|
-
console.log(red('To run the blocklet, you need a running
|
|
209
|
+
// 未安装 blocklet server
|
|
210
|
+
console.log(red('To run the blocklet, you need a running blocklet server instance on local machine.'), '\n');
|
|
201
211
|
console.log(`Checkout ${green('README.md')} for more usage instructions.`);
|
|
202
212
|
console.log('Now you should run:', '\n');
|
|
203
|
-
console.log(cyan('npm install -g @
|
|
204
|
-
console.log(cyan('
|
|
213
|
+
console.log(cyan('npm install -g @blocklet/cli'));
|
|
214
|
+
console.log(cyan('blocklet server start -a'));
|
|
205
215
|
} else if (!isSatisfiedVersion) {
|
|
206
|
-
// 已安装
|
|
207
|
-
console.log(red('Your
|
|
216
|
+
// 已安装 blocklet server,但版本不满足
|
|
217
|
+
console.log(red('Your blocklet server version is outdate, please update it to the latest version.'));
|
|
208
218
|
console.log('Now you should run:', '\n');
|
|
209
219
|
if (isAbtnodeRunning) {
|
|
210
|
-
//
|
|
211
|
-
const
|
|
212
|
-
console.log(cyan(`cd ${
|
|
213
|
-
console.log(cyan('
|
|
214
|
-
console.log(cyan('npm install -g @
|
|
215
|
-
console.log(cyan('
|
|
220
|
+
// blocklet server 已经启动
|
|
221
|
+
const serverPath = getAbtnodeDirectory();
|
|
222
|
+
console.log(cyan(`cd ${serverPath}`));
|
|
223
|
+
console.log(cyan('blocklet server stop'));
|
|
224
|
+
console.log(cyan('npm install -g @blocklet/cli'));
|
|
225
|
+
console.log(cyan('blocklet server start'));
|
|
216
226
|
console.log(cyan(`cd ${cwd}`));
|
|
217
227
|
} else {
|
|
218
|
-
//
|
|
219
|
-
// TODO: 如何获取未启动的
|
|
220
|
-
console.log(cyan('npm install -g @
|
|
221
|
-
console.log(cyan('
|
|
228
|
+
// blocklet server 未启动
|
|
229
|
+
// TODO: 如何获取未启动的 blocklet server 实例目录?
|
|
230
|
+
console.log(cyan('npm install -g @blocklet/cli'));
|
|
231
|
+
console.log(cyan('blocklet server start -a'));
|
|
222
232
|
}
|
|
223
233
|
} else if (!isAbtnodeRunning) {
|
|
224
|
-
// 已经安装
|
|
225
|
-
console.log(red('You need to start your
|
|
234
|
+
// 已经安装 blocklet server,且版本满足,并且 blocklet server 未启动
|
|
235
|
+
console.log(red('You need to start your blocklet server before develop this blocklet.'));
|
|
226
236
|
console.log('Now you should run:', '\n');
|
|
227
|
-
// TODO: 如何获取未启动的
|
|
228
|
-
console.log(cyan('
|
|
237
|
+
// TODO: 如何获取未启动的 blocklet server 实例目录?
|
|
238
|
+
console.log(cyan('blocklet server start -a'));
|
|
229
239
|
}
|
|
230
240
|
|
|
231
241
|
console.log(`\n\nScaffolding project in ${root}...`);
|
|
@@ -238,6 +248,10 @@ async function init() {
|
|
|
238
248
|
const commonDir = path.join(__dirname, 'common');
|
|
239
249
|
const commonFiles = fs.readdirSync(commonDir);
|
|
240
250
|
for (const file of commonFiles) {
|
|
251
|
+
if (framework !== 'react' && file === '_eslintrc.js') {
|
|
252
|
+
// eslint-disable-next-line no-continue
|
|
253
|
+
continue;
|
|
254
|
+
}
|
|
241
255
|
const targetPath = renameFiles[file] ? path.join(root, renameFiles[file]) : path.join(root, file);
|
|
242
256
|
copy(path.join(commonDir, file), targetPath);
|
|
243
257
|
}
|
package/lib/abtnode.js
CHANGED
|
@@ -2,17 +2,17 @@ import semver from 'semver';
|
|
|
2
2
|
import { getOutput } from './index.js';
|
|
3
3
|
|
|
4
4
|
export function checkAbtnodeInstalled() {
|
|
5
|
-
const output = getOutput('which
|
|
5
|
+
const output = getOutput('which blocklet');
|
|
6
6
|
return !!output;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
9
|
export function getAbtnodeVersion() {
|
|
10
|
-
const output = getOutput('
|
|
10
|
+
const output = getOutput('blocklet --version');
|
|
11
11
|
return output.trim();
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export function getAbtnodeStatus() {
|
|
15
|
-
const output = getOutput('
|
|
15
|
+
const output = getOutput('blocklet server status');
|
|
16
16
|
const [matchStr] = output.match(/ABT Node status:[\s\S]*?\n/gm) || [];
|
|
17
17
|
if (!matchStr) {
|
|
18
18
|
return 'stop';
|
|
@@ -26,17 +26,17 @@ export function checkAbtnodeRunning() {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
export function checkSatisfiedVersion() {
|
|
29
|
-
const output = getOutput('
|
|
29
|
+
const output = getOutput('blocklet --version');
|
|
30
30
|
const version = output.trim();
|
|
31
|
-
return semver.satisfies(version, '>= 1.
|
|
31
|
+
return semver.satisfies(version, '>= 1.6.1');
|
|
32
32
|
}
|
|
33
33
|
|
|
34
34
|
export function getAbtnodeDirectory() {
|
|
35
|
-
const output = getOutput('
|
|
36
|
-
const [matchStr] = output.match(/
|
|
35
|
+
const output = getOutput('blocklet server status');
|
|
36
|
+
const [matchStr] = output.match(/Blocklet Server Data Directory:[\s\S]*?\n/gm) || [];
|
|
37
37
|
if (!matchStr) return null;
|
|
38
38
|
|
|
39
|
-
const directory = matchStr.replace(/
|
|
39
|
+
const directory = matchStr.replace(/Blocklet Server Data Directory:[\s]*([\S]+)\/\.abtnode\n/gm, '$1');
|
|
40
40
|
return directory;
|
|
41
41
|
}
|
|
42
42
|
|
package/lib/index.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -34,17 +34,17 @@ This blocklet is a dapp project, which means this is a full-stack application. I
|
|
|
34
34
|
|
|
35
35
|
## Development
|
|
36
36
|
|
|
37
|
-
1. Make sure you have [@
|
|
37
|
+
1. Make sure you have [@blocklet/cli](https://www.npmjs.com/package/@blocklet/cli) installed
|
|
38
38
|
|
|
39
|
-
Blocklet needs
|
|
40
|
-
`npm install -g @
|
|
39
|
+
Blocklet needs blocklet server as a dependency. So you need to install it first.
|
|
40
|
+
`npm install -g @blocklet/cli`
|
|
41
41
|
See details in [https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#use-the-binary-distribution](https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#use-the-binary-distribution)
|
|
42
42
|
|
|
43
|
-
2. Init
|
|
43
|
+
2. Init blocklet server & start blocklet server
|
|
44
44
|
|
|
45
|
-
Before starting an
|
|
46
|
-
`
|
|
47
|
-
`
|
|
45
|
+
Before starting an blocklet server, you need to init blocklet server.
|
|
46
|
+
`blocklet server init --mode=debug`
|
|
47
|
+
`blocklet server start`
|
|
48
48
|
See details in [https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#configure-abt-node](https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#configure-abt-node)
|
|
49
49
|
|
|
50
50
|
3. Go to the project directory `cd [name]`
|
|
@@ -57,19 +57,19 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
57
57
|
|
|
58
58
|
## Deploy
|
|
59
59
|
|
|
60
|
-
- If you want to deploy this blocklet to local
|
|
60
|
+
- If you want to deploy this blocklet to local blocklet server, you can use `blocklet deploy .blocklet/bundle` command(Make sure the blocklet is bundled before deployment).
|
|
61
61
|
> Or you can simply use `npm run deploy` command.
|
|
62
|
-
- If you want to deploy this blocklet to remote
|
|
62
|
+
- If you want to deploy this blocklet to remote blocklet server, you can use the command below.
|
|
63
63
|
|
|
64
64
|
```shell
|
|
65
|
-
blocklet deploy .blocklet/bundle --endpoint {your
|
|
65
|
+
blocklet deploy .blocklet/bundle --endpoint {your blocklet server url} --access-key {blocklet server access key} --access-secret {blocklet server access secret}
|
|
66
66
|
```
|
|
67
67
|
|
|
68
68
|
> Make sure the blocklet is bundled before deployment.
|
|
69
69
|
|
|
70
|
-
## Upload to blocklet
|
|
70
|
+
## Upload to blocklet store
|
|
71
71
|
|
|
72
|
-
- If you want to upload the blocklet to any
|
|
72
|
+
- If you want to upload the blocklet to any store for other users to download and use, you can following the following instructions.
|
|
73
73
|
|
|
74
74
|
Bump version at first.
|
|
75
75
|
|
|
@@ -77,22 +77,22 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
77
77
|
make bump-version
|
|
78
78
|
```
|
|
79
79
|
|
|
80
|
-
Then config blocklet
|
|
81
|
-
You can use those
|
|
80
|
+
Then config blocklet store url.
|
|
81
|
+
You can use those store url in below.
|
|
82
82
|
|
|
83
|
-
1. [https://
|
|
84
|
-
2. [https://dev.
|
|
85
|
-
3. A blocklet
|
|
86
|
-
> Make sure you have installed a `blocklet
|
|
83
|
+
1. [https://store.blocklet.dev/](https://store.blocklet.dev/)
|
|
84
|
+
2. [https://dev.store.blocklet.dev/](https://dev.store.blocklet.dev/)
|
|
85
|
+
3. A blocklet store started by yourself.
|
|
86
|
+
> Make sure you have installed a `blocklet store` on your own blocklet server. Check it on here: [https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ](https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ)
|
|
87
87
|
|
|
88
88
|
```shell
|
|
89
|
-
blocklet config set
|
|
89
|
+
blocklet config set store {store url}
|
|
90
90
|
```
|
|
91
91
|
|
|
92
92
|
Get a `accessToken` by using this command.
|
|
93
93
|
|
|
94
94
|
> Why we need a `accessToken`?
|
|
95
|
-
> A `accessToken` is genrate by blocklet
|
|
95
|
+
> A `accessToken` is genrate by blocklet store, which help us upload our blocklet to any store.
|
|
96
96
|
|
|
97
97
|
Set `accessToken` to blocklet config
|
|
98
98
|
|
|
@@ -100,7 +100,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
100
100
|
blocklet config set accessToken {accessToken}
|
|
101
101
|
```
|
|
102
102
|
|
|
103
|
-
Upload a new version to a
|
|
103
|
+
Upload a new version to a store.
|
|
104
104
|
|
|
105
105
|
> Make sure the blocklet is bundled before upload.
|
|
106
106
|
|
|
@@ -110,7 +110,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
110
110
|
|
|
111
111
|
Or you can simply use `npm run upload` command.
|
|
112
112
|
|
|
113
|
-
- You also can upload a new version to a
|
|
113
|
+
- You also can upload a new version to a store by Github CI.
|
|
114
114
|
Bump version at first.
|
|
115
115
|
|
|
116
116
|
```shell
|
|
@@ -118,7 +118,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
Push your code to Github main/master branch, or make a pull request to the main/master branch.
|
|
121
|
-
The CI workflow will automatically upload a new version to a
|
|
121
|
+
The CI workflow will automatically upload a new version to a store.
|
|
122
122
|
|
|
123
123
|
## Q & A
|
|
124
124
|
|
|
@@ -28,17 +28,17 @@ This blocklet is a static project, which means this is a frontend application. I
|
|
|
28
28
|
|
|
29
29
|
## Development
|
|
30
30
|
|
|
31
|
-
1. Make sure you have [@
|
|
31
|
+
1. Make sure you have [@blocklet/cli](https://www.npmjs.com/package/@blocklet/cli) installed
|
|
32
32
|
|
|
33
|
-
Blocklet needs
|
|
34
|
-
`npm install -g @
|
|
33
|
+
Blocklet needs blocklet server as a dependency. So you need to install it first.
|
|
34
|
+
`npm install -g @blocklet/cli`
|
|
35
35
|
See details in [https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#use-the-binary-distribution](https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#use-the-binary-distribution)
|
|
36
36
|
|
|
37
|
-
2. Init
|
|
37
|
+
2. Init blocklet server & start blocklet server
|
|
38
38
|
|
|
39
|
-
Before starting an
|
|
40
|
-
`
|
|
41
|
-
`
|
|
39
|
+
Before starting an blocklet server, you need to init blocklet server.
|
|
40
|
+
`blocklet server init --mode=debug`
|
|
41
|
+
`blocklet server start`
|
|
42
42
|
See details in [https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#configure-abt-node](https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#configure-abt-node)
|
|
43
43
|
|
|
44
44
|
3. Go to the project directory `cd [name]`
|
|
@@ -51,19 +51,19 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
51
51
|
|
|
52
52
|
## Deploy
|
|
53
53
|
|
|
54
|
-
- If you want to deploy this blocklet to local
|
|
54
|
+
- If you want to deploy this blocklet to local blocklet server, you can use `blocklet deploy .blocklet/bundle` command(Make sure the blocklet is bundled before deployment.)
|
|
55
55
|
> Or you can simply use `npm run deploy` command.
|
|
56
|
-
- If you want to deploy this blocklet to remote
|
|
56
|
+
- If you want to deploy this blocklet to remote blocklet server, you can use the command below.
|
|
57
57
|
|
|
58
58
|
```shell
|
|
59
|
-
blocklet deploy .blocklet/bundle --endpoint {your
|
|
59
|
+
blocklet deploy .blocklet/bundle --endpoint {your blocklet server url} --access-key {blocklet server access key} --access-secret {blocklet server access secret}
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
> Make sure the blocklet is bundled before deployment.
|
|
63
63
|
|
|
64
|
-
## Upload to blocklet
|
|
64
|
+
## Upload to blocklet store
|
|
65
65
|
|
|
66
|
-
- If you want to upload the blocklet to any
|
|
66
|
+
- If you want to upload the blocklet to any store for other users to download and use, you can following the following instructions.
|
|
67
67
|
|
|
68
68
|
Bump version at first.
|
|
69
69
|
|
|
@@ -71,22 +71,22 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
71
71
|
make bump-version
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
Then config blocklet
|
|
75
|
-
You can use those
|
|
74
|
+
Then config blocklet store url.
|
|
75
|
+
You can use those store url in below.
|
|
76
76
|
|
|
77
|
-
1. [https://
|
|
78
|
-
2. [https://dev.
|
|
79
|
-
3. A blocklet
|
|
80
|
-
> Make sure you have installed a `blocklet
|
|
77
|
+
1. [https://store.blocklet.dev/](https://store.blocklet.dev/)
|
|
78
|
+
2. [https://dev.store.blocklet.dev/](https://dev.store.blocklet.dev/)
|
|
79
|
+
3. A blocklet store started by yourself.
|
|
80
|
+
> Make sure you have installed a `blocklet store` on your own blocklet server. Check it on here: [https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ](https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ)
|
|
81
81
|
|
|
82
82
|
```shell
|
|
83
|
-
blocklet config set
|
|
83
|
+
blocklet config set store {store url}
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
Get a `accessToken` from blocklet
|
|
86
|
+
Get a `accessToken` from blocklet store.
|
|
87
87
|
|
|
88
88
|
> Why we need a `accessToken`?
|
|
89
|
-
> A `accessToken` is genrate by blocklet
|
|
89
|
+
> A `accessToken` is genrate by blocklet store, which help us upload our blocklet to any store.
|
|
90
90
|
|
|
91
91
|
Set `accessToken` to blocklet config
|
|
92
92
|
|
|
@@ -94,7 +94,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
94
94
|
blocklet config set accessToken {accessToken}
|
|
95
95
|
```
|
|
96
96
|
|
|
97
|
-
Upload a new version to a
|
|
97
|
+
Upload a new version to a store.
|
|
98
98
|
|
|
99
99
|
> Make sure the blocklet is bundled before upload.
|
|
100
100
|
|
|
@@ -104,7 +104,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
104
104
|
|
|
105
105
|
Or you can simply use `npm run upload` command.
|
|
106
106
|
|
|
107
|
-
- You also can upload a new version to blocklet
|
|
107
|
+
- You also can upload a new version to blocklet store by Github CI.
|
|
108
108
|
Bump version at first.
|
|
109
109
|
|
|
110
110
|
```shell
|
|
@@ -112,7 +112,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
112
112
|
```
|
|
113
113
|
|
|
114
114
|
Push your code to Github main/master branch, or make a pull request to the main/master branch.
|
|
115
|
-
The CI workflow will automatically upload a new version to a
|
|
115
|
+
The CI workflow will automatically upload a new version to a store.
|
|
116
116
|
|
|
117
117
|
## Q & A
|
|
118
118
|
|
|
@@ -46,7 +46,17 @@ requirements:
|
|
|
46
46
|
scripts:
|
|
47
47
|
preStart: node server/hooks/pre-start.js
|
|
48
48
|
dev: npm run start
|
|
49
|
-
environments:
|
|
49
|
+
environments:
|
|
50
|
+
- name: CHAIN_ID
|
|
51
|
+
description: What's endpoint of the chain id?
|
|
52
|
+
required: true
|
|
53
|
+
default: 'beta'
|
|
54
|
+
secure: false
|
|
55
|
+
- name: CHAIN_HOST
|
|
56
|
+
description: What's endpoint of the chain?
|
|
57
|
+
required: true
|
|
58
|
+
default: 'https://beta.abtnetwork.io/api/'
|
|
59
|
+
secure: false
|
|
50
60
|
capabilities: {}
|
|
51
61
|
screenshots: []
|
|
52
62
|
children: []
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
APP_TITLE=''
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# Getting Started with Create Blocklet
|
|
2
|
+
|
|
3
|
+
This project was bootstrapped with [Create Blocklet](https://github.com/blocklet/create-blocklet).
|
|
4
|
+
|
|
5
|
+
This blocklet is a static project, which means this is a frontend application. It's contained `client` code.
|
|
6
|
+
|
|
7
|
+
## File Structure
|
|
8
|
+
|
|
9
|
+
- public/ - static files
|
|
10
|
+
- favicon.ico - favicon
|
|
11
|
+
- favicon.svg - favicon
|
|
12
|
+
- index.html - main html file, template for vue
|
|
13
|
+
- screenshots/ - Screenshots
|
|
14
|
+
- src/ - Client side code (A standard vue app structure)
|
|
15
|
+
- .env - Environment variables
|
|
16
|
+
- .env.local - Local environment variables
|
|
17
|
+
- .eslintrc.js - ESLint configuration
|
|
18
|
+
- .gitignore - Git ignore file
|
|
19
|
+
- .prettierrc - Prettier configuration
|
|
20
|
+
- blocklet.md - Blocklet README
|
|
21
|
+
- blocklet.yml - Blocklet configuration
|
|
22
|
+
- LICENSE - License file
|
|
23
|
+
- logo.png - Blocklet logo file
|
|
24
|
+
- Makefile - Makefile
|
|
25
|
+
- package.json - Npm package file
|
|
26
|
+
- README.md - A guide for this blocklet
|
|
27
|
+
- version - Version file
|
|
28
|
+
|
|
29
|
+
## Development
|
|
30
|
+
|
|
31
|
+
1. Make sure you have [@blocklet/cli](https://www.npmjs.com/package/@blocklet/cli) installed
|
|
32
|
+
|
|
33
|
+
Blocklet needs blocklet server as a dependency. So you need to install it first.
|
|
34
|
+
`npm install -g @blocklet/cli`
|
|
35
|
+
See details in [https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#use-the-binary-distribution](https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#use-the-binary-distribution)
|
|
36
|
+
|
|
37
|
+
2. Init blocklet server & start blocklet server
|
|
38
|
+
|
|
39
|
+
Before starting an blocklet server, you need to init blocklet server.
|
|
40
|
+
`blocklet server init --mode=debug`
|
|
41
|
+
`blocklet server start`
|
|
42
|
+
See details in [https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#configure-abt-node](https://docs.arcblock.io/abtnode/en/introduction/abtnode-setup#configure-abt-node)
|
|
43
|
+
|
|
44
|
+
3. Go to the project directory `cd [name]`
|
|
45
|
+
4. Install dependencies: `npm install` or `yarn`
|
|
46
|
+
5. Start development server: `blocklet dev`
|
|
47
|
+
|
|
48
|
+
## Bundle
|
|
49
|
+
|
|
50
|
+
After developing a blocklet, you may need to bundle it. Use `npm run bundle` command.
|
|
51
|
+
|
|
52
|
+
## Deploy
|
|
53
|
+
|
|
54
|
+
- If you want to deploy this blocklet to local blocklet server, you can use `blocklet deploy .blocklet/bundle` command(Make sure the blocklet is bundled before deployment.)
|
|
55
|
+
> Or you can simply use `npm run deploy` command.
|
|
56
|
+
- If you want to deploy this blocklet to remote blocklet server, you can use the command below.
|
|
57
|
+
|
|
58
|
+
```shell
|
|
59
|
+
blocklet deploy .blocklet/bundle --endpoint {your blocklet server url} --access-key {blocklet server access key} --access-secret {blocklet server access secret}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> Make sure the blocklet is bundled before deployment.
|
|
63
|
+
|
|
64
|
+
## Upload to blocklet store
|
|
65
|
+
|
|
66
|
+
- If you want to upload the blocklet to any store for other users to download and use, you can following the following instructions.
|
|
67
|
+
|
|
68
|
+
Bump version at first.
|
|
69
|
+
|
|
70
|
+
```shell
|
|
71
|
+
make bump-version
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Then config blocklet store url.
|
|
75
|
+
You can use those store url in below.
|
|
76
|
+
|
|
77
|
+
1. [https://store.blocklet.dev/](https://store.blocklet.dev/)
|
|
78
|
+
2. [https://dev.store.blocklet.dev/](https://dev.store.blocklet.dev/)
|
|
79
|
+
3. A blocklet store started by yourself.
|
|
80
|
+
> Make sure you have installed a `blocklet store` on your own blocklet server. Check it on here: [https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ](https://store.blocklet.dev/blocklet/z8ia29UsENBg6tLZUKi2HABj38Cw1LmHZocbQ)
|
|
81
|
+
|
|
82
|
+
```shell
|
|
83
|
+
blocklet config set store {store url}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Get a `accessToken` from blocklet store.
|
|
87
|
+
|
|
88
|
+
> Why we need a `accessToken`?
|
|
89
|
+
> A `accessToken` is genrate by blocklet store, which help us upload our blocklet to any store.
|
|
90
|
+
|
|
91
|
+
Set `accessToken` to blocklet config
|
|
92
|
+
|
|
93
|
+
```shell
|
|
94
|
+
blocklet config set accessToken {accessToken}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Upload a new version to a store.
|
|
98
|
+
|
|
99
|
+
> Make sure the blocklet is bundled before upload.
|
|
100
|
+
|
|
101
|
+
```shell
|
|
102
|
+
blocklet upload
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Or you can simply use `npm run upload` command.
|
|
106
|
+
|
|
107
|
+
- You also can upload a new version to blocklet store by Github CI.
|
|
108
|
+
Bump version at first.
|
|
109
|
+
|
|
110
|
+
```shell
|
|
111
|
+
make bump-version
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
Push your code to Github main/master branch, or make a pull request to the main/master branch.
|
|
115
|
+
The CI workflow will automatically upload a new version to a store.
|
|
116
|
+
|
|
117
|
+
## Q & A
|
|
118
|
+
|
|
119
|
+
1. Q: How to change a blocklet's name?
|
|
120
|
+
|
|
121
|
+
A: Change the `name` field in the `package.json` file, change the `name` field in the `blocklet.yml` file.
|
|
122
|
+
|
|
123
|
+
You can also change the `title` field and `description` field in the `blocklet.yml` file.
|
|
124
|
+
|
|
125
|
+
Run `blocklet meta` command, you will get a `did` config, copy the `did` value.
|
|
126
|
+
|
|
127
|
+
Replace this command `"bundle": "PUBLIC_PATH=/.blocklet/proxy/<%= did %> npm run build",` in `package.json`
|
|
128
|
+
|
|
129
|
+
Replace `did` field in the `blocklet.yml`
|
|
130
|
+
|
|
131
|
+
2. Q: How to change a blocklet's logo?
|
|
132
|
+
|
|
133
|
+
Change the `logo.png` file root folder.
|
|
134
|
+
|
|
135
|
+
Or you can change the `logo` field in the `blocklet.yml` file.
|
|
136
|
+
|
|
137
|
+
> Make sure you have added the logo path to the `blocklet.yml` file `files` field.
|
|
138
|
+
|
|
139
|
+
## Learn More
|
|
140
|
+
|
|
141
|
+
- Full specification of `blocklet.yml`: [https://github.com/blocklet/blocklet-specification/blob/main/docs/meta.md](https://github.com/blocklet/blocklet-specification/blob/main/docs/meta.md)
|
|
142
|
+
- Full document of AbtNode & blocklet development: [https://docs.arcblock.io/abtnode/en/introduction](https://docs.arcblock.io/abtnode/en/introduction)
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
The code is licensed under the Apache 2.0 license found in the
|
|
147
|
+
[LICENSE](LICENSE) file.
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
name: template-vue2
|
|
2
|
+
title: Blocklet Template Vue2
|
|
3
|
+
description: ABT Node blocklet project
|
|
4
|
+
keywords:
|
|
5
|
+
- blocklet
|
|
6
|
+
- vue
|
|
7
|
+
group: static
|
|
8
|
+
did: ''
|
|
9
|
+
main: dist
|
|
10
|
+
author:
|
|
11
|
+
name: zhanghan
|
|
12
|
+
email: zhanghan@arcblock.io
|
|
13
|
+
repository:
|
|
14
|
+
type: git
|
|
15
|
+
url: git+https://github.com/blocklet/create-blocklet.git
|
|
16
|
+
specVersion: 1.1.1
|
|
17
|
+
version: 0.1.0
|
|
18
|
+
logo: logo.png
|
|
19
|
+
files:
|
|
20
|
+
- logo.png
|
|
21
|
+
- README.md
|
|
22
|
+
- blocklet.md
|
|
23
|
+
- screenshots
|
|
24
|
+
interfaces:
|
|
25
|
+
- type: web
|
|
26
|
+
name: publicUrl
|
|
27
|
+
path: /
|
|
28
|
+
prefix: '*'
|
|
29
|
+
port: BLOCKLET_PORT
|
|
30
|
+
protocol: http
|
|
31
|
+
community: ''
|
|
32
|
+
documentation: ''
|
|
33
|
+
homepage: ''
|
|
34
|
+
license: ''
|
|
35
|
+
charging:
|
|
36
|
+
price: 0
|
|
37
|
+
tokens: []
|
|
38
|
+
shares: []
|
|
39
|
+
timeout:
|
|
40
|
+
start: 60
|
|
41
|
+
requirements:
|
|
42
|
+
abtnode: '>=1.4.0'
|
|
43
|
+
os: '*'
|
|
44
|
+
cpu: '*'
|
|
45
|
+
scripts:
|
|
46
|
+
dev: npm run start
|
|
47
|
+
environments:
|
|
48
|
+
- name: CHAIN_ID
|
|
49
|
+
description: What's endpoint of the chain id?
|
|
50
|
+
required: true
|
|
51
|
+
default: 'beta'
|
|
52
|
+
secure: false
|
|
53
|
+
- name: CHAIN_HOST
|
|
54
|
+
description: What's endpoint of the chain?
|
|
55
|
+
required: true
|
|
56
|
+
default: 'https://beta.abtnetwork.io/api/'
|
|
57
|
+
secure: false
|
|
58
|
+
capabilities: {}
|
|
59
|
+
screenshots: []
|
|
60
|
+
children: []
|