Browse Source

refactor: Upgrade to Fusebox 2.0

pull/98/head
NGPixel 7 years ago
parent
commit
3fa941ce19
7 changed files with 149 additions and 51 deletions
  1. 17
      client/js/components/copy-path.vue
  2. 11
      client/js/pages/view.js
  3. 46
      fuse.js
  4. 6
      package.json
  5. 4
      server/libs/markdown.js
  6. 15
      tsconfig.json
  7. 101
      yarn.lock

17
client/js/components/copy-path.vue

@ -0,0 +1,17 @@
<template>
<div>
<p>{{ msg }}</p>
<input type="text" v-model="msg" />
</div>
</template>
<script>
export default {
name: 'app',
data () {
return {
msg: 'Welcome to Your Vue.js App'
}
}
}
</script>

11
client/js/pages/view.js

@ -1,12 +1,23 @@
'use strict'
/* eslint-disable no-new */
import $ from 'jquery'
import MathJax from 'mathjax'
import * as CopyPath from '../components/copy-path.vue'
import Vue from 'vue'
module.exports = (alerts) => {
if ($('#page-type-view').length) {
let currentBasePath = ($('#page-type-view').data('entrypath') !== 'home') ? $('#page-type-view').data('entrypath') : ''
// Copy Path
new Vue({
el: '.modal-copypath',
render: h => h(CopyPath)
})
// MathJax Render
MathJax.Hub.Config({

46
fuse.js

@ -188,11 +188,12 @@ globalTasks.then(() => {
fuse = fsbx.FuseBox.init({
homeDir: './client',
outFile: './assets/js/bundle.min.js',
output: './assets/js/$name.min.js',
alias: ALIASES,
shim: SHIMS,
plugins: [
[ fsbx.SassPlugin({ includePaths: ['../core'] }), fsbx.CSSPlugin() ],
fsbx.VuePlugin(),
[ '.scss', fsbx.SassPlugin(), fsbx.CSSPlugin() ],
fsbx.BabelPlugin({ comments: false, presets: ['es2015'] }),
fsbx.JSONPlugin()
],
@ -200,15 +201,16 @@ globalTasks.then(() => {
log: true
})
fuse.devServer('>index.js', {
fuse.dev({
port: 4444,
httpServer: false,
hmr: false
httpServer: false
})
// Server
fuse.bundle('bundle')
.instructions('> index.js')
.watch()
_.delay(() => {
fuse.run().then(() => {
nodemon({
exec: (args.i) ? 'node --inspect server' : 'node server',
ignore: ['assets/', 'client/', 'data/', 'repo/', 'tests/'],
@ -216,7 +218,8 @@ globalTasks.then(() => {
watch: ['server'],
env: { 'NODE_ENV': 'development' }
})
}, 1000)
})
break
// =============================================
// CONFIGURE - DEVELOPER MODE
@ -226,11 +229,11 @@ globalTasks.then(() => {
fuse = fsbx.FuseBox.init({
homeDir: './client',
outFile: './assets/js/configure.min.js',
output: './assets/js/$name.min.js',
alias: ALIASES,
shim: SHIMS,
plugins: [
[ fsbx.SassPlugin({ includePaths: ['../core'] }), fsbx.CSSPlugin() ],
[ '.scss', fsbx.SassPlugin(), fsbx.CSSPlugin() ],
fsbx.BabelPlugin({ comments: false, presets: ['es2015'] }),
fsbx.JSONPlugin()
],
@ -238,14 +241,16 @@ globalTasks.then(() => {
log: true
})
fuse.devServer('>configure.js', {
fuse.dev({
port: 4444,
httpServer: false
})
// Server
fuse.bundle('configure')
.instructions('> configure.js')
.watch()
_.delay(() => {
fuse.run().then(() => {
nodemon({
exec: 'node wiki configure',
ignore: ['assets/', 'client/', 'data/', 'repo/', 'tests/'],
@ -253,7 +258,8 @@ globalTasks.then(() => {
watch: ['server/configure.js'],
env: { 'NODE_ENV': 'development' }
})
}, 1000)
})
break
// =============================================
// BUILD ONLY MODE
@ -261,11 +267,13 @@ globalTasks.then(() => {
case 'build':
fuse = fsbx.FuseBox.init({
homeDir: './client',
output: './assets/js/$name.min.js',
alias: ALIASES,
shim: SHIMS,
plugins: [
fsbx.EnvPlugin({ NODE_ENV: 'production' }),
[ fsbx.SassPlugin({ outputStyle: 'compressed', includePaths: ['./node_modules/requarks-core'] }), fsbx.CSSPlugin() ],
fsbx.VuePlugin(),
[ '.scss', fsbx.SassPlugin({ outputStyle: 'compressed' }), fsbx.CSSPlugin() ],
fsbx.BabelPlugin({
config: {
comments: false,
@ -282,10 +290,10 @@ globalTasks.then(() => {
log: true
})
fuse.bundle({
'./assets/js/bundle.min.js': '>index.js',
'./assets/js/configure.min.js': '>configure.js'
}).then(() => {
fuse.bundle('bundle').instructions('> index.js')
fuse.bundle('configure').instructions('> configure.js')
fuse.run().then(() => {
console.info(colors.green.bold('\nAssets compilation + bundling completed.'))
}).catch(err => {
console.error(colors.red(' X Bundle compilation failed! ' + err.message))

6
package.json

@ -134,7 +134,7 @@
"eslint-plugin-node": "latest",
"eslint-plugin-promise": "latest",
"eslint-plugin-standard": "latest",
"fuse-box": "^1.3.131",
"fuse-box": "^2.0.0-beta.13",
"jest": "latest",
"jquery": "^3.2.1",
"jquery-contextmenu": "^2.4.4",
@ -148,9 +148,11 @@
"snyk": "latest",
"standard": "latest",
"twemoji-awesome": "^1.0.6",
"typescript": "^2.3.2",
"uglify-js": "latest",
"vee-validate": "^2.0.0-rc.2",
"vue": "^2.3.0"
"vue": "^2.3.2",
"vue-template-compiler": "^2.3.2"
},
"standard": {
"globals": [

4
server/libs/markdown.js

@ -112,10 +112,10 @@ const parseTree = (content) => {
let content = ''
let anchor = ''
if (heading.children && heading.children.length > 0 && heading.children[0].type === 'link_open') {
content = removeMarkdown(heading.children[1].content)
content = mdRemove(heading.children[1].content)
anchor = _.kebabCase(content)
} else {
content = removeMarkdown(heading.content)
content = mdRemove(heading.content)
anchor = _.kebabCase(heading.children.reduce((acc, t) => acc + t.content, ''))
}

15
tsconfig.json

@ -0,0 +1,15 @@
{
"compilerOptions": {
"allowJs": true,
"alwaysStrict": true,
"module": "commonjs",
"moduleResolution": "node",
"noImplicitAny": true,
"preserveConstEnums": true,
"removeComments": true,
"sourceMap": false,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"target": "es5"
}
}

101
yarn.lock

@ -273,12 +273,18 @@ async@1.5, async@^1.4.0, async@^1.5, async@~1.5:
version "1.5.2"
resolved "https://registry.yarnpkg.com/async/-/async-1.5.2.tgz#ec6a61ae56480c0c3cb241c95618e20892f9672a"
async@2.1.4, async@^2.1.4:
async@2.1.4:
version "2.1.4"
resolved "https://registry.yarnpkg.com/async/-/async-2.1.4.tgz#2d2160c7788032e4dd6cbe2502f1f9a2c8f6cde4"
dependencies:
lodash "^4.14.0"
async@^2.1.4:
version "2.4.0"
resolved "https://registry.yarnpkg.com/async/-/async-2.4.0.tgz#4990200f18ea5b837c2cc4f8c031a6985c385611"
dependencies:
lodash "^4.14.0"
async@~0.9.0:
version "0.9.2"
resolved "https://registry.yarnpkg.com/async/-/async-0.9.2.tgz#aea74d5e61c1f899613bf64bda66d4c78f2fd17d"
@ -1490,6 +1496,10 @@ dashdash@^1.12.0, dashdash@^1.14.0:
dependencies:
assert-plus "^1.0.0"
de-indent@^1.0.2:
version "1.0.2"
resolved "https://registry.yarnpkg.com/de-indent/-/de-indent-1.0.2.tgz#b2038e846dc33baa5796128d0804b455b8c1e21d"
debug-log@^1.0.0:
version "1.0.1"
resolved "https://registry.yarnpkg.com/debug-log/-/debug-log-1.0.1.tgz#2307632d4c04382b8df8a32f70b895046d52745f"
@ -1851,10 +1861,14 @@ es6-map@^0.1.3:
es6-symbol "~3.1.1"
event-emitter "~0.3.5"
es6-promise@3.2.1, es6-promise@^3.0.2, es6-promise@^3.1.2:
es6-promise@3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.2.1.tgz#ec56233868032909207170c39448e24449dd1fc4"
es6-promise@^3.0.2, es6-promise@^3.1.2:
version "3.3.1"
resolved "https://registry.yarnpkg.com/es6-promise/-/es6-promise-3.3.1.tgz#a08cdde84ccdbf34d027a1451bc91d4bcd28a613"
es6-set@~0.1.5:
version "0.1.5"
resolved "https://registry.yarnpkg.com/es6-set/-/es6-set-0.1.5.tgz#d2b3ec5d4d800ced818db538d28974db0a73ccb1"
@ -2434,8 +2448,8 @@ fs-extra@^2.0.0:
jsonfile "^2.1.0"
fs-extra@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.0.tgz#244e0c4b0b8818f54040ec049d8a2bddc1202861"
version "3.0.1"
resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-3.0.1.tgz#3794f378c58b342ea7dbbb23095109c4b3b62291"
dependencies:
graceful-fs "^4.1.2"
jsonfile "^3.0.0"
@ -2481,9 +2495,9 @@ 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@^1.3.131:
version "1.3.131"
resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-1.3.131.tgz#8325ae47236139aad6b2cbe92a4a5fafea3063c6"
fuse-box@^2.0.0-beta.13:
version "2.0.0-beta.13"
resolved "https://registry.yarnpkg.com/fuse-box/-/fuse-box-2.0.0-beta.13.tgz#b30651dbe199f6297cdbe8a6e1907329dc73fd0c"
dependencies:
acorn "^4.0.3"
acorn-es7 "^0.1.0"
@ -2492,22 +2506,30 @@ fuse-box@^1.3.131:
app-root-path "^2.0.1"
base64-img "^1.0.3"
base64-js "^1.2.0"
chokidar "^1.6.1"
commander "^2.9.0"
concat-with-sourcemaps "^1.0.4"
escodegen "^1.8.1"
express "^4.14.0"
fs-extra "^2.0.0"
fuse-tools "^1.0.4"
glob "^7.1.1"
ieee754 "^1.1.8"
inquirer "^3.0.6"
mustache "^2.3.0"
postcss "^5.2.11"
pretty-time "^0.2.0"
prettysize "0.0.3"
realm-utils "^1.0.8"
request "^2.79.0"
shorthash "0.0.2"
watch "^1.0.1"
ws "^1.1.1"
fuse-tools@^1.0.4:
version "1.0.5"
resolved "https://registry.yarnpkg.com/fuse-tools/-/fuse-tools-1.0.5.tgz#98c9f5133348a9a91357cbf8bf57171fa6cd614a"
gauge@~2.7.1:
version "2.7.4"
resolved "https://registry.yarnpkg.com/gauge/-/gauge-2.7.4.tgz#2c03405c7538c39d7eb37b317022e325fb018bf7"
@ -2685,8 +2707,8 @@ growly@^1.3.0:
resolved "https://registry.yarnpkg.com/growly/-/growly-1.3.0.tgz#f10748cbe76af964b7c96c93c6bcc28af120c081"
handlebars@^4.0.3:
version "4.0.7"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.7.tgz#e97325aeb8ea0b9e12b9c4dd73c4c312ad0ede59"
version "4.0.8"
resolved "https://registry.yarnpkg.com/handlebars/-/handlebars-4.0.8.tgz#22b875cd3f0e6cbea30314f144e82bc7a72ff420"
dependencies:
async "^1.4.0"
optimist "^0.6.1"
@ -2750,6 +2772,10 @@ hawk@~3.1.3:
hoek "2.x.x"
sntp "1.x.x"
he@^1.1.0:
version "1.1.1"
resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd"
highlight.js@^9.11.0:
version "9.11.0"
resolved "https://registry.yarnpkg.com/highlight.js/-/highlight.js-9.11.0.tgz#47f98c7399918700db2caf230ded12cec41a84ae"
@ -2848,8 +2874,8 @@ ignore-by-default@^1.0.0:
resolved "https://registry.yarnpkg.com/ignore-by-default/-/ignore-by-default-1.0.1.tgz#48ca6d72f6c6a3af00a9ad4ae6876be3889e2b09"
ignore@^3.0.11, ignore@^3.0.9, ignore@^3.2.0:
version "3.2.7"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.2.7.tgz#4810ca5f1d8eca5595213a34b94f2eb4ed926bbd"
version "3.3.0"
resolved "https://registry.yarnpkg.com/ignore/-/ignore-3.3.0.tgz#3812d22cbe9125f2c2b4915755a1b8abd745a001"
image-size@^0.5.1:
version "0.5.1"
@ -4099,8 +4125,8 @@ markdown-it-emoji@^1.3.0:
resolved "https://registry.yarnpkg.com/markdown-it-emoji/-/markdown-it-emoji-1.3.0.tgz#903ae1a9968c3f17d4e142f115d4ec575e56d2cb"
markdown-it-expand-tabs@^1.0.11:
version "1.0.11"
resolved "https://registry.yarnpkg.com/markdown-it-expand-tabs/-/markdown-it-expand-tabs-1.0.11.tgz#7804ab5aab8b1368191b43469d87e2ede4af086a"
version "1.0.12"
resolved "https://registry.yarnpkg.com/markdown-it-expand-tabs/-/markdown-it-expand-tabs-1.0.12.tgz#f54bd2f303f858ee6798ca2bd83fe70144814ca0"
dependencies:
lodash.repeat "^4.0.0"
@ -4117,8 +4143,8 @@ markdown-it-mathjax@^2.0.0:
resolved "https://registry.yarnpkg.com/markdown-it-mathjax/-/markdown-it-mathjax-2.0.0.tgz#ae2b4f4c5c719a03f9e475c664f7b2685231d9e9"
markdown-it-task-lists@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/markdown-it-task-lists/-/markdown-it-task-lists-2.0.0.tgz#471edd893fe87b8bb61d48fd427f8f20b5ab739e"
version "2.0.1"
resolved "https://registry.yarnpkg.com/markdown-it-task-lists/-/markdown-it-task-lists-2.0.1.tgz#a9ce7f55cde9f45e0fca629071d11d3fd5a69416"
markdown-it@^8.3.1:
version "8.3.1"
@ -4347,6 +4373,10 @@ muri@1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/muri/-/muri-1.2.1.tgz#ec7ea5ce6ca6a523eb1ab35bacda5fa816c9aa3c"
mustache@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/mustache/-/mustache-2.3.0.tgz#4028f7778b17708a489930a6e52ac3bca0da41d0"
mute-stream@0.0.5:
version "0.0.5"
resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.5.tgz#8fbfabb0a98a253d3184331f9e8deb7372fac6c0"
@ -4623,13 +4653,13 @@ on-headers@~1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/on-headers/-/on-headers-1.0.1.tgz#928f5d0f470d49342651ea6794b0857c100693f7"
once@^1.3.0, once@~1.3.0:
once@^1.3.0, once@^1.3.1, once@~1.3.0:
version "1.3.3"
resolved "https://registry.yarnpkg.com/once/-/once-1.3.3.tgz#b2e261557ce4c314ec8304f3fa82663e4297ca20"
dependencies:
wrappy "1"
once@^1.3.1, once@^1.3.3, once@^1.4.0:
once@^1.3.3, once@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/once/-/once-1.4.0.tgz#583b1aa775961d4b113ac17d9c50baef9dd76bd1"
dependencies:
@ -5529,8 +5559,8 @@ regexpu-core@^2.0.0:
regjsparser "^0.1.4"
registry-auth-token@^3.0.1:
version "3.3.0"
resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.0.tgz#57ae67347e73d96345ed1bc01294c7237c02aa63"
version "3.3.1"
resolved "https://registry.yarnpkg.com/registry-auth-token/-/registry-auth-token-3.3.1.tgz#fb0d3289ee0d9ada2cbb52af5dfe66cb070d3006"
dependencies:
rc "^1.1.6"
safe-buffer "^5.0.1"
@ -5860,6 +5890,10 @@ shimmer@^1.0.0, shimmer@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/shimmer/-/shimmer-1.1.0.tgz#97d7377137ffbbab425522e429fe0aa89a488b35"
shorthash@0.0.2:
version "0.0.2"
resolved "https://registry.yarnpkg.com/shorthash/-/shorthash-0.0.2.tgz#59b268eecbde59038b30da202bcfbddeb2c4a4eb"
signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"
@ -5984,8 +6018,8 @@ snyk-try-require@^1.1.1, snyk-try-require@^1.2.0:
then-fs "^2.0.0"
snyk@latest:
version "1.29.0"
resolved "https://registry.yarnpkg.com/snyk/-/snyk-1.29.0.tgz#20be4eaddc9641ca004fb24368dc33d6f82d17dc"
version "1.30.0"
resolved "https://registry.yarnpkg.com/snyk/-/snyk-1.30.0.tgz#a323809ea477d6aff0e325f5995cb491c0d7ca3d"
dependencies:
abbrev "^1.0.7"
ansi-escapes "^1.3.0"
@ -6494,6 +6528,10 @@ typedarray@^0.0.6:
version "0.0.6"
resolved "https://registry.yarnpkg.com/typedarray/-/typedarray-0.0.6.tgz#867ac74e3864187b1d3d47d996a78ec5c8830777"
typescript@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.3.2.tgz#f0f045e196f69a72f06b25fd3bd39d01c3ce9984"
typo-js@*:
version "1.0.3"
resolved "https://registry.yarnpkg.com/typo-js/-/typo-js-1.0.3.tgz#54d8ebc7949f1a7810908b6002c6841526c99d5a"
@ -6673,8 +6711,8 @@ vasync@^1.6.4:
verror "1.6.0"
vee-validate@^2.0.0-rc.2:
version "2.0.0-rc.2"
resolved "https://registry.yarnpkg.com/vee-validate/-/vee-validate-2.0.0-rc.2.tgz#bb93b021e272465f432fe829d7e52cf626bafdc4"
version "2.0.0-rc.3"
resolved "https://registry.yarnpkg.com/vee-validate/-/vee-validate-2.0.0-rc.3.tgz#2ae889c203d0fcaca787a16070027ef36e5b1f6d"
verror@1.3.6:
version "1.3.6"
@ -6689,8 +6727,8 @@ verror@1.6.0:
extsprintf "1.2.0"
verror@^1.8.1:
version "1.9.0"
resolved "https://registry.yarnpkg.com/verror/-/verror-1.9.0.tgz#107a8a2d14c33586fc4bb830057cd2d19ae2a6ee"
version "1.10.0"
resolved "https://registry.yarnpkg.com/verror/-/verror-1.10.0.tgz#3a105ca17053af55d6e270c1f8288682e18da400"
dependencies:
assert-plus "^1.0.0"
core-util-is "1.0.2"
@ -6706,9 +6744,16 @@ void-elements@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/void-elements/-/void-elements-2.0.1.tgz#c066afb582bb1cb4128d60ea92392e94d5e9dbec"
vue@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.3.0.tgz#bc44db0488c5245c788304c7683efe7b4c862d82"
vue-template-compiler@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/vue-template-compiler/-/vue-template-compiler-2.3.2.tgz#d48a7f53df5f497033827182ceb4f0d340803017"
dependencies:
de-indent "^1.0.2"
he "^1.1.0"
vue@^2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/vue/-/vue-2.3.2.tgz#9e52aae3593480be235ff227557837e69f98203a"
vxx@^1.2.0:
version "1.2.1"

Loading…
Cancel
Save