Skip to content

Commit ee9d439

Browse files
committed
build: upgrade nuxt; migrate to runtime config
1 parent 7260bca commit ee9d439

File tree

9 files changed

+3619
-5189
lines changed

9 files changed

+3619
-5189
lines changed

.env.example

Whitespace-only changes.

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ module.exports = {
5555
'repository.ts',
5656
'*.repository.ts',
5757
'test/**/*',
58+
'*.d.ts',
5859
],
5960
rules: {
6061
'@typescript-eslint/no-explicit-any': 'off',

api/social/social.repository.ts

+2-5
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ export default ($axios: AxiosInstance) => ({
1515
.then((response: AxiosResponse<UserResponseInterface[]>) => {
1616
const { data } = response
1717

18-
const users: UserResponseInterface[] = data
19-
20-
return users
18+
return data
2119
})
2220
.catch((error: AxiosError) => {
2321
throw error
@@ -34,9 +32,8 @@ export default ($axios: AxiosInstance) => ({
3432
.get(`${API_URL}/${id}`)
3533
.then((response: AxiosResponse<UserResponseInterface>) => {
3634
const { data } = response
37-
const user: UserResponseInterface = data
3835

39-
return user
36+
return data
4037
})
4138
.catch((error: AxiosError) => {
4239
throw error

components/footer/Footer.vue

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<template>
22
<v-footer app color="primary">
33
<span class="mx-auto white--text font-weight-bold"
4-
>{{ new Date().getFullYear() }} &copy; {{ appName }}</span
4+
>{{ new Date().getFullYear() }} &copy; {{ $config.appName }}</span
55
>
66
</v-footer>
77
</template>
@@ -10,8 +10,5 @@
1010
import { Component, Vue } from 'nuxt-property-decorator'
1111
1212
@Component
13-
export default class Footer extends Vue {
14-
// * * Data
15-
appName?: string = process.env.APP_NAME
16-
}
13+
export default class Footer extends Vue {}
1714
</script>

nuxt.config.js

+29-24
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
const DEBUG = process.env.NODE_ENV !== 'production'
2-
const APP_NAME = 'Nuxify'
3-
const APP_DESCRIPTION = "Writing Software Like It's Ours"
4-
const APP_URL = 'http://localhost:3000'
5-
6-
const API_URL = DEBUG
7-
? 'https://jsonplaceholder.typicode.com'
8-
: 'https://jsonplaceholder.typicode.com'
92

103
export default {
11-
target: 'static',
124
ssr: true,
5+
target: 'static',
6+
server: {
7+
port: process.env.APP_PORT,
8+
host: process.env.APP_HOST,
9+
},
1310
/*
1411
** Headers of the page
1512
*/
1613
head: {
17-
titleTemplate: '%s - ' + APP_NAME,
18-
title: APP_NAME || '',
14+
titleTemplate: '%s - ' + process.env.APP_NAME,
15+
title: process.env.APP_NAME || '',
1916
meta: [
2017
{ charset: 'utf-8' },
2118
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
2219
{
2320
hid: 'description',
2421
name: 'description',
25-
content: APP_DESCRIPTION || '',
22+
content: process.env.APP_DESCRIPTION || '',
2623
},
2724
// OG Tag setup
2825
// https://vue-meta.nuxtjs.org/api/#meta
@@ -33,27 +30,27 @@ export default {
3330
},
3431
{
3532
property: 'og:title',
36-
content: APP_NAME,
33+
content: process.env.APP_NAME,
3734
vmid: 'og:title',
3835
},
3936
{
4037
property: 'og:description',
41-
content: APP_DESCRIPTION,
38+
content: process.env.APP_DESCRIPTION,
4239
vmid: 'og:description',
4340
},
4441
{
4542
property: 'og:site_name',
46-
content: APP_URL,
43+
content: process.env.APP_URL,
4744
vmid: 'og:site_name',
4845
},
4946
{
5047
property: 'og:url',
51-
content: APP_URL,
48+
content: process.env.APP_URL,
5249
vmid: 'og:url',
5350
},
5451
{
5552
property: 'og:image',
56-
content: APP_URL + '/icon.png',
53+
content: process.env.APP_URL + '/icon.png',
5754
vmid: 'og:image',
5855
},
5956
],
@@ -97,23 +94,31 @@ export default {
9794
// Doc: https://axios.nuxtjs.org/usage
9895
'@nuxtjs/axios',
9996
'@nuxtjs/pwa',
100-
// Doc: https://github.com/nuxt-community/dotenv-module
101-
'@nuxtjs/dotenv',
10297
['vue-scrollto/nuxt', { duration: 1000 }],
10398
],
99+
/**
100+
* Public runtime configs
101+
*/
102+
publicRuntimeConfig: {
103+
appName: process.env.APP_NAME,
104+
},
105+
/**
106+
* Private runtime configs
107+
*/
108+
privateRuntimeConfig: {},
104109
/**
105110
* PWA module configuration
106111
* https://pwa.nuxtjs.org/setup.html
107112
*/
108113
pwa: {
109114
meta: {
110-
title: APP_NAME,
115+
title: process.env.APP_NAME,
111116
},
112117
manifest: {
113-
name: APP_NAME,
114-
short_name: APP_NAME,
115-
description: APP_DESCRIPTION,
116-
start_url: APP_URL,
118+
name: process.env.APP_NAME,
119+
short_name: process.env.APP_NAME,
120+
description: process.env.APP_DESCRIPTION,
121+
start_url: process.env.APP_URL,
117122
lang: 'en',
118123
},
119124
},
@@ -122,7 +127,7 @@ export default {
122127
** See https://axios.nuxtjs.org/options
123128
*/
124129
axios: {
125-
baseURL: API_URL,
130+
baseURL: process.env.API_URL,
126131
debug: DEBUG,
127132
},
128133
/*

0 commit comments

Comments
 (0)