create-blocklet 0.3.4 → 0.3.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/common/.prettierrc +1 -1
- package/index.js +10 -5
- package/lib/git.js +21 -5
- package/lib/index.js +8 -3
- package/lib/npm.js +1 -1
- package/lib/server.js +23 -11
- package/package.json +8 -10
- package/{template-static/blocklet-page → templates/blocklet-page-static}/README.md +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/blocklet.md +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/blocklet.yml +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/package.json +1 -1
- package/{template-static/blocklet-page → templates/blocklet-page-static}/site/blocks/CustomBlock.mdx +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/site/composes/MyLayout.mdx +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/site/pages/index.mdx +0 -0
- package/{template-static/blocklet-page → templates/blocklet-page-static}/xmark.yml +0 -0
- package/{template-api/express → templates/express-api}/README.md +0 -0
- package/{template-api/express → templates/express-api}/api/hooks/pre-start.js +0 -0
- package/{template-api/express → templates/express-api}/api/index.js +0 -0
- package/{template-api/express → templates/express-api}/api/libs/auth.js +0 -0
- package/{template-api/express → templates/express-api}/api/libs/env.js +0 -0
- package/{template-api/express → templates/express-api}/api/libs/logger.js +0 -0
- package/{template-api/express → templates/express-api}/blocklet.md +0 -0
- package/{template-api/express → templates/express-api}/blocklet.yml +0 -0
- package/{template-api/express → templates/express-api}/package.json +0 -0
- package/{template-api/express → templates/express-api}/screenshots/.gitkeep +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/.eslintrc.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/README.md +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/hooks/pre-start.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/index.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/auth.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/env.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/libs/logger.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/api/routes/index.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/blocklet.md +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/blocklet.yml +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/next.config.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/package.json +5 -5
- package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/_app.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/api/hello.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/pages/index.js +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/styles/Home.module.css +0 -0
- package/{template-dapp/nextjs → templates/nextjs-dapp}/styles/globals.css +0 -0
- package/{template-dapp/react → templates/react-dapp}/.env +0 -0
- package/{template-dapp/react → templates/react-dapp}/.env.local +0 -0
- package/{template-dapp/react → templates/react-dapp}/README.md +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/hooks/pre-start.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/index.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/libs/auth.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/libs/env.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/libs/logger.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/api/routes/index.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/blocklet.md +0 -0
- package/{template-dapp/react → templates/react-dapp}/blocklet.yml +0 -0
- package/templates/react-dapp/craco.config.js +17 -0
- package/{template-dapp/react → templates/react-dapp}/package.json +8 -8
- package/{template-dapp/react → templates/react-dapp}/public/index.html +0 -0
- package/{template-static/react → templates/react-dapp}/src/app.css +5 -3
- package/{template-dapp/react → templates/react-dapp}/src/app.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/index.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/libs/api.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/logo.svg +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/pages/about.js +0 -0
- package/{template-dapp/react → templates/react-dapp}/src/pages/home.js +1 -1
- package/templates/react-gun-dapp/.env +3 -0
- package/templates/react-gun-dapp/README.md +153 -0
- package/{template-dapp/vue → templates/react-gun-dapp}/api/hooks/pre-start.js +0 -0
- package/templates/react-gun-dapp/api/index.js +65 -0
- package/{template-dapp/vue → templates/react-gun-dapp}/api/libs/auth.js +0 -0
- package/{template-dapp/vue → templates/react-gun-dapp}/api/libs/env.js +0 -0
- package/{template-dapp/vue → templates/react-gun-dapp}/api/libs/logger.js +0 -0
- package/{template-dapp/vue → templates/react-gun-dapp}/api/routes/index.js +0 -0
- package/{template-static/react → templates/react-gun-dapp}/blocklet.md +0 -0
- package/templates/react-gun-dapp/blocklet.yml +57 -0
- package/templates/react-gun-dapp/craco.config.js +30 -0
- package/templates/react-gun-dapp/package.json +81 -0
- package/{template-static/react → templates/react-gun-dapp}/public/index.html +0 -0
- package/templates/react-gun-dapp/src/app.css +41 -0
- package/{template-static/react → templates/react-gun-dapp}/src/app.js +0 -0
- package/{template-static/react → templates/react-gun-dapp}/src/index.js +0 -0
- package/{template-dapp/vue → templates/react-gun-dapp}/src/libs/api.js +0 -0
- package/templates/react-gun-dapp/src/logo.svg +1 -0
- package/templates/react-gun-dapp/src/pages/about.js +26 -0
- package/templates/react-gun-dapp/src/pages/home.js +61 -0
- package/{template-static/react → templates/react-static}/.env +0 -0
- package/{template-static/react → templates/react-static}/README.md +0 -0
- package/templates/react-static/blocklet.md +3 -0
- package/{template-static/react → templates/react-static}/blocklet.yml +0 -0
- package/templates/react-static/craco.config.js +11 -0
- package/{template-static/react → templates/react-static}/package.json +3 -2
- package/templates/react-static/public/index.html +35 -0
- package/{template-dapp/react → templates/react-static}/src/app.css +5 -3
- package/templates/react-static/src/app.js +32 -0
- package/templates/react-static/src/index.js +5 -0
- package/{template-static/react → templates/react-static}/src/logo.svg +0 -0
- package/{template-static/react → templates/react-static}/src/pages/about.js +0 -0
- package/{template-static/react → templates/react-static}/src/pages/home.js +4 -0
- package/{template-dapp/vue → templates/vue-dapp}/.browserslistrc +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/.env +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/.eslintrc.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/README.md +0 -0
- package/{template-dapp/vue2 → templates/vue-dapp}/api/hooks/pre-start.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/api/index.js +0 -0
- package/{template-dapp/vue2 → templates/vue-dapp}/api/libs/auth.js +0 -0
- package/{template-dapp/vue2 → templates/vue-dapp}/api/libs/env.js +0 -0
- package/{template-dapp/vue2 → templates/vue-dapp}/api/libs/logger.js +0 -0
- package/{template-dapp/vue2 → templates/vue-dapp}/api/routes/index.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/blocklet.md +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/blocklet.yml +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/index.html +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/package.json +7 -7
- package/{template-dapp/vue → templates/vue-dapp}/src/App.vue +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/src/assets/logo.png +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/src/components/HelloWorld.vue +0 -0
- package/{template-dapp/vue2 → templates/vue-dapp}/src/libs/api.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/src/main.js +0 -0
- package/{template-dapp/vue → templates/vue-dapp}/vite.config.js +0 -0
- package/{template-dapp/vue2 → templates/vue-static}/.browserslistrc +0 -0
- package/{template-dapp/vue2 → templates/vue-static}/.env +0 -0
- package/{template-static/vue → templates/vue-static}/.eslintrc.js +0 -0
- package/{template-static/vue → templates/vue-static}/README.md +0 -0
- package/{template-static/vue → templates/vue-static}/blocklet.md +0 -0
- package/{template-static/vue → templates/vue-static}/blocklet.yml +0 -0
- package/{template-static/vue → templates/vue-static}/index.html +0 -0
- package/{template-static/vue → templates/vue-static}/package.json +1 -1
- package/{template-static/vue → templates/vue-static}/src/App.vue +0 -0
- package/{template-dapp/vue2 → templates/vue-static}/src/assets/logo.png +0 -0
- package/{template-static/vue → templates/vue-static}/src/components/HelloWorld.vue +0 -0
- package/{template-static/vue → templates/vue-static}/src/main.js +0 -0
- package/{template-static/vue → templates/vue-static}/vite.config.js +0 -0
- package/{template-static/vue → templates/vue2-dapp}/.browserslistrc +0 -0
- package/{template-static/vue → templates/vue2-dapp}/.env +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/.eslintrc.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/README.md +0 -0
- package/templates/vue2-dapp/api/hooks/pre-start.js +33 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/api/index.js +0 -0
- package/templates/vue2-dapp/api/libs/auth.js +22 -0
- package/templates/vue2-dapp/api/libs/env.js +6 -0
- package/templates/vue2-dapp/api/libs/logger.js +3 -0
- package/templates/vue2-dapp/api/routes/index.js +6 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/babel.config.js +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/blocklet.md +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/blocklet.yml +1 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/jsconfig.json +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/package.json +6 -6
- package/{template-dapp/vue2 → templates/vue2-dapp}/public/index.html +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/src/App.vue +0 -0
- package/{template-static/vue → templates/vue2-dapp}/src/assets/logo.png +0 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/src/components/HelloWorld.vue +0 -0
- package/templates/vue2-dapp/src/libs/api.js +14 -0
- package/{template-dapp/vue2 → templates/vue2-dapp}/src/main.js +0 -0
- package/templates/vue2-dapp/vue.config.js +18 -0
- package/{template-static/vue2 → templates/vue2-static}/.browserslistrc +0 -0
- package/{template-static/vue2 → templates/vue2-static}/.env +0 -0
- package/{template-static/vue2 → templates/vue2-static}/.eslintrc.js +0 -0
- package/{template-static/vue2 → templates/vue2-static}/README.md +0 -0
- package/{template-static/vue2 → templates/vue2-static}/babel.config.js +0 -0
- package/{template-static/vue2 → templates/vue2-static}/blocklet.md +0 -0
- package/{template-static/vue2 → templates/vue2-static}/blocklet.yml +0 -0
- package/{template-static/vue2 → templates/vue2-static}/jsconfig.json +0 -0
- package/{template-static/vue2 → templates/vue2-static}/package.json +0 -0
- package/{template-static/vue2 → templates/vue2-static}/public/index.html +0 -0
- package/{template-static/vue2 → templates/vue2-static}/src/App.vue +0 -0
- package/{template-static/vue2 → templates/vue2-static}/src/assets/logo.png +0 -0
- package/{template-static/vue2 → templates/vue2-static}/src/components/HelloWorld.vue +0 -0
- package/{template-static/vue2 → templates/vue2-static}/src/main.js +0 -0
- package/templates/vue2-static/vue.config.js +13 -0
- package/template-dapp/react/src/setupProxy.js +0 -12
- package/template-dapp/vue2/vue.config.js +0 -10
- package/template-static/vue2/vue.config.js +0 -3
|
@@ -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
|
+
};
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
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",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"prepare": "husky install"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@arcblock/did-auth": "^1.
|
|
21
|
+
"@arcblock/did-auth": "^1.16.0",
|
|
22
22
|
"@arcblock/did-auth-storage-nedb": "^1.6.3",
|
|
23
|
-
"@blocklet/sdk": "^1.7.
|
|
24
|
-
"@ocap/client": "^1.
|
|
25
|
-
"@ocap/mcrypto": "^1.
|
|
26
|
-
"@ocap/wallet": "^1.
|
|
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.
|
|
50
|
+
"vite-plugin-blocklet": "^0.1.2"
|
|
51
51
|
},
|
|
52
52
|
"lint-staged": {
|
|
53
53
|
"*.{mjs,js,vue}": [
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
|
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"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
+
})();
|
|
File without changes
|
|
@@ -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
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
|
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.
|
|
21
|
+
"@arcblock/did-auth": "^1.16.0",
|
|
22
22
|
"@arcblock/did-auth-storage-nedb": "^1.6.3",
|
|
23
|
-
"@blocklet/sdk": "^1.7.
|
|
24
|
-
"@ocap/client": "^1.
|
|
25
|
-
"@ocap/mcrypto": "^1.
|
|
26
|
-
"@ocap/wallet": "^1.
|
|
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",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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;
|
|
File without changes
|
|
@@ -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
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -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
|
-
};
|