Skip to content

Commit

Permalink
fix: Safari/iOS const redefinition
Browse files Browse the repository at this point in the history
  • Loading branch information
NGPixel committed Jul 22, 2017
1 parent 44b5a2e commit 6a45e1e
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 12 deletions.
47 changes: 45 additions & 2 deletions fuse.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
const colors = require('colors/safe')
const fsbx = require('fuse-box')
const nodemon = require('nodemon')
const babel = require('babel-core')
const uglify = require('uglify-es')
const fs = require('fs-extra')

// ======================================================
// Parse cmd arguments
Expand Down Expand Up @@ -90,7 +93,7 @@ globalTasks.then(() => {
fsbx.VuePlugin(),
['.scss', fsbx.SassPlugin({ outputStyle: (dev) ? 'nested' : 'compressed' }), fsbx.CSSPlugin()],
fsbx.BabelPlugin({ comments: false, presets: ['es2015'] }),
fsbx.JSONPlugin(),
fsbx.JSONPlugin()
/* !dev && fsbx.QuantumPlugin({
target: 'browser',
uglify: true,
Expand All @@ -109,7 +112,7 @@ globalTasks.then(() => {
})
}
}) */
!dev && fsbx.UglifyESPlugin()
// !dev && fsbx.UglifyESPlugin()
],
debug: false,
log: true
Expand Down Expand Up @@ -140,6 +143,46 @@ globalTasks.then(() => {
watch: (args.d) ? ['server'] : ['server/configure.js'],
env: { 'NODE_ENV': 'development' }
})
} else {
console.info(colors.yellow.bold('\nTranspiling vendor bundle...'))
let appCode = babel.transform(fs.readFileSync('./assets/js/app.js', 'utf8'), {
babelrc: false,
compact: false,
filename: 'app.js',
plugins: ['transform-object-assign']
}).code
let vendorCode = babel.transform(fs.readFileSync('./assets/js/vendor.js', 'utf8'), {
babelrc: false,
comments: false,
compact: false,
filename: 'vendor.js',
plugins: [
'transform-es2015-arrow-functions',
'transform-es2015-block-scoped-functions',
'transform-es2015-block-scoping',
'transform-es2015-classes',
'transform-es2015-computed-properties',
'transform-es2015-destructuring',
'transform-es2015-duplicate-keys',
'transform-es2015-for-of',
'transform-es2015-function-name',
'transform-es2015-literals',
'transform-es2015-object-super',
'transform-es2015-parameters',
'transform-es2015-shorthand-properties',
'transform-es2015-spread',
'transform-es2015-sticky-regex',
'transform-es2015-template-literals',
'transform-es2015-typeof-symbol',
'transform-es2015-unicode-regex'
]
}).code
console.info(colors.yellow.bold('Minifing bundles...'))
fs.writeFileSync('./assets/js/vendor.js', uglify.minify(vendorCode).code, 'utf8')
fs.writeFileSync('./assets/js/app.js', uglify.minify(appCode).code, 'utf8')
fs.writeFileSync('./assets/js/configure.js', uglify.minify(fs.readFileSync('./assets/js/configure.js', 'utf8')).code, 'utf8')
console.info(colors.green.bold('\nBUILD SUCCEEDED.'))
return true
}
}).catch(err => {
console.error(colors.red(' X Bundle compilation failed! ' + err.message))
Expand Down
2 changes: 1 addition & 1 deletion npm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wiki.js",
"version": "1.0.0",
"version": "1.0.1",
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "install.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wiki",
"version": "1.0.0",
"version": "1.0.1",
"description": "A modern, lightweight and powerful wiki app built on NodeJS, Git and Markdown",
"main": "wiki.js",
"scripts": {
Expand Down Expand Up @@ -129,6 +129,7 @@
"@panter/vue-i18next": "~0.5.0",
"babel-cli": "~6.24.1",
"babel-jest": "~20.0.3",
"babel-plugin-transform-object-assign": "~6.22.0",
"babel-preset-es2015": "~6.24.1",
"brace": "~0.10.0",
"colors": "~1.1.2",
Expand Down
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
"target": "es5"
},
"exclude": [
"node_modules"
".fusebox",
"data",
"node_modules",
"repo"
]
}
18 changes: 12 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,12 @@ babel-plugin-transform-es2015-unicode-regex@^6.24.1:
babel-runtime "^6.22.0"
regexpu-core "^2.0.0"

babel-plugin-transform-object-assign@~6.22.0:
version "6.22.0"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-object-assign/-/babel-plugin-transform-object-assign-6.22.0.tgz#f99d2f66f1a0b0d498e346c5359684740caa20ba"
dependencies:
babel-runtime "^6.22.0"

babel-plugin-transform-regenerator@^6.24.1:
version "6.24.1"
resolved "https://registry.yarnpkg.com/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.24.1.tgz#b8da305ad43c3c99b4848e4fe4037b770d23c418"
Expand Down Expand Up @@ -2043,7 +2049,7 @@ eslint-scope@^3.7.1:
esrecurse "^4.1.0"
estraverse "^4.1.1"

eslint@^4.3.0:
eslint@~4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/eslint/-/eslint-4.3.0.tgz#fcd7c96376bbf34c85ee67ed0012a299642b108f"
dependencies:
Expand Down Expand Up @@ -2591,7 +2597,7 @@ functional-red-black-tree@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"

fuse-box@^2.2.1:
fuse-box@~2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-2.2.1.tgz#444dc3bd01a47b8044210d7344495cae92d3af3a"
dependencies:
Expand Down Expand Up @@ -4490,7 +4496,7 @@ mongodb@2.2.27:
mongodb-core "2.1.14"
readable-stream "2.2.7"

mongoose@*, mongoose@^4.11.1:
mongoose@*, mongoose@~4.11.1:
version "4.11.3"
resolved "https://registry.yarnpkg.com/mongoose/-/mongoose-4.11.3.tgz#f93d427b282c2e798b0fe1532fb41a7dde6e98d3"
dependencies:
Expand Down Expand Up @@ -5999,7 +6005,7 @@ search-index-adder@~0.3.9:
optionalDependencies:
leveldown "^1.7.1"

search-index-searcher@^0.2.10:
search-index-searcher@~0.2.10:
version "0.2.10"
resolved "https://registry.yarnpkg.com/search-index-searcher/-/search-index-searcher-0.2.10.tgz#3b52b8bb643065883997dfce57c6c792ec551cb0"
dependencies:
Expand Down Expand Up @@ -6936,7 +6942,7 @@ vue-resource@~1.3.4:
dependencies:
got "^7.0.0"

vue-template-compiler@^2.4.2:
vue-template-compiler@~2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.4.2.tgz#5a45d843f148b098f6c1d1e35ac20c4956d30ad1"
dependencies:
Expand All @@ -6947,7 +6953,7 @@ vue-template-es2015-compiler@~1.5.3:
version "1.5.3"
resolved "https://registry.yarnpkg.com/vue-template-es2015-compiler/-/vue-template-es2015-compiler-1.5.3.tgz#22787de4e37ebd9339b74223bc467d1adee30545"

vue@^2.4.2:
vue@~2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.4.2.tgz#a9855261f191c978cc0dc1150531b8d08149b58c"

Expand Down

0 comments on commit 6a45e1e

Please sign in to comment.