Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Firebase hosting #31

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
upd
  • Loading branch information
ihororlovskyi committed Dec 21, 2018
commit 6bf62ba15ff5cba21963c3df2a72dc122cc0b9c8
38 changes: 24 additions & 14 deletions .firebase/hosting.cHVibGlj.cache
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
assets/client/0e4338761429b4eb16ac.css,1545395109000,f1b651238a58fe290baec6c5e32f3bdb1943dd2bd582f02569231f7a757c7837
404.html,1545395988000,05cbc6f94d7a69ce2e29646eab13be2c884e61ba93e3094df5028866876d18b3
index.html,1545395988000,2733a859c83708115343a7aeacbb9f438ba721e3aa8eecbc879031ea87f6b750
assets/client/023e0dc2786c62eb6ff6.css,1545395109000,d71025acdfbfd11b2e1ea9c26a963115bfb81ff6fd4ffb81ddd6b88157cd106a
assets/client/3e56e0c8051d8b215d57.js,1545395109000,534d8682ba563bed59965f540d450584aa5e699b67fddcc0f06ca1af51200be9
assets/client/LICENSES,1545395109000,94f1febf195e9d00cfc81a6c7409128fd283bce9353e0d9e5122980ba03131d7
assets/client/4dd29d1562f69d7284bd.js,1545395109000,ca05f8722d5a4f2024f8952366fda39ad657bf0dd3fb3ea99bdcb4298f1566dd
assets/server/index.spa.html,1545395109000,ae38f295d69115199fd3090c22c3a8bbefe0a0649352b9b78b2a777719c6d195
assets/server/index.ssr.html,1545395109000,6c3a8db5fff66b7b944cb9f44c4ac362208dfa10709de4021ccb0be7f3450ae7
assets/server/vue-ssr-client-manifest.json,1545395109000,3e636b5e3fecd93a0c6e7e43e4d7c80e42bbbac6eb3405a7d802fa9003925c53
assets/client/813c417f745479e1d65b.js,1545395109000,92673286a9f24259569b182f2debb144f85b244246f16c41ad15f9328133161e
assets/client/f6d6c40f11917b2ec412.js,1545395109000,f819d201ba94283431d793d2c5c635ce01bd9a5ff955d9a93f514daa81249ba5
assets/client/1db33fde65a52ad6f7f5.js,1545395109000,d9ec54f216b712779e86216ed6a8d0249b7fb9af22965aff62c7ceef92fb19dd
assets/server/server-bundle.json,1545395109000,a1922abaf6d3c1946a2d2c3cdcf8d1601a01fbf7c6a5a26ad020d7d8b0006198
app.bc35257661150fa55f19fa5726fe83ae.css,1545424730000,d4f5e17422a8b9a47022c787dbb6a3779a5e30e70e0d0e7595570d2d4eef6b52
manifest.ef51d643e9f2bee5cc2e.js,1545424730000,1760d77f3af3fbe040d5a49c455631f85c7752e6b447f823b5027a2b37a50595
LICENSES,1545424730000,5f30c576ab19aa6fe0b26e0b8af5955228ba1f93701da179d1aa3bbbb3d70b70
index.spa.html,1545424730000,3c572bded1376dbec59f189325cc57d6eeab7f268913ae1a0f8a3ea65a00a475
dist/LICENSES,1545424770000,5f30c576ab19aa6fe0b26e0b8af5955228ba1f93701da179d1aa3bbbb3d70b70
index.ssr.html,1545424730000,1596fb45cfe6baa57df6fd80efab6e3698542869dfaab5e3757b6cba66afb6b3
dist/app.bc35257661150fa55f19fa5726fe83ae.css,1545424770000,d4f5e17422a8b9a47022c787dbb6a3779a5e30e70e0d0e7595570d2d4eef6b52
dist/index.spa.html,1545424770000,3c572bded1376dbec59f189325cc57d6eeab7f268913ae1a0f8a3ea65a00a475
dist/index.ssr.html,1545424770000,1596fb45cfe6baa57df6fd80efab6e3698542869dfaab5e3757b6cba66afb6b3
dist/manifest.ef51d643e9f2bee5cc2e.js,1545424770000,1760d77f3af3fbe040d5a49c455631f85c7752e6b447f823b5027a2b37a50595
app.7e4da707c9280a16df1e.js,1545424730000,c534d89f2538ae5c71a9b377c8cb436cc644049ef73203964119f45f15dc779f
dist/layouts/default.6b655dc83b729cb8293b.js,1545424770000,37b1c5e579407e958c27862703813fc1fe57039151a84419b6edcc622ab5de4f
dist/vue-ssr-client-manifest.json,1545424770000,079eeefd121c0f2811783ba66ee299164f3c5f5023cbf5adbc3ebed817415195
dist/app.7e4da707c9280a16df1e.js,1545424770000,c534d89f2538ae5c71a9b377c8cb436cc644049ef73203964119f45f15dc779f
dist/pages/index.637615b5af75a3338bfb.js,1545424770000,39c962202d7d7f988321fc48352e28529a43b52a3557dc60cf58bd07237533c0
layouts/default.6b655dc83b729cb8293b.js,1545424730000,37b1c5e579407e958c27862703813fc1fe57039151a84419b6edcc622ab5de4f
dist/pages/release/_key.154fd3a744256ba8dc85.js,1545424770000,7d51ce688980009a479bdad1723aa3677c61629927a66993dbb94ad18fb4ae1e
vue-ssr-client-manifest.json,1545424730000,079eeefd121c0f2811783ba66ee299164f3c5f5023cbf5adbc3ebed817415195
pages/index.637615b5af75a3338bfb.js,1545424730000,39c962202d7d7f988321fc48352e28529a43b52a3557dc60cf58bd07237533c0
pages/release/_key.154fd3a744256ba8dc85.js,1545424730000,7d51ce688980009a479bdad1723aa3677c61629927a66993dbb94ad18fb4ae1e
dist/server-bundle.json,1545424770000,041b1adbcac73a0f218b35d231eaecf5c11f8cf38a72211a19abf7e2a069b498
server-bundle.json,1545424730000,041b1adbcac73a0f218b35d231eaecf5c11f8cf38a72211a19abf7e2a069b498
dist/vendor.8fa848e2668953cf81c0.js,1545424770000,d75dbb1a8ca9ce3fcfa6b262e62e332953bf1aeb1f028f30c7a8b2931b07bee8
vendor.8fa848e2668953cf81c0.js,1545424730000,d75dbb1a8ca9ce3fcfa6b262e62e332953bf1aeb1f028f30c7a8b2931b07bee8
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
node_modules/
.nuxt/
dist/
public/
firebase-debug.log
.firebase/
functions/nuxt/
2 changes: 1 addition & 1 deletion functions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const config = {
dev: false,
buildDir: 'nuxt',
build: {
publicPath: '/public/'
publicPath: '/'
}
}

