Skip to content

Commit 128aa4d

Browse files
authored
feat: Updated vue template for codegen (#807)
* feat: Updated vue template * package.json fixes
1 parent 86ab58d commit 128aa4d

File tree

21 files changed

+14985
-12143
lines changed

21 files changed

+14985
-12143
lines changed

starport/templates/app/stargate/vue/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
node_modules
33
/dist
44

5+
56
# local env files
67
.env.local
78
.env.*.local
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
module.exports = {
2-
presets: [
3-
'@vue/cli-plugin-babel/preset'
4-
]
2+
presets: ['@vue/cli-plugin-babel/preset']
53
}

starport/templates/app/stargate/vue/package-lock.json

Lines changed: 14444 additions & 12060 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

starport/templates/app/stargate/vue/package.json

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,43 @@
55
"scripts": {
66
"dev": "npm install && vue-cli-service serve",
77
"serve": "vue-cli-service serve",
8-
"build": "vue-cli-service build"
8+
"build": "vue-cli-service build",
9+
"lint": "vue-cli-service lint",
10+
"test": "echo \"Error: run tests from root\" && exit 1"
911
},
1012
"dependencies": {
11-
"@cosmjs/launchpad": "0.23.2",
12-
"@cosmjs/proto-signing": "0.24.0-alpha.26",
13-
"@cosmjs/stargate": "0.24.0-alpha.26",
14-
"@tendermint/vue": "0.1.12",
15-
"core-js": "^3.6.5",
16-
"vue": "^2.6.11",
17-
"vue-router": "^3.2.0",
18-
"vuex": "^3.4.0"
13+
"@cosmjs/crypto": "^0.23.2",
14+
"@cosmjs/encoding": "^0.23.2",
15+
"@cosmjs/proto-signing": "^0.24.0-alpha.26",
16+
"@cosmjs/stargate": "^0.24.0-alpha.26",
17+
"@starport/vue": "^0.1.20",
18+
"@starport/vuex": "^0.1.20",
19+
"bip39": "^3.0.3",
20+
"core-js": "^3.9.1",
21+
"crypto-js": "^4.0.0",
22+
"file-saver": "^2.0.5",
23+
"moment": "^2.29.1",
24+
"vue": "^3.0.7",
25+
"vue-router": "^4.0.3",
26+
"vue-uuid": "^2.0.2",
27+
"vuex": "^4.0.0"
1928
},
2029
"devDependencies": {
21-
"@vue/cli-plugin-babel": "^4.4.0",
22-
"@vue/cli-plugin-router": "^4.4.0",
23-
"@vue/cli-plugin-vuex": "^4.4.6",
24-
"@vue/cli-service": "^4.4.0",
25-
"vue-template-compiler": "^2.6.11"
30+
"@babel/core": "^7.13.8",
31+
"@babel/node": "^7.13.0",
32+
"@vue/cli-plugin-babel": "^4.5.11",
33+
"@vue/cli-plugin-eslint": "^4.5.11",
34+
"@vue/cli-plugin-vuex": "^4.5.11",
35+
"@vue/cli-service": "^4.5.11",
36+
"@vue/compiler-sfc": "^3.0.7",
37+
"@vue/eslint-config-prettier": "^6.0.0",
38+
"babel-eslint": "^10.1.0",
39+
"eslint": "^7.21.0",
40+
"eslint-plugin-prettier": "^3.3.1",
41+
"eslint-plugin-vue": "^7.7.0",
42+
"node-sass": "^5.0.0",
43+
"prettier": "^2.2.1",
44+
"protobufjs": "^6.10.2",
45+
"sass-loader": "^10.1.1"
2646
}
2747
}

