create-blocklet 0.3.3 → 0.3.6

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 (170) hide show
  1. package/README.md +14 -0
  2. package/index.js +38 -28
  3. package/lib/did.js +1 -1
  4. package/lib/git.js +21 -5
  5. package/lib/index.js +8 -3
  6. package/lib/npm.js +1 -1
  7. package/lib/server.js +23 -11
  8. package/package.json +9 -10
  9. package/{template-static/blocklet-page → templates/blocklet-page-static}/README.md +0 -0
  10. package/{template-static/blocklet-page → templates/blocklet-page-static}/blocklet.md +0 -0
  11. package/{template-static/blocklet-page → templates/blocklet-page-static}/blocklet.yml +0 -0
  12. package/{template-static/blocklet-page → templates/blocklet-page-static}/package.json +1 -1
  13. package/{template-static/blocklet-page → templates/blocklet-page-static}/site/blocks/CustomBlock.mdx +0 -0
  14. package/{template-static/blocklet-page → templates/blocklet-page-static}/site/composes/MyLayout.mdx +0 -0
  15. package/{template-static/blocklet-page → templates/blocklet-page-static}/site/pages/index.mdx +0 -0
  16. package/{template-static/blocklet-page → templates/blocklet-page-static}/xmark.yml +0 -0
  17. package/{template-api/express → templates/express-api}/README.md +0 -0
  18. package/{template-api/express → templates/express-api}/api/hooks/pre-start.js +0 -0
  19. package/{template-api/express → templates/express-api}/api/index.js +0 -0
  20. package/{template-api/express → templates/express-api}/api/libs/auth.js +0 -0
  21. package/{template-api/express → templates/express-api}/api/libs/env.js +0 -0
  22. package/{template-api/express → templates/express-api}/api/libs/logger.js +0 -0
  23. package/{template-api/express → templates/express-api}/blocklet.md +0 -0
  24. package/{template-api/express → templates/express-api}/blocklet.yml +3 -4
  25. package/{template-api/express → templates/express-api}/package.json +0 -0
  26. package/{template-api/express → templates/express-api}/screenshots/.gitkeep +0 -0
  27. package/{template-dapp/nextjs → templates/nextjs-dapp}/.eslintrc.js +0 -0
  28. package/{template-dapp/nextjs → templates/nextjs-dapp}/README.md +0 -0
  29. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/hooks/pre-start.js +0 -0
  30. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/index.js +0 -0
  31. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/auth.js +0 -0
  32. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/env.js +0 -0
  33. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/logger.js +0 -0
  34. package/{template-dapp/nextjs → templates/nextjs-dapp}/api/routes/index.js +0 -0
  35. package/{template-dapp/nextjs → templates/nextjs-dapp}/blocklet.md +0 -0
  36. package/{template-dapp/nextjs → templates/nextjs-dapp}/blocklet.yml +3 -4
  37. package/{template-dapp/nextjs → templates/nextjs-dapp}/next.config.js +0 -0
  38. package/{template-dapp/nextjs → templates/nextjs-dapp}/package.json +5 -5
  39. package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/_app.js +0 -0
  40. package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/api/hello.js +0 -0
  41. package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/index.js +0 -0
  42. package/{template-dapp/nextjs → templates/nextjs-dapp}/styles/Home.module.css +0 -0
  43. package/{template-dapp/nextjs → templates/nextjs-dapp}/styles/globals.css +0 -0
  44. package/{template-dapp/react → templates/react-dapp}/.env +0 -0
  45. package/{template-dapp/react → templates/react-dapp}/.env.local +0 -0
  46. package/{template-dapp/react → templates/react-dapp}/README.md +0 -0
  47. package/{template-dapp/react → templates/react-dapp}/api/hooks/pre-start.js +0 -0
  48. package/{template-dapp/react → templates/react-dapp}/api/index.js +0 -0
  49. package/{template-dapp/react → templates/react-dapp}/api/libs/auth.js +0 -0
  50. package/{template-dapp/react → templates/react-dapp}/api/libs/env.js +0 -0
  51. package/{template-dapp/react → templates/react-dapp}/api/libs/logger.js +0 -0
  52. package/{template-dapp/react → templates/react-dapp}/api/routes/index.js +0 -0
  53. package/{template-dapp/react → templates/react-dapp}/blocklet.md +0 -0
  54. package/{template-dapp/react → templates/react-dapp}/blocklet.yml +3 -4
  55. package/templates/react-dapp/craco.config.js +17 -0
  56. package/{template-dapp/react → templates/react-dapp}/package.json +8 -8
  57. package/{template-dapp/react → templates/react-dapp}/public/index.html +0 -0
  58. package/{template-static/react → templates/react-dapp}/src/app.css +5 -3
  59. package/{template-dapp/react → templates/react-dapp}/src/app.js +0 -0
  60. package/{template-dapp/react → templates/react-dapp}/src/index.js +0 -0
  61. package/{template-dapp/react → templates/react-dapp}/src/libs/api.js +0 -0
  62. package/{template-dapp/react → templates/react-dapp}/src/logo.svg +0 -0
  63. package/{template-dapp/react → templates/react-dapp}/src/pages/about.js +0 -0
  64. package/{template-dapp/react → templates/react-dapp}/src/pages/home.js +1 -1
  65. package/templates/react-gun-dapp/.env +3 -0
  66. package/templates/react-gun-dapp/README.md +153 -0
  67. package/{template-dapp/vue → templates/react-gun-dapp}/api/hooks/pre-start.js +0 -0
  68. package/templates/react-gun-dapp/api/index.js +65 -0
  69. package/{template-dapp/vue → templates/react-gun-dapp}/api/libs/auth.js +0 -0
  70. package/{template-dapp/vue → templates/react-gun-dapp}/api/libs/env.js +0 -0
  71. package/{template-dapp/vue → templates/react-gun-dapp}/api/libs/logger.js +0 -0
  72. package/{template-dapp/vue → templates/react-gun-dapp}/api/routes/index.js +0 -0
  73. package/{template-static/react → templates/react-gun-dapp}/blocklet.md +0 -0
  74. package/templates/react-gun-dapp/blocklet.yml +57 -0
  75. package/templates/react-gun-dapp/craco.config.js +30 -0
  76. package/templates/react-gun-dapp/package.json +81 -0
  77. package/{template-static/react → templates/react-gun-dapp}/public/index.html +0 -0
  78. package/templates/react-gun-dapp/src/app.css +41 -0
  79. package/{template-static/react → templates/react-gun-dapp}/src/app.js +0 -0
  80. package/{template-static/react → templates/react-gun-dapp}/src/index.js +0 -0
  81. package/{template-dapp/vue → templates/react-gun-dapp}/src/libs/api.js +0 -0
  82. package/templates/react-gun-dapp/src/logo.svg +1 -0
  83. package/templates/react-gun-dapp/src/pages/about.js +26 -0
  84. package/templates/react-gun-dapp/src/pages/home.js +61 -0
  85. package/{template-static/react → templates/react-static}/.env +0 -0
  86. package/{template-static/react → templates/react-static}/README.md +0 -0
  87. package/templates/react-static/blocklet.md +3 -0
  88. package/{template-static/react → templates/react-static}/blocklet.yml +3 -4
  89. package/templates/react-static/craco.config.js +11 -0
  90. package/{template-static/react → templates/react-static}/package.json +3 -2
  91. package/templates/react-static/public/index.html +35 -0
  92. package/{template-dapp/react → templates/react-static}/src/app.css +5 -3
  93. package/templates/react-static/src/app.js +32 -0
  94. package/templates/react-static/src/index.js +5 -0
  95. package/{template-static/react → templates/react-static}/src/logo.svg +0 -0
  96. package/{template-static/react → templates/react-static}/src/pages/about.js +0 -0
  97. package/{template-static/react → templates/react-static}/src/pages/home.js +4 -0
  98. package/{template-dapp/vue → templates/vue-dapp}/.browserslistrc +0 -0
  99. package/{template-dapp/vue → templates/vue-dapp}/.env +0 -0
  100. package/{template-dapp/vue → templates/vue-dapp}/.eslintrc.js +0 -0
  101. package/{template-dapp/vue → templates/vue-dapp}/README.md +0 -0
  102. package/{template-dapp/vue2 → templates/vue-dapp}/api/hooks/pre-start.js +0 -0
  103. package/{template-dapp/vue → templates/vue-dapp}/api/index.js +0 -0
  104. package/{template-dapp/vue2 → templates/vue-dapp}/api/libs/auth.js +0 -0
  105. package/{template-dapp/vue2 → templates/vue-dapp}/api/libs/env.js +0 -0
  106. package/{template-dapp/vue2 → templates/vue-dapp}/api/libs/logger.js +0 -0
  107. package/{template-dapp/vue2 → templates/vue-dapp}/api/routes/index.js +0 -0
  108. package/{template-dapp/vue → templates/vue-dapp}/blocklet.md +0 -0
  109. package/{template-dapp/vue → templates/vue-dapp}/blocklet.yml +3 -4
  110. package/{template-dapp/vue → templates/vue-dapp}/index.html +0 -0
  111. package/{template-dapp/vue → templates/vue-dapp}/package.json +7 -7
  112. package/{template-dapp/vue → templates/vue-dapp}/src/App.vue +0 -0
  113. package/{template-dapp/vue → templates/vue-dapp}/src/assets/logo.png +0 -0
  114. package/{template-dapp/vue → templates/vue-dapp}/src/components/HelloWorld.vue +0 -0
  115. package/{template-dapp/vue2 → templates/vue-dapp}/src/libs/api.js +0 -0
  116. package/{template-dapp/vue → templates/vue-dapp}/src/main.js +0 -0
  117. package/{template-dapp/vue → templates/vue-dapp}/vite.config.js +0 -0
  118. package/{template-dapp/vue2 → templates/vue-static}/.browserslistrc +0 -0
  119. package/{template-dapp/vue2 → templates/vue-static}/.env +0 -0
  120. package/{template-static/vue → templates/vue-static}/.eslintrc.js +0 -0
  121. package/{template-static/vue → templates/vue-static}/README.md +0 -0
  122. package/{template-static/vue → templates/vue-static}/blocklet.md +0 -0
  123. package/{template-static/vue → templates/vue-static}/blocklet.yml +3 -4
  124. package/{template-static/vue → templates/vue-static}/index.html +0 -0
  125. package/{template-static/vue → templates/vue-static}/package.json +1 -1
  126. package/{template-static/vue → templates/vue-static}/src/App.vue +0 -0
  127. package/{template-dapp/vue2 → templates/vue-static}/src/assets/logo.png +0 -0
  128. package/{template-static/vue → templates/vue-static}/src/components/HelloWorld.vue +0 -0
  129. package/{template-static/vue → templates/vue-static}/src/main.js +0 -0
  130. package/{template-static/vue → templates/vue-static}/vite.config.js +0 -0
  131. package/{template-static/vue → templates/vue2-dapp}/.browserslistrc +0 -0
  132. package/{template-static/vue → templates/vue2-dapp}/.env +0 -0
  133. package/{template-dapp/vue2 → templates/vue2-dapp}/.eslintrc.js +0 -0
  134. package/{template-dapp/vue2 → templates/vue2-dapp}/README.md +0 -0
  135. package/templates/vue2-dapp/api/hooks/pre-start.js +33 -0
  136. package/{template-dapp/vue2 → templates/vue2-dapp}/api/index.js +0 -0
  137. package/templates/vue2-dapp/api/libs/auth.js +22 -0
  138. package/templates/vue2-dapp/api/libs/env.js +6 -0
  139. package/templates/vue2-dapp/api/libs/logger.js +3 -0
  140. package/templates/vue2-dapp/api/routes/index.js +6 -0
  141. package/{template-dapp/vue2 → templates/vue2-dapp}/babel.config.js +0 -0
  142. package/{template-dapp/vue2 → templates/vue2-dapp}/blocklet.md +0 -0
  143. package/{template-dapp/vue2 → templates/vue2-dapp}/blocklet.yml +4 -4
  144. package/{template-dapp/vue2 → templates/vue2-dapp}/jsconfig.json +0 -0
  145. package/{template-dapp/vue2 → templates/vue2-dapp}/package.json +6 -6
  146. package/{template-dapp/vue2 → templates/vue2-dapp}/public/index.html +0 -0
  147. package/{template-dapp/vue2 → templates/vue2-dapp}/src/App.vue +0 -0
  148. package/{template-static/vue → templates/vue2-dapp}/src/assets/logo.png +0 -0
  149. package/{template-dapp/vue2 → templates/vue2-dapp}/src/components/HelloWorld.vue +0 -0
  150. package/templates/vue2-dapp/src/libs/api.js +14 -0
  151. package/{template-dapp/vue2 → templates/vue2-dapp}/src/main.js +0 -0
  152. package/templates/vue2-dapp/vue.config.js +18 -0
  153. package/{template-static/vue2 → templates/vue2-static}/.browserslistrc +0 -0
  154. package/{template-static/vue2 → templates/vue2-static}/.env +0 -0
  155. package/{template-static/vue2 → templates/vue2-static}/.eslintrc.js +0 -0
  156. package/{template-static/vue2 → templates/vue2-static}/README.md +0 -0
  157. package/{template-static/vue2 → templates/vue2-static}/babel.config.js +0 -0
  158. package/{template-static/vue2 → templates/vue2-static}/blocklet.md +0 -0
  159. package/{template-static/vue2 → templates/vue2-static}/blocklet.yml +3 -4
  160. package/{template-static/vue2 → templates/vue2-static}/jsconfig.json +0 -0
  161. package/{template-static/vue2 → templates/vue2-static}/package.json +0 -0
  162. package/{template-static/vue2 → templates/vue2-static}/public/index.html +0 -0
  163. package/{template-static/vue2 → templates/vue2-static}/src/App.vue +0 -0
  164. package/{template-static/vue2 → templates/vue2-static}/src/assets/logo.png +0 -0
  165. package/{template-static/vue2 → templates/vue2-static}/src/components/HelloWorld.vue +0 -0
  166. package/{template-static/vue2 → templates/vue2-static}/src/main.js +0 -0
  167. package/templates/vue2-static/vue.config.js +13 -0
  168. package/template-dapp/react/src/setupProxy.js +0 -12
  169. package/template-dapp/vue2/vue.config.js +0 -10
  170. package/template-static/vue2/vue.config.js +0 -3
