create-blocklet 0.7.8 → 0.8.0
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 +10 -7
- package/common/.prettierrc +1 -1
- package/common/LICENSE +1 -1
- package/common/_gitignore +1 -0
- package/common/scripts/build-clean.mjs +7 -0
- package/index.js +40 -32
- package/lib/arcblock.js +1 -1
- package/lib/constant.js +1 -0
- package/lib/did.js +2 -1
- package/lib/git.js +21 -21
- package/lib/server.js +10 -10
- package/lib/utils.js +2 -1
- package/package.json +16 -16
- package/templates/express-api/README.md +3 -3
- package/templates/express-api/api/hooks/pre-start.js +2 -1
- package/templates/express-api/api/index.js +1 -12
- package/templates/express-api/blocklet.yml +1 -1
- package/templates/express-api/package.json +20 -17
- package/templates/express-api/template-info.json +6 -3
- package/templates/html-static/README.md +3 -3
- package/templates/html-static/app/index.html +35 -36
- package/templates/html-static/app/styles/style.css +9 -1
- package/templates/html-static/blocklet.yml +1 -1
- package/templates/html-static/package.json +6 -5
- package/templates/html-static/template-info.json +2 -2
- package/templates/monorepo/.prettierrc +1 -1
- package/templates/monorepo/README.md +2 -2
- package/templates/monorepo/package.json +21 -13
- package/templates/monorepo/scripts/bump-version.mjs +1 -1
- package/templates/nestjs-api/.eslintrc.js +27 -3
- package/templates/nestjs-api/README.md +3 -3
- package/templates/nestjs-api/api/app.controller.ts +3 -1
- package/templates/nestjs-api/api/app.service.ts +1 -16
- package/templates/nestjs-api/api/hooks/pre-start.js +2 -1
- package/templates/nestjs-api/blocklet.yml +1 -1
- package/templates/nestjs-api/package.json +29 -26
- package/templates/nestjs-api/template-info.json +4 -1
- package/templates/nestjs-api/tsconfig.build.json +6 -1
- package/templates/nestjs-api/tsconfig.eslint.json +7 -0
- package/templates/nextjs-dapp/README.md +3 -3
- package/templates/nextjs-dapp/api/hooks/pre-start.js +2 -1
- package/templates/nextjs-dapp/blocklet.yml +1 -1
- package/templates/nextjs-dapp/package.json +23 -20
- package/templates/nextjs-dapp/pages/_app.js +1 -1
- package/templates/nextjs-dapp/pages/api/hello.js +1 -1
- package/templates/nextjs-dapp/pages/index.js +9 -17
- package/templates/nextjs-dapp/styles/Home.module.css +12 -3
- package/templates/nextjs-dapp/styles/globals.css +12 -2
- package/templates/nextjs-dapp/template-info.json +2 -2
- package/templates/react-dapp/README.md +3 -3
- package/templates/react-dapp/api/hooks/pre-start.js +2 -1
- package/templates/react-dapp/api/routes/index.js +6 -0
- package/templates/react-dapp/blocklet.yml +1 -1
- package/templates/react-dapp/index.html +14 -11
- package/templates/react-dapp/package.json +32 -28
- package/templates/react-dapp/src/app.jsx +1 -5
- package/templates/react-dapp/src/assets/blocklet.svg +16 -0
- package/templates/react-dapp/src/assets/react.svg +1 -0
- package/templates/react-dapp/src/assets/vite.svg +1 -0
- package/templates/react-dapp/src/index.css +68 -0
- package/templates/react-dapp/src/index.jsx +1 -0
- package/templates/react-dapp/src/libs/api.js +5 -12
- package/templates/react-dapp/src/pages/home.css +45 -0
- package/templates/react-dapp/src/pages/home.jsx +42 -15
- package/templates/react-dapp/template-info.json +2 -2
- package/templates/react-dapp-ts/.eslintrc.js +3 -0
- package/templates/react-dapp-ts/README.md +3 -3
- package/templates/react-dapp-ts/api/src/hooks/pre-start.ts +2 -2
- package/templates/react-dapp-ts/api/src/routes/index.ts +6 -0
- package/templates/react-dapp-ts/blocklet.yml +1 -1
- package/templates/react-dapp-ts/index.html +14 -11
- package/templates/react-dapp-ts/package.json +38 -34
- package/templates/react-dapp-ts/src/app.tsx +1 -6
- package/templates/react-dapp-ts/src/assets/blocklet.svg +16 -0
- package/templates/react-dapp-ts/src/assets/react.svg +1 -0
- package/templates/react-dapp-ts/src/assets/vite.svg +1 -0
- package/templates/react-dapp-ts/src/index.css +68 -0
- package/templates/react-dapp-ts/src/index.tsx +2 -2
- package/templates/react-dapp-ts/src/libs/api.ts +5 -12
- package/templates/react-dapp-ts/src/pages/home.css +45 -0
- package/templates/react-dapp-ts/src/pages/home.tsx +42 -15
- package/templates/react-dapp-ts/tsconfig.api.json +4 -1
- package/templates/react-dapp-ts/tsconfig.eslint.json +3 -1
- package/templates/react-gun-dapp/README.md +3 -3
- package/templates/react-gun-dapp/api/hooks/pre-start.js +2 -1
- package/templates/react-gun-dapp/blocklet.yml +1 -1
- package/templates/react-gun-dapp/index.html +14 -11
- package/templates/react-gun-dapp/package.json +31 -28
- package/templates/react-gun-dapp/src/app.jsx +1 -1
- package/templates/react-gun-dapp/src/libs/api.js +1 -1
- package/templates/react-gun-dapp/src/pages/about.jsx +5 -1
- package/templates/react-gun-dapp/src/pages/home.jsx +5 -1
- package/templates/react-static/README.md +3 -3
- package/templates/react-static/blocklet.yml +1 -1
- package/templates/react-static/index.html +14 -11
- package/templates/react-static/package.json +20 -18
- package/templates/react-static/src/app.jsx +1 -5
- package/templates/react-static/src/assets/blocklet.svg +16 -0
- package/templates/react-static/src/assets/react.svg +1 -0
- package/templates/react-static/src/assets/vite.svg +1 -0
- package/templates/react-static/src/index.css +68 -0
- package/templates/react-static/src/index.jsx +1 -0
- package/templates/react-static/src/pages/home.css +45 -0
- package/templates/react-static/src/pages/home.jsx +30 -15
- package/templates/react-static/template-info.json +6 -3
- package/templates/solidjs-dapp/.eslintrc.js +2 -1
- package/templates/solidjs-dapp/README.md +3 -3
- package/templates/solidjs-dapp/api/hooks/pre-start.js +2 -1
- package/templates/solidjs-dapp/api/routes/index.js +6 -0
- package/templates/solidjs-dapp/blocklet.yml +4 -2
- package/templates/solidjs-dapp/index.html +15 -12
- package/templates/solidjs-dapp/package.json +34 -30
- package/templates/solidjs-dapp/src/App.jsx +15 -3
- package/templates/solidjs-dapp/src/App.module.css +7 -1
- package/templates/solidjs-dapp/src/assets/blocklet.svg +16 -0
- package/templates/{solidjs-static/src/logo.svg → solidjs-dapp/src/assets/solidjs.svg} +1 -1
- package/templates/solidjs-dapp/src/index.css +21 -5
- package/templates/solidjs-dapp/src/libs/api.js +7 -0
- package/templates/solidjs-dapp/template-info.json +2 -2
- package/templates/solidjs-static/.eslintrc.js +4 -0
- package/templates/solidjs-static/README.md +3 -3
- package/templates/solidjs-static/blocklet.yml +1 -1
- package/templates/solidjs-static/index.html +15 -12
- package/templates/solidjs-static/package.json +22 -21
- package/templates/solidjs-static/src/App.jsx +7 -3
- package/templates/solidjs-static/src/App.module.css +7 -1
- package/templates/solidjs-static/src/assets/blocklet.svg +16 -0
- package/templates/solidjs-static/src/index.css +3 -5
- package/templates/solidjs-static/template-info.json +2 -2
- package/templates/svelte-dapp/README.md +3 -4
- package/templates/svelte-dapp/api/hooks/pre-start.js +2 -1
- package/templates/svelte-dapp/api/routes/index.js +6 -0
- package/templates/svelte-dapp/blocklet.yml +1 -1
- package/templates/svelte-dapp/index.html +13 -10
- package/templates/svelte-dapp/jsconfig.json +9 -7
- package/templates/svelte-dapp/package.json +29 -29
- package/templates/svelte-dapp/src/App.svelte +45 -42
- package/templates/svelte-dapp/src/app.css +79 -0
- package/templates/svelte-dapp/src/assets/blocklet.svg +16 -0
- package/templates/svelte-dapp/src/assets/svelte.svg +1 -0
- package/templates/svelte-dapp/src/assets/vite.svg +1 -0
- package/templates/svelte-dapp/src/components/Counter.svelte +10 -0
- package/templates/svelte-dapp/src/libs/api.js +7 -0
- package/templates/svelte-dapp/src/main.js +1 -0
- package/templates/svelte-dapp/template-info.json +2 -2
- package/templates/svelte-dapp/vite.config.mjs +6 -1
- package/templates/svelte-static/README.md +3 -4
- package/templates/svelte-static/blocklet.yml +1 -1
- package/templates/svelte-static/index.html +13 -10
- package/templates/svelte-static/jsconfig.json +9 -7
- package/templates/svelte-static/package.json +18 -22
- package/templates/svelte-static/src/App.svelte +36 -43
- package/templates/svelte-static/src/app.css +79 -0
- package/templates/svelte-static/src/assets/blocklet.svg +16 -0
- package/templates/svelte-static/src/assets/svelte.svg +1 -0
- package/templates/svelte-static/src/assets/vite.svg +1 -0
- package/templates/svelte-static/src/components/Counter.svelte +10 -0
- package/templates/svelte-static/src/main.js +1 -0
- package/templates/svelte-static/template-info.json +6 -3
- package/templates/svelte-static/vite.config.mjs +6 -1
- package/templates/todo-list-example/.eslintrc.js +1 -1
- package/templates/todo-list-example/api/src/hooks/pre-start.ts +2 -1
- package/templates/todo-list-example/api/src/routes/todo-list/$get.ts +1 -1
- package/templates/todo-list-example/api/src/routes/todo-list/$put.ts +1 -1
- package/templates/todo-list-example/blocklet.md +27 -2
- package/templates/todo-list-example/blocklet.yml +8 -6
- package/templates/todo-list-example/blocklet.zh.md +28 -0
- package/templates/todo-list-example/index.html +14 -11
- package/templates/todo-list-example/package.json +44 -41
- package/templates/todo-list-example/src/components/layout.tsx +1 -1
- package/templates/todo-list-example/src/libs/api.ts +5 -12
- package/templates/todo-list-example/src/logo.svg +1 -1
- package/templates/todo-list-example/src/pages/required-login.tsx +3 -6
- package/templates/todo-list-example/src/pages/todo-list.css +72 -68
- package/templates/todo-list-example/src/pages/todo-list.tsx +32 -32
- package/templates/todo-list-example/template-info.json +1 -1
- package/templates/todo-list-example/tsconfig.api.json +4 -1
- package/templates/todo-list-example/tsconfig.eslint.json +3 -1
- package/templates/vue-dapp/README.md +3 -3
- package/templates/vue-dapp/api/hooks/pre-start.js +2 -1
- package/templates/vue-dapp/api/routes/index.js +6 -0
- package/templates/vue-dapp/blocklet.yml +1 -1
- package/templates/vue-dapp/index.html +14 -11
- package/templates/vue-dapp/package.json +32 -28
- package/templates/vue-dapp/src/App.vue +26 -19
- package/templates/vue-dapp/src/assets/blocklet.svg +16 -0
- package/templates/vue-dapp/src/assets/vite.svg +1 -0
- package/templates/vue-dapp/src/assets/vue.svg +1 -0
- package/templates/vue-dapp/src/components/HelloWorld.vue +25 -15
- package/templates/vue-dapp/src/libs/api.js +5 -12
- package/templates/vue-dapp/src/main.js +1 -0
- package/templates/vue-dapp/src/style.css +79 -0
- package/templates/vue-dapp/template-info.json +2 -2
- package/templates/vue-static/README.md +3 -3
- package/templates/vue-static/blocklet.yml +1 -1
- package/templates/vue-static/index.html +14 -11
- package/templates/vue-static/package.json +20 -19
- package/templates/vue-static/src/App.vue +27 -12
- package/templates/vue-static/src/assets/blocklet.svg +16 -0
- package/templates/vue-static/src/assets/vite.svg +1 -0
- package/templates/vue-static/src/assets/vue.svg +1 -0
- package/templates/vue-static/src/components/HelloWorld.vue +15 -15
- package/templates/vue-static/src/main.js +1 -0
- package/templates/vue-static/src/style.css +79 -0
- package/templates/vue-static/template-info.json +6 -3
- package/templates/vue2-dapp/README.md +3 -3
- package/templates/vue2-dapp/api/hooks/pre-start.js +2 -1
- package/templates/vue2-dapp/blocklet.yml +1 -1
- package/templates/vue2-dapp/index.html +14 -11
- package/templates/vue2-dapp/package.json +30 -27
- package/templates/vue2-dapp/src/libs/api.js +1 -1
- package/templates/vue2-dapp/template-info.json +2 -2
- package/templates/vue2-static/README.md +3 -3
- package/templates/vue2-static/blocklet.yml +1 -1
- package/templates/vue2-static/index.html +14 -11
- package/templates/vue2-static/package.json +19 -18
- package/templates/vue2-static/template-info.json +6 -3
- package/common/.husky/pre-commit +0 -4
- package/common/_npmrc +0 -4
- package/common/scripts/build-clean.js +0 -5
- package/templates/express-api/.env +0 -1
- package/templates/monorepo/.husky/pre-commit +0 -4
- package/templates/react-dapp/src/app.css +0 -30
- package/templates/react-dapp/src/logo.svg +0 -1
- package/templates/react-dapp/src/pages/about.jsx +0 -16
- package/templates/react-dapp-ts/src/app.css +0 -30
- package/templates/react-dapp-ts/src/logo.svg +0 -1
- package/templates/react-dapp-ts/src/pages/about.tsx +0 -16
- package/templates/react-static/src/app.css +0 -30
- package/templates/react-static/src/logo.svg +0 -1
- package/templates/react-static/src/pages/about.jsx +0 -16
- package/templates/svelte-dapp/.eslintrc.js +0 -22
- package/templates/svelte-dapp/src/assets/svelte.png +0 -0
- package/templates/svelte-dapp/src/lib/Counter.svelte +0 -34
- package/templates/svelte-static/.eslintrc.js +0 -22
- package/templates/svelte-static/src/assets/svelte.png +0 -0
- package/templates/svelte-static/src/lib/Counter.svelte +0 -34
- package/templates/todo-list-example/.editorconfig +0 -23
- package/templates/todo-list-example/.github/workflows/main.yml +0 -36
- package/templates/todo-list-example/.github/workflows/pr-title.yml +0 -21
- package/templates/todo-list-example/.github/workflows/version-check.yml +0 -20
- package/templates/todo-list-example/.husky/pre-commit +0 -4
- package/templates/todo-list-example/.prettierrc +0 -9
- package/templates/todo-list-example/logo.png +0 -0
- package/templates/todo-list-example/public/.gitkeep +0 -0
- package/templates/todo-list-example/screenshots/.gitkeep +0 -0
- package/templates/todo-list-example/scripts/build-clean.js +0 -5
- package/templates/todo-list-example/scripts/bump-version.mjs +0 -35
- package/templates/vue-static/src/assets/logo.png +0 -0
- /package/templates/monorepo/{eslintrc.js → .eslintrc.js} +0 -0
- /package/templates/{solidjs-dapp/src/logo.svg → solidjs-static/src/assets/solidjs.svg} +0 -0
|
@@ -27,14 +27,14 @@ This blocklet is a static project, which means this is a frontend application. I
|
|
|
27
27
|
|
|
28
28
|
Blocklet needs blocklet server as a dependency. So you need to install it first.
|
|
29
29
|
`npm install -g @blocklet/cli`
|
|
30
|
-
See details in [https://
|
|
30
|
+
See details in [https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli](https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli)
|
|
31
31
|
|
|
32
32
|
2. Init blocklet server & start blocklet server
|
|
33
33
|
|
|
34
34
|
Before starting an blocklet server, you need to init blocklet server.
|
|
35
35
|
`blocklet server init --mode=debug`
|
|
36
36
|
`blocklet server start`
|
|
37
|
-
See details in [https://
|
|
37
|
+
See details in [https://www.arcblock.io/docs/blocklet-developer/getting-started](https://www.arcblock.io/docs/blocklet-developer/getting-started)
|
|
38
38
|
|
|
39
39
|
3. Go to the project directory `cd [name]`
|
|
40
40
|
4. Install dependencies: `npm install` or `yarn`
|
|
@@ -134,7 +134,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
134
134
|
## Learn More
|
|
135
135
|
|
|
136
136
|
- 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)
|
|
137
|
-
- Full document of Blocklet Server & blocklet development: [https://
|
|
137
|
+
- Full document of Blocklet Server & blocklet development: [https://www.arcblock.io/docs/blocklet-developer](https://www.arcblock.io/docs/blocklet-developer)
|
|
138
138
|
|
|
139
139
|
## License
|
|
140
140
|
|
|
@@ -1,40 +1,39 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
<
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
<h3>Blocklet Server →</h3>
|
|
26
|
-
<p>Learn about Blocklet Server</p>
|
|
27
|
-
</a>
|
|
28
|
-
</div>
|
|
29
|
-
<br />
|
|
30
|
-
<br />
|
|
31
|
-
</section>
|
|
32
|
-
<footer class="footer">
|
|
33
|
-
Powered by
|
|
34
|
-
<a href="http://www.arcblock.io/" target="_blank">
|
|
35
|
-
<strong>ArcBlock</strong>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="UTF-8" />
|
|
6
|
+
<link rel="icon" href="/favicon.ico?imageFilter=convert&f=png&w=32" />
|
|
7
|
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
|
8
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
9
|
+
<link rel="stylesheet" href="./styles/style.css" />
|
|
10
|
+
<title>HTML Template</title>
|
|
11
|
+
<script src="__blocklet__.js"></script>
|
|
12
|
+
</head>
|
|
13
|
+
|
|
14
|
+
<body>
|
|
15
|
+
<div id="app">
|
|
16
|
+
<section class="body">
|
|
17
|
+
<div class="logo">
|
|
18
|
+
<img src="./images/logo.svg" alt="logo" />
|
|
19
|
+
<p>Get started by edit <code class="code">app/index.html</code> file</p>
|
|
20
|
+
</div>
|
|
21
|
+
<div class="card-list">
|
|
22
|
+
<a class="card" href="https://www.arcblock.io/docs/blocklet-developer/getting-started" target="_blank">
|
|
23
|
+
<h3>Documentation →</h3>
|
|
24
|
+
<p>Find in-depth information about blocklet features and API.</p>
|
|
36
25
|
</a>
|
|
37
|
-
</
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
</div>
|
|
27
|
+
<br />
|
|
28
|
+
<br />
|
|
29
|
+
</section>
|
|
30
|
+
<footer class="footer">
|
|
31
|
+
Powered by
|
|
32
|
+
<a href="http://www.arcblock.io/" target="_blank">
|
|
33
|
+
<strong>ArcBlock</strong>
|
|
34
|
+
</a>
|
|
35
|
+
</footer>
|
|
36
|
+
</div>
|
|
37
|
+
</body>
|
|
38
|
+
|
|
40
39
|
</html>
|
|
@@ -22,6 +22,7 @@ a {
|
|
|
22
22
|
}
|
|
23
23
|
.logo {
|
|
24
24
|
font-size: 18px;
|
|
25
|
+
text-align: center;
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
.footer {
|
|
@@ -55,7 +56,14 @@ a {
|
|
|
55
56
|
background: #fafafa;
|
|
56
57
|
border-radius: 5px;
|
|
57
58
|
padding: 0.75rem;
|
|
58
|
-
font-family:
|
|
59
|
+
font-family:
|
|
60
|
+
Menlo,
|
|
61
|
+
Monaco,
|
|
62
|
+
Lucida Console,
|
|
63
|
+
Liberation Mono,
|
|
64
|
+
DejaVu Sans Mono,
|
|
65
|
+
Bitstream Vera Sans Mono,
|
|
66
|
+
Courier New,
|
|
59
67
|
monospace;
|
|
60
68
|
}
|
|
61
69
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "template-html",
|
|
2
|
+
"name": "template-html-static",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev",
|
|
6
|
-
"clean": "node scripts/build-clean.
|
|
6
|
+
"clean": "node scripts/build-clean.mjs",
|
|
7
7
|
"bundle": "npm run clean && blocklet bundle --zip --create-release",
|
|
8
8
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
9
9
|
"deploy:child": "npm run bundle && blocklet deploy .blocklet/bundle --app-did=<%= did %>",
|
|
@@ -15,8 +15,9 @@
|
|
|
15
15
|
"author": "",
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"bumpp": "^
|
|
19
|
-
"
|
|
20
|
-
"
|
|
18
|
+
"bumpp": "^9.4.1",
|
|
19
|
+
"prettier": "^3.3.2",
|
|
20
|
+
"rimraf": "^5.0.7",
|
|
21
|
+
"zx": "^8.1.3"
|
|
21
22
|
}
|
|
22
23
|
}
|
|
@@ -27,14 +27,14 @@ This project is a monorepo project, which means that there are multiple blocklet
|
|
|
27
27
|
|
|
28
28
|
Blocklet needs blocklet server as a dependency. So you need to install it first.
|
|
29
29
|
`npm install -g @blocklet/cli`
|
|
30
|
-
See details in [https://
|
|
30
|
+
See details in [https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli](https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli)
|
|
31
31
|
|
|
32
32
|
2. Init blocklet server & start blocklet server
|
|
33
33
|
|
|
34
34
|
Before starting an blocklet server, you need to init blocklet server.
|
|
35
35
|
`blocklet server init --mode=debug`
|
|
36
36
|
`blocklet server start`
|
|
37
|
-
See details in [https://
|
|
37
|
+
See details in [https://www.arcblock.io/docs/blocklet-developer/getting-started](https://www.arcblock.io/docs/blocklet-developer/getting-started)
|
|
38
38
|
|
|
39
39
|
3. init project
|
|
40
40
|
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
3
|
-
"version": "0.1.
|
|
2
|
+
"name": "template-monorepo",
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"workspaces": [
|
|
6
6
|
"blocklets/*"
|
|
7
7
|
],
|
|
8
|
-
"husky": {
|
|
9
|
-
"hooks": {
|
|
10
|
-
"pre-commit": "npm run lint"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
8
|
"scripts": {
|
|
14
9
|
"init": "lerna bootstrap && lerna link",
|
|
15
10
|
"lint": "lerna run lint",
|
|
16
11
|
"lint:fix": "lerna run lint:fix",
|
|
17
12
|
"build": "lerna run clean && lerna run build",
|
|
18
13
|
"clean": "lerna clean && lerna run clean",
|
|
14
|
+
"prepare": "npx simple-git-hooks",
|
|
19
15
|
"bump-version": "zx --quiet scripts/bump-version.mjs",
|
|
20
16
|
"update:deps": "lerna exec --no-bail -- \"ncu -u -f /arcblock\\|ocap\\|abtnode\\|blocklet\\|did-connect/\" && lerna bootstrap && npx yarn-deduplicate yarn.lock && yarn"
|
|
21
17
|
},
|
|
@@ -23,11 +19,23 @@
|
|
|
23
19
|
"author": "",
|
|
24
20
|
"license": "ISC",
|
|
25
21
|
"devDependencies": {
|
|
26
|
-
"@arcblock/eslint-config": "0.2
|
|
27
|
-
"bumpp": "^
|
|
28
|
-
"eslint": "^8.
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"zx": "^
|
|
22
|
+
"@arcblock/eslint-config": "^0.3.2",
|
|
23
|
+
"bumpp": "^9.4.1",
|
|
24
|
+
"eslint": "^8.57.0",
|
|
25
|
+
"prettier": "^3.3.2",
|
|
26
|
+
"simple-git-hooks": "^2.11.1",
|
|
27
|
+
"zx": "^8.1.3"
|
|
28
|
+
},
|
|
29
|
+
"simple-git-hooks": {
|
|
30
|
+
"pre-commit": "npx lint-staged"
|
|
31
|
+
},
|
|
32
|
+
"lint-staged": {
|
|
33
|
+
"*.{mjs,js,ts}": [
|
|
34
|
+
"prettier --write",
|
|
35
|
+
"eslint"
|
|
36
|
+
],
|
|
37
|
+
"*.{css,less,scss,json,graphql}": [
|
|
38
|
+
"prettier --write"
|
|
39
|
+
]
|
|
32
40
|
}
|
|
33
41
|
}
|
|
@@ -5,7 +5,7 @@ import { $, chalk, fs, path } from 'zx';
|
|
|
5
5
|
const cwd = process.cwd(); // 获取脚本执行目录
|
|
6
6
|
|
|
7
7
|
// or use pnpm to bump version: `pnpm -r --filter {packages/*, themes/*} -- pnpm version`
|
|
8
|
-
execSync('bumpp package.json blocklets/*/package.json', { stdio: 'inherit' });
|
|
8
|
+
execSync('bumpp --no-tag --no-commit --no-push package.json blocklets/*/package.json', { stdio: 'inherit' });
|
|
9
9
|
|
|
10
10
|
const { version } = await fs.readJSON('package.json');
|
|
11
11
|
await fs.writeFileSync('version', version);
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
const { join } = require('path');
|
|
2
|
+
|
|
1
3
|
module.exports = {
|
|
2
4
|
parser: '@typescript-eslint/parser',
|
|
3
5
|
parserOptions: {
|
|
4
|
-
project: 'tsconfig.json',
|
|
5
6
|
tsconfigRootDir: __dirname,
|
|
6
7
|
sourceType: 'module',
|
|
8
|
+
project: [join(__dirname, 'tsconfig.eslint.json'), join(__dirname, 'tsconfig.json')],
|
|
7
9
|
},
|
|
8
|
-
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
9
10
|
root: true,
|
|
10
|
-
|
|
11
|
+
plugins: ['@typescript-eslint/eslint-plugin'],
|
|
12
|
+
extends: ['@arcblock/eslint-config-base'],
|
|
11
13
|
globals: {
|
|
12
14
|
logger: true,
|
|
13
15
|
},
|
|
14
16
|
rules: {
|
|
17
|
+
'import/prefer-default-export': 'off',
|
|
15
18
|
'no-console': 'off',
|
|
16
19
|
'no-restricted-syntax': [
|
|
17
20
|
'error',
|
|
@@ -20,5 +23,26 @@ module.exports = {
|
|
|
20
23
|
message: 'Unexpected property on console object was called',
|
|
21
24
|
},
|
|
22
25
|
],
|
|
26
|
+
'import/extensions': [
|
|
27
|
+
'error',
|
|
28
|
+
'ignorePackages',
|
|
29
|
+
{
|
|
30
|
+
js: 'never',
|
|
31
|
+
jsx: 'never',
|
|
32
|
+
ts: 'never',
|
|
33
|
+
tsx: 'never',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
settings: {
|
|
38
|
+
'import/extensions': ['.js', '.jsx', '.ts', '.tsx'],
|
|
39
|
+
'import/parsers': {
|
|
40
|
+
'@typescript-eslint/parser': ['.ts', '.tsx'],
|
|
41
|
+
},
|
|
42
|
+
'import/resolver': {
|
|
43
|
+
node: {
|
|
44
|
+
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
23
47
|
},
|
|
24
48
|
};
|
|
@@ -27,14 +27,14 @@ This blocklet is a dapp project, which means this is a full-stack application. I
|
|
|
27
27
|
|
|
28
28
|
Blocklet needs blocklet server as a dependency. So you need to install it first.
|
|
29
29
|
`npm install -g @blocklet/cli`
|
|
30
|
-
See details in [https://
|
|
30
|
+
See details in [https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli](https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli)
|
|
31
31
|
|
|
32
32
|
2. Init blocklet server & start blocklet server
|
|
33
33
|
|
|
34
34
|
Before starting an blocklet server, you need to init blocklet server.
|
|
35
35
|
`blocklet server init --mode=debug`
|
|
36
36
|
`blocklet server start`
|
|
37
|
-
See details in [https://
|
|
37
|
+
See details in [https://www.arcblock.io/docs/blocklet-developer/getting-started](https://www.arcblock.io/docs/blocklet-developer/getting-started)
|
|
38
38
|
|
|
39
39
|
3. Go to the project directory `cd [name]`
|
|
40
40
|
4. Install dependencies: `npm install` or `yarn`
|
|
@@ -134,7 +134,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
134
134
|
## Learn More
|
|
135
135
|
|
|
136
136
|
- 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)
|
|
137
|
-
- Full document of Blocklet Server & blocklet development: [https://
|
|
137
|
+
- Full document of Blocklet Server & blocklet development: [https://www.arcblock.io/docs/blocklet-developer](https://www.arcblock.io/docs/blocklet-developer)
|
|
138
138
|
|
|
139
139
|
## License
|
|
140
140
|
|
|
@@ -3,7 +3,9 @@ import { AppService } from './app.service';
|
|
|
3
3
|
|
|
4
4
|
@Controller()
|
|
5
5
|
export class AppController {
|
|
6
|
-
constructor(private readonly appService: AppService) {
|
|
6
|
+
constructor(private readonly appService: AppService) {
|
|
7
|
+
this.appService = appService;
|
|
8
|
+
}
|
|
7
9
|
|
|
8
10
|
@Get()
|
|
9
11
|
getHello(): string {
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import { Injectable } from '@nestjs/common';
|
|
2
|
-
const env = require('@blocklet/sdk/lib/env');
|
|
3
|
-
const environment = {
|
|
4
|
-
...env,
|
|
5
|
-
chainHost: process.env.CHAIN_HOST || '',
|
|
6
|
-
};
|
|
7
2
|
|
|
8
3
|
@Injectable()
|
|
9
4
|
export class AppService {
|
|
10
5
|
getHello(): string {
|
|
11
|
-
return
|
|
12
|
-
<div style="display:flex;flex-direction:column;align-items:center;padding:64px 0;">
|
|
13
|
-
<h1 style="margin:64px 0;">
|
|
14
|
-
<span style="display:inline-block;padding:8px 24px;background:#1dc1c7;color:#fff;">Blocklet</span>
|
|
15
|
-
<span style="color:#777;">+ NestJS</span>
|
|
16
|
-
</h1>
|
|
17
|
-
<pre>
|
|
18
|
-
${JSON.stringify(environment, null, 2)}
|
|
19
|
-
</pre>
|
|
20
|
-
</div>
|
|
21
|
-
`;
|
|
6
|
+
return 'Hello Blocklet!';
|
|
22
7
|
}
|
|
23
8
|
}
|
|
@@ -25,9 +25,10 @@ const ensureAccountDeclared = async () => {
|
|
|
25
25
|
(async () => {
|
|
26
26
|
try {
|
|
27
27
|
await ensureAccountDeclared();
|
|
28
|
+
logger.info(`${name} pre-start successfully`);
|
|
28
29
|
process.exit(0);
|
|
29
30
|
} catch (err) {
|
|
30
|
-
logger.error(`${name} pre-start error`, err
|
|
31
|
+
logger.error(`${name} pre-start error`, err);
|
|
31
32
|
process.exit(1);
|
|
32
33
|
}
|
|
33
34
|
})();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "nestjs",
|
|
2
|
+
"name": "template-nestjs-api",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "api/main.ts",
|
|
@@ -9,13 +9,13 @@
|
|
|
9
9
|
"build": "nest build",
|
|
10
10
|
"dev": "blocklet dev",
|
|
11
11
|
"start": "NODE_ENV=development && nest start --watch",
|
|
12
|
-
"clean": "node scripts/build-clean.
|
|
12
|
+
"clean": "node scripts/build-clean.mjs",
|
|
13
13
|
"bundle": "npm run clean && blocklet bundle --zip --create-release",
|
|
14
14
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
15
15
|
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
|
|
16
16
|
"deploy:child": "npm run bundle && blocklet deploy .blocklet/bundle --app-did=<%= did %>",
|
|
17
17
|
"dev:child": "blocklet dev --component --app-did=<%= did %>",
|
|
18
|
-
"prepare": "
|
|
18
|
+
"prepare": "npx simple-git-hooks",
|
|
19
19
|
"bump-version": "zx --quiet scripts/bump-version.mjs"
|
|
20
20
|
},
|
|
21
21
|
"lint-staged": {
|
|
@@ -32,35 +32,38 @@
|
|
|
32
32
|
"license": "ISC",
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
35
|
-
"@blocklet/sdk": "^1.16.
|
|
36
|
-
"@nestjs/common": "^10.3.
|
|
37
|
-
"@nestjs/core": "^10.3.
|
|
38
|
-
"@nestjs/platform-express": "^10.3.
|
|
39
|
-
"@ocap/client": "^1.18.
|
|
40
|
-
"dotenv-flow": "^
|
|
41
|
-
"express": "^4.
|
|
42
|
-
"reflect-metadata": "^0.
|
|
35
|
+
"@blocklet/sdk": "^1.16.28",
|
|
36
|
+
"@nestjs/common": "^10.3.9",
|
|
37
|
+
"@nestjs/core": "^10.3.9",
|
|
38
|
+
"@nestjs/platform-express": "^10.3.9",
|
|
39
|
+
"@ocap/client": "^1.18.124",
|
|
40
|
+
"dotenv-flow": "^4.1.0",
|
|
41
|
+
"express": "^4.19.2",
|
|
42
|
+
"reflect-metadata": "^0.2.2",
|
|
43
43
|
"rxjs": "^7.8.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@arcblock/eslint-config-base": "^0.2
|
|
47
|
-
"@nestjs/cli": "^10.2
|
|
48
|
-
"@nestjs/schematics": "^10.
|
|
46
|
+
"@arcblock/eslint-config-base": "^0.3.2",
|
|
47
|
+
"@nestjs/cli": "^10.3.2",
|
|
48
|
+
"@nestjs/schematics": "^10.1.1",
|
|
49
49
|
"@types/express": "^4.17.21",
|
|
50
|
-
"@types/node": "^
|
|
51
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
52
|
-
"@typescript-eslint/parser": "^
|
|
53
|
-
"bumpp": "^
|
|
54
|
-
"eslint": "^8.
|
|
55
|
-
"
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
50
|
+
"@types/node": "^20.14.9",
|
|
51
|
+
"@typescript-eslint/eslint-plugin": "^7.14.1",
|
|
52
|
+
"@typescript-eslint/parser": "^7.14.1",
|
|
53
|
+
"bumpp": "^9.4.1",
|
|
54
|
+
"eslint": "^8.57.0",
|
|
55
|
+
"lint-staged": "^15.2.7",
|
|
56
|
+
"nodemon": "^3.1.4",
|
|
57
|
+
"prettier": "^3.3.2",
|
|
58
|
+
"rimraf": "^5.0.7",
|
|
59
|
+
"simple-git-hooks": "^2.11.1",
|
|
60
60
|
"source-map-support": "^0.5.21",
|
|
61
61
|
"ts-node": "^10.9.2",
|
|
62
62
|
"tsconfig-paths": "^4.2.0",
|
|
63
|
-
"typescript": "^5.
|
|
64
|
-
"zx": "^
|
|
63
|
+
"typescript": "^5.5.2",
|
|
64
|
+
"zx": "^8.1.3"
|
|
65
|
+
},
|
|
66
|
+
"simple-git-hooks": {
|
|
67
|
+
"pre-commit": "npx lint-staged"
|
|
65
68
|
}
|
|
66
69
|
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nestjs-api",
|
|
3
|
-
"desc": {
|
|
3
|
+
"desc": {
|
|
4
|
+
"en": "A server-side API application built on NestJS",
|
|
5
|
+
"zh": "一个基于 NestJS 构建的服务端 API 应用"
|
|
6
|
+
},
|
|
4
7
|
"displayName": "NestJS API",
|
|
5
8
|
"blockletType": "dapp",
|
|
6
9
|
"composable": true,
|
|
@@ -38,14 +38,14 @@ This blocklet is a dapp project, which means this is a full-stack application. I
|
|
|
38
38
|
|
|
39
39
|
Blocklet needs blocklet server as a dependency. So you need to install it first.
|
|
40
40
|
`npm install -g @blocklet/cli`
|
|
41
|
-
See details in [https://
|
|
41
|
+
See details in [https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli](https://www.arcblock.io/docs/blocklet-developer/install-blocklet-cli)
|
|
42
42
|
|
|
43
43
|
2. Init blocklet server & start blocklet server
|
|
44
44
|
|
|
45
45
|
Before starting an blocklet server, you need to init blocklet server.
|
|
46
46
|
`blocklet server init --mode=debug`
|
|
47
47
|
`blocklet server start`
|
|
48
|
-
See details in [https://
|
|
48
|
+
See details in [https://www.arcblock.io/docs/blocklet-developer/getting-started](https://www.arcblock.io/docs/blocklet-developer/getting-started)
|
|
49
49
|
|
|
50
50
|
3. Go to the project directory `cd [name]`
|
|
51
51
|
4. Install dependencies: `npm install` or `yarn`
|
|
@@ -145,7 +145,7 @@ After developing a blocklet, you may need to bundle it. Use `npm run bundle` com
|
|
|
145
145
|
## Learn More
|
|
146
146
|
|
|
147
147
|
- 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)
|
|
148
|
-
- Full document of Blocklet Server & blocklet development: [https://
|
|
148
|
+
- Full document of Blocklet Server & blocklet development: [https://www.arcblock.io/docs/blocklet-developer](https://www.arcblock.io/docs/blocklet-developer)
|
|
149
149
|
|
|
150
150
|
## License
|
|
151
151
|
|
|
@@ -25,9 +25,10 @@ const ensureAccountDeclared = async () => {
|
|
|
25
25
|
(async () => {
|
|
26
26
|
try {
|
|
27
27
|
await ensureAccountDeclared();
|
|
28
|
+
logger.info(`${name} pre-start successfully`);
|
|
28
29
|
process.exit(0);
|
|
29
30
|
} catch (err) {
|
|
30
|
-
logger.error(`${name} pre-start error`, err
|
|
31
|
+
logger.error(`${name} pre-start error`, err);
|
|
31
32
|
process.exit(1);
|
|
32
33
|
}
|
|
33
34
|
})();
|