create-blocklet 0.3.8 → 0.3.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.
Files changed (112) hide show
  1. package/README.md +5 -0
  2. package/common/.makefiles/bump_version.sh +2 -1
  3. package/common/_gitignore +9 -16
  4. package/index.js +48 -12
  5. package/package.json +2 -1
  6. package/templates/blocklet-page-static/package.json +1 -1
  7. package/templates/express-api/api/index.js +1 -1
  8. package/templates/express-api/package.json +4 -4
  9. package/templates/html-static/app/favicon.ico +0 -0
  10. package/templates/html-static/app/images/logo.svg +17 -0
  11. package/templates/html-static/app/index.html +39 -0
  12. package/templates/html-static/app/styles/style.css +67 -0
  13. package/templates/html-static/blocklet.md +3 -0
  14. package/templates/html-static/blocklet.yml +48 -0
  15. package/templates/html-static/package.json +13 -0
  16. package/templates/{react-dapp/.env.local → nextjs-dapp/.env} +0 -0
  17. package/templates/nextjs-dapp/api/index.js +1 -1
  18. package/templates/nextjs-dapp/package.json +13 -13
  19. package/templates/react-dapp/.env +0 -1
  20. package/templates/react-dapp/api/index.js +1 -6
  21. package/templates/react-dapp/craco.config.js +5 -3
  22. package/templates/react-dapp/package.json +11 -11
  23. package/templates/react-gun-dapp/.env +0 -1
  24. package/templates/react-gun-dapp/api/index.js +1 -6
  25. package/templates/react-gun-dapp/craco.config.js +6 -4
  26. package/templates/react-gun-dapp/package.json +13 -13
  27. package/templates/react-static/craco.config.js +1 -1
  28. package/templates/react-static/package.json +6 -6
  29. package/templates/solidjs-dapp/.env +1 -0
  30. package/templates/solidjs-dapp/.eslintrc.js +17 -0
  31. package/templates/solidjs-dapp/README.md +147 -0
  32. package/templates/solidjs-dapp/api/hooks/pre-start.js +33 -0
  33. package/templates/solidjs-dapp/api/index.js +50 -0
  34. package/templates/solidjs-dapp/api/libs/auth.js +22 -0
  35. package/templates/solidjs-dapp/api/libs/env.js +6 -0
  36. package/templates/solidjs-dapp/api/libs/logger.js +3 -0
  37. package/templates/solidjs-dapp/api/routes/index.js +6 -0
  38. package/templates/solidjs-dapp/blocklet.md +3 -0
  39. package/templates/solidjs-dapp/blocklet.yml +49 -0
  40. package/templates/solidjs-dapp/index.html +17 -0
  41. package/templates/solidjs-dapp/package.json +63 -0
  42. package/templates/solidjs-dapp/src/App.jsx +24 -0
  43. package/templates/solidjs-dapp/src/App.module.css +33 -0
  44. package/templates/solidjs-dapp/src/assets/favicon.ico +0 -0
  45. package/templates/solidjs-dapp/src/index.css +13 -0
  46. package/templates/solidjs-dapp/src/index.jsx +7 -0
  47. package/templates/solidjs-dapp/src/logo.svg +1 -0
  48. package/templates/solidjs-dapp/vite.config.js +36 -0
  49. package/templates/solidjs-static/.env +1 -0
  50. package/templates/solidjs-static/.eslintrc.js +9 -0
  51. package/templates/solidjs-static/README.md +147 -0
  52. package/templates/solidjs-static/blocklet.md +3 -0
  53. package/templates/solidjs-static/blocklet.yml +49 -0
  54. package/templates/solidjs-static/index.html +17 -0
  55. package/templates/solidjs-static/package.json +43 -0
  56. package/templates/solidjs-static/src/App.jsx +24 -0
  57. package/templates/solidjs-static/src/App.module.css +33 -0
  58. package/templates/solidjs-static/src/assets/favicon.ico +0 -0
  59. package/templates/solidjs-static/src/index.css +13 -0
  60. package/templates/solidjs-static/src/index.jsx +7 -0
  61. package/templates/solidjs-static/src/logo.svg +1 -0
  62. package/templates/solidjs-static/vite.config.js +32 -0
  63. package/templates/svelte-dapp/.browserslistrc +4 -0
  64. package/templates/svelte-dapp/.env +1 -0
  65. package/templates/svelte-dapp/.eslintrc.js +22 -0
  66. package/templates/svelte-dapp/.vscode/extensions.json +3 -0
  67. package/templates/svelte-dapp/README.md +146 -0
  68. package/templates/svelte-dapp/api/hooks/pre-start.js +33 -0
  69. package/templates/svelte-dapp/api/index.js +50 -0
  70. package/templates/svelte-dapp/api/libs/auth.js +22 -0
  71. package/templates/svelte-dapp/api/libs/env.js +6 -0
  72. package/templates/svelte-dapp/api/libs/logger.js +3 -0
  73. package/templates/svelte-dapp/api/routes/index.js +6 -0
  74. package/templates/svelte-dapp/blocklet.md +3 -0
  75. package/templates/svelte-dapp/blocklet.yml +49 -0
  76. package/templates/svelte-dapp/index.html +16 -0
  77. package/templates/svelte-dapp/jsconfig.json +34 -0
  78. package/templates/svelte-dapp/package.json +59 -0
  79. package/templates/svelte-dapp/src/App.svelte +64 -0
  80. package/templates/svelte-dapp/src/assets/svelte.png +0 -0
  81. package/templates/svelte-dapp/src/lib/Counter.svelte +34 -0
  82. package/templates/svelte-dapp/src/main.js +7 -0
  83. package/templates/svelte-dapp/src/vite-env.d.ts +2 -0
  84. package/templates/svelte-dapp/vite.config.js +33 -0
  85. package/templates/svelte-static/.browserslistrc +4 -0
  86. package/templates/svelte-static/.env +1 -0
  87. package/templates/svelte-static/.eslintrc.js +22 -0
  88. package/templates/svelte-static/.vscode/extensions.json +3 -0
  89. package/templates/svelte-static/README.md +146 -0
  90. package/templates/svelte-static/blocklet.md +3 -0
  91. package/templates/svelte-static/blocklet.yml +49 -0
  92. package/templates/svelte-static/index.html +16 -0
  93. package/templates/svelte-static/jsconfig.json +34 -0
  94. package/templates/svelte-static/package.json +40 -0
  95. package/templates/svelte-static/src/App.svelte +64 -0
  96. package/templates/svelte-static/src/assets/svelte.png +0 -0
  97. package/templates/svelte-static/src/lib/Counter.svelte +34 -0
  98. package/templates/svelte-static/src/main.js +7 -0
  99. package/templates/svelte-static/src/vite-env.d.ts +2 -0
  100. package/templates/svelte-static/vite.config.js +29 -0
  101. package/templates/vue-dapp/api/index.js +1 -6
  102. package/templates/vue-dapp/index.html +1 -1
  103. package/templates/vue-dapp/package.json +15 -15
  104. package/templates/vue-dapp/vite.config.js +8 -4
  105. package/templates/vue-static/README.md +0 -1
  106. package/templates/vue-static/package.json +9 -9
  107. package/templates/vue-static/vite.config.js +5 -3
  108. package/templates/vue2-dapp/api/index.js +1 -6
  109. package/templates/vue2-dapp/package.json +16 -16
  110. package/templates/vue2-dapp/vue.config.js +5 -2
  111. package/templates/vue2-static/package.json +8 -8
  112. package/templates/vue2-static/vue.config.js +1 -1