@@ -8,19 +8,21 @@ body {
8
8
  }
9
9
 
10
10
  .app-logo {
11
- height: 40vmin;
11
+ height: 10vmin;
12
12
  pointer-events: none;
13
13
  }
14
14
 
15
15
  .app-header {
16
- background-color: #282c34;
17
16
  min-height: 100vh;
18
17
  display: flex;
19
18
  flex-direction: column;
20
19
  align-items: center;
21
20
  justify-content: center;
22
21
  font-size: calc(10px + 2vmin);
23
- color: white;
22
+ }
23
+
24
+ pre {
25
+ font-size: 0.75em;
24
26
  }
25
27
 
26
28
  .app-link {
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
3
+
4
+ import './app.css';
5
+ import Home from './pages/home';
6
+ import About from './pages/about';
7
+
8
+ function App() {
9
+ return (
10
+ <div className="app">
11
+ <Routes>
12
+ <Route exact path="/" element={<Home />} />
13
+ <Route path="/about" element={<About />} />
14
+ <Route path="/home" element={<Home />} />
15
+ <Route path="*" element={<Navigate to="/" />} />
16
+ </Routes>
17
+ </div>
18
+ );
19
+ }
20
+
21
+ const WrappedApp = App;
22
+
23
+ export default () => {
24
+ // While the blocklet is deploy to a sub path, this will be work properly.
25
+ const basename = window?.blocklet?.prefix || '/';
26
+
27
+ return (
28
+ <Router basename={basename}>
29
+ <WrappedApp />
30
+ </Router>
31
+ );
32
+ };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom';
3
+ import App from './app';
4
+
5
+ ReactDOM.render(<App />, document.getElementById('root'));
@@ -1,11 +1,15 @@
1
1
  import React from 'react';
2
2
  import { Link } from 'react-router-dom';
3
+
3
4
  import logo from '../logo.svg';
4
5
 
5
6
  const Home = () => {
6
7
  return (
7
8
  <header className="app-header">
8
9
  <img src={logo} className="app-logo" alt="logo" />
10
+ <pre style={{ textAlign: 'left' }}>
11
+ <code>window.blocklet = {JSON.stringify(window.blocklet, null, 2)}</code>
12
+ </pre>
9
13
  <Link className="app-link" to="/about">
10
14
  About
11
15
  </Link>
File without changes
@@ -34,10 +34,9 @@ community: ''
34
34
  documentation: ''
35
35
  homepage: ''
36
36
  license: ''
37
- charging:
38
- price: 0
39
- tokens: []
40
- shares: []
37
+ payment:
38
+ price: []
39
+ share: []
41
40
  timeout:
42
41
  start: 60
43
42
  requirements:
@@ -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",
@@ -18,12 +18,12 @@
18
18
  "prepare": "husky install"
19
19
  },
20
20
  "dependencies": {
21
- "@arcblock/did-auth": "^1.15.2",
21
+ "@arcblock/did-auth": "^1.16.0",
22
22
  "@arcblock/did-auth-storage-nedb": "^1.6.3",
23
- "@blocklet/sdk": "^1.7.0",
24
- "@ocap/client": "^1.15.2",
25
- "@ocap/mcrypto": "^1.15.2",
26
- "@ocap/wallet": "^1.15.2",
23
+ "@blocklet/sdk": "^1.7.6",
24
+ "@ocap/client": "^1.16.0",
25
+ "@ocap/mcrypto": "^1.16.0",
26
+ "@ocap/wallet": "^1.16.0",
27
27
  "axios": "^0.26.1",
28
28
  "compression": "^1.7.4",
29
29
  "cookie-parser": "^1.4.6",
@@ -47,7 +47,7 @@
47
47
  "npm-run-all": "^4.1.5",
48
48
  "prettier": "^2.6.0",
49
49
  "vite": "^2.8.6",
50
- "vite-plugin-blocklet": "^0.1.1"
50
+ "vite-plugin-blocklet": "^0.1.2"
51
51
  },
52
52
  "lint-staged": {
53
53
  "*.{mjs,js,vue}": [
@@ -32,10 +32,9 @@ community: ''
32
32
  documentation: ''
33
33
  homepage: ''
34
34
  license: ''
35
- charging:
36
- price: 0
37
- tokens: []
38
- shares: []
35
+ payment:
36
+ price: []
37
+ share: []
39
38
  timeout:
40
39
  start: 60
41
40
  requirements:
@@ -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"
@@ -0,0 +1,33 @@
1
+ require('@blocklet/sdk/lib/error-handler');
2
+ require('dotenv-flow').config();
3
+
4
+ const Client = require('@ocap/client');
5
+
6
+ const env = require('../libs/env');
7
+ const logger = require('../libs/logger');
8
+ const { wallet } = require('../libs/auth');
9
+ const { name } = require('../../package.json');
10
+
11
+ const ensureAccountDeclared = async () => {
12
+ if (env.isComponent) return;
13
+ if (!env.chainHost) return;
14
+
15
+ const client = new Client(env.chainHost);
16
+ const { state } = await client.getAccountState({ address: wallet.toAddress() }, { ignoreFields: ['context'] });
17
+ if (!state) {
18
+ const hash = await client.declare({ moniker: name, wallet });
19
+ logger.log(`app account declared on chain ${env.chainHost}`, hash);
20
+ } else {
21
+ logger.log(`app account already declared on chain ${env.chainHost}`);
22
+ }
23
+ };
24
+
25
+ (async () => {
26
+ try {
27
+ await ensureAccountDeclared();
28
+ process.exit(0);
29
+ } catch (err) {
30
+ logger.error(`${name} pre-start error`, err.message);
31
+ process.exit(1);
32
+ }
33
+ })();
@@ -0,0 +1,22 @@
1
+ const path = require('path');
2
+ const AuthStorage = require('@arcblock/did-auth-storage-nedb');
3
+ const getWallet = require('@blocklet/sdk/lib/wallet');
4
+ const WalletAuthenticator = require('@blocklet/sdk/lib/wallet-authenticator');
5
+ const WalletHandler = require('@blocklet/sdk/lib/wallet-handler');
6
+
7
+ const env = require('./env');
8
+
9
+ const wallet = getWallet();
10
+ const authenticator = new WalletAuthenticator();
11
+ const handlers = new WalletHandler({
12
+ authenticator,
13
+ tokenStorage: new AuthStorage({
14
+ dbPath: path.join(env.dataDir, 'auth.db'),
15
+ }),
16
+ });
17
+
18
+ module.exports = {
19
+ authenticator,
20
+ handlers,
21
+ wallet,
22
+ };
@@ -0,0 +1,6 @@
1
+ const env = require('@blocklet/sdk/lib/env');
2
+
3
+ module.exports = {
4
+ ...env,
5
+ chainHost: process.env.CHAIN_HOST || '',
6
+ };
@@ -0,0 +1,3 @@
1
+ const logger = console;
2
+
3
+ module.exports = logger;
@@ -0,0 +1,6 @@
1
+ const middleware = require('@blocklet/sdk/lib/middlewares');
2
+ const router = require('express').Router();
3
+
4
+ router.use('/user', middleware.user(), (req, res) => res.json(req.user || {}));
5
+
6
+ module.exports = router;
@@ -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
@@ -33,10 +34,9 @@ community: ''
33
34
  documentation: ''
34
35
  homepage: ''
35
36
  license: ''
36
- charging:
37
- price: 0
38
- tokens: []
39
- shares: []
37
+ payment:
38
+ price: []
39
+ share: []
40
40
  timeout:
41
41
  start: 60
42
42
  requirements:
@@ -11,19 +11,19 @@
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",
18
18
  "prepare": "husky install"
19
19
  },
20
20
  "dependencies": {
21
- "@arcblock/did-auth": "^1.15.2",
21
+ "@arcblock/did-auth": "^1.16.0",
22
22
  "@arcblock/did-auth-storage-nedb": "^1.6.3",
23
- "@blocklet/sdk": "^1.7.0",
24
- "@ocap/client": "^1.15.2",
25
- "@ocap/mcrypto": "^1.15.2",
26
- "@ocap/wallet": "^1.15.2",
23
+ "@blocklet/sdk": "^1.7.6",
24
+ "@ocap/client": "^1.16.0",
25
+ "@ocap/mcrypto": "^1.16.0",
26
+ "@ocap/wallet": "^1.16.0",
27
27
  "axios": "^0.26.1",
28
28
  "compression": "^1.7.4",
29
29
  "cookie-parser": "^1.4.6",
@@ -0,0 +1,14 @@
1
+ import axios from 'axios';
2
+
3
+ axios.interceptors.request.use(
4
+ (config) => {
5
+ const prefix = window.blocklet ? window.blocklet.prefix : '/';
6
+ config.baseURL = prefix || '';
7
+ config.timeout = 200000;
8
+
9
+ return config;
10
+ },
11
+ (error) => Promise.reject(error)
12
+ );
13
+
14
+ export default axios;
@@ -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
+ };
@@ -32,10 +32,9 @@ community: ''
32
32
  documentation: ''
33
33
  homepage: ''
34
34
  license: ''
35
- charging:
36
- price: 0
37
- tokens: []
38
- shares: []
35
+ payment:
36
+ price: []
37
+ share: []
39
38
  timeout:
40
39
  start: 60
41
40
  requirements:
@@ -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
- };