create-blocklet 0.7.9 → 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.
Files changed (249) hide show
  1. package/common/.github/workflows/main.yml +10 -7
  2. package/common/.prettierrc +1 -1
  3. package/common/LICENSE +1 -1
  4. package/common/_gitignore +1 -0
  5. package/common/scripts/build-clean.mjs +7 -0
  6. package/index.js +40 -32
  7. package/lib/arcblock.js +1 -1
  8. package/lib/constant.js +1 -0
  9. package/lib/did.js +2 -1
  10. package/lib/git.js +21 -21
  11. package/lib/server.js +10 -10
  12. package/lib/utils.js +2 -1
  13. package/package.json +16 -16
  14. package/templates/express-api/README.md +3 -3
  15. package/templates/express-api/api/hooks/pre-start.js +2 -1
  16. package/templates/express-api/api/index.js +1 -12
  17. package/templates/express-api/blocklet.yml +1 -1
  18. package/templates/express-api/package.json +20 -17
  19. package/templates/express-api/template-info.json +6 -3
  20. package/templates/html-static/README.md +3 -3
  21. package/templates/html-static/app/index.html +35 -36
  22. package/templates/html-static/app/styles/style.css +9 -1
  23. package/templates/html-static/blocklet.yml +1 -1
  24. package/templates/html-static/package.json +6 -5
  25. package/templates/html-static/template-info.json +2 -2
  26. package/templates/monorepo/.prettierrc +1 -1
  27. package/templates/monorepo/README.md +2 -2
  28. package/templates/monorepo/package.json +21 -13
  29. package/templates/monorepo/scripts/bump-version.mjs +1 -1
  30. package/templates/nestjs-api/.eslintrc.js +27 -3
  31. package/templates/nestjs-api/README.md +3 -3
  32. package/templates/nestjs-api/api/app.controller.ts +3 -1
  33. package/templates/nestjs-api/api/app.service.ts +1 -16
  34. package/templates/nestjs-api/api/hooks/pre-start.js +2 -1
  35. package/templates/nestjs-api/blocklet.yml +1 -1
  36. package/templates/nestjs-api/package.json +29 -26
  37. package/templates/nestjs-api/template-info.json +4 -1
  38. package/templates/nestjs-api/tsconfig.build.json +6 -1
  39. package/templates/nestjs-api/tsconfig.eslint.json +7 -0
  40. package/templates/nextjs-dapp/README.md +3 -3
  41. package/templates/nextjs-dapp/api/hooks/pre-start.js +2 -1
  42. package/templates/nextjs-dapp/blocklet.yml +1 -1
  43. package/templates/nextjs-dapp/package.json +23 -20
  44. package/templates/nextjs-dapp/pages/_app.js +1 -1
  45. package/templates/nextjs-dapp/pages/api/hello.js +1 -1
  46. package/templates/nextjs-dapp/pages/index.js +9 -17
  47. package/templates/nextjs-dapp/styles/Home.module.css +12 -3
  48. package/templates/nextjs-dapp/styles/globals.css +12 -2
  49. package/templates/nextjs-dapp/template-info.json +2 -2
  50. package/templates/react-dapp/README.md +3 -3
  51. package/templates/react-dapp/api/hooks/pre-start.js +2 -1
  52. package/templates/react-dapp/api/routes/index.js +6 -0
  53. package/templates/react-dapp/blocklet.yml +1 -1
  54. package/templates/react-dapp/index.html +14 -11
  55. package/templates/react-dapp/package.json +32 -28
  56. package/templates/react-dapp/src/app.jsx +1 -5
  57. package/templates/react-dapp/src/assets/blocklet.svg +16 -0
  58. package/templates/react-dapp/src/assets/react.svg +1 -0
  59. package/templates/react-dapp/src/assets/vite.svg +1 -0
  60. package/templates/react-dapp/src/index.css +68 -0
  61. package/templates/react-dapp/src/index.jsx +1 -0
  62. package/templates/react-dapp/src/libs/api.js +5 -12
  63. package/templates/react-dapp/src/pages/home.css +45 -0
  64. package/templates/react-dapp/src/pages/home.jsx +42 -15
  65. package/templates/react-dapp/template-info.json +2 -2
  66. package/templates/react-dapp-ts/.eslintrc.js +3 -0
  67. package/templates/react-dapp-ts/README.md +3 -3
  68. package/templates/react-dapp-ts/api/src/hooks/pre-start.ts +2 -2
  69. package/templates/react-dapp-ts/api/src/routes/index.ts +6 -0
  70. package/templates/react-dapp-ts/blocklet.yml +1 -1
  71. package/templates/react-dapp-ts/index.html +14 -11
  72. package/templates/react-dapp-ts/package.json +38 -34
  73. package/templates/react-dapp-ts/src/app.tsx +1 -6
  74. package/templates/react-dapp-ts/src/assets/blocklet.svg +16 -0
  75. package/templates/react-dapp-ts/src/assets/react.svg +1 -0
  76. package/templates/react-dapp-ts/src/assets/vite.svg +1 -0
  77. package/templates/react-dapp-ts/src/index.css +68 -0
  78. package/templates/react-dapp-ts/src/index.tsx +2 -2
  79. package/templates/react-dapp-ts/src/libs/api.ts +5 -12
  80. package/templates/react-dapp-ts/src/pages/home.css +45 -0
  81. package/templates/react-dapp-ts/src/pages/home.tsx +42 -15
  82. package/templates/react-dapp-ts/tsconfig.api.json +4 -1
  83. package/templates/react-dapp-ts/tsconfig.eslint.json +3 -1
  84. package/templates/react-gun-dapp/README.md +3 -3
  85. package/templates/react-gun-dapp/api/hooks/pre-start.js +2 -1
  86. package/templates/react-gun-dapp/blocklet.yml +1 -1
  87. package/templates/react-gun-dapp/index.html +14 -11
  88. package/templates/react-gun-dapp/package.json +31 -28
  89. package/templates/react-gun-dapp/src/app.jsx +1 -1
  90. package/templates/react-gun-dapp/src/libs/api.js +1 -1
  91. package/templates/react-gun-dapp/src/pages/about.jsx +5 -1
  92. package/templates/react-gun-dapp/src/pages/home.jsx +5 -1
  93. package/templates/react-static/README.md +3 -3
  94. package/templates/react-static/blocklet.yml +1 -1
  95. package/templates/react-static/index.html +14 -11
  96. package/templates/react-static/package.json +20 -18
  97. package/templates/react-static/src/app.jsx +1 -5
  98. package/templates/react-static/src/assets/blocklet.svg +16 -0
  99. package/templates/react-static/src/assets/react.svg +1 -0
  100. package/templates/react-static/src/assets/vite.svg +1 -0
  101. package/templates/react-static/src/index.css +68 -0
  102. package/templates/react-static/src/index.jsx +1 -0
  103. package/templates/react-static/src/pages/home.css +45 -0
  104. package/templates/react-static/src/pages/home.jsx +30 -15
  105. package/templates/react-static/template-info.json +6 -3
  106. package/templates/solidjs-dapp/.eslintrc.js +2 -1
  107. package/templates/solidjs-dapp/README.md +3 -3
  108. package/templates/solidjs-dapp/api/hooks/pre-start.js +2 -1
  109. package/templates/solidjs-dapp/api/routes/index.js +6 -0
  110. package/templates/solidjs-dapp/blocklet.yml +4 -2
  111. package/templates/solidjs-dapp/index.html +15 -12
  112. package/templates/solidjs-dapp/package.json +34 -30
  113. package/templates/solidjs-dapp/src/App.jsx +15 -3
  114. package/templates/solidjs-dapp/src/App.module.css +7 -1
  115. package/templates/solidjs-dapp/src/assets/blocklet.svg +16 -0
  116. package/templates/{solidjs-static/src/logo.svg → solidjs-dapp/src/assets/solidjs.svg} +1 -1
  117. package/templates/solidjs-dapp/src/index.css +21 -5
  118. package/templates/solidjs-dapp/src/libs/api.js +7 -0
  119. package/templates/solidjs-dapp/template-info.json +2 -2
  120. package/templates/solidjs-static/.eslintrc.js +4 -0
  121. package/templates/solidjs-static/README.md +3 -3
  122. package/templates/solidjs-static/blocklet.yml +1 -1
  123. package/templates/solidjs-static/index.html +15 -12
  124. package/templates/solidjs-static/package.json +22 -21
  125. package/templates/solidjs-static/src/App.jsx +7 -3
  126. package/templates/solidjs-static/src/App.module.css +7 -1
  127. package/templates/solidjs-static/src/assets/blocklet.svg +16 -0
  128. package/templates/solidjs-static/src/index.css +3 -5
  129. package/templates/solidjs-static/template-info.json +2 -2
  130. package/templates/svelte-dapp/README.md +3 -4
  131. package/templates/svelte-dapp/api/hooks/pre-start.js +2 -1
  132. package/templates/svelte-dapp/api/routes/index.js +6 -0
  133. package/templates/svelte-dapp/blocklet.yml +1 -1
  134. package/templates/svelte-dapp/index.html +13 -10
  135. package/templates/svelte-dapp/jsconfig.json +9 -7
  136. package/templates/svelte-dapp/package.json +29 -29
  137. package/templates/svelte-dapp/src/App.svelte +45 -42
  138. package/templates/svelte-dapp/src/app.css +79 -0
  139. package/templates/svelte-dapp/src/assets/blocklet.svg +16 -0
  140. package/templates/svelte-dapp/src/assets/svelte.svg +1 -0
  141. package/templates/svelte-dapp/src/assets/vite.svg +1 -0
  142. package/templates/svelte-dapp/src/components/Counter.svelte +10 -0
  143. package/templates/svelte-dapp/src/libs/api.js +7 -0
  144. package/templates/svelte-dapp/src/main.js +1 -0
  145. package/templates/svelte-dapp/template-info.json +2 -2
  146. package/templates/svelte-dapp/vite.config.mjs +6 -1
  147. package/templates/svelte-static/README.md +3 -4
  148. package/templates/svelte-static/blocklet.yml +1 -1
  149. package/templates/svelte-static/index.html +13 -10
  150. package/templates/svelte-static/jsconfig.json +9 -7
  151. package/templates/svelte-static/package.json +18 -22
  152. package/templates/svelte-static/src/App.svelte +36 -43
  153. package/templates/svelte-static/src/app.css +79 -0
  154. package/templates/svelte-static/src/assets/blocklet.svg +16 -0
  155. package/templates/svelte-static/src/assets/svelte.svg +1 -0
  156. package/templates/svelte-static/src/assets/vite.svg +1 -0
  157. package/templates/svelte-static/src/components/Counter.svelte +10 -0
  158. package/templates/svelte-static/src/main.js +1 -0
  159. package/templates/svelte-static/template-info.json +6 -3
  160. package/templates/svelte-static/vite.config.mjs +6 -1
  161. package/templates/todo-list-example/.eslintrc.js +1 -1
  162. package/templates/todo-list-example/api/src/hooks/pre-start.ts +2 -1
  163. package/templates/todo-list-example/api/src/routes/todo-list/$get.ts +1 -1
  164. package/templates/todo-list-example/api/src/routes/todo-list/$put.ts +1 -1
  165. package/templates/todo-list-example/blocklet.yml +7 -5
  166. package/templates/todo-list-example/index.html +14 -11
  167. package/templates/todo-list-example/package.json +44 -41
  168. package/templates/todo-list-example/src/components/layout.tsx +1 -1
  169. package/templates/todo-list-example/src/libs/api.ts +5 -12
  170. package/templates/todo-list-example/src/logo.svg +1 -1
  171. package/templates/todo-list-example/src/pages/required-login.tsx +3 -6
  172. package/templates/todo-list-example/src/pages/todo-list.css +72 -68
  173. package/templates/todo-list-example/src/pages/todo-list.tsx +32 -32
  174. package/templates/todo-list-example/template-info.json +1 -1
  175. package/templates/todo-list-example/tsconfig.api.json +4 -1
  176. package/templates/todo-list-example/tsconfig.eslint.json +3 -1
  177. package/templates/vue-dapp/README.md +3 -3
  178. package/templates/vue-dapp/api/hooks/pre-start.js +2 -1
  179. package/templates/vue-dapp/api/routes/index.js +6 -0
  180. package/templates/vue-dapp/blocklet.yml +1 -1
  181. package/templates/vue-dapp/index.html +14 -11
  182. package/templates/vue-dapp/package.json +32 -28
  183. package/templates/vue-dapp/src/App.vue +26 -19
  184. package/templates/vue-dapp/src/assets/blocklet.svg +16 -0
  185. package/templates/vue-dapp/src/assets/vite.svg +1 -0
  186. package/templates/vue-dapp/src/assets/vue.svg +1 -0
  187. package/templates/vue-dapp/src/components/HelloWorld.vue +25 -15
  188. package/templates/vue-dapp/src/libs/api.js +5 -12
  189. package/templates/vue-dapp/src/main.js +1 -0
  190. package/templates/vue-dapp/src/style.css +79 -0
  191. package/templates/vue-dapp/template-info.json +2 -2
  192. package/templates/vue-static/README.md +3 -3
  193. package/templates/vue-static/blocklet.yml +1 -1
  194. package/templates/vue-static/index.html +14 -11
  195. package/templates/vue-static/package.json +20 -19
  196. package/templates/vue-static/src/App.vue +27 -12
  197. package/templates/vue-static/src/assets/blocklet.svg +16 -0
  198. package/templates/vue-static/src/assets/vite.svg +1 -0
  199. package/templates/vue-static/src/assets/vue.svg +1 -0
  200. package/templates/vue-static/src/components/HelloWorld.vue +15 -15
  201. package/templates/vue-static/src/main.js +1 -0
  202. package/templates/vue-static/src/style.css +79 -0
  203. package/templates/vue-static/template-info.json +6 -3
  204. package/templates/vue2-dapp/README.md +3 -3
  205. package/templates/vue2-dapp/api/hooks/pre-start.js +2 -1
  206. package/templates/vue2-dapp/blocklet.yml +1 -1
  207. package/templates/vue2-dapp/index.html +14 -11
  208. package/templates/vue2-dapp/package.json +30 -27
  209. package/templates/vue2-dapp/src/libs/api.js +1 -1
  210. package/templates/vue2-dapp/template-info.json +2 -2
  211. package/templates/vue2-static/README.md +3 -3
  212. package/templates/vue2-static/blocklet.yml +1 -1
  213. package/templates/vue2-static/index.html +14 -11
  214. package/templates/vue2-static/package.json +19 -18
  215. package/templates/vue2-static/template-info.json +6 -3
  216. package/common/.husky/pre-commit +0 -4
  217. package/common/_npmrc +0 -4
  218. package/common/scripts/build-clean.js +0 -5
  219. package/templates/express-api/.env +0 -1
  220. package/templates/monorepo/.husky/pre-commit +0 -4
  221. package/templates/react-dapp/src/app.css +0 -30
  222. package/templates/react-dapp/src/logo.svg +0 -1
  223. package/templates/react-dapp/src/pages/about.jsx +0 -16
  224. package/templates/react-dapp-ts/src/app.css +0 -30
  225. package/templates/react-dapp-ts/src/logo.svg +0 -1
  226. package/templates/react-dapp-ts/src/pages/about.tsx +0 -16
  227. package/templates/react-static/src/app.css +0 -30
  228. package/templates/react-static/src/logo.svg +0 -1
  229. package/templates/react-static/src/pages/about.jsx +0 -16
  230. package/templates/svelte-dapp/.eslintrc.js +0 -22
  231. package/templates/svelte-dapp/src/assets/svelte.png +0 -0
  232. package/templates/svelte-dapp/src/lib/Counter.svelte +0 -34
  233. package/templates/svelte-static/.eslintrc.js +0 -22
  234. package/templates/svelte-static/src/assets/svelte.png +0 -0
  235. package/templates/svelte-static/src/lib/Counter.svelte +0 -34
  236. package/templates/todo-list-example/.editorconfig +0 -23
  237. package/templates/todo-list-example/.github/workflows/main.yml +0 -36
  238. package/templates/todo-list-example/.github/workflows/pr-title.yml +0 -21
  239. package/templates/todo-list-example/.github/workflows/version-check.yml +0 -20
  240. package/templates/todo-list-example/.husky/pre-commit +0 -4
  241. package/templates/todo-list-example/.prettierrc +0 -9
  242. package/templates/todo-list-example/logo.png +0 -0
  243. package/templates/todo-list-example/public/.gitkeep +0 -0
  244. package/templates/todo-list-example/screenshots/.gitkeep +0 -0
  245. package/templates/todo-list-example/scripts/build-clean.js +0 -5
  246. package/templates/todo-list-example/scripts/bump-version.mjs +0 -35
  247. package/templates/vue-static/src/assets/logo.png +0 -0
  248. /package/templates/monorepo/{eslintrc.js → .eslintrc.js} +0 -0
  249. /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://developer.blocklet.io/docs/en/quick-start/blocklet-server#use-the-binary-distribution](https://developer.blocklet.io/docs/en/quick-start/blocklet-server#use-the-binary-distribution)
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://developer.blocklet.io/docs/en/quick-start/blocklet-server](https://developer.blocklet.io/docs/en/quick-start/blocklet-server)
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://developer.blocklet.io/docs/en](https://developer.blocklet.io/docs/en)
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
- <head>
4
- <meta charset="UTF-8" />
5
- <link rel="icon" href="/favicon.ico?imageFilter=convert&f=png&w=32" />
6
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
7
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
8
- <link rel="stylesheet" href="./styles/style.css" />
9
- <title>HTML Template</title>
10
- <script src="__blocklet__.js"></script>
11
- </head>
12
- <body>
13
- <div id="app">
14
- <section class="body">
15
- <div class="logo">
16
- <img src="./images/logo.svg" alt="logo" />
17
- <p>Get started by edit <code class="code">app/index.html</code> file</p>
18
- </div>
19
- <div class="card-list">
20
- <a class="card" href="https://developer.blocklet.io/docs/en/blocklet" target="_blank">
21
- <h3>Documentation →</h3>
22
- <p>Find in-depth information about blocklet features and API.</p>
23
- </a>
24
- <a class="card" href="https://developer.blocklet.io/docs/en" target="_blank">
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
- </footer>
38
- </div>
39
- </body>
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: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New,
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
 