Expand Down
125 changes: 0 additions & 125 deletions functions/nuxt/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,32 +29,6 @@ let router
const NUXT = window.__NUXT__ || {}


// Setup global Vue error handler
const defaultErrorHandler = Vue.config.errorHandler
Vue.config.errorHandler = function (err, vm, info) {
const nuxtError = {
statusCode: err.statusCode || err.name || 'Whoops!',
message: err.message || err.toString()
}

// Show Nuxt Error Page
if(vm && vm.$root && vm.$root.$nuxt && vm.$root.$nuxt.error && info !== 'render function') {
vm.$root.$nuxt.error(nuxtError)
}

// Call other handler if exist
if (typeof defaultErrorHandler === 'function') {
return defaultErrorHandler(...arguments)
}

// Log to console
if (process.env.NODE_ENV !== 'production') {
console.error(err)
} else {
console.error(err.message || nuxtError.message)
}
}


// Create and mount App
createApp()
Expand Down Expand Up @@ -407,9 +381,6 @@ function fixPrepatch(to, ___) {
})
showNextPage.call(this, to)

// Hot reloading
setTimeout(() => hotReloadAPI(this), 100)

})
}

Expand All @@ -431,99 +402,6 @@ function nuxtReady (_app) {
}


// Special hot reload with asyncData(context)
function getNuxtChildComponents($parent, $components = []) {
$parent.$children.forEach(($child) => {
if ($child.$vnode.data.nuxtChild && !$components.find(c =>(c.$options.__file === $child.$options.__file))) {
$components.push($child)
}
if ($child.$children && $child.$children.length) {
getNuxtChildComponents($child, $components)
}
})

return $components
}

function hotReloadAPI (_app) {
if (!module.hot) return

let $components = getNuxtChildComponents(_app.$nuxt, [])

$components.forEach(addHotReload.bind(_app))
}

function addHotReload ($component, depth) {
if ($component.$vnode.data._hasHotReload) return
$component.$vnode.data._hasHotReload = true

var _forceUpdate = $component.$forceUpdate.bind($component.$parent)

$component.$vnode.context.$forceUpdate = async () => {
let Components = getMatchedComponents(router.currentRoute)
let Component = Components[depth]
if (!Component) return _forceUpdate()
if (typeof Component === 'object' && !Component.options) {
// Updated via vue-router resolveAsyncComponents()
Component = Vue.extend(Component)
Component._Ctor = Component
}
this.error()
let promises = []
const next = function (path) {
this.$loading.finish && this.$loading.finish()
router.push(path)
}
await setContext(app, {
route: router.currentRoute,
isHMR: true,
next: next.bind(this)
})
const context = app.context
this.$loading.start && this.$loading.start()
callMiddleware.call(this, Components, context)
.then(() => {
// If layout changed
if (depth !== 0) return Promise.resolve()
let layout = Component.options.layout || 'default'
if (typeof layout === 'function') {
layout = layout(context)
}
if (this.layoutName === layout) return Promise.resolve()
let promise = this.loadLayout(layout)
promise.then(() => {
this.setLayout(layout)
Vue.nextTick(() => hotReloadAPI(this))
})
return promise
})
.then(() => {
return callMiddleware.call(this, Components, context, this.layout)
})
.then(() => {
// Call asyncData(context)
let pAsyncData = promisify(Component.options.asyncData || noopData, context)
pAsyncData.then((asyncDataResult) => {
applyAsyncData(Component, asyncDataResult)
this.$loading.increase && this.$loading.increase(30)
})
promises.push(pAsyncData)
// Call fetch()
Component.options.fetch = Component.options.fetch || noopFetch
let pFetch = Component.options.fetch(context)
if (!pFetch || (!(pFetch instanceof Promise) && (typeof pFetch.then !== 'function'))) { pFetch = Promise.resolve(pFetch) }
pFetch.then(() => this.$loading.increase && this.$loading.increase(30))
promises.push(pFetch)
return Promise.all(promises)
})
.then(() => {
this.$loading.finish && this.$loading.finish()
_forceUpdate()
setTimeout(() => hotReloadAPI(this), 100)
})
}
}