package/README.md CHANGED
@@ -36,6 +36,8 @@ Currently supported template presets include:
36
36
  - `react`
37
37
  - `vue3 + vite`
38
38
  - `vue2 + @vue/cli`
39
+ - `solid-js`
40
+ - `svelte`
39
41
  - `next.js`
40
42
  - `react + gunjs`
41
43
 
@@ -44,7 +46,10 @@ Currently supported template presets include:
44
46
  - `react`
45
47
  - `vue3 + vite`
46
48
  - `vue2 + @vue/cli`
49
+ - `solid-js`
50
+ - `svelte`
47
51
  - `blocklet page`
52
+ - `html`
48
53
 
49
54
  **api**
50
55
  - `express`
@@ -39,7 +39,8 @@ if [ -f $VERSION ]; then
39
39
  echo -e "${NOTICE_FLAG} Will set new version to be ${WHITE}$INPUT_STRING"
40
40
  echo $INPUT_STRING >$VERSION
41
41
 
42
- echo "## $INPUT_STRING ($NOW)\n" >tmpfile
42
+ echo "## $INPUT_STRING ($NOW)" >tmpfile
43
+ echo "" >>tmpfile
43
44
  git log --pretty=format:"- %s" "$BASE_STRING"...HEAD >>tmpfile
44
45
  echo "" >>tmpfile
45
46
  echo "" >>tmpfile
package/common/_gitignore CHANGED
@@ -1,35 +1,28 @@
1
1
  # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2
2
 
3
3
  # dependencies
4
- /.pnp
4
+ .pnp
5
5
  .pnp.js
6
6
  .DS_Store