@@ -14,7 +14,7 @@ author:
14
14
  repository:
15
15
  type: git
16
16
  url: 'git+https://github.com/blocklet/create-blocklet.git'
17
- specVersion: 1.1.1
17
+ specVersion: 1.2.8
18
18
  version: 0.1.0
19
19
  logo: logo.png
20
20
  files:
@@ -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.js",
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": "^8.2.1",
19
- "rimraf": "^3.0.2",
20
- "zx": "^7.2.3"
18
+ "bumpp": "^9.4.1",
19
+ "prettier": "^3.3.2",
20
+ "rimraf": "^5.0.7",
21
+ "zx": "^8.1.3"
21
22
  }
22
23
  }
@@ -8,5 +8,5 @@
8
8
  "composable": true,
9
9
  "languages": "HTML",
10
10
  "useCase": "Starter",
11
- "author": "ZhangHan"
12
- }
11
+ "author": "Blocklet"
12
+ }
@@ -2,7 +2,7 @@
2
2
  "printWidth": 120,
3
3
  "useTabs": false,
4
4
  "tabWidth": 2,
5
- "trailingComma": "es5",
5
+ "trailingComma": "all",
6
6
  "bracketSameLine": true,
7
7
  "semi": true,
8
8
  "singleQuote": true
@@ -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://developer.blocklet.io/docs/en/quick-start/blocklet-server#use-the-binary-distribution](https://developer.blocklet.io/docs/en/quick-start/blocklet-server#use-the-binary-distribution)
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://developer.blocklet.io/docs/en/quick-start/blocklet-server](https://developer.blocklet.io/docs/en/quick-start/blocklet-server)
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": "root",
3
- "version": "0.1.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.4",
27
- "bumpp": "^7.2.0",
28
- "eslint": "^8.56.0",
29
- "husky": "^4.3.8",
30
- "prettier": "^3.1.1",
31
- "zx": "^7.2.3"
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
- extends: '@arcblock/eslint-config-base',
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://developer.blocklet.io/docs/en/quick-start/blocklet-server#use-the-binary-distribution](https://developer.blocklet.io/docs/en/quick-start/blocklet-server#use-the-binary-distribution)
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://developer.blocklet.io/docs/en/quick-start/blocklet-server](https://developer.blocklet.io/docs/en/quick-start/blocklet-server)
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://developer.blocklet.io/docs/en](https://developer.blocklet.io/docs/en)
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.message);
31
+ logger.error(`${name} pre-start error`, err);
31
32
  process.exit(1);
