create-blocklet 0.4.69 → 0.4.71
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/package.json +4 -4
- package/templates/docsite/package.json +2 -2
- package/templates/express-api/package.json +1 -1
- package/templates/nextjs-dapp/package.json +4 -4
- package/templates/react-dapp/.env +1 -1
- package/templates/react-dapp/api/index.js +1 -1
- package/templates/react-dapp/blocklet.yml +2 -2
- package/templates/react-dapp/index.html +16 -0
- package/templates/react-dapp/package.json +12 -9
- package/templates/react-dapp/src/index.jsx +1 -1
- package/templates/react-dapp/vite.config.js +36 -0
- package/templates/react-gun-dapp/.env +1 -1
- package/templates/react-gun-dapp/api/index.js +1 -1
- package/templates/react-gun-dapp/blocklet.yml +2 -2
- package/templates/react-gun-dapp/index.html +16 -0
- package/templates/react-gun-dapp/package.json +12 -9
- package/templates/react-gun-dapp/src/index.jsx +1 -1
- package/templates/react-gun-dapp/src/pages/home.jsx +1 -1
- package/templates/react-gun-dapp/vite.config.js +41 -0
- package/templates/react-static/.env +1 -1
- package/templates/react-static/blocklet.yml +1 -1
- package/templates/react-static/index.html +16 -0
- package/templates/react-static/package.json +9 -5
- package/templates/react-static/src/index.jsx +1 -1
- package/templates/react-static/vite.config.js +26 -0
- package/templates/solidjs-dapp/package.json +6 -6
- package/templates/solidjs-static/package.json +2 -2
- package/templates/svelte-dapp/package.json +6 -6
- package/templates/svelte-static/package.json +2 -2
- package/templates/vue-dapp/package.json +6 -6
- package/templates/vue-dapp/vite.config.js +5 -1
- package/templates/vue-static/package.json +2 -2
- package/templates/vue2-dapp/package.json +4 -4
- package/templates/vue2-dapp/vue.config.js +4 -4
- package/templates/website/package.json +1 -1
- package/templates/react-dapp/craco.config.js +0 -39
- package/templates/react-dapp/public/index.html +0 -35
- package/templates/react-gun-dapp/craco.config.js +0 -41
- package/templates/react-gun-dapp/public/index.html +0 -35
- package/templates/react-static/craco.config.js +0 -28
- package/templates/react-static/public/index.html +0 -35
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-blocklet",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.71",
|
|
4
4
|
"exports": "./index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": "git@github.com:blocklet/create-blocklet.git",
|
|
@@ -29,9 +29,9 @@
|
|
|
29
29
|
"test:run": "vitest run"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@arcblock/did": "^1.17.
|
|
33
|
-
"@ocap/mcrypto": "^1.17.
|
|
34
|
-
"@ocap/util": "^1.17.
|
|
32
|
+
"@arcblock/did": "^1.17.23",
|
|
33
|
+
"@ocap/mcrypto": "^1.17.23",
|
|
34
|
+
"@ocap/util": "^1.17.23",
|
|
35
35
|
"boxen": "^6.2.1",
|
|
36
36
|
"ejs": "^3.1.8",
|
|
37
37
|
"envfile": "^6.18.0",
|
|
@@ -27,12 +27,12 @@
|
|
|
27
27
|
]
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@arcblock/did-auth": "^1.17.
|
|
30
|
+
"@arcblock/did-auth": "^1.17.23",
|
|
31
31
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
32
32
|
"@blocklet/sdk": "^1.8.27",
|
|
33
|
-
"@ocap/client": "^1.17.
|
|
34
|
-
"@ocap/mcrypto": "^1.17.
|
|
35
|
-
"@ocap/wallet": "^1.17.
|
|
33
|
+
"@ocap/client": "^1.17.23",
|
|
34
|
+
"@ocap/mcrypto": "^1.17.23",
|
|
35
|
+
"@ocap/wallet": "^1.17.23",
|
|
36
36
|
"dotenv-flow": "^3.2.0",
|
|
37
37
|
"express": "^4.18.2",
|
|
38
38
|
"next": "12.2.3",
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
GENERATE_SOURCEMAP=false
|
|
2
|
-
|
|
2
|
+
APP_TITLE=''
|
|
@@ -27,7 +27,7 @@ if (isProduction) {
|
|
|
27
27
|
app.use(cors());
|
|
28
28
|
app.use(compression());
|
|
29
29
|
|
|
30
|
-
const staticDir = path.resolve(process.env.BLOCKLET_APP_DIR, '
|
|
30
|
+
const staticDir = path.resolve(process.env.BLOCKLET_APP_DIR, 'dist');
|
|
31
31
|
app.use(express.static(staticDir, { maxAge: '30d', index: false }));
|
|
32
32
|
app.use(router);
|
|
33
33
|
app.use(fallback('index.html', { root: staticDir }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name: template-react
|
|
1
|
+
name: template-react-dapp
|
|
2
2
|
title: Blocklet Template React
|
|
3
3
|
description: A Blocklet DAPP blocklet
|
|
4
4
|
keywords:
|
|
@@ -17,7 +17,7 @@ specVersion: 1.1.1
|
|
|
17
17
|
version: 0.1.0
|
|
18
18
|
logo: logo.png
|
|
19
19
|
files:
|
|
20
|
-
-
|
|
20
|
+
- dist
|
|
21
21
|
- logo.png
|
|
22
22
|
- screenshots
|
|
23
23
|
- api/hooks/pre-start.js
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" href="/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
7
|
+
<meta name="theme-color" content="#4F6AF5" />
|
|
8
|
+
<meta name="description" content="Web site created using create-blocklet" />
|
|
9
|
+
<title><%- title %></title>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<noscript> You need to enable JavaScript to run this app. </noscript>
|
|
13
|
+
<div id="app"></div>
|
|
14
|
+
<script type="module" src="/src/index.jsx"></script>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev",
|
|
6
|
-
"eject": "
|
|
6
|
+
"eject": "vite eject",
|
|
7
7
|
"lint": "eslint src api --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
8
8
|
"lint:fix": "npm run lint -- --fix",
|
|
9
9
|
"start": "npm-run-all --parallel start:*",
|
|
10
|
-
"start:client": "
|
|
10
|
+
"start:client": "vite --host",
|
|
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": "
|
|
14
|
+
"bundle:client": "vite 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",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@arcblock/did-auth": "^1.17.
|
|
44
|
+
"@arcblock/did-auth": "^1.17.23",
|
|
45
45
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
46
46
|
"@blocklet/sdk": "^1.8.27",
|
|
47
|
-
"@ocap/client": "^1.17.
|
|
48
|
-
"@ocap/mcrypto": "^1.17.
|
|
49
|
-
"@ocap/wallet": "^1.17.
|
|
47
|
+
"@ocap/client": "^1.17.23",
|
|
48
|
+
"@ocap/mcrypto": "^1.17.23",
|
|
49
|
+
"@ocap/wallet": "^1.17.23",
|
|
50
50
|
"axios": "^0.27.2",
|
|
51
51
|
"compression": "^1.7.4",
|
|
52
52
|
"cookie-parser": "^1.4.6",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@arcblock/eslint-config": "^0.2.3",
|
|
64
|
-
"@
|
|
64
|
+
"@vitejs/plugin-react": "^2.1.0",
|
|
65
65
|
"eslint": "^8.25.0",
|
|
66
66
|
"husky": "^8.0.1",
|
|
67
67
|
"lint-staged": "^12.5.0",
|
|
@@ -69,6 +69,9 @@
|
|
|
69
69
|
"nodemon": "^2.0.20",
|
|
70
70
|
"npm-run-all": "^4.1.5",
|
|
71
71
|
"prettier": "^2.7.1",
|
|
72
|
-
"
|
|
72
|
+
"vite": "^3.1.7",
|
|
73
|
+
"vite-plugin-blocklet": "^0.4.71",
|
|
74
|
+
"vite-plugin-html": "^3.2.0",
|
|
75
|
+
"vite-plugin-svgr": "^2.2.1"
|
|
73
76
|
}
|
|
74
77
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import { createHtmlPlugin } from 'vite-plugin-html';
|
|
4
|
+
import { createBlockletPlugin } from 'vite-plugin-blocklet';
|
|
5
|
+
import svgr from 'vite-plugin-svgr';
|
|
6
|
+
|
|
7
|
+
// https://vitejs.dev/config/
|
|
8
|
+
export default defineConfig(async ({ mode }) => {
|
|
9
|
+
const envMap = loadEnv(mode, process.cwd(), '');
|
|
10
|
+
const apiPort = envMap.API_PORT || 3030;
|
|
11
|
+
const apiPrefix = `${process.env.BLOCKLET_DEV_MOUNT_POINT || ''}/api`;
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
plugins: [
|
|
15
|
+
react(),
|
|
16
|
+
createHtmlPlugin({
|
|
17
|
+
minify: true,
|
|
18
|
+
inject: {
|
|
19
|
+
data: {
|
|
20
|
+
title: envMap.APP_TITLE,
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
}),
|
|
24
|
+
createBlockletPlugin(),
|
|
25
|
+
svgr(),
|
|
26
|
+
],
|
|
27
|
+
server: {
|
|
28
|
+
proxy: {
|
|
29
|
+
[apiPrefix]: {
|
|
30
|
+
target: `http://127.0.0.1:${apiPort}`,
|
|
31
|
+
rewrite: (path) => path.replace(apiPrefix, '/api'), // rewrite path when blocklet dev
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
GENERATE_SOURCEMAP=false
|
|
2
|
-
|
|
2
|
+
APP_TITLE=''
|
|
@@ -32,7 +32,7 @@ if (isProduction) {
|
|
|
32
32
|
app.use(cors());
|
|
33
33
|
app.use(compression());
|
|
34
34
|
|
|
35
|
-
const staticDir = path.resolve(process.env.BLOCKLET_APP_DIR, '
|
|
35
|
+
const staticDir = path.resolve(process.env.BLOCKLET_APP_DIR, 'dist');
|
|
36
36
|
app.use(express.static(staticDir, { maxAge: '30d', index: false }));
|
|
37
37
|
app.use(router);
|
|
38
38
|
app.use(fallback('index.html', { root: staticDir }));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
name: template-react
|
|
1
|
+
name: template-react-gunjs
|
|
2
2
|
title: Blocklet Template React
|
|
3
3
|
description: A Blocklet DAPP blocklet
|
|
4
4
|
keywords:
|
|
@@ -17,7 +17,7 @@ specVersion: 1.1.1
|
|
|
17
17
|
version: 0.1.0
|
|
18
18
|
logo: logo.png
|
|
19
19
|
files:
|
|
20
|
-
-
|
|
20
|
+
- dist
|
|
21
21
|
- logo.png
|
|
22
22
|
- screenshots
|
|
23
23
|
- api/hooks/pre-start.js
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" href="/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
7
|
+
<meta name="theme-color" content="#4F6AF5" />
|
|
8
|
+
<meta name="description" content="Web site created using create-blocklet" />
|
|
9
|
+
<title><%- title %></title>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<noscript> You need to enable JavaScript to run this app. </noscript>
|
|
13
|
+
<div id="app"></div>
|
|
14
|
+
<script type="module" src="/src/index.jsx"></script>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev",
|
|
6
|
-
"eject": "
|
|
6
|
+
"eject": "vite eject",
|
|
7
7
|
"lint": "eslint src api --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
8
8
|
"lint:fix": "npm run lint -- --fix",
|
|
9
9
|
"start": "npm-run-all --parallel start:*",
|
|
10
|
-
"start:client": "
|
|
10
|
+
"start:client": "vite --host",
|
|
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": "
|
|
14
|
+
"bundle:client": "vite 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",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
]
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@arcblock/did-auth": "^1.17.
|
|
44
|
+
"@arcblock/did-auth": "^1.17.23",
|
|
45
45
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
46
46
|
"@blocklet/sdk": "^1.8.27",
|
|
47
|
-
"@ocap/client": "^1.17.
|
|
48
|
-
"@ocap/mcrypto": "^1.17.
|
|
49
|
-
"@ocap/wallet": "^1.17.
|
|
47
|
+
"@ocap/client": "^1.17.23",
|
|
48
|
+
"@ocap/mcrypto": "^1.17.23",
|
|
49
|
+
"@ocap/wallet": "^1.17.23",
|
|
50
50
|
"axios": "^0.27.2",
|
|
51
51
|
"compression": "^1.7.4",
|
|
52
52
|
"cookie-parser": "^1.4.6",
|
|
@@ -62,13 +62,16 @@
|
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"@arcblock/eslint-config": "^0.2.3",
|
|
65
|
-
"@
|
|
65
|
+
"@vitejs/plugin-react": "^2.1.0",
|
|
66
66
|
"eslint": "^8.25.0",
|
|
67
67
|
"husky": "^8.0.1",
|
|
68
68
|
"lint-staged": "^12.5.0",
|
|
69
69
|
"nodemon": "^2.0.20",
|
|
70
70
|
"npm-run-all": "^4.1.5",
|
|
71
71
|
"prettier": "^2.7.1",
|
|
72
|
-
"
|
|
72
|
+
"vite": "^3.1.7",
|
|
73
|
+
"vite-plugin-blocklet": "^0.4.71",
|
|
74
|
+
"vite-plugin-html": "^3.2.0",
|
|
75
|
+
"vite-plugin-svgr": "^2.2.1"
|
|
73
76
|
}
|
|
74
77
|
}
|
|
@@ -5,7 +5,7 @@ import Gun from 'gun';
|
|
|
5
5
|
import { Link } from 'react-router-dom';
|
|
6
6
|
|
|
7
7
|
const gun = Gun({
|
|
8
|
-
peers: [`${window.location.origin}
|
|
8
|
+
peers: [`${window.location.origin}${window?.blocklet?.prefix || ''}gun`], // Put the relay nodes that you want here
|
|
9
9
|
});
|
|
10
10
|
|
|
11
11
|
export default function Home() {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import { createHtmlPlugin } from 'vite-plugin-html';
|
|
4
|
+
import { createBlockletPlugin } from 'vite-plugin-blocklet';
|
|
5
|
+
import svgr from 'vite-plugin-svgr';
|
|
6
|
+
|
|
7
|
+
// https://vitejs.dev/config/
|
|
8
|
+
export default defineConfig(async ({ mode }) => {
|
|
9
|
+
const envMap = loadEnv(mode, process.cwd(), '');
|
|
10
|
+
const apiPort = envMap.API_PORT || 3030;
|
|
11
|
+
const apiPrefix = `${process.env.BLOCKLET_DEV_MOUNT_POINT || ''}/api`;
|
|
12
|
+
const gunPrefix = '/gun'; // ws suffix only supports first level paths
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
plugins: [
|
|
16
|
+
react(),
|
|
17
|
+
createHtmlPlugin({
|
|
18
|
+
minify: true,
|
|
19
|
+
inject: {
|
|
20
|
+
data: {
|
|
21
|
+
title: envMap.APP_TITLE,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
}),
|
|
25
|
+
createBlockletPlugin(),
|
|
26
|
+
svgr(),
|
|
27
|
+
],
|
|
28
|
+
server: {
|
|
29
|
+
proxy: {
|
|
30
|
+
[apiPrefix]: {
|
|
31
|
+
target: `http://127.0.0.1:${apiPort}`,
|
|
32
|
+
rewrite: (path) => path.replace(apiPrefix, '/api'), // rewrite path when blocklet dev
|
|
33
|
+
},
|
|
34
|
+
[gunPrefix]: {
|
|
35
|
+
target: `ws://127.0.0.1:${apiPort}`,
|
|
36
|
+
ws: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
});
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
GENERATE_SOURCEMAP=false
|
|
2
|
-
|
|
2
|
+
APP_TITLE=''
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<link rel="icon" href="/favicon.ico" />
|
|
6
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
7
|
+
<meta name="theme-color" content="#4F6AF5" />
|
|
8
|
+
<meta name="description" content="Web site created using create-blocklet" />
|
|
9
|
+
<title><%- title %></title>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<noscript> You need to enable JavaScript to run this app. </noscript>
|
|
13
|
+
<div id="app"></div>
|
|
14
|
+
<script type="module" src="/src/index.jsx"></script>
|
|
15
|
+
</body>
|
|
16
|
+
</html>
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": "blocklet dev",
|
|
6
|
-
"eject": "
|
|
6
|
+
"eject": "vite eject",
|
|
7
|
+
"serve": "vite preview",
|
|
7
8
|
"lint": "eslint src --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
8
9
|
"lint:fix": "npm run lint -- --fix",
|
|
9
|
-
"start": "
|
|
10
|
+
"start": "vite --host",
|
|
10
11
|
"clean": "rm -rf .blocklet",
|
|
11
|
-
"bundle": "npm run clean &&
|
|
12
|
+
"bundle": "npm run clean && vite build && blocklet bundle --zip --create-release",
|
|
12
13
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
13
14
|
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
|
|
14
15
|
"deploy:child": "npm run bundle && blocklet deploy .blocklet/bundle --app-did=<%= did %>",
|
|
@@ -43,11 +44,14 @@
|
|
|
43
44
|
},
|
|
44
45
|
"devDependencies": {
|
|
45
46
|
"@arcblock/eslint-config": "^0.2.3",
|
|
46
|
-
"@
|
|
47
|
+
"@vitejs/plugin-react": "^2.1.0",
|
|
47
48
|
"eslint": "^8.25.0",
|
|
48
49
|
"husky": "^8.0.1",
|
|
49
50
|
"lint-staged": "^12.5.0",
|
|
50
51
|
"prettier": "^2.7.1",
|
|
51
|
-
"
|
|
52
|
+
"vite": "^3.1.7",
|
|
53
|
+
"vite-plugin-blocklet": "^0.4.71",
|
|
54
|
+
"vite-plugin-html": "^3.2.0",
|
|
55
|
+
"vite-plugin-svgr": "^2.2.1"
|
|
52
56
|
}
|
|
53
57
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { defineConfig, loadEnv } from 'vite';
|
|
2
|
+
import react from '@vitejs/plugin-react';
|
|
3
|
+
import { createHtmlPlugin } from 'vite-plugin-html';
|
|
4
|
+
import { createBlockletPlugin } from 'vite-plugin-blocklet';
|
|
5
|
+
import svgr from 'vite-plugin-svgr';
|
|
6
|
+
|
|
7
|
+
// https://vitejs.dev/config/
|
|
8
|
+
export default defineConfig(async ({ mode }) => {
|
|
9
|
+
const envMap = loadEnv(mode, process.cwd(), '');
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
plugins: [
|
|
13
|
+
react(),
|
|
14
|
+
createHtmlPlugin({
|
|
15
|
+
minify: true,
|
|
16
|
+
inject: {
|
|
17
|
+
data: {
|
|
18
|
+
title: envMap.APP_TITLE,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
}),
|
|
22
|
+
createBlockletPlugin(),
|
|
23
|
+
svgr(),
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
});
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"nodemon": "^2.0.20",
|
|
32
32
|
"npm-run-all": "^4.1.5",
|
|
33
33
|
"prettier": "^2.7.1",
|
|
34
|
-
"vite": "^3.1.
|
|
35
|
-
"vite-plugin-blocklet": "^0.4.
|
|
34
|
+
"vite": "^3.1.7",
|
|
35
|
+
"vite-plugin-blocklet": "^0.4.71",
|
|
36
36
|
"vite-plugin-html": "^3.2.0",
|
|
37
37
|
"vite-plugin-solid": "^2.3.9"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@arcblock/did-auth": "^1.17.
|
|
40
|
+
"@arcblock/did-auth": "^1.17.23",
|
|
41
41
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
42
42
|
"@blocklet/sdk": "^1.8.27",
|
|
43
|
-
"@ocap/client": "^1.17.
|
|
44
|
-
"@ocap/mcrypto": "^1.17.
|
|
45
|
-
"@ocap/wallet": "^1.17.
|
|
43
|
+
"@ocap/client": "^1.17.23",
|
|
44
|
+
"@ocap/mcrypto": "^1.17.23",
|
|
45
|
+
"@ocap/wallet": "^1.17.23",
|
|
46
46
|
"axios": "^0.27.2",
|
|
47
47
|
"compression": "^1.7.4",
|
|
48
48
|
"cookie-parser": "^1.4.6",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"husky": "^8.0.1",
|
|
26
26
|
"lint-staged": "^12.5.0",
|
|
27
27
|
"prettier": "^2.7.1",
|
|
28
|
-
"vite": "^3.1.
|
|
29
|
-
"vite-plugin-blocklet": "^0.4.
|
|
28
|
+
"vite": "^3.1.7",
|
|
29
|
+
"vite-plugin-blocklet": "^0.4.71",
|
|
30
30
|
"vite-plugin-html": "^3.2.0",
|
|
31
31
|
"vite-plugin-solid": "^2.3.9"
|
|
32
32
|
},
|
|
@@ -19,12 +19,12 @@
|
|
|
19
19
|
"prepare": "husky install"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@arcblock/did-auth": "^1.17.
|
|
22
|
+
"@arcblock/did-auth": "^1.17.23",
|
|
23
23
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
24
24
|
"@blocklet/sdk": "^1.8.27",
|
|
25
|
-
"@ocap/client": "^1.17.
|
|
26
|
-
"@ocap/mcrypto": "^1.17.
|
|
27
|
-
"@ocap/wallet": "^1.17.
|
|
25
|
+
"@ocap/client": "^1.17.23",
|
|
26
|
+
"@ocap/mcrypto": "^1.17.23",
|
|
27
|
+
"@ocap/wallet": "^1.17.23",
|
|
28
28
|
"axios": "^0.27.2",
|
|
29
29
|
"compression": "^1.7.4",
|
|
30
30
|
"cookie-parser": "^1.4.6",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"npm-run-all": "^4.1.5",
|
|
46
46
|
"prettier": "^2.7.1",
|
|
47
47
|
"svelte": "^3.50.1",
|
|
48
|
-
"vite": "^3.1.
|
|
49
|
-
"vite-plugin-blocklet": "^0.4.
|
|
48
|
+
"vite": "^3.1.7",
|
|
49
|
+
"vite-plugin-blocklet": "^0.4.71",
|
|
50
50
|
"vite-plugin-html": "^3.2.0"
|
|
51
51
|
},
|
|
52
52
|
"lint-staged": {
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"prepare": "husky install"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@arcblock/did-auth": "^1.17.
|
|
23
|
+
"@arcblock/did-auth": "^1.17.23",
|
|
24
24
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
25
25
|
"@blocklet/sdk": "^1.8.27",
|
|
26
|
-
"@ocap/client": "^1.17.
|
|
27
|
-
"@ocap/mcrypto": "^1.17.
|
|
28
|
-
"@ocap/wallet": "^1.17.
|
|
26
|
+
"@ocap/client": "^1.17.23",
|
|
27
|
+
"@ocap/mcrypto": "^1.17.23",
|
|
28
|
+
"@ocap/wallet": "^1.17.23",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"compression": "^1.7.4",
|
|
31
31
|
"cookie-parser": "^1.4.6",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"nodemon": "^2.0.20",
|
|
49
49
|
"npm-run-all": "^4.1.5",
|
|
50
50
|
"prettier": "^2.7.1",
|
|
51
|
-
"vite": "^3.1.
|
|
52
|
-
"vite-plugin-blocklet": "^0.4.
|
|
51
|
+
"vite": "^3.1.7",
|
|
52
|
+
"vite-plugin-blocklet": "^0.4.71"
|
|
53
53
|
},
|
|
54
54
|
"lint-staged": {
|
|
55
55
|
"*.{mjs,js,vue}": [
|
|
@@ -7,6 +7,7 @@ import { createBlockletPlugin } from 'vite-plugin-blocklet';
|
|
|
7
7
|
export default defineConfig(async ({ mode }) => {
|
|
8
8
|
const envMap = loadEnv(mode, process.cwd(), '');
|
|
9
9
|
const apiPort = envMap.API_PORT || 3030;
|
|
10
|
+
const apiPrefix = `${process.env.BLOCKLET_DEV_MOUNT_POINT || ''}/api`;
|
|
10
11
|
|
|
11
12
|
return {
|
|
12
13
|
plugins: [
|
|
@@ -23,7 +24,10 @@ export default defineConfig(async ({ mode }) => {
|
|
|
23
24
|
],
|
|
24
25
|
server: {
|
|
25
26
|
proxy: {
|
|
26
|
-
|
|
27
|
+
[apiPrefix]: {
|
|
28
|
+
target: `http://127.0.0.1:${apiPort}`,
|
|
29
|
+
rewrite: (path) => path.replace(apiPrefix, '/api'), // rewrite path when blocklet dev
|
|
30
|
+
},
|
|
27
31
|
},
|
|
28
32
|
},
|
|
29
33
|
};
|
|
@@ -20,12 +20,12 @@
|
|
|
20
20
|
"prepare": "husky install"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@arcblock/did-auth": "^1.17.
|
|
23
|
+
"@arcblock/did-auth": "^1.17.23",
|
|
24
24
|
"@arcblock/did-auth-storage-nedb": "^1.7.1",
|
|
25
25
|
"@blocklet/sdk": "^1.8.27",
|
|
26
|
-
"@ocap/client": "^1.17.
|
|
27
|
-
"@ocap/mcrypto": "^1.17.
|
|
28
|
-
"@ocap/wallet": "^1.17.
|
|
26
|
+
"@ocap/client": "^1.17.23",
|
|
27
|
+
"@ocap/mcrypto": "^1.17.23",
|
|
28
|
+
"@ocap/wallet": "^1.17.23",
|
|
29
29
|
"axios": "^0.27.2",
|
|
30
30
|
"compression": "^1.7.4",
|
|
31
31
|
"cookie-parser": "^1.4.6",
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
require('dotenv-flow').config();
|
|
2
2
|
|
|
3
|
+
const mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
|
|
3
4
|
const port = process.env.BLOCKLET_PORT || process.env.PORT || 3000;
|
|
4
5
|
const apiPort = process.env.API_PORT || 3030;
|
|
5
|
-
|
|
6
|
+
const apiPrefix = `${mountPoint}/api`;
|
|
6
7
|
const whenDev = process.env.NODE_ENV === 'development';
|
|
7
8
|
|
|
8
|
-
const mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
|
|
9
|
-
|
|
10
9
|
module.exports = {
|
|
11
10
|
publicPath: whenDev ? '' : process.env.PUBLIC_PATH || '/',
|
|
12
11
|
devServer: {
|
|
@@ -17,8 +16,9 @@ module.exports = {
|
|
|
17
16
|
webSocketURL: `wss://0.0.0.0${mountPoint}/ws`,
|
|
18
17
|
},
|
|
19
18
|
proxy: {
|
|
20
|
-
|
|
19
|
+
[apiPrefix]: {
|
|
21
20
|
target: `http://127.0.0.1:${apiPort}`,
|
|
21
|
+
rewrite: (path) => path.replace(apiPrefix, '/api'), // rewrite path when blocklet dev
|
|
22
22
|
},
|
|
23
23
|
},
|
|
24
24
|
},
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
require('dotenv-flow').config();
|
|
2
|
-
|
|
3
|
-
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin');
|
|
4
|
-
|
|
5
|
-
const port = process.env.BLOCKLET_PORT || process.env.PORT || 3000;
|
|
6
|
-
const apiPort = process.env.API_PORT || 3030;
|
|
7
|
-
const whenDev = process.env.NODE_ENV === 'development';
|
|
8
|
-
const mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
|
|
9
|
-
|
|
10
|
-
const plugins = [new NodePolyfillPlugin({ excludeAliases: ['console'] })];
|
|
11
|
-
|
|
12
|
-
const webpackConfig = whenDev
|
|
13
|
-
? {
|
|
14
|
-
configure: {
|
|
15
|
-
output: {
|
|
16
|
-
publicPath: '', // When the dev mode as component, this line required
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
plugins,
|
|
20
|
-
}
|
|
21
|
-
: { plugins };
|
|
22
|
-
|
|
23
|
-
module.exports = {
|
|
24
|
-
webpack: {
|
|
25
|
-
...webpackConfig,
|
|
26
|
-
},
|
|
27
|
-
devServer: {
|
|
28
|
-
port,
|
|
29
|
-
client: {
|
|
30
|
-
// If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
|
|
31
|
-
webSocketURL: `wss://0.0.0.0${mountPoint}/ws`,
|
|
32
|
-
},
|
|
33
|
-
proxy: {
|
|
34
|
-
'/api': {
|
|
35
|
-
target: `http://127.0.0.1:${apiPort}`,
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
7
|
-
<meta name="theme-color" content="#4F6AF5" />
|
|
8
|
-
<meta name="description" content="Web site created using create-blocklet" />
|
|
9
|
-
<script src="__meta__.js"></script>
|
|
10
|
-
<!--
|
|
11
|
-
Notice the use of %PUBLIC_URL% in the tags above.
|
|
12
|
-
It will be replaced with the URL of the `public` folder during the build.
|
|
13
|
-
Only files inside the `public` folder can be referenced from the HTML.
|
|
14
|
-
|
|
15
|
-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
16
|
-
work correctly both with client-side routing and a non-root public URL.
|
|
17
|
-
Learn how to configure a non-root public URL by running `npm run build`.
|
|
18
|
-
-->
|
|
19
|
-
<title>%REACT_APP_TITLE%</title>
|
|
20
|
-
</head>
|
|
21
|
-
<body>
|
|
22
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
23
|
-
<div id="root"></div>
|
|
24
|
-
<!--
|
|
25
|
-
This HTML file is a template.
|
|
26
|
-
If you open it directly in the browser, you will see an empty page.
|
|
27
|
-
|
|
28
|
-
You can add webfonts, meta tags, or analytics to this file.
|
|
29
|
-
The build step will place the bundled scripts into the <body> tag.
|
|
30
|
-
|
|
31
|
-
To begin the development, run `npm start` or `yarn start`.
|
|
32
|
-
To create a production bundle, use `npm run build` or `yarn build`.
|
|
33
|
-
-->
|
|
34
|
-
</body>
|
|
35
|
-
</html>
|
|
@@ -1,41 +0,0 @@
|
|
|
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;
|
|
5
|
-
|
|
6
|
-
const whenDev = process.env.NODE_ENV === 'development';
|
|
7
|
-
|
|
8
|
-
const mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
|
|
9
|
-
|
|
10
|
-
module.exports = {
|
|
11
|
-
devServer: {
|
|
12
|
-
port,
|
|
13
|
-
client: {
|
|
14
|
-
// If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
|
|
15
|
-
webSocketURL: `wss://0.0.0.0${mountPoint}/ws`,
|
|
16
|
-
},
|
|
17
|
-
proxy: [
|
|
18
|
-
{
|
|
19
|
-
context: ['/api'],
|
|
20
|
-
target: `http://127.0.0.1:${apiPort}`,
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
context: ['/gun'],
|
|
24
|
-
target: `ws://127.0.0.1:${apiPort}`,
|
|
25
|
-
ws: true,
|
|
26
|
-
},
|
|
27
|
-
],
|
|
28
|
-
},
|
|
29
|
-
webpack: {
|
|
30
|
-
configure: {
|
|
31
|
-
module: {
|
|
32
|
-
noParse: /gun\.js$/,
|
|
33
|
-
},
|
|
34
|
-
output: whenDev
|
|
35
|
-
? {
|
|
36
|
-
publicPath: '', // When the dev mode as component, this line required
|
|
37
|
-
}
|
|
38
|
-
: {},
|
|
39
|
-
},
|
|
40
|
-
},
|
|
41
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
7
|
-
<meta name="theme-color" content="#4F6AF5" />
|
|
8
|
-
<meta name="description" content="Web site created using create-blocklet" />
|
|
9
|
-
<script src="__meta__.js"></script>
|
|
10
|
-
<!--
|
|
11
|
-
Notice the use of %PUBLIC_URL% in the tags above.
|
|
12
|
-
It will be replaced with the URL of the `public` folder during the build.
|
|
13
|
-
Only files inside the `public` folder can be referenced from the HTML.
|
|
14
|
-
|
|
15
|
-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
16
|
-
work correctly both with client-side routing and a non-root public URL.
|
|
17
|
-
Learn how to configure a non-root public URL by running `npm run build`.
|
|
18
|
-
-->
|
|
19
|
-
<title>%REACT_APP_TITLE%</title>
|
|
20
|
-
</head>
|
|
21
|
-
<body>
|
|
22
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
23
|
-
<div id="root"></div>
|
|
24
|
-
<!--
|
|
25
|
-
This HTML file is a template.
|
|
26
|
-
If you open it directly in the browser, you will see an empty page.
|
|
27
|
-
|
|
28
|
-
You can add webfonts, meta tags, or analytics to this file.
|
|
29
|
-
The build step will place the bundled scripts into the <body> tag.
|
|
30
|
-
|
|
31
|
-
To begin the development, run `npm start` or `yarn start`.
|
|
32
|
-
To create a production bundle, use `npm run build` or `yarn build`.
|
|
33
|
-
-->
|
|
34
|
-
</body>
|
|
35
|
-
</html>
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const port = process.env.BLOCKLET_PORT || process.env.PORT || 3000;
|
|
2
|
-
|
|
3
|
-
const whenDev = process.env.NODE_ENV === 'development';
|
|
4
|
-
|
|
5
|
-
const mountPoint = process.env.BLOCKLET_DEV_MOUNT_POINT || '';
|
|
6
|
-
|
|
7
|
-
const webpackConfig = whenDev
|
|
8
|
-
? {
|
|
9
|
-
configure: {
|
|
10
|
-
output: {
|
|
11
|
-
publicPath: '', // When the dev mode as component, this line required
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
}
|
|
15
|
-
: {};
|
|
16
|
-
|
|
17
|
-
module.exports = {
|
|
18
|
-
webpack: {
|
|
19
|
-
...webpackConfig,
|
|
20
|
-
},
|
|
21
|
-
devServer: {
|
|
22
|
-
port,
|
|
23
|
-
client: {
|
|
24
|
-
// If you want to development this blocklet without blocklet-server, you can delete next line, otherwise the hot reload will be failed.
|
|
25
|
-
webSocketURL: `wss://0.0.0.0${mountPoint}/ws`,
|
|
26
|
-
},
|
|
27
|
-
},
|
|
28
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8" />
|
|
5
|
-
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
6
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
7
|
-
<meta name="theme-color" content="#4F6AF5" />
|
|
8
|
-
<meta name="description" content="Web site created using create-blocklet" />
|
|
9
|
-
<script src="__meta__.js"></script>
|
|
10
|
-
<!--
|
|
11
|
-
Notice the use of %PUBLIC_URL% in the tags above.
|
|
12
|
-
It will be replaced with the URL of the `public` folder during the build.
|
|
13
|
-
Only files inside the `public` folder can be referenced from the HTML.
|
|
14
|
-
|
|
15
|
-
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
|
16
|
-
work correctly both with client-side routing and a non-root public URL.
|
|
17
|
-
Learn how to configure a non-root public URL by running `npm run build`.
|
|
18
|
-
-->
|
|
19
|
-
<title>%REACT_APP_TITLE%</title>
|
|
20
|
-
</head>
|
|
21
|
-
<body>
|
|
22
|
-
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
23
|
-
<div id="root"></div>
|
|
24
|
-
<!--
|
|
25
|
-
This HTML file is a template.
|
|
26
|
-
If you open it directly in the browser, you will see an empty page.
|
|
27
|
-
|
|
28
|
-
You can add webfonts, meta tags, or analytics to this file.
|
|
29
|
-
The build step will place the bundled scripts into the <body> tag.
|
|
30
|
-
|
|
31
|
-
To begin the development, run `npm start` or `yarn start`.
|
|
32
|
-
To create a production bundle, use `npm run build` or `yarn build`.
|
|
33
|
-
-->
|
|
34
|
-
</body>
|
|
35
|
-
</html>
|