async function mountApp(__app) {
// Set global variables
Expand Down Expand Up @@ -553,9 +431,6 @@ async function mountApp(__app) {
// Call window.onNuxtReady callbacks
nuxtReady(_app)

// Enable hot reloading
hotReloadAPI(_app)

})
}

Expand Down
22 changes: 0 additions & 22 deletions functions/nuxt/components/nuxt-error.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
<nuxt-link class="error-link" to="/">Back to the home page</nuxt-link>
</p>

<p class="description" v-else>An error occurred while rendering the page. Check developer tools console for details.</p>


<div class="logo">
<a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt.js</a>
Expand All @@ -34,26 +32,6 @@ export default {
}
},

// Only on debug mode
data () {
return {
mounted: false
}
},
mounted () {
this.mounted = true
},
created () {
console.error(this.error)
},
watch: {
error(newErr) {
if(newErr) {
console.error(newErr)
}
}
},

computed: {
statusCode () {
return (this.error && this.error.statusCode) || 500
Expand Down
6 changes: 6 additions & 0 deletions functions/nuxt/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Router from 'vue-router'

Vue.use(Router)

const _845fa828 = () => import('../../src/pages/release/_key.vue' /* webpackChunkName: "pages/release/_key" */).then(m => m.default || m)
const _a5133d84 = () => import('../../src/pages/index.vue' /* webpackChunkName: "pages/index" */).then(m => m.default || m)


Expand Down Expand Up @@ -63,6 +64,11 @@ export function createRouter () {
linkExactActiveClass: 'nuxt-link-exact-active',
scrollBehavior,
routes: [
{
path: "/release/:key?",
component: _845fa828,
name: "release-key"
},
{
path: "/",
component: _a5133d84,
Expand Down
6 changes: 3 additions & 3 deletions functions/nuxt/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { applyAsyncData, sanitizeComponent, getMatchedComponents, getContext, mi
const debug = require('debug')('nuxt:render')
debug.color = 4 // force blue color

const isDev = true
const isDev = false

const noopApp = () => new Vue({ render: (h) => h('div') })

Expand Down Expand Up @@ -77,7 +77,7 @@ export default async ssrContext => {
return renderErrorPage()
}

const s = isDev && Date.now()


// Components are already resolved by setContext -> getRouteData (app/utils.js)
const Components = getMatchedComponents(router.match(ssrContext.url))
Expand Down Expand Up @@ -184,7 +184,7 @@ export default async ssrContext => {
return Promise.all(promises)
}))

if (asyncDatas.length) debug('Data fetching ' + ssrContext.url + ': ' + (Date.now() - s) + 'ms')


// datas are the first row of each
ssrContext.nuxt.data = asyncDatas.map(r => r[0] || {})
Expand Down
2 changes: 1 addition & 1 deletion functions/nuxt/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export async function setContext(app, context) {
return process.client
},
isStatic: process.static,
isDev: true,
isDev: false,
isHMR: false,
app,

Expand Down
2 changes: 1 addition & 1 deletion functions/nuxt/views/error.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<div class="error">
<svg xmlns="http://www.w3.org/2000/svg" width="90" height="90" fill="#DBE1EC" viewBox="0 0 48 48"><path d="M22 30h4v4h-4zm0-16h4v12h-4zm1.99-10C12.94 4 4 12.95 4 24s8.94 20 19.99 20S44 35.05 44 24 35.04 4 23.99 4zM24 40c-8.84 0-16-7.16-16-16S15.16 8 24 8s16 7.16 16 16-7.16 16-16 16z"/></svg>
<div class="title">Server error</div>
<div class="description">{{ message }}</div>
<div class="description">An error occurred in the application and your page could not be served. If you are the application owner, check your logs for details.</div>
</div>
<div class="logo">
<a href="https://nuxtjs.org" target="_blank" rel="noopener">Nuxt.js</a>
Expand Down
Loading