starport/templates/app/stargate/vue/public/index.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
<meta name="viewport" content="width=device-width,initial-scale=1.0">
77
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
88
<title><%= htmlWebpackPlugin.options.title %></title>
9+
<link rel="preconnect" href="https://fonts.gstatic.com">
10+
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&display=swap" rel="stylesheet">
911
</head>
1012
<body>
1113
<noscript>
1214
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
1315
</noscript>
14-
<div id="app"></div>
16+
<div id="app" class="app"></div>
1517
<!-- built files will be auto injected -->
1618
</body>
1719
</html>
Lines changed: 62 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,72 @@
11
<template>
2-
<div>
3-
<router-view />
4-
</div>
2+
<div v-if="initialized">
3+
<SpWallet ref="wallet" v-on:dropdown-opened="$refs.menu.closeDropdown()" />
4+
<SpLayout>
5+
<template v-slot:sidebar>
6+
<SpSidebar
7+
v-on:sidebar-open="sidebarOpen = true"
8+
v-on:sidebar-close="sidebarOpen = false"
9+
>
10+
<template v-slot:header>
11+
<SpLogo />
12+
</template>
13+
<template v-slot:default>
14+
<SpLinkIcon link="/" text="Dashboard" icon="Dashboard" />
15+
<SpLinkIcon link="/modules" text="Modules" icon="Modules" />
16+
<SpLinkIcon
17+
link="/transactions"
18+
text="Transactions"
19+
icon="Transactions"
20+
/>
21+
<SpLinkIcon link="/types" text="Custom Type" icon="Form" />
22+
<div class="sp-dash"></div>
23+
<SpLinkIcon link="/settings" text="Settings" icon="Settings" />
24+
<SpLinkIcon link="/docs" text="Documentation" icon="Docs" />
25+
</template>
26+
<template v-slot:footer>
27+
<SpStatusAPI :showText="sidebarOpen" />
28+
<SpStatusRPC :showText="sidebarOpen" />
29+
<SpStatusWS :showText="sidebarOpen" />
30+
<div class="sp-text">Build: v0.3.8</div>
31+
</template>
32+
</SpSidebar>
33+
</template>
34+
<template v-slot:content>
35+
<router-view />
36+
</template>
37+
</SpLayout>
38+
</div>
539
</template>
640

741
<style>
8-
.sp-container {
9-
margin: 0 auto;
10-
max-width: 800px;
11-
padding: 1rem;
42+
body {
43+
margin: 0;
1244
}
1345
</style>
1446

1547
<script>
48+
import './scss/app.scss'
49+
import '@starport/vue/lib/starport-vue.css'
50+
1651
export default {
17-
created() {
18-
this.$store.dispatch("cosmos/init");
19-
},
20-
};
52+
data() {
53+
return {
54+
initialized: false,
55+
sidebarOpen: true
56+
}
57+
},
58+
computed: {
59+
hasWallet() {
60+
return this.$store.hasModule(['chain', 'common', 'wallet'])
61+
}
62+
},
63+
async created() {
64+
await this.$store.dispatch('chain/common/env/init')
65+
this.initialized = true
66+
},
67+
errorCaptured(err) {
68+
console.log(err)
69+
return false
70+
}
71+
}
2172
</script>
Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
import Vue from "vue";
2-
import App from "./App.vue";
3-
import router from "./router";
4-
import store from "./store";
1+
import { createApp } from 'vue'
2+
import App from './App.vue'
3+
import store from './store'
4+
import router from './router'
5+
import vueLib from '@starport/vue'
56

6-
Vue.config.productionTip = false;
7-
8-
new Vue({
9-
router,
10-
store,
11-
render: (h) => h(App),
12-
}).$mount("#app");
7+
const app = createApp(App)
8+
app.config.globalProperties._depsLoaded = true
9+
app.use(store).use(router).use(vueLib).mount('#app')
Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,29 @@
1-
import Vue from "vue";
2-
import VueRouter from "vue-router";
3-
import Index from "../views/Index.vue";
4-
5-
Vue.use(VueRouter);
1+
import { createRouter, createWebHistory } from 'vue-router'
2+
import Index from '@/views/Index.vue'
3+
import Address from '@/views/Address.vue'
4+
import Block from '@/views/Block.vue'
5+
import Blocks from '@/views/Blocks.vue'
6+
import Send from '@/views/Send.vue'
7+
import Wallet from '@/views/Wallet.vue'
8+
import Legacy from '@/views/Legacy.vue'
69

10+
const routerHistory = createWebHistory()
711
const routes = [
8-
{
9-
path: "/",
10-
component: Index,
11-
},
12-
];
12+
{
13+
path: '/',
14+
component: Index
15+
},
16+
{ path: '/address/:address', component: Address },
17+
{ path: '/block/:block', component: Block },
18+
{ path: '/blocks/:page?', component: Blocks },
19+
{ path: '/send/', component: Send },
20+
{ path: '/wallet/', component: Wallet },
21+
{ path: '/legacy/', component: Legacy }
22+
]
1323

14-
const router = new VueRouter({
15-
mode: "history",
16-
base: process.env.BASE_URL,
17-
routes,
18-
});
24+
const router = createRouter({
25+
history: routerHistory,
26+
routes
27+
})
1928

20-
export default router;
29+
export default router
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
//Your custom styles here
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import CosmosBankV1beta1 from './cosmos/cosmos-sdk/cosmos.bank.v1beta1'
2+
// To be filled with rest of sdk modules
3+
export default { CosmosBankV1beta1 }

0 commit comments

Comments
 (0)