7
7
  node_modules
8
8
 
9
9
  # testing
10
- /coverage
10
+ coverage
11
11
 
12
12
  # production
13
- /build
14
- /dist
13
+ build
14
+ dist
15
+ dist-ssr
15
16
  .blocklet
16
17
 
17
18
  # local env files
18
- .env.local
19
- .env.*.local
19
+ *.local
20
20
 
21
21
  # Log files
22
+ logs
23
+ *.log
22
24
  npm-debug.log*
23
25
  yarn-debug.log*
24
26
  yarn-error.log*
25
27
  pnpm-debug.log*
26
-
27
- # Editor directories and files
28
- .idea
29
- .vscode
30
- *.suo
31
- *.ntvs*
32
- *.njsproj
33
- *.sln
34
- *.sw?
35
-
28
+ lerna-debug.log*
package/index.js CHANGED
@@ -8,6 +8,7 @@ import { cd, argv, fs, YAML, chalk, path } from 'zx';
8
8
  import ora from 'ora';
9
9
  import prompts from 'prompts';
10
10
  import * as envfile from 'envfile';
11
+ import getPort from 'get-port';
11
12
 
12
13
  import { echoBrand, echoDocument } from './lib/arcblock.js';
13
14
  import { getUser } from './lib/index.js';
@@ -15,7 +16,7 @@ import { checkServerInstalled, checkServerRunning, checkSatisfiedVersion, getSer
15
16
  import { toBlockletDid } from './lib/did.js';
16
17
  import { initGitRepo } from './lib/git.js';
17
18
 
18
- const { yellow, red, green, cyan, blue, bold } = chalk;
19
+ const { yellow, red, green, cyan, blue, bold, magenta } = chalk;
19
20
 
20
21
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
21
22
 
@@ -31,6 +32,11 @@ const TYPES = [
31
32
  display: 'react',
32
33
  color: yellow,
33
34
  },
35
+ {
36
+ name: 'solidjs',
37
+ display: 'solidjs',
38
+ color: yellow,
39
+ },
34
40
  {
35
41
  name: 'vue',
36
42
  display: 'vue3 + vite',
@@ -41,6 +47,11 @@ const TYPES = [
41
47
  display: 'vue2 + @vue/cli',
42
48
  color: green,
43
49
  },
50
+ {
51
+ name: 'svelte',
52
+ display: 'svelte',
53
+ color: magenta,
54
+ },
44
55
  {
45
56
  name: 'nextjs',
46
57
  display: 'next.js',
@@ -62,6 +73,11 @@ const TYPES = [
62
73
  display: 'react',
63
74
  color: yellow,
64
75
  },
76
+ {
77
+ name: 'solidjs',
78
+ display: 'solidjs',
79
+ color: yellow,
80
+ },
65
81
  {
66
82
  name: 'vue',
67
83
  display: 'vue3 + vite',
@@ -72,11 +88,21 @@ const TYPES = [
72
88
  display: 'vue2 + @vue/cli',
73
89
  color: green,
74
90
  },
91
+ {
92
+ name: 'svelte',
93
+ display: 'svelte',
94
+ color: magenta,
95
+ },
75
96
  {
76
97
  name: 'blocklet-page',
77
98
  display: 'blocklet page',
78
99
  color: blue,
79
100
  },
101
+ {
102
+ name: 'html',
103
+ display: 'html',
104
+ color: blue,
105
+ },
80
106
  ],
81
107
  },
82
108
  {
@@ -281,8 +307,16 @@ async function init() {
281
307
  modifyBlockletMd((md) => {
282
308
  return md.replace(/# template-react/g, `# ${name}`);
283
309
  });
284
- if (!['blocklet-page'].includes(framework)) {
285
- modifyEnv((env) => {
310
+
311
+ let randomPort;
312
+ if (['dapp'].includes(type)) {
313
+ randomPort = await getPort();
314
+ }
315
+ modifyEnv((env) => {
316
+ if (randomPort) {
317
+ env.API_PORT = randomPort;
318
+ }
319
+ if (!['blocklet-page'].includes(framework)) {
286
320
  if (['react'].includes(framework)) {
287
321
  env.REACT_APP_TITLE = name;
288
322
  } else if (['vue', 'blocklet-page'].includes(framework)) {
@@ -290,9 +324,9 @@ async function init() {
290
324
  } else {
291
325
  env.APP_TITLE = name;
292
326
  }
293
- return env;
294
- });
295
- }
327
+ }
328
+ return env;
329
+ });
296
330
 
297
331
  // patch blocklet author
298
332
  modifyBlockletYaml(async (yamlConfig) => {
@@ -307,10 +341,14 @@ async function init() {
307
341
  yamlConfig.did = did;
308
342
  });
309
343
  modifyPackage((pkg) => {
310
- if (type === 'dapp') {
311
- pkg.scripts['bundle:client'] = ejs.render(pkg.scripts['bundle:client'], { did });
312
- } else if (type === 'static') {
313
- pkg.scripts.bundle = ejs.render(pkg.scripts.bundle, { did });
344
+ try {
345
+ if (type === 'dapp') {
346
+ pkg.scripts['bundle:client'] = ejs.render(pkg.scripts['bundle:client'], { did });
347
+ } else if (type === 'static') {
348
+ pkg.scripts.bundle = ejs.render(pkg.scripts.bundle, { did });
349
+ }
350
+ } catch {
351
+ console.info('\nNo need to patch bundle script\n');
314
352
  }
315
353
  });
316
354
  // disabled random logo
@@ -385,11 +423,9 @@ async function init() {
385
423
  execSync('blocklet dev', { stdio: 'inherit' });
386
424
  } else {
387
425
  console.log();
388
- console.log();
389
426
  }
390
427
  } else {
391
428
  console.log();
392
- console.log();
393
429
  }
394
430
 
395
431
  if (!isServerInstalled) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-blocklet",
3
- "version": "0.3.8",
3
+ "version": "0.3.9",
4
4
  "exports": "./index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:blocklet/create-blocklet.git",
@@ -36,6 +36,7 @@
36
36
  "ejs": "^3.1.6",
37
37
  "envfile": "^6.17.0",
38
38
  "figlet": "^1.5.2",
39
+ "get-port": "^6.1.2",
39
40
  "gradient-string": "^2.0.0",
40
41
  "jdenticon": "^3.1.1",
41
42
  "ora": "^6.1.0",
@@ -11,6 +11,6 @@
11
11
  "upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json"
12
12
  },
13
13
  "dependencies": {
14
- "@xmark/cli": "^2.0.31"
14
+ "@xmark/cli": "^2.0.37"
15
15
  }
16
16
  }
@@ -2,7 +2,7 @@ const express = require('express');
2
2
 
3
3
  const app = express();
4
4
 
5
- const port = process.env.BLOCKLET_PORT || 3030;
5
+ const port = process.env.BLOCKLET_PORT || process.env.PORT || 3030;
6
6
 
7
7
  app.get('/', (req, res) => {
8
8
  res.send('Hello World, Blocklet!');
@@ -15,12 +15,12 @@
15
15
  "license": "ISC",
16
16
  "dependencies": {
17
17
  "@arcblock/did-auth-storage-nedb": "^1.6.3",
18
- "@blocklet/sdk": "^1.7.0",
19
- "@ocap/client": "^1.15.2",
18
+ "@blocklet/sdk": "^1.7.9",
19
+ "@ocap/client": "^1.16.4",
20
20
  "dotenv-flow": "^3.2.0",
21
- "express": "^4.17.3"
21
+ "express": "^4.18.0"
22
22
  },
23
23
  "devDependencies": {
24
- "nodemon": "^2.0.15"
24
+ "nodemon": "^2.0.16"
25
25
  }
26
26
  }
@@ -0,0 +1,17 @@
1
+ <svg width="204" height="64" viewBox="0 0 204 64" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M80 44.5707V20H91.8859C95.101 20 97.7075 22.6064 97.7075 25.8216V27.5875C97.7075 29.135 97.1037 30.5414 96.1188 31.5841C97.8642 32.5893 99.0393 34.4737 99.0393 36.6325V38.7491C99.0393 41.9643 96.4328 44.5707 93.2177 44.5707H80ZM82.5874 30.8109H92.1522C93.8138 30.6754 95.1201 29.284 95.1201 27.5875V25.8216C95.1201 24.0354 93.6721 22.5874 91.8859 22.5874H82.5874V30.8109ZM82.5874 41.9833V33.4091L93.2177 33.3983C95.0039 33.3983 96.4519 34.8463 96.4519 36.6325V38.7491C96.4519 40.5353 95.0039 41.9833 93.2177 41.9833H82.5874ZM106.501 20V44.5707H103.794V20H106.501ZM119.917 26.6346H117.11C113.877 26.6346 111.256 29.2555 111.256 32.4885V38.7167C111.256 41.9498 113.877 44.5707 117.11 44.5707H119.917C123.15 44.5707 125.771 41.9498 125.771 38.7167V32.4885C125.771 29.2555 123.15 26.6346 119.917 26.6346ZM117.11 29.3416C115.372 29.3416 113.963 30.7505 113.963 32.4885V38.7167C113.963 40.4547 115.372 41.8636 117.11 41.8636H119.917C121.655 41.8636 123.064 40.4547 123.064 38.7167V32.4885C123.064 30.7505 121.655 29.3416 119.917 29.3416H117.11ZM149.437 44.5801V35.7411H152.738L157.841 44.5801H160.967L155.097 34.413L159.695 26.4493H156.569L152.767 33.0341H149.437V20H146.73V44.5801H149.437ZM140.902 32.9673V32.4885C140.902 30.7505 139.493 29.3416 137.755 29.3416H134.948C133.21 29.3416 131.801 30.7505 131.801 32.4885V38.7167C131.801 40.4547 133.21 41.8636 134.948 41.8636H137.755C139.493 41.8636 140.902 40.4547 140.902 38.7167V38.2379H143.609V38.7167C143.609 41.9498 140.988 44.5707 137.755 44.5707H134.948C131.715 44.5707 129.094 41.9498 129.094 38.7167V32.4885C129.094 29.2555 131.715 26.6346 134.948 26.6346H137.755C140.988 26.6346 143.609 29.2555 143.609 32.4885V32.9673H140.902ZM168.429 44.5707V20H165.722V44.5707H168.429ZM176.094 36.342V38.7167C176.094 40.4547 177.502 41.8636 179.24 41.8636H182.047C183.785 41.8636 185.194 40.4547 185.194 38.7167V38.2379H187.901V38.7167C187.901 41.9498 185.281 44.5707 182.047 44.5707H179.24C176.007 44.5707 173.386 41.9498 173.386 38.7167V32.4885C173.386 29.2555 176.007 26.6346 179.24 26.6346H182.047C185.281 26.6346 187.901 29.2555 187.901 32.4885V33.635V35.3244V36.342H176.094ZM185.194 33.635H176.094V32.4885C176.094 30.7505 177.502 29.3416 179.24 29.3416H182.047C183.785 29.3416 185.194 30.7505 185.194 32.4885V33.635ZM193.626 30.6973H191.217V27.9903H193.626V23.6154H196.214V27.9903H202.477V30.6973H196.214V39.4188C196.214 40.8351 197.362 41.9833 198.778 41.9833C200.194 41.9833 201.343 40.8351 201.343 39.4188V38.8802H203.93V39.4188C203.93 42.2641 201.623 44.5707 198.778 44.5707C195.933 44.5707 193.626 42.2641 193.626 39.4188V30.6973Z" fill="black"/>
3
+ <path opacity="0.6" fill-rule="evenodd" clip-rule="evenodd" d="M49.12 10.6348L30.7 0L12.28 10.6348V24.7781L0 31.868V53.1375L18.42 63.7723L30.6702 56.6997L30.7 56.7169L30.7298 56.6997L42.98 63.7723L61.4 53.1375V31.868L49.12 24.7781V10.6348ZM59.4813 32.9757L47.2013 25.8859V11.7426L30.7 2.21558L14.1988 11.7426V25.8859L1.91875 32.9757V52.0297L18.42 61.5568L30.6702 54.4841L30.7 54.5013L30.7298 54.4841L42.98 61.5568L59.4813 52.0297V32.9757Z" fill="url(#paint0_linear_898_1378)"/>
4
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M30.6998 14.1797L49.1198 24.8145V46.0841L30.6998 56.7189L12.2798 46.0841V24.8145L30.6998 14.1797ZM15.1579 25.3684L29.7404 33.7876V16.9492L15.1579 25.3684ZM28.781 35.4493L14.1985 27.0301V43.8685L28.781 35.4493ZM31.6592 37.111L46.2417 45.5302L31.6592 53.9494V37.111ZM47.201 43.8685L32.6185 35.4493L47.201 27.0301V43.8685ZM29.7404 53.9494L15.1579 45.5302L29.7404 37.111V53.9494ZM31.6592 16.9492L46.2417 25.3684L31.6592 33.7876V16.9492Z" fill="url(#paint1_linear_898_1378)"/>
5
+ <defs>
6
+ <linearGradient id="paint0_linear_898_1378" x1="30.7" y1="-31.8862" x2="-33.0265" y2="29.4697" gradientUnits="userSpaceOnUse">
7
+ <stop stop-color="#4EF1BA"/>
8
+ <stop offset="0.501904" stop-color="#16CED1"/>
9
+ <stop offset="1" stop-color="#3773F2"/>
10
+ </linearGradient>
11
+ <linearGradient id="paint1_linear_898_1378" x1="33.1078" y1="-37.1138" x2="-37.2973" y2="18.5071" gradientUnits="userSpaceOnUse">
12
+ <stop stop-color="#4EF1BA"/>
13
+ <stop offset="0.501904" stop-color="#16CED1"/>
14
+ <stop offset="1" stop-color="#3773F2"/>
15
+ </linearGradient>
16
+ </defs>
17
+ </svg>
@@ -0,0 +1,39 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8" />
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
7
+ <link rel="stylesheet" href="./styles/style.css" />
8
+ <title>HTML Template</title>
9
+ <script src="__meta__.js"></script>
10
+ </head>
11
+ <body>
12
+ <div id="app">
13
+ <section class="body">
14
+ <div class="logo">
15
+ <img src="./images/logo.svg" alt="logo" />
16
+ <p>Get started by edit <code class="code">app/index.html</code> file</p>
17
+ </div>
18
+ <div class="card-list">
19
+ <a class="card" href="https://docs.arcblock.io/abtnode/en/blocklet" target="_blank">
20
+ <h3>Documentation →</h3>
21
+ <p>Find in-depth information about blocklet features and API.</p>
22
+ </a>
23
+ <a class="card" href="https://docs.arcblock.io/abtnode/en/introduction" target="_blank">
24
+ <h3>Blocklet Server →</h3>
25
+ <p>Learn about Blocklet Server</p>
26
+ </a>
27
+ </div>
28
+ <br />
29
+ <br />
30
+ </section>
31
+ <footer class="footer">
32
+ Powered by
33
+ <a href="http://www.arcblock.io/" target="_blank">
34
+ <strong>ArcBlock</strong>
35
+ </a>
36
+ </footer>
37
+ </div>
38
+ </body>
39
+ </html>
@@ -0,0 +1,67 @@
1
+ html,
2
+ body {
3
+ padding: 0;
4
+ margin: 0;
5
+ }
6
+ a {
7
+ text-decoration: none;
8
+ color: initial;
9
+ }
10
+ #app {
11
+ display: flex;
12
+ flex-direction: column;
13
+ min-height: 100vh;
14
+ }
15
+
16
+ .body {
17
+ flex: 1;
18
+ display: flex;
19
+ flex-direction: column;
20
+ align-items: center;
21
+ justify-content: center;
22
+ }
23
+ .logo {
24
+ font-size: 18px;
25
+ }
26
+
27
+ .footer {
28
+ height: 80px;
29
+ line-height: 80px;
30
+ text-align: center;
31
+ font-size: 18px;
32
+ }
33
+ .card-list {
34
+ display: flex;
35
+ margin-top: 30px;
36
+ gap: 40px;
37
+ padding: 20px;
38
+ }
39
+ .card {
40
+ border: 1px solid #e7e7e7;
41
+ border-radius: 6px;
42
+ padding: 0 25px;
43
+ flex: 1;
44
+ text-decoration: none;
45
+ color: initial;
46
+ font-size: 18px;
47
+ }
48
+ .card:hover {
49
+ box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
50
+ }
51
+ .card h3 {
52
+ font-size: 24px;
53
+ }
54
+ .code {
55
+ background: #fafafa;
56
+ border-radius: 5px;
57
+ padding: 0.75rem;
58
+ font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New,
59
+ monospace;
60
+ }
61
+
62
+ @media (max-width: 768px) {
63
+ .card-list {
64
+ flex-direction: column;
65
+ gap: 20px;
66
+ }
67
+ }
@@ -0,0 +1,3 @@
1
+ # template-html
2
+
3
+ A html template for creating a new blocklet project.
@@ -0,0 +1,48 @@
1
+ name: template-html
2
+ title: Blocklet Template HTML
3
+ description: A Blocklet Server blocklet
4
+ keywords:
5
+ - blocklet
6
+ - html
7
+ - static
8
+ group: static
9
+ did: ''
10
+ main: app
11
+ author:
12
+ name: Blocklet
13
+ email: blocklet@arcblock.io
14
+ repository:
15
+ type: git
16
+ url: 'git+https://github.com/blocklet/create-blocklet.git'
17
+ specVersion: 1.1.1
18
+ version: 0.1.0
19
+ logo: logo.png
20
+ files:
21
+ - logo.png
22
+ - README.md
23
+ - blocklet.md
24
+ - screenshots
25
+ interfaces:
26
+ - type: web
27
+ name: publicUrl
28
+ path: /
29
+ prefix: '*'
30
+ port: BLOCKLET_PORT
31
+ protocol: http
32
+ community: ''
33
+ documentation: ''
34
+ homepage: ''
35
+ license: ''
36
+ payment:
37
+ price: []
38
+ share: []
39
+ timeout:
40
+ start: 60
41
+ requirements:
42
+ server: '>=1.6.29'
43
+ os: '*'
44
+ cpu: '*'
45
+ environments: []
46
+ capabilities: {}
47
+ screenshots: []
48
+ children: []
@@ -0,0 +1,13 @@
1
+ {
2
+ "name": "template-html",
3
+ "version": "0.1.0",
4
+ "scripts": {
5
+ "clean": "rm -rf .blocklet",
6
+ "release": "npm run clean && blocklet bundle --create-release",
7
+ "deploy": "npm run release && blocklet deploy .blocklet/bundle --skip-hooks",
8
+ "upload": "npm run release && blocklet upload .blocklet/release/blocklet.json"
9
+ },
10
+ "keywords": [],
11
+ "author": "",
12
+ "license": "ISC"
13
+ }
@@ -1,7 +1,7 @@
1
1
  const express = require('express');
2
2
  const next = require('next');
3
3
 
4
- const port = parseInt(process.env.BLOCKLET_PORT, 10) || 3000;
4
+ const port = parseInt(process.env.BLOCKLET_PORT || process.env.PORT, 10) || 3000;
5
5
  const dev = process.env.NODE_ENV !== 'production';
6
6
  const app = next({ dev });
7
7
  const handle = app.getRequestHandler();
@@ -25,24 +25,24 @@
25
25
  ]
26
26
  },
27
27
  "dependencies": {
28
- "@arcblock/did-auth": "^1.16.0",
28
+ "@arcblock/did-auth": "^1.16.4",
29
29
  "@arcblock/did-auth-storage-nedb": "^1.6.3",
30
- "@blocklet/sdk": "^1.7.6",
31
- "@ocap/client": "^1.16.0",
32
- "@ocap/mcrypto": "^1.16.0",
33
- "@ocap/wallet": "^1.16.0",
30
+ "@blocklet/sdk": "^1.7.9",
31
+ "@ocap/client": "^1.16.4",
32
+ "@ocap/mcrypto": "^1.16.4",
33
+ "@ocap/wallet": "^1.16.4",
34
34
  "dotenv-flow": "^3.2.0",
35
- "express": "^4.17.3",
36
- "next": "12.1.0",
37
- "react": "17.0.2",
38
- "react-dom": "17.0.2"
35
+ "express": "^4.18.0",
36
+ "next": "12.1.5",
37
+ "react": "18.1.0",
38
+ "react-dom": "18.1.0"
39
39
  },
40
40
  "devDependencies": {
41
- "eslint": "8.11.0",
42
- "eslint-config-next": "12.1.0",
41
+ "eslint": "8.14.0",
42
+ "eslint-config-next": "12.1.5",
43
43
  "husky": "^7.0.4",
44
- "lint-staged": "^12.3.7",
45
- "nodemon": "^2.0.15",
44
+ "lint-staged": "^12.4.1",
45
+ "nodemon": "^2.0.16",
46
46
  "npm-run-all": "^4.1.5"
47
47
  }
48
48
  }
@@ -1,3 +1,2 @@
1
1
  GENERATE_SOURCEMAP=false
2
- APP_PORT=3030
3
2
  REACT_APP_TITLE=''
@@ -20,13 +20,8 @@ app.use(express.urlencoded({ extended: true, limit: '1 mb' }));
20
20
  const router = express.Router();
21
21
  router.use('/api', require('./routes'));
22
22
 
23
- const isDevelopment = process.env.NODE_ENV === 'development';
24
23
  const isProduction = process.env.NODE_ENV === 'production' || process.env.ABT_NODE_SERVICE_ENV === 'production';
25
24
 
26
- if (isDevelopment) {
27
- process.env.BLOCKLET_PORT = 3030;
28
- }
29
-
30
25
  if (isProduction) {
31
26
  app.use(cors());
32
27
  app.use(compression());
@@ -47,7 +42,7 @@ if (isProduction) {
47
42
  app.use(router);
48
43
  }
49
44
 
50
- const port = parseInt(process.env.BLOCKLET_PORT, 10) || 3030;
45
+ const port = parseInt(process.env.API_PORT, 10) || 3030;
51
46
 
52
47
  app.listen(port, (err) => {
53
48
  if (err) throw err;
@@ -1,5 +1,7 @@
1
- const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
2
- const dappPort = process.env.APP_PORT || 3030;
1
+ require('dotenv-flow').config();
2
+
3
+ const port = process.env.BLOCKLET_PORT || process.env.PORT || 3000;
4
+ const apiPort = process.env.API_PORT || 3030;
3
5
 
4
6
  module.exports = {
5
7
  devServer: {
@@ -10,7 +12,7 @@ module.exports = {
10
12
  },
11
13
  proxy: {
12
14
  '/api': {
13
- target: `http://127.0.0.1:${dappPort}`,
15
+ target: `http://127.0.0.1:${apiPort}`,
14
16
  },
15
17
  },
16
18
  },
@@ -39,25 +39,25 @@
39
39
  ]
40
40
  },
41
41
  "dependencies": {
42
- "@arcblock/did-auth": "^1.16.0",
42
+ "@arcblock/did-auth": "^1.16.4",
43
43
  "@arcblock/did-auth-storage-nedb": "^1.6.3",
44
- "@blocklet/sdk": "^1.7.6",
44
+ "@blocklet/sdk": "^1.7.9",
45
45
  "@craco/craco": "^6.4.3",
46
- "@ocap/client": "^1.16.0",
47
- "@ocap/mcrypto": "^1.16.0",
48
- "@ocap/wallet": "^1.16.0",
49
- "axios": "^0.26.1",
46
+ "@ocap/client": "^1.16.4",
47
+ "@ocap/mcrypto": "^1.16.4",
48
+ "@ocap/wallet": "^1.16.4",
49
+ "axios": "^0.27.2",
50
50
  "compression": "^1.7.4",
51
51
  "cookie-parser": "^1.4.6",
52
52
  "cors": "^2.8.5",
53
53
  "dotenv-flow": "^3.2.0",
54
- "express": "^4.17.3",
54
+ "express": "^4.18.0",
55
55
  "express-async-errors": "^3.1.1",
56
56
  "express-history-api-fallback": "^2.2.1",
57
57
  "react": "^17.0.2",
58
58
  "react-dom": "^17.0.2",
59
- "react-router-dom": "^6.2.2",
60
- "react-scripts": "5.0.0"
59
+ "react-router-dom": "^6.3.0",
60
+ "react-scripts": "5.0.1"
61
61
  },
62
62
  "devDependencies": {
63
63
  "@arcblock/eslint-config": "^0.1.8",
@@ -72,8 +72,8 @@
72
72
  "eslint-plugin-react-hooks": "^4.2.0",
73
73
  "eslint-plugin-unicorn": "^34.0.1",
74
74
  "husky": "^7.0.4",
75
- "lint-staged": "^12.3.7",
76
- "nodemon": "^2.0.15",
75
+ "lint-staged": "^12.4.1",
76
+ "nodemon": "^2.0.16",
77
77
  "npm-run-all": "^4.1.5",
78
78
  "prettier": "^2.6.0"
79
79
  }
@@ -1,3 +1,2 @@
1
1
  GENERATE_SOURCEMAP=false
2
- APP_PORT=3030
3
2
  REACT_APP_TITLE=''
@@ -25,13 +25,8 @@ app.use(Gun.serve);
25
25
  const router = express.Router();
26
26
  router.use('/api', require('./routes'));
27
27
 
28
- const isDevelopment = process.env.NODE_ENV === 'development';
29
28
  const isProduction = process.env.NODE_ENV === 'production' || process.env.ABT_NODE_SERVICE_ENV === 'production';
30
29
 
31
- if (isDevelopment) {
32
- process.env.BLOCKLET_PORT = 3030;
33
- }
34
-
35
30
  if (isProduction) {
36
31
  app.use(cors());
37
32
  app.use(compression());
@@ -52,7 +47,7 @@ if (isProduction) {
52
47
  app.use(router);
53
48
  }
54
49
 
55
- const port = parseInt(process.env.BLOCKLET_PORT, 10) || 3030;
50
+ const port = parseInt(process.env.API_PORT, 10) || 3030;
56
51
 
57
52
  const server = app.listen(port, (err) => {
58
53
  if (err) throw err;
@@ -1,5 +1,7 @@
1
- const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
2
- const dappPort = process.env.APP_PORT || 3030;
1
+ require('dotenv-flow').config();
2
+
3
+ const port = process.env.BLOCKLET_PORT || process.env.PORT || 3000;
4
+ const apiPort = process.env.API_PORT || 3030;
3
5
 
4
6
  module.exports = {
5
7
  devServer: {
@@ -11,11 +13,11 @@ module.exports = {
11
13
  proxy: [
12
14
  {
13
15
  context: ['/api'],
14
- target: `http://127.0.0.1:${dappPort}`,
16
+ target: `http://127.0.0.1:${apiPort}`,
15
17
  },
16
18
  {
17
19
  context: ['/gun'],
18
- target: `ws://127.0.0.1:${dappPort}`,
20
+ target: `ws://127.0.0.1:${apiPort}`,
19
21
  ws: true,
20
22
  },
21
23
  ],