32
33
  }
33
34
  })();
@@ -13,7 +13,7 @@ author:
13
13
  repository:
14
14
  type: git
15
15
  url: 'git+https://github.com/blocklet/create-blocklet.git'
16
- specVersion: 1.1.1
16
+ specVersion: 1.2.8
17
17
  version: 0.1.0
18
18
  logo: logo.png
19
19
  files:
@@ -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.js",
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": "husky install",
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.20",
36
- "@nestjs/common": "^10.3.0",
37
- "@nestjs/core": "^10.3.0",
38
- "@nestjs/platform-express": "^10.3.0",
39
- "@ocap/client": "^1.18.108",
40
- "dotenv-flow": "^3.3.0",
41
- "express": "^4.18.2",
42
- "reflect-metadata": "^0.1.14",
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.4",
47
- "@nestjs/cli": "^10.2.1",
48
- "@nestjs/schematics": "^10.0.3",
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": "^18.19.3",
51
- "@typescript-eslint/eslint-plugin": "^6.15.0",
52
- "@typescript-eslint/parser": "^6.15.0",
53
- "bumpp": "^8.2.1",
54
- "eslint": "^8.56.0",
55
- "husky": "^8.0.3",
56
- "lint-staged": "^12.5.0",
57
- "nodemon": "^3.0.2",
58
- "prettier": "^3.1.1",
59
- "rimraf": "^3.0.2",
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.3.3",
64
- "zx": "^7.2.3"
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": { "en": "A server-side API application built on NestJS", "zh": "一个基于 NestJS 构建的服务端 API 应用" },
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,
@@ -1,4 +1,9 @@
1
1
  {
2
2
  "extends": "./tsconfig.json",
3
- "exclude": ["node_modules", "dist", "test", "**/*spec.ts"]
3
+ "exclude": [
4
+ "node_modules",
5
+ "dist",
6
+ "test",
7
+ "**/*spec.ts"
8
+ ]
4
9
  }
@@ -0,0 +1,7 @@
1
+ {
2
+ "extends": "./tsconfig",
3
+ "compilerOptions": {
4
+ "noEmit": true
5
+ },
6
+ "include": [".eslintrc.js"]
7
+ }
@@ -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://developer.blocklet.io/docs/en/quick-start/blocklet-server#use-the-binary-distribution](https://developer.blocklet.io/docs/en/quick-start/blocklet-server#use-the-binary-distribution)
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://developer.blocklet.io/docs/en/quick-start/blocklet-server](https://developer.blocklet.io/docs/en/quick-start/blocklet-server)
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://developer.blocklet.io/docs/en](https://developer.blocklet.io/docs/en)
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.message);
31
+ logger.error(`${name} pre-start error`, err);
31
32
  process.exit(1);
32
33
  }
33
34
  })();
@@ -13,7 +13,7 @@ author:
13
13
  repository:
14
14
  type: git
15
15
  url: 'git+https://github.com/blocklet/create-blocklet.git'
16
- specVersion: 1.1.1
16
+ specVersion: 1.2.8
17
17
  version: 0.1.0
18
18
  logo: logo.png
19
19
  files: