create-blocklet 0.3.4 → 0.3.5

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 (148) hide show
  1. package/index.js +3 -3
  2. package/lib/git.js +21 -5
  3. package/lib/index.js +6 -2
  4. package/lib/npm.js +1 -1
  5. package/lib/server.js +6 -2
  6. package/package.json +6 -8
  7. package/{template-static/blocklet-page → templates/blocklet-page-static}/README.md +0 -0
  8. package/{template-static/blocklet-page → templates/blocklet-page-static}/blocklet.md +0 -0
  9. package/{template-static/blocklet-page → templates/blocklet-page-static}/blocklet.yml +0 -0
  10. package/{template-static/blocklet-page → templates/blocklet-page-static}/package.json +1 -1
  11. package/{template-static/blocklet-page → templates/blocklet-page-static}/site/blocks/CustomBlock.mdx +0 -0
  12. package/{template-static/blocklet-page → templates/blocklet-page-static}/site/composes/MyLayout.mdx +0 -0
  13. package/{template-static/blocklet-page → templates/blocklet-page-static}/site/pages/index.mdx +0 -0
  14. package/{template-static/blocklet-page → templates/blocklet-page-static}/xmark.yml +0 -0
  15. package/{template-api/express → templates/express-api}/README.md +0 -0
  16. package/{template-api/express → templates/express-api}/api/hooks/pre-start.js +0 -0
  17. package/{template-api/express → templates/express-api}/api/index.js +0 -0
  18. package/{template-api/express → templates/express-api}/api/libs/auth.js +0 -0
  19. package/{template-api/express → templates/express-api}/api/libs/env.js +0 -0
  20. package/{template-api/express → templates/express-api}/api/libs/logger.js +0 -0
  21. package/{template-api/express → templates/express-api}/blocklet.md +0 -0
  22. package/{template-api/express → templates/express-api}/blocklet.yml +0 -0
  23. package/{template-api/express → templates/express-api}/package.json +0 -0
  24. package/{template-api/express → templates/express-api}/screenshots/.gitkeep +0 -0
  25. package/{template-dapp/nextjs → templates/nextjs-dapp}/.eslintrc.js +0 -0
  26. package/{template-dapp/nextjs → templates/nextjs-dapp}/README.md +0 -0
  27. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/hooks/pre-start.js +0 -0
  28. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/index.js +0 -0
  29. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/auth.js +0 -0
  30. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/env.js +0 -0
  31. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/logger.js +0 -0
  32. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/routes/index.js +0 -0
  33. package/{template-dapp/nextjs → templates/nextjs-dapp}/blocklet.md +0 -0
  34. package/{template-dapp/nextjs → templates/nextjs-dapp}/blocklet.yml +0 -0
  35. package/{template-dapp/nextjs → templates/nextjs-dapp}/next.config.js +0 -0
  36. package/{template-dapp/nextjs → templates/nextjs-dapp}/package.json +0 -0
  37. package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/_app.js +0 -0
  38. package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/api/hello.js +0 -0
  39. package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/index.js +0 -0
  40. package/{template-dapp/nextjs → templates/nextjs-dapp}/styles/Home.module.css +0 -0
  41. package/{template-dapp/nextjs → templates/nextjs-dapp}/styles/globals.css +0 -0
  42. package/{template-dapp/react → templates/react-dapp}/.env +0 -0
  43. package/{template-dapp/react → templates/react-dapp}/.env.local +0 -0
  44. package/{template-dapp/react → templates/react-dapp}/README.md +0 -0
  45. package/{template-dapp/react → templates/react-dapp}/api/hooks/pre-start.js +0 -0
  46. package/{template-dapp/react → templates/react-dapp}/api/index.js +0 -0
  47. package/{template-dapp/react → templates/react-dapp}/api/libs/auth.js +0 -0
  48. package/{template-dapp/react → templates/react-dapp}/api/libs/env.js +0 -0
  49. package/{template-dapp/react → templates/react-dapp}/api/libs/logger.js +0 -0
  50. package/{template-dapp/react → templates/react-dapp}/api/routes/index.js +0 -0
  51. package/{template-dapp/react → templates/react-dapp}/blocklet.md +0 -0
  52. package/{template-dapp/react → templates/react-dapp}/blocklet.yml +0 -0
  53. package/templates/react-dapp/craco.config.js +17 -0
  54. package/{template-dapp/react → templates/react-dapp}/package.json +3 -3
  55. package/{template-dapp/react → templates/react-dapp}/public/index.html +0 -0
  56. package/{template-dapp/react → templates/react-dapp}/src/app.css +0 -0
  57. package/{template-dapp/react → templates/react-dapp}/src/app.js +0 -0
  58. package/{template-dapp/react → templates/react-dapp}/src/index.js +0 -0
  59. package/{template-dapp/react → templates/react-dapp}/src/libs/api.js +0 -0
  60. package/{template-dapp/react → templates/react-dapp}/src/logo.svg +0 -0
  61. package/{template-dapp/react → templates/react-dapp}/src/pages/about.js +0 -0
  62. package/{template-dapp/react → templates/react-dapp}/src/pages/home.js +0 -0
  63. package/{template-static/react → templates/react-static}/.env +0 -0
  64. package/{template-static/react → templates/react-static}/README.md +0 -0
  65. package/{template-static/react → templates/react-static}/blocklet.md +0 -0
  66. package/{template-static/react → templates/react-static}/blocklet.yml +0 -0
  67. package/templates/react-static/craco.config.js +11 -0
  68. package/{template-static/react → templates/react-static}/package.json +3 -2
  69. package/{template-static/react → templates/react-static}/public/index.html +0 -0
  70. package/{template-static/react → templates/react-static}/src/app.css +0 -0
  71. package/{template-static/react → templates/react-static}/src/app.js +0 -0
  72. package/{template-static/react → templates/react-static}/src/index.js +0 -0
  73. package/{template-static/react → templates/react-static}/src/logo.svg +0 -0
  74. package/{template-static/react → templates/react-static}/src/pages/about.js +0 -0
  75. package/{template-static/react → templates/react-static}/src/pages/home.js +0 -0
  76. package/{template-dapp/vue → templates/vue-dapp}/.browserslistrc +0 -0
  77. package/{template-dapp/vue → templates/vue-dapp}/.env +0 -0
  78. package/{template-dapp/vue → templates/vue-dapp}/.eslintrc.js +0 -0
  79. package/{template-dapp/vue → templates/vue-dapp}/README.md +0 -0
  80. package/{template-dapp/vue → templates/vue-dapp}/api/hooks/pre-start.js +0 -0
  81. package/{template-dapp/vue → templates/vue-dapp}/api/index.js +0 -0
  82. package/{template-dapp/vue → templates/vue-dapp}/api/libs/auth.js +0 -0
  83. package/{template-dapp/vue → templates/vue-dapp}/api/libs/env.js +0 -0
  84. package/{template-dapp/vue → templates/vue-dapp}/api/libs/logger.js +0 -0
  85. package/{template-dapp/vue → templates/vue-dapp}/api/routes/index.js +0 -0
  86. package/{template-dapp/vue → templates/vue-dapp}/blocklet.md +0 -0
  87. package/{template-dapp/vue → templates/vue-dapp}/blocklet.yml +0 -0
  88. package/{template-dapp/vue → templates/vue-dapp}/index.html +0 -0
  89. package/{template-dapp/vue → templates/vue-dapp}/package.json +1 -1
  90. package/{template-dapp/vue → templates/vue-dapp}/src/App.vue +0 -0
  91. package/{template-dapp/vue → templates/vue-dapp}/src/assets/logo.png +0 -0
  92. package/{template-dapp/vue → templates/vue-dapp}/src/components/HelloWorld.vue +0 -0
  93. package/{template-dapp/vue → templates/vue-dapp}/src/libs/api.js +0 -0
  94. package/{template-dapp/vue → templates/vue-dapp}/src/main.js +0 -0
  95. package/{template-dapp/vue → templates/vue-dapp}/vite.config.js +0 -0
  96. package/{template-dapp/vue2 → templates/vue-static}/.browserslistrc +0 -0
  97. package/{template-dapp/vue2 → templates/vue-static}/.env +0 -0
  98. package/{template-static/vue → templates/vue-static}/.eslintrc.js +0 -0
  99. package/{template-static/vue → templates/vue-static}/README.md +0 -0
  100. package/{template-static/vue → templates/vue-static}/blocklet.md +0 -0
  101. package/{template-static/vue → templates/vue-static}/blocklet.yml +0 -0
  102. package/{template-static/vue → templates/vue-static}/index.html +0 -0
  103. package/{template-static/vue → templates/vue-static}/package.json +1 -1
  104. package/{template-static/vue → templates/vue-static}/src/App.vue +0 -0
  105. package/{template-dapp/vue2 → templates/vue-static}/src/assets/logo.png +0 -0
  106. package/{template-static/vue → templates/vue-static}/src/components/HelloWorld.vue +0 -0
  107. package/{template-static/vue → templates/vue-static}/src/main.js +0 -0
  108. package/{template-static/vue → templates/vue-static}/vite.config.js +0 -0
  109. package/{template-static/vue → templates/vue2-dapp}/.browserslistrc +0 -0
  110. package/{template-static/vue → templates/vue2-dapp}/.env +0 -0
  111. package/{template-dapp/vue2 → templates/vue2-dapp}/.eslintrc.js +0 -0
  112. package/{template-dapp/vue2 → templates/vue2-dapp}/README.md +0 -0
  113. package/{template-dapp/vue2 → templates/vue2-dapp}/api/hooks/pre-start.js +0 -0
  114. package/{template-dapp/vue2 → templates/vue2-dapp}/api/index.js +0 -0
  115. package/{template-dapp/vue2 → templates/vue2-dapp}/api/libs/auth.js +0 -0
  116. package/{template-dapp/vue2 → templates/vue2-dapp}/api/libs/env.js +0 -0
  117. package/{template-dapp/vue2 → templates/vue2-dapp}/api/libs/logger.js +0 -0
  118. package/{template-dapp/vue2 → templates/vue2-dapp}/api/routes/index.js +0 -0
  119. package/{template-dapp/vue2 → templates/vue2-dapp}/babel.config.js +0 -0
  120. package/{template-dapp/vue2 → templates/vue2-dapp}/blocklet.md +0 -0
  121. package/{template-dapp/vue2 → templates/vue2-dapp}/blocklet.yml +1 -0
  122. package/{template-dapp/vue2 → templates/vue2-dapp}/jsconfig.json +0 -0
  123. package/{template-dapp/vue2 → templates/vue2-dapp}/package.json +1 -1
  124. package/{template-dapp/vue2 → templates/vue2-dapp}/public/index.html +0 -0
  125. package/{template-dapp/vue2 → templates/vue2-dapp}/src/App.vue +0 -0
  126. package/{template-static/vue → templates/vue2-dapp}/src/assets/logo.png +0 -0
  127. package/{template-dapp/vue2 → templates/vue2-dapp}/src/components/HelloWorld.vue +0 -0
  128. package/{template-dapp/vue2 → templates/vue2-dapp}/src/libs/api.js +0 -0
  129. package/{template-dapp/vue2 → templates/vue2-dapp}/src/main.js +0 -0
  130. package/templates/vue2-dapp/vue.config.js +18 -0
  131. package/{template-static/vue2 → templates/vue2-static}/.browserslistrc +0 -0
  132. package/{template-static/vue2 → templates/vue2-static}/.env +0 -0
  133. package/{template-static/vue2 → templates/vue2-static}/.eslintrc.js +0 -0
  134. package/{template-static/vue2 → templates/vue2-static}/README.md +0 -0
  135. package/{template-static/vue2 → templates/vue2-static}/babel.config.js +0 -0
  136. package/{template-static/vue2 → templates/vue2-static}/blocklet.md +0 -0
  137. package/{template-static/vue2 → templates/vue2-static}/blocklet.yml +0 -0
  138. package/{template-static/vue2 → templates/vue2-static}/jsconfig.json +0 -0
  139. package/{template-static/vue2 → templates/vue2-static}/package.json +0 -0
  140. package/{template-static/vue2 → templates/vue2-static}/public/index.html +0 -0
  141. package/{template-static/vue2 → templates/vue2-static}/src/App.vue +0 -0
  142. package/{template-static/vue2 → templates/vue2-static}/src/assets/logo.png +0 -0
  143. package/{template-static/vue2 → templates/vue2-static}/src/components/HelloWorld.vue +0 -0
  144. package/{template-static/vue2 → templates/vue2-static}/src/main.js +0 -0
  145. package/templates/vue2-static/vue.config.js +13 -0
  146. package/template-dapp/react/src/setupProxy.js +0 -12
  147. package/template-dapp/vue2/vue.config.js +0 -10
  148. package/template-static/vue2/vue.config.js +0 -3
package/index.js CHANGED
@@ -15,7 +15,7 @@ import { checkServerInstalled, checkServerRunning, checkSatisfiedVersion, getSer
15
15
  import { toBlockletDid } from './lib/did.js';
16
16
  import { initGitRepo } from './lib/git.js';
17
17
 
18
- const { yellow, red, green, cyan, blue, bold, dim } = chalk;
18
+ const { yellow, red, green, cyan, blue, bold } = chalk;
19
19
 
20
20
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
21
21
 
@@ -229,7 +229,7 @@ async function init() {
229
229
 
230
230
  const scaffoldSpinner = ora('Creating project...').start();
231
231
 
232
- const templateDir = path.join(__dirname, `template-${type}/${framework}`);
232
+ const templateDir = path.join(__dirname, `templates/${framework}-${type}`);
233
233
  const name = packageName || targetDir;
234
234
 
235
235
  // copy common files
@@ -417,7 +417,7 @@ async function init() {
417
417
  }
418
418
 
419
419
  if (!hasStart) {
420
- console.log(dim('\n start it later by:\n'));
420
+ // console.log(dim('\n start it later by:\n'));
421
421
  if (root !== cwd) console.log(blue(` cd ${bold(related)}`));
422
422
 
423
423
  console.log(blue(` ${defaultAgent === 'yarn' ? 'yarn' : `${defaultAgent} install`}`));
package/lib/git.js CHANGED
@@ -1,7 +1,18 @@
1
- import { $, which, cd } from 'zx';
1
+ import { $, which, cd, chalk } from 'zx';
2
+
3
+ const { yellow } = chalk;
2
4
 
3
5
  $.verbose = false;
4
6
 
7
+ async function canInitGit() {
8
+ const isInstalled = await isGitInstalled();
9
+ const gitInfo = await getUserInfo();
10
+ if (isInstalled && gitInfo.name && gitInfo.email) {
11
+ return true;
12
+ }
13
+ return false;
14
+ }
15
+
5
16
  export async function isGitInstalled() {
6
17
  try {
7
18
  await which('git');
@@ -12,10 +23,15 @@ export async function isGitInstalled() {
12
23
  }
13
24
 
14
25
  export async function initGitRepo(root) {
15
- await cd(root);
16
- await $`git init`;
17
- await $`git add .`;
18
- await $`git commit -m 'init'`;
26
+ const canInstalled = await canInitGit();
27
+ if (canInstalled) {
28
+ await cd(root);
29
+ await $`git init`;
30
+ await $`git add .`;
31
+ await $`git commit -m 'init'`;
32
+ } else {
33
+ console.warn(`${yellow('Git is not installed')}`);
34
+ }
19
35
  }
20
36
 
21
37
  export async function getUserInfo() {
package/lib/index.js CHANGED
@@ -11,9 +11,13 @@ export async function getOutput(cmd) {
11
11
  }
12
12
 
13
13
  export async function getUser() {
14
+ function purifyString(str) {
15
+ return [undefined, 'undefined', null, 'null'].includes(str) ? '' : str;
16
+ }
17
+
14
18
  const [npmAuthor, gitUser, serverUser] = await Promise.all([getAuthor(), getUserInfo(), getServerUserInfo()]);
15
19
  return {
16
- name: serverUser.name || npmAuthor.name || gitUser.name || '',
17
- email: serverUser.email || npmAuthor.email || gitUser.email || '',
20
+ name: purifyString(serverUser.name) || purifyString(npmAuthor.name) || purifyString(gitUser.name) || '',
21
+ email: purifyString(serverUser.email) || purifyString(npmAuthor.email) || purifyString(gitUser.email) || '',
18
22
  };
19
23
  }
package/lib/npm.js CHANGED
@@ -8,7 +8,7 @@ export async function getAuthor() {
8
8
  const { stdout: name } = await $`npm config get init.author.name`;
9
9
  const { stdout: email } = await $`npm config get init.author.email`;
10
10
 
11
- return { name: name.trim(), email: email.trim() };
11
+ return { name: name?.trim(), email: email?.trim() };
12
12
  } catch {
13
13
  return {
14
14
  name: '',
package/lib/server.js CHANGED
@@ -13,8 +13,12 @@ export async function checkServerInstalled() {
13
13
  }
14
14
 
15
15
  export async function getServerVersion() {
16
- const { stdout: output } = await $`blocklet --version`;
17
- return output.trim();
16
+ try {
17
+ const { stdout: output } = await $`blocklet --version`;
18
+ return output.trim();
19
+ } catch (e) {
20
+ return '0.0.0';
21
+ }
18
22
  }
19
23
 
20
24
  export async function getServerStatus() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-blocklet",
3
- "version": "0.3.4",
3
+ "version": "0.3.5",
4
4
  "exports": "./index.js",
5
5
  "type": "module",
6
6
  "repository": "git@github.com:blocklet/create-blocklet.git",
@@ -13,9 +13,7 @@
13
13
  "index.js",
14
14
  "common",
15
15
  "lib",
16
- "template-api",
17
- "template-dapp",
18
- "template-static"
16
+ "templates"
19
17
  ],
20
18
  "engines": {
21
19
  "node": ">=16.0.0"
@@ -31,9 +29,9 @@
31
29
  "test:run": "vitest run"
32
30
  },
33
31
  "dependencies": {
34
- "@arcblock/did": "^1.14.25",
35
- "@ocap/mcrypto": "^1.14.25",
36
- "@ocap/util": "^1.14.25",
32
+ "@arcblock/did": "^1.15.7",
33
+ "@ocap/mcrypto": "^1.15.7",
34
+ "@ocap/util": "^1.15.7",
37
35
  "boxen": "^6.2.1",
38
36
  "ejs": "^3.1.6",
39
37
  "envfile": "^6.17.0",
@@ -44,7 +42,7 @@
44
42
  "prompts": "^2.4.2",
45
43
  "semver": "^7.3.5",
46
44
  "terminal-link": "^3.0.0",
47
- "zx": "^6.0.6"
45
+ "zx": "^6.0.7"
48
46
  },
49
47
  "devDependencies": {
50
48
  "@arcblock/eslint-config": "0.1.8",
@@ -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.28"
14
+ "@xmark/cli": "^2.0.31"
15
15
  }
16
16
  }
@@ -0,0 +1,17 @@
1
+ const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
2
+ const dappPort = process.env.APP_PORT || 3030;
3
+
4
+ module.exports = {
5
+ devServer: {
6
+ port,
7
+ client: {
8
+ // If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
9
+ webSocketURL: 'wss://0.0.0.0/ws',
10
+ },
11
+ proxy: {
12
+ '/api': {
13
+ target: `http://127.0.0.1:${dappPort}`,
14
+ },
15
+ },
16
+ },
17
+ };
@@ -2,8 +2,8 @@
2
2
  "name": "template-react",
3
3
  "version": "0.1.0",
4
4
  "scripts": {
5
- "dev": "react-scripts start",
6
- "build": "react-scripts build",
5
+ "dev": "craco start",
6
+ "build": "craco build",
7
7
  "eject": "react-scripts eject",
8
8
  "lint": "eslint src api --ext .mjs,.js,.jsx,.ts,.tsx",
9
9
  "start": "npm-run-all --parallel start:*",
@@ -42,6 +42,7 @@
42
42
  "@arcblock/did-auth": "^1.15.2",
43
43
  "@arcblock/did-auth-storage-nedb": "^1.6.3",
44
44
  "@blocklet/sdk": "^1.7.0",
45
+ "@craco/craco": "^6.4.3",
45
46
  "@ocap/client": "^1.15.2",
46
47
  "@ocap/mcrypto": "^1.15.2",
47
48
  "@ocap/wallet": "^1.15.2",
@@ -70,7 +71,6 @@
70
71
  "eslint-plugin-react": "^7.24.0",
71
72
  "eslint-plugin-react-hooks": "^4.2.0",
72
73
  "eslint-plugin-unicorn": "^34.0.1",
73
- "http-proxy-middleware": "^2.0.4",
74
74
  "husky": "^7.0.4",
75
75
  "lint-staged": "^12.3.7",
76
76
  "nodemon": "^2.0.15",
@@ -0,0 +1,11 @@
1
+ const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
2
+
3
+ module.exports = {
4
+ devServer: {
5
+ port,
6
+ client: {
7
+ // If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
8
+ webSocketURL: 'wss://0.0.0.0/ws',
9
+ },
10
+ },
11
+ };
@@ -2,8 +2,8 @@
2
2
  "name": "template-react",
3
3
  "version": "0.1.0",
4
4
  "scripts": {
5
- "dev": "react-scripts start",
6
- "build": "react-scripts build",
5
+ "dev": "craco start",
6
+ "build": "craco build",
7
7
  "eject": "react-scripts eject",
8
8
  "lint": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx",
9
9
  "start": "npm run dev",
@@ -35,6 +35,7 @@
35
35
  ]
36
36
  },
37
37
  "dependencies": {
38
+ "@craco/craco": "^6.4.3",
38
39
  "react": "^17.0.2",
39
40
  "react-dom": "^17.0.2",
40
41
  "react-router-dom": "^6.2.2",
File without changes
@@ -10,7 +10,7 @@
10
10
  "start:api": "NODE_ENV=development nodemon api/index.js -w api",
11
11
  "clean": "rm -rf .blocklet",
12
12
  "bundle": "npm run bundle:client && npm run bundle:api",
13
- "bundle:client": "vite build --base /.blocklet/proxy/<%= did %>",
13
+ "bundle:client": "vite build --base /.blocklet/proxy/<%= did %>/",
14
14
  "bundle:api": "npm run clean && blocklet bundle --zip --create-release",
15
15
  "deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
16
16
  "upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
@@ -8,7 +8,7 @@
8
8
  "lint": "eslint src --ext .mjs,.js,.vue",
9
9
  "serve": "vite preview",
10
10
  "clean": "rm -rf .blocklet",
11
- "bundle": "npm run clean && vite build --base /.blocklet/proxy/<%= did %> && blocklet bundle --zip --create-release",
11
+ "bundle": "npm run clean && vite build --base /.blocklet/proxy/<%= did %>/ && blocklet bundle --zip --create-release",
12
12
  "deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
13
13
  "upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
14
14
  "prepare": "husky install"
@@ -22,6 +22,7 @@ files:
22
22
  - blocklet.md
23
23
  - screenshots
24
24
  - api/hooks/pre-start.js
25
+ - dist
25
26
  interfaces:
26
27
  - type: web
27
28
  name: publicUrl
@@ -11,7 +11,7 @@
11
11
  "start:api": "NODE_ENV=development nodemon api/index.js -w api",
12
12
  "clean": "rm -rf .blocklet",
13
13
  "bundle": "npm run bundle:client && npm run bundle:api",
14
- "bundle:client": "PUBLIC_PATH=/.blocklet/proxy/z8ia5PYHKJaG7LxTiKK74YhN1vkVMf7N7VncW",
14
+ "bundle:client": "PUBLIC_PATH=/.blocklet/proxy/<%= did %> npm run build",
15
15
  "bundle:api": "npm run clean && blocklet bundle --zip --create-release",
16
16
  "deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
17
17
  "upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
@@ -0,0 +1,18 @@
1
+ const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
2
+
3
+ module.exports = {
4
+ publicPath: process.env.PUBLIC_PATH || '/',
5
+ devServer: {
6
+ port,
7
+ allowedHosts: 'all',
8
+ client: {
9
+ // If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
10
+ webSocketURL: 'wss://0.0.0.0/ws',
11
+ },
12
+ proxy: {
13
+ '/api': {
14
+ target: 'http://127.0.0.1:3030',
15
+ },
16
+ },
17
+ },
18
+ };
@@ -0,0 +1,13 @@
1
+ const port = process.env.BLOCKLET_PORT || process.env.PORT || 8080;
2
+
3
+ module.exports = {
4
+ publicPath: process.env.PUBLIC_PATH || '/',
5
+ devServer: {
6
+ port,
7
+ allowedHosts: 'all',
8
+ client: {
9
+ // If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
10
+ webSocketURL: 'wss://0.0.0.0/ws',
11
+ },
12
+ },
13
+ };
@@ -1,12 +0,0 @@
1
- require('dotenv-flow').config();
2
-
3
- const { createProxyMiddleware } = require('http-proxy-middleware');
4
-
5
- module.exports = (app) => {
6
- app.use(
7
- '/api',
8
- createProxyMiddleware({
9
- target: `http://127.0.0.1:${process.env.APP_PORT || 3030}`,
10
- })
11
- );
12
- };
@@ -1,10 +0,0 @@
1
- module.exports = {
2
- publicPath: process.env.PUBLIC_PATH || '/',
3
- devServer: {
4
- proxy: {
5
- '/api': {
6
- target: 'http://127.0.0.1:3030',
7
- },
8
- },
9
- },
10
- };
@@ -1,3 +0,0 @@
1
- module.exports = {
2
- publicPath: process.env.PUBLIC_PATH || '/',
3
- };