create-blocklet 0.2.18 → 0.3.0
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/common/.github/workflows/main.yml +5 -5
- package/common/.husky/pre-commit +4 -0
- package/common/_eslintignore +10 -0
- package/common/_eslintrc.js +1 -0
- package/common/_gitignore +15 -9
- package/common/logo.png +0 -0
- package/common/public/favicon.ico +0 -0
- package/index.js +178 -72
- package/lib/arcblock.js +3 -1
- package/lib/git.js +25 -0
- package/lib/index.js +17 -5
- package/lib/npm.js +7 -9
- package/lib/server.js +26 -20
- package/package.json +18 -16
- package/template-dapp/react/README.md +5 -5
- package/template-dapp/react/{server → api}/hooks/pre-start.js +0 -0
- package/template-dapp/react/{server → api}/index.js +0 -0
- package/template-dapp/react/{server → api}/libs/auth.js +0 -0
- package/template-dapp/react/{server → api}/libs/env.js +0 -0
- package/template-dapp/react/{server → api}/libs/logger.js +0 -0
- package/template-dapp/{vue2/server → react/api}/routes/index.js +1 -1
- package/template-dapp/react/blocklet.yml +5 -5
- package/template-dapp/react/package.json +35 -23
- package/template-dapp/react/public/index.html +1 -3
- package/template-dapp/react/src/app.js +8 -8
- package/template-dapp/vue/.browserslistrc +4 -0
- package/template-dapp/vue/.eslintrc.js +25 -0
- package/template-dapp/vue/{server → api}/hooks/pre-start.js +0 -0
- package/template-dapp/vue/{server → api}/index.js +0 -0
- package/template-dapp/vue/{server → api}/libs/auth.js +0 -0
- package/template-dapp/vue/{server → api}/libs/env.js +0 -0
- package/template-dapp/vue/{server → api}/libs/logger.js +0 -0
- package/template-dapp/{react/server → vue/api}/routes/index.js +1 -1
- package/template-dapp/vue/blocklet.yml +5 -4
- package/template-dapp/vue/index.html +2 -3
- package/template-dapp/vue/package.json +38 -21
- package/template-dapp/vue/src/App.vue +4 -2
- package/template-dapp/vue/vite.config.js +8 -6
- package/template-dapp/vue2/.browserslistrc +4 -0
- package/template-dapp/vue2/.eslintrc.js +14 -0
- package/template-dapp/vue2/{server → api}/hooks/pre-start.js +0 -0
- package/template-dapp/vue2/{server → api}/index.js +0 -0
- package/template-dapp/vue2/{server → api}/libs/auth.js +0 -0
- package/template-dapp/vue2/{server → api}/libs/env.js +0 -0
- package/template-dapp/vue2/{server → api}/libs/logger.js +0 -0
- package/template-dapp/{vue/server → vue2/api}/routes/index.js +1 -1
- package/template-dapp/vue2/blocklet.yml +6 -4
- package/template-dapp/vue2/jsconfig.json +19 -0
- package/template-dapp/vue2/package.json +38 -43
- package/template-dapp/vue2/public/index.html +2 -9
- package/template-dapp/vue2/src/App.vue +17 -1
- package/template-dapp/vue2/src/main.js +0 -2
- package/template-dapp/vue2/vue.config.js +0 -1
- package/template-static/blocklet-page/package.json +5 -5
- package/template-static/react/blocklet.yml +2 -2
- package/template-static/react/package.json +21 -9
- package/template-static/react/public/index.html +1 -3
- package/template-static/react/src/app.js +8 -8
- package/template-static/vue/.browserslistrc +4 -0
- package/template-static/vue/.eslintrc.js +25 -0
- package/template-static/vue/blocklet.yml +2 -2
- package/template-static/vue/index.html +2 -3
- package/template-static/vue/package.json +25 -8
- package/template-static/vue/vite.config.js +8 -6
- package/template-static/vue2/.browserslistrc +4 -0
- package/template-static/vue2/.eslintrc.js +14 -0
- package/template-static/vue2/blocklet.yml +2 -2
- package/template-static/vue2/jsconfig.json +19 -0
- package/template-static/vue2/package.json +25 -30
- package/template-static/vue2/public/index.html +2 -9
- package/template-static/vue2/src/App.vue +7 -1
- package/template-static/vue2/src/main.js +0 -2
- package/template-static/vue2/vue.config.js +0 -3
- package/common/public/favicon.svg +0 -1
- package/template-dapp/vue2/src/pages/About.vue +0 -13
- package/template-dapp/vue2/src/pages/Home.vue +0 -27
- package/template-dapp/vue2/src/router.js +0 -24
- package/template-static/vue2/src/pages/About.vue +0 -13
- package/template-static/vue2/src/pages/Home.vue +0 -20
- package/template-static/vue2/src/router.js +0 -24
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const middleware = require('@blocklet/sdk/lib/middlewares');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user', middleware.user(), (req, res) => res.json(req.user));
|
|
4
|
+
router.use('/user', middleware.user(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
module.exports = router;
|
|
@@ -6,10 +6,10 @@ keywords:
|
|
|
6
6
|
- react
|
|
7
7
|
group: dapp
|
|
8
8
|
did: ''
|
|
9
|
-
main:
|
|
9
|
+
main: api/index.js
|
|
10
10
|
author:
|
|
11
|
-
name:
|
|
12
|
-
email:
|
|
11
|
+
name: Blocklet
|
|
12
|
+
email: blocklet@arcblock.io
|
|
13
13
|
repository:
|
|
14
14
|
type: git
|
|
15
15
|
url: 'git+https://github.com/blocklet/create-blocklet.git'
|
|
@@ -22,7 +22,7 @@ files:
|
|
|
22
22
|
- README.md
|
|
23
23
|
- blocklet.md
|
|
24
24
|
- screenshots
|
|
25
|
-
-
|
|
25
|
+
- api/hooks/pre-start.js
|
|
26
26
|
interfaces:
|
|
27
27
|
- type: web
|
|
28
28
|
name: publicUrl
|
|
@@ -45,7 +45,7 @@ requirements:
|
|
|
45
45
|
os: '*'
|
|
46
46
|
cpu: '*'
|
|
47
47
|
scripts:
|
|
48
|
-
preStart: node
|
|
48
|
+
preStart: node api/hooks/pre-start.js
|
|
49
49
|
dev: npm run start
|
|
50
50
|
environments:
|
|
51
51
|
- name: CHAIN_HOST
|
|
@@ -2,19 +2,29 @@
|
|
|
2
2
|
"name": "template-react",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"scripts": {
|
|
5
|
+
"dev": "react-scripts start",
|
|
5
6
|
"build": "react-scripts build",
|
|
6
7
|
"eject": "react-scripts eject",
|
|
7
|
-
"lint": "eslint src
|
|
8
|
-
"dev": "react-scripts start",
|
|
8
|
+
"lint": "eslint src api --ext .mjs,.js,.jsx,.ts,.tsx",
|
|
9
9
|
"start": "npm-run-all --parallel start:*",
|
|
10
10
|
"start:client": "npm run dev",
|
|
11
|
-
"start:
|
|
11
|
+
"start:api": "NODE_ENV=development nodemon api/index.js -w api",
|
|
12
12
|
"clean": "rm -rf .blocklet",
|
|
13
|
-
"bundle": "npm run bundle:client && npm run bundle:
|
|
13
|
+
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
14
14
|
"bundle:client": "PUBLIC_URL='/.blocklet/proxy/<%= did %>' npm run build",
|
|
15
|
-
"bundle:
|
|
15
|
+
"bundle:api": "npm run clean && blocklet bundle --zip --create-release",
|
|
16
16
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
17
|
-
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json"
|
|
17
|
+
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
|
|
18
|
+
"prepare": "husky install"
|
|
19
|
+
},
|
|
20
|
+
"lint-staged": {
|
|
21
|
+
"*.{mjs,js,jsx,ts,tsx}": [
|
|
22
|
+
"prettier --write",
|
|
23
|
+
"eslint"
|
|
24
|
+
],
|
|
25
|
+
"*.{css,less,scss,json,graphql}": [
|
|
26
|
+
"prettier --write"
|
|
27
|
+
]
|
|
18
28
|
},
|
|
19
29
|
"browserslist": {
|
|
20
30
|
"production": [
|
|
@@ -29,40 +39,42 @@
|
|
|
29
39
|
]
|
|
30
40
|
},
|
|
31
41
|
"dependencies": {
|
|
32
|
-
"@arcblock/did-auth": "
|
|
33
|
-
"@arcblock/did-auth-storage-nedb": "
|
|
34
|
-
"@blocklet/sdk": "
|
|
35
|
-
"@ocap/client": "
|
|
36
|
-
"@ocap/mcrypto": "
|
|
37
|
-
"@ocap/wallet": "
|
|
38
|
-
"axios": "^0.
|
|
42
|
+
"@arcblock/did-auth": "^1.15.2",
|
|
43
|
+
"@arcblock/did-auth-storage-nedb": "^1.6.3",
|
|
44
|
+
"@blocklet/sdk": "^1.7.0",
|
|
45
|
+
"@ocap/client": "^1.15.2",
|
|
46
|
+
"@ocap/mcrypto": "^1.15.2",
|
|
47
|
+
"@ocap/wallet": "^1.15.2",
|
|
48
|
+
"axios": "^0.26.1",
|
|
39
49
|
"compression": "^1.7.4",
|
|
40
|
-
"cookie-parser": "^1.4.
|
|
50
|
+
"cookie-parser": "^1.4.6",
|
|
41
51
|
"cors": "^2.8.5",
|
|
42
52
|
"dotenv-flow": "^3.2.0",
|
|
43
|
-
"express": "^4.17.
|
|
53
|
+
"express": "^4.17.3",
|
|
44
54
|
"express-async-errors": "^3.1.1",
|
|
45
55
|
"express-history-api-fallback": "^2.2.1",
|
|
46
56
|
"react": "^17.0.2",
|
|
47
57
|
"react-dom": "^17.0.2",
|
|
48
|
-
"react-router-dom": "^
|
|
49
|
-
"react-scripts": "
|
|
58
|
+
"react-router-dom": "^6.2.2",
|
|
59
|
+
"react-scripts": "5.0.0"
|
|
50
60
|
},
|
|
51
61
|
"devDependencies": {
|
|
52
|
-
"@arcblock/eslint-config": "
|
|
62
|
+
"@arcblock/eslint-config": "^0.1.8",
|
|
53
63
|
"babel-eslint": "^10.1.0",
|
|
54
|
-
"eslint": "^7.
|
|
64
|
+
"eslint": "^7.32.0",
|
|
55
65
|
"eslint-config-airbnb": "^18.2.1",
|
|
56
66
|
"eslint-config-prettier": "^8.3.0",
|
|
57
67
|
"eslint-plugin-import": "^2.23.4",
|
|
58
68
|
"eslint-plugin-jsx-a11y": "^6.4.1",
|
|
59
|
-
"eslint-plugin-prettier": "^3.4.
|
|
69
|
+
"eslint-plugin-prettier": "^3.4.1",
|
|
60
70
|
"eslint-plugin-react": "^7.24.0",
|
|
61
71
|
"eslint-plugin-react-hooks": "^4.2.0",
|
|
62
72
|
"eslint-plugin-unicorn": "^34.0.1",
|
|
63
|
-
"http-proxy-middleware": "^2.0.
|
|
64
|
-
"
|
|
73
|
+
"http-proxy-middleware": "^2.0.4",
|
|
74
|
+
"husky": "^7.0.4",
|
|
75
|
+
"lint-staged": "^12.3.7",
|
|
76
|
+
"nodemon": "^2.0.15",
|
|
65
77
|
"npm-run-all": "^4.1.5",
|
|
66
|
-
"prettier": "^2.
|
|
78
|
+
"prettier": "^2.6.0"
|
|
67
79
|
}
|
|
68
80
|
}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
|
-
<link rel="icon"
|
|
6
|
-
<link rel="alternate icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
7
|
-
<link rel="mask-icon" href="%PUBLIC_URL%/favicon.svg" color="#4F6AF5" />
|
|
5
|
+
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
|
|
8
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
9
7
|
<meta name="theme-color" content="#4F6AF5" />
|
|
10
8
|
<meta name="description" content="Web site created using create-blocklet" />
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { BrowserRouter as Router,
|
|
2
|
+
import { BrowserRouter as Router, Routes, Route, Navigate } from 'react-router-dom';
|
|
3
3
|
|
|
4
4
|
import './app.css';
|
|
5
5
|
import Home from './pages/home';
|
|
@@ -8,17 +8,17 @@ import About from './pages/about';
|
|
|
8
8
|
function App() {
|
|
9
9
|
return (
|
|
10
10
|
<div className="app">
|
|
11
|
-
<
|
|
12
|
-
<Route exact path="/"
|
|
13
|
-
<Route path="/about"
|
|
14
|
-
<Route path="/home"
|
|
15
|
-
<
|
|
16
|
-
</
|
|
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
17
|
</div>
|
|
18
18
|
);
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const WrappedApp =
|
|
21
|
+
const WrappedApp = App;
|
|
22
22
|
|
|
23
23
|
export default () => {
|
|
24
24
|
// While the blocklet is deploy to a sub path, this will be work properly.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
node: true,
|
|
5
|
+
},
|
|
6
|
+
extends: ['plugin:vue/vue3-essential', 'eslint:recommended', 'plugin:prettier/recommended'],
|
|
7
|
+
globals: {
|
|
8
|
+
// Ref sugar (take 2)
|
|
9
|
+
$: 'readonly',
|
|
10
|
+
$$: 'readonly',
|
|
11
|
+
$ref: 'readonly',
|
|
12
|
+
$shallowRef: 'readonly',
|
|
13
|
+
$computed: 'readonly',
|
|
14
|
+
|
|
15
|
+
// script setup
|
|
16
|
+
defineProps: 'readonly',
|
|
17
|
+
defineEmits: 'readonly',
|
|
18
|
+
defineExpose: 'readonly',
|
|
19
|
+
withDefaults: 'readonly',
|
|
20
|
+
},
|
|
21
|
+
rules: {
|
|
22
|
+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
23
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
24
|
+
},
|
|
25
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const middleware = require('@blocklet/sdk/lib/middlewares');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user', middleware.user(), (req, res) => res.json(req.user));
|
|
4
|
+
router.use('/user', middleware.user(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
module.exports = router;
|
|
@@ -6,10 +6,10 @@ keywords:
|
|
|
6
6
|
- vue
|
|
7
7
|
group: dapp
|
|
8
8
|
did: ''
|
|
9
|
-
main:
|
|
9
|
+
main: api/index.js
|
|
10
10
|
author:
|
|
11
|
-
name:
|
|
12
|
-
email:
|
|
11
|
+
name: Blocklet
|
|
12
|
+
email: blocklet@arcblock.io
|
|
13
13
|
repository:
|
|
14
14
|
type: git
|
|
15
15
|
url: 'git+https://github.com/blocklet/create-blocklet.git'
|
|
@@ -22,6 +22,7 @@ files:
|
|
|
22
22
|
- README.md
|
|
23
23
|
- blocklet.md
|
|
24
24
|
- screenshots
|
|
25
|
+
- api/hooks/pre-start.js
|
|
25
26
|
interfaces:
|
|
26
27
|
- type: web
|
|
27
28
|
name: publicUrl
|
|
@@ -44,7 +45,7 @@ requirements:
|
|
|
44
45
|
os: '*'
|
|
45
46
|
cpu: '*'
|
|
46
47
|
scripts:
|
|
47
|
-
preStart: node
|
|
48
|
+
preStart: node api/hooks/pre-start.js
|
|
48
49
|
dev: npm run start
|
|
49
50
|
environments:
|
|
50
51
|
- name: CHAIN_HOST
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
<html lang="en">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="UTF-8" />
|
|
5
|
-
<link rel="icon"
|
|
6
|
-
<link rel="alternate icon" href="<%- base %>/favicon.ico" />
|
|
7
|
-
<link rel="mask-icon" href="<%- base %>/favicon.svg" color="#4F6AF5" />
|
|
5
|
+
<link rel="icon" href="<%- base %>/favicon.ico" />
|
|
8
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
9
7
|
<meta name="theme-color" content="#4F6AF5" />
|
|
10
8
|
<meta name="description" content="Web site created using create-blocklet" />
|
|
@@ -12,6 +10,7 @@
|
|
|
12
10
|
<script src="__meta__.js"></script>
|
|
13
11
|
</head>
|
|
14
12
|
<body>
|
|
13
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
15
14
|
<div id="app"></div>
|
|
16
15
|
<script type="module" src="/src/main.js"></script>
|
|
17
16
|
</body>
|
|
@@ -2,42 +2,59 @@
|
|
|
2
2
|
"name": "template-vue",
|
|
3
3
|
"version": "0.1.0",
|
|
4
4
|
"scripts": {
|
|
5
|
-
"dev": "vite",
|
|
5
|
+
"dev": "vite --host",
|
|
6
6
|
"build": "vite build",
|
|
7
7
|
"serve": "vite preview",
|
|
8
8
|
"start": "npm-run-all --parallel start:*",
|
|
9
|
-
"start:client": "
|
|
10
|
-
"start:
|
|
9
|
+
"start:client": "npm run dev",
|
|
10
|
+
"start:api": "NODE_ENV=development nodemon api/index.js -w api",
|
|
11
11
|
"clean": "rm -rf .blocklet",
|
|
12
|
-
"bundle": "npm run bundle:client && npm run bundle:
|
|
12
|
+
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
13
13
|
"bundle:client": "vite build --base /.blocklet/proxy/<%= did %>",
|
|
14
|
-
"bundle:
|
|
14
|
+
"bundle:api": "npm run clean && blocklet bundle --zip --create-release",
|
|
15
15
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
16
|
-
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json"
|
|
16
|
+
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
|
|
17
|
+
"lint": "eslint src api --ext .mjs,.js,.vue",
|
|
18
|
+
"prepare": "husky install"
|
|
17
19
|
},
|
|
18
20
|
"dependencies": {
|
|
19
|
-
"@arcblock/did-auth": "
|
|
20
|
-
"@arcblock/did-auth-storage-nedb": "
|
|
21
|
-
"@blocklet/sdk": "
|
|
22
|
-
"@ocap/client": "
|
|
23
|
-
"@ocap/mcrypto": "
|
|
24
|
-
"@ocap/wallet": "
|
|
25
|
-
"axios": "^0.
|
|
21
|
+
"@arcblock/did-auth": "^1.15.2",
|
|
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",
|
|
27
|
+
"axios": "^0.26.1",
|
|
26
28
|
"compression": "^1.7.4",
|
|
27
|
-
"cookie-parser": "^1.4.
|
|
29
|
+
"cookie-parser": "^1.4.6",
|
|
28
30
|
"cors": "^2.8.5",
|
|
29
31
|
"dotenv-flow": "^3.2.0",
|
|
30
|
-
"express": "^4.17.
|
|
32
|
+
"express": "^4.17.3",
|
|
31
33
|
"express-async-errors": "^3.1.1",
|
|
32
34
|
"express-history-api-fallback": "^2.2.1",
|
|
33
|
-
"vite-plugin-html": "^2.
|
|
34
|
-
"vue": "^3.2.
|
|
35
|
+
"vite-plugin-html": "^3.2.0",
|
|
36
|
+
"vue": "^3.2.31"
|
|
35
37
|
},
|
|
36
38
|
"devDependencies": {
|
|
37
|
-
"@vitejs/plugin-vue": "^
|
|
38
|
-
"
|
|
39
|
+
"@vitejs/plugin-vue": "^2.2.4",
|
|
40
|
+
"eslint": "^7.32.0",
|
|
41
|
+
"eslint-config-prettier": "^8.5.0",
|
|
42
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
43
|
+
"eslint-plugin-vue": "^8.5.0",
|
|
44
|
+
"husky": "^7.0.4",
|
|
45
|
+
"lint-staged": "^12.3.7",
|
|
46
|
+
"nodemon": "^2.0.15",
|
|
39
47
|
"npm-run-all": "^4.1.5",
|
|
40
|
-
"
|
|
41
|
-
"
|
|
48
|
+
"prettier": "^2.6.0",
|
|
49
|
+
"vite": "^2.8.6"
|
|
50
|
+
},
|
|
51
|
+
"lint-staged": {
|
|
52
|
+
"*.{mjs,js,vue}": [
|
|
53
|
+
"prettier --write",
|
|
54
|
+
"eslint --ext .mjs,.js,.vue"
|
|
55
|
+
],
|
|
56
|
+
"*.{css,less,scss,json,graphql}": [
|
|
57
|
+
"prettier --write"
|
|
58
|
+
]
|
|
42
59
|
}
|
|
43
60
|
}
|
|
@@ -3,14 +3,16 @@ import { ref } from 'vue';
|
|
|
3
3
|
// This starter template is using Vue 3 <script setup> SFCs
|
|
4
4
|
// Check out https://v3.vuejs.org/api/sfc-script-setup.html#sfc-script-setup
|
|
5
5
|
import HelloWorld from './components/HelloWorld.vue';
|
|
6
|
+
|
|
7
|
+
const msg = ref('Hello Vue 3 + Vite');
|
|
6
8
|
</script>
|
|
7
9
|
|
|
8
10
|
<template>
|
|
9
11
|
<img alt="Vue logo" src="./assets/logo.png" />
|
|
10
|
-
<HelloWorld msg="
|
|
12
|
+
<HelloWorld :msg="msg" />
|
|
11
13
|
<div :style="{ display: 'flex', justifyContent: 'center' }">
|
|
12
14
|
<pre :style="{ textAlign: 'left' }">
|
|
13
|
-
<code>{{ JSON.stringify(window
|
|
15
|
+
<code>{{ JSON.stringify(window?.blocklet, null, 2) }}</code>
|
|
14
16
|
</pre>
|
|
15
17
|
</div>
|
|
16
18
|
</template>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { defineConfig, loadEnv } from 'vite';
|
|
2
2
|
import vue from '@vitejs/plugin-vue';
|
|
3
|
-
import {
|
|
3
|
+
import { createHtmlPlugin } from 'vite-plugin-html';
|
|
4
4
|
|
|
5
5
|
// https://vitejs.dev/config/
|
|
6
6
|
export default ({ mode }) => {
|
|
@@ -8,11 +8,13 @@ export default ({ mode }) => {
|
|
|
8
8
|
return defineConfig({
|
|
9
9
|
plugins: [
|
|
10
10
|
vue(),
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
11
|
+
createHtmlPlugin({
|
|
12
|
+
minify: true,
|
|
13
|
+
inject: {
|
|
14
|
+
data: {
|
|
15
|
+
base: process.env.BASE_URL || '/',
|
|
16
|
+
title: envMap.VITE_APP_TITLE,
|
|
17
|
+
},
|
|
16
18
|
},
|
|
17
19
|
}),
|
|
18
20
|
],
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
root: true,
|
|
3
|
+
env: {
|
|
4
|
+
node: true,
|
|
5
|
+
},
|
|
6
|
+
extends: ['plugin:vue/essential', 'eslint:recommended', 'plugin:prettier/recommended'],
|
|
7
|
+
parserOptions: {
|
|
8
|
+
parser: '@babel/eslint-parser',
|
|
9
|
+
},
|
|
10
|
+
rules: {
|
|
11
|
+
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
12
|
+
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
const middleware = require('@blocklet/sdk/lib/middlewares');
|
|
2
2
|
const router = require('express').Router();
|
|
3
3
|
|
|
4
|
-
router.use('/user', middleware.user(), (req, res) => res.json(req.user));
|
|
4
|
+
router.use('/user', middleware.user(), (req, res) => res.json(req.user || {}));
|
|
5
5
|
|
|
6
6
|
module.exports = router;
|
|
@@ -4,12 +4,12 @@ description: A Blocklet Server blocklet
|
|
|
4
4
|
keywords:
|
|
5
5
|
- blocklet
|
|
6
6
|
- vue
|
|
7
|
-
group:
|
|
7
|
+
group: dapp
|
|
8
8
|
did: ''
|
|
9
|
-
main:
|
|
9
|
+
main: api/index.js
|
|
10
10
|
author:
|
|
11
|
-
name:
|
|
12
|
-
email:
|
|
11
|
+
name: Blocklet
|
|
12
|
+
email: blocklet@arcblock.io
|
|
13
13
|
repository:
|
|
14
14
|
type: git
|
|
15
15
|
url: git+https://github.com/blocklet/create-blocklet.git
|
|
@@ -21,6 +21,7 @@ files:
|
|
|
21
21
|
- README.md
|
|
22
22
|
- blocklet.md
|
|
23
23
|
- screenshots
|
|
24
|
+
- api/hooks/pre-start.js
|
|
24
25
|
interfaces:
|
|
25
26
|
- type: web
|
|
26
27
|
name: publicUrl
|
|
@@ -43,6 +44,7 @@ requirements:
|
|
|
43
44
|
os: '*'
|
|
44
45
|
cpu: '*'
|
|
45
46
|
scripts:
|
|
47
|
+
preStart: node api/hooks/pre-start.js
|
|
46
48
|
dev: npm run start
|
|
47
49
|
environments:
|
|
48
50
|
- name: CHAIN_HOST
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"module": "esnext",
|
|
5
|
+
"baseUrl": "./",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"paths": {
|
|
8
|
+
"@/*": [
|
|
9
|
+
"src/*"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"lib": [
|
|
13
|
+
"esnext",
|
|
14
|
+
"dom",
|
|
15
|
+
"dom.iterable",
|
|
16
|
+
"scripthost"
|
|
17
|
+
]
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -5,64 +5,59 @@
|
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve": "vue-cli-service serve",
|
|
7
7
|
"build": "vue-cli-service build",
|
|
8
|
-
"lint": "vue
|
|
8
|
+
"lint": "eslint src api --ext .mjs,.js,.vue",
|
|
9
9
|
"start": "npm-run-all --parallel start:*",
|
|
10
10
|
"start:client": "npm run serve",
|
|
11
|
-
"start:
|
|
11
|
+
"start:api": "NODE_ENV=development nodemon api/index.js -w api",
|
|
12
12
|
"clean": "rm -rf .blocklet",
|
|
13
|
-
"bundle": "npm run bundle:client && npm run bundle:
|
|
13
|
+
"bundle": "npm run bundle:client && npm run bundle:api",
|
|
14
14
|
"bundle:client": "PUBLIC_PATH=/.blocklet/proxy/z8ia5PYHKJaG7LxTiKK74YhN1vkVMf7N7VncW",
|
|
15
|
-
"bundle:
|
|
15
|
+
"bundle:api": "npm run clean && blocklet bundle --zip --create-release",
|
|
16
16
|
"deploy": "npm run bundle && blocklet deploy .blocklet/bundle",
|
|
17
|
-
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json"
|
|
17
|
+
"upload": "npm run bundle && blocklet upload .blocklet/release/blocklet.json",
|
|
18
|
+
"prepare": "husky install"
|
|
18
19
|
},
|
|
19
20
|
"dependencies": {
|
|
20
|
-
"@arcblock/did-auth": "
|
|
21
|
-
"@arcblock/did-auth-storage-nedb": "
|
|
22
|
-
"@blocklet/sdk": "
|
|
23
|
-
"@ocap/client": "
|
|
24
|
-
"@ocap/mcrypto": "
|
|
25
|
-
"@ocap/wallet": "
|
|
26
|
-
"axios": "^0.
|
|
21
|
+
"@arcblock/did-auth": "^1.15.2",
|
|
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",
|
|
27
|
+
"axios": "^0.26.1",
|
|
27
28
|
"compression": "^1.7.4",
|
|
28
|
-
"cookie-parser": "^1.4.
|
|
29
|
-
"core-js": "^3.
|
|
29
|
+
"cookie-parser": "^1.4.6",
|
|
30
|
+
"core-js": "^3.21.1",
|
|
30
31
|
"cors": "^2.8.5",
|
|
31
32
|
"dotenv-flow": "^3.2.0",
|
|
32
|
-
"express": "^4.17.
|
|
33
|
+
"express": "^4.17.3",
|
|
33
34
|
"express-async-errors": "^3.1.1",
|
|
34
35
|
"express-history-api-fallback": "^2.2.1",
|
|
35
|
-
"vue": "^2.6.
|
|
36
|
-
"vue-router": "^3.5.3"
|
|
36
|
+
"vue": "^2.6.14"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@
|
|
40
|
-
"@
|
|
41
|
-
"@vue/cli-
|
|
42
|
-
"
|
|
43
|
-
"
|
|
44
|
-
"eslint
|
|
45
|
-
"
|
|
39
|
+
"@babel/core": "^7.17.8",
|
|
40
|
+
"@babel/eslint-parser": "^7.17.0",
|
|
41
|
+
"@vue/cli-plugin-babel": "~5.0.3",
|
|
42
|
+
"@vue/cli-plugin-eslint": "~5.0.3",
|
|
43
|
+
"@vue/cli-service": "~5.0.3",
|
|
44
|
+
"eslint": "^7.32.0",
|
|
45
|
+
"eslint-config-prettier": "^8.5.0",
|
|
46
|
+
"eslint-plugin-prettier": "^4.0.0",
|
|
47
|
+
"eslint-plugin-vue": "^8.5.0",
|
|
48
|
+
"husky": "^7.0.4",
|
|
49
|
+
"lint-staged": "^12.3.7",
|
|
50
|
+
"nodemon": "^2.0.15",
|
|
46
51
|
"npm-run-all": "^4.1.5",
|
|
47
|
-
"vue-template-compiler": "^2.6.
|
|
52
|
+
"vue-template-compiler": "^2.6.14"
|
|
48
53
|
},
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
"
|
|
53
|
-
},
|
|
54
|
-
"extends": [
|
|
55
|
-
"plugin:vue/essential",
|
|
56
|
-
"eslint:recommended"
|
|
54
|
+
"lint-staged": {
|
|
55
|
+
"*.{mjs,js,vue}": [
|
|
56
|
+
"prettier --write",
|
|
57
|
+
"eslint --ext .mjs,.js,.vue"
|
|
57
58
|
],
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
"browserslist": [
|
|
64
|
-
"> 1%",
|
|
65
|
-
"last 2 versions",
|
|
66
|
-
"not dead"
|
|
67
|
-
]
|
|
59
|
+
"*.{css,less,scss,json,graphql}": [
|
|
60
|
+
"prettier --write"
|
|
61
|
+
]
|
|
62
|
+
}
|
|
68
63
|
}
|
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
<html lang="">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
|
-
<link rel="icon"
|
|
6
|
-
<link rel="alternate icon" href="<%= BASE_URL %>favicon.ico" />
|
|
7
|
-
<link rel="mask-icon" href="<%= BASE_URL %>favicon.svg" color="#4F6AF5" />
|
|
5
|
+
<link rel="icon" href="<%= BASE_URL %>favicon.ico" />
|
|
8
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
|
|
9
7
|
<meta name="theme-color" content="#4F6AF5" />
|
|
10
8
|
<meta name="description" content="Web site created using create-blocklet" />
|
|
@@ -12,12 +10,7 @@
|
|
|
12
10
|
<script src="__meta__.js"></script>
|
|
13
11
|
</head>
|
|
14
12
|
<body>
|
|
15
|
-
<noscript>
|
|
16
|
-
<strong
|
|
17
|
-
>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please
|
|
18
|
-
enable it to continue.</strong
|
|
19
|
-
>
|
|
20
|
-
</noscript>
|
|
13
|
+
<noscript>You need to enable JavaScript to run this app.</noscript>
|
|
21
14
|
<div id="app"></div>
|
|
22
15
|
<!-- built files will be auto injected -->
|
|
23
16
|
</body>
|