Commit 54c566d2 by Jason Zhou

fix app App issue

parent 8a5fbded
...@@ -15,11 +15,16 @@ handlebars.registerHelper('if_eq', function(a, b, opts) { ...@@ -15,11 +15,16 @@ handlebars.registerHelper('if_eq', function(a, b, opts) {
const restoreLegacyCodes = () => { const restoreLegacyCodes = () => {
log.title('📤 Restore previous codes') log.title('📤 Restore previous codes')
LEGACY_CODES.forEach(file => { LEGACY_CODES.regulars.forEach(file => {
log.item(`Restoring ${file} ...`) log.item(`Restoring ${file} ...`)
const basename = path.basename(file) const basename = path.basename(file)
fs.copyFileSync(`${__dirname}/codes/old/${basename}`, file) fs.copyFileSync(`${__dirname}/codes/old/${basename}`, file)
}) })
LEGACY_CODES.exceptions.forEach(file => {
log.item(`Restoring ${file} ...`)
const basename = path.basename(file)
fs.copyFileSync(`${__dirname}/codes/old/exceptions/${basename}`, file)
})
} }
const updateConfigs = (mode = 'chill') => { const updateConfigs = (mode = 'chill') => {
...@@ -45,11 +50,16 @@ const restoreConfigs = () => { ...@@ -45,11 +50,16 @@ const restoreConfigs = () => {
} }
const updateCodes = () => { const updateCodes = () => {
LEGACY_CODES.forEach(file => { LEGACY_CODES.regulars.forEach(file => {
const basename = path.basename(file) const basename = path.basename(file)
log.item(`Updating ${basename} ...`) log.item(`Updating ${basename} ...`)
fs.copyFileSync(`${__dirname}/codes/new/${basename}`, file) fs.copyFileSync(`${__dirname}/codes/new/${basename}`, file)
}) })
LEGACY_CODES.exceptions.forEach(file => {
const basename = path.basename(file)
log.item(`Updating ${basename} ...`)
fs.copyFileSync(`${__dirname}/codes/new/exceptions/${basename}`, file)
})
} }
const updatePackages = () => { const updatePackages = () => {
......
[ {
"regulars": [
"package.json", "package.json",
"yarn.lock", "yarn.lock",
"config/fonts.json", "config/fonts.json",
"Procfile", "Procfile",
"fe/js/App.es6",
"fe/js/blog.client.es6", "fe/js/blog.client.es6",
"fe/js/BlogEditor.es6", "fe/js/BlogEditor.es6",
"fe/js/components/HtmlComponent.es6", "fe/js/components/HtmlComponent.es6",
...@@ -37,4 +37,6 @@ ...@@ -37,4 +37,6 @@
"fe/manifests/verticals/zine.js", "fe/manifests/verticals/zine.js",
"fe/nextgen/app.es6", "fe/nextgen/app.es6",
"fe/scripts/fonts/generateFontsJson.js" "fe/scripts/fonts/generateFontsJson.js"
] ],
"exceptions": ["fe/js/App.es6"]
}
require('./init')
// This component will be the entry point for our entire app based on new architecture design from
// this document: https://striking.quip.com/gazxA3ZruIrs
// It curently only includes very limited functionality, but the goal is to gradually move everything
// to be bootstrap from here
import $ from 'jquery'
import EditorStore from 'js/stores/editor_store'
import EditPage from 'js/v3_bridge/edit_page_bridge'
import * as i18nHelper from 'js/utils/helpers/i18nHelper'
import 'js/vendor/jquery/jquery.ba-hashchange.min'
// HACK: setup event object (v3 legacy, only a fix for old code)
// v3 code still relay on event to communicate with iframes
let Event = null
window.edit_page = EditPage
if (parent.window.edit_page && parent.window.edit_page.Event) {
Event = parent.window.edit_page.Event
EditPage.Event = Event
} else {
Event = EditPage.Event
if (parent.window.edit_page) {
parent.window.edit_page.Event = Event
} else {
parent.window.edit_page = {
Event
}
}
}
const p1 = import(`locales/${i18nHelper.getTranslationFile()}`)
Promise.all([p1])
.then(([poFile]) => {
const I18n = require('js/utils/i18n')
I18n.init(poFile)
$(() => {
const cloudinary = require('cloudinary')
const ConfStore = require('js/stores/conf_store')
cloudinary.config('cloud_name', ConfStore.getCloudinaryCloudName())
const ctx = EditorStore.init()
const ReactAppManager = require('js/v4_bridge/react_app_bridge/ReactAppManager')
ReactAppManager.init(ctx)
// TODO: use react router
$(window).hashchange(() => {
const appName = document.location.hash.replace('#', '')
if (appName !== '') {
ReactAppManager.loadApp(appName)
}
})
$(window).hashchange()
})
})
.catch(e => console.error(e))
if (module.hot) {
module.hot.accept(err => {
if (err) {
console.error(err)
}
})
}
require('./init')
// This component will be the entry point for our entire app based on new architecture design from
// this document: https://striking.quip.com/gazxA3ZruIrs
// It curently only includes very limited functionality, but the goal is to gradually move everything
// to be bootstrap from here
import $ from 'jquery'
import EditorStore from 'js/stores/editor_store'
import EditPage from 'js/v3_bridge/edit_page_bridge'
import * as i18nHelper from 'js/utils/helpers/i18nHelper'
import 'js/vendor/jquery/jquery.ba-hashchange.min'
// HACK: setup event object (v3 legacy, only a fix for old code)
// v3 code still relay on event to communicate with iframes
let Event = null
window.edit_page = EditPage
if (parent.window.edit_page && parent.window.edit_page.Event) {
Event = parent.window.edit_page.Event
EditPage.Event = Event
} else {
Event = EditPage.Event
if (parent.window.edit_page) {
parent.window.edit_page.Event = Event
} else {
parent.window.edit_page = {
Event,
}
}
}
const p1 = require(`promise-loader?global!locales/${i18nHelper.getTranslationFile()}`)
Promise.all([p1()])
.then(([poFile]) => {
const I18n = require('js/utils/i18n')
I18n.init(poFile)
$(() => {
const cloudinary = require('cloudinary')
const ConfStore = require('js/stores/conf_store')
cloudinary.config('cloud_name', ConfStore.getCloudinaryCloudName())
const ctx = EditorStore.init()
const ReactAppManager = require('js/v4_bridge/react_app_bridge/ReactAppManager')
ReactAppManager.init(ctx)
// TODO: use react router
$(window).hashchange(() => {
const appName = document.location.hash.replace('#', '')
if (appName !== '') {
ReactAppManager.loadApp(appName)
}
})
$(window).hashchange()
})
})
.catch(e => console.error(e))
if (module.hot) {
module.hot.accept(err => {
if (err) {
console.error(err)
}
})
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment