refactor: dev optimizations + improvements
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
**/node_modules/**
|
||||
**/*.min.js
|
||||
assets/**
|
||||
client/libs/**
|
||||
coverage/**
|
||||
repo/**
|
||||
data/**
|
||||
|
||||
@@ -80,7 +80,6 @@ Vue.component('login', () => import(/* webpackMode: "eager" */ './components/log
|
||||
Vue.component('nav-header', () => import(/* webpackMode: "eager" */ './components/nav-header.vue'))
|
||||
Vue.component('navigator', () => import(/* webpackMode: "eager" */ './components/navigator.vue'))
|
||||
Vue.component('setup', () => import(/* webpackChunkName: "setup" */ './components/setup.vue'))
|
||||
Vue.component('toggle', () => import(/* webpackMode: "eager" */ './components/toggle.vue'))
|
||||
|
||||
let bootstrap = () => {
|
||||
// ====================================
|
||||
|
||||
@@ -4,49 +4,71 @@
|
||||
.pa-3.pt-4
|
||||
.headline.primary--text Developer Tools
|
||||
.subheading.grey--text ¯\_(ツ)_/¯
|
||||
v-tabs(color='grey lighten-4', fixed-tabs, slider-color='primary', show-arrows)
|
||||
v-tab Graph API Playground
|
||||
v-tab Graph API Map
|
||||
|
||||
v-tab-item(:transition='false', :reverse-transition='false')
|
||||
v-tabs(v-model='selectedTab', color='grey lighten-4', fixed-tabs, slider-color='primary', show-arrows, @input='tabChanged')
|
||||
v-tab(key='0') Graph API Playground
|
||||
v-tab(key='1') Graph API Map
|
||||
v-tabs-items(v-model='selectedTab')
|
||||
v-tab-item(key='0', :transition='false', :reverse-transition='false')
|
||||
#graphiql
|
||||
|
||||
v-tab-item(key='1', :transition='false', :reverse-transition='false')
|
||||
#voyager
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import React from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import GraphiQL from 'graphiql'
|
||||
import { Voyager } from 'graphql-voyager'
|
||||
import 'graphiql/graphiql.css'
|
||||
import 'graphql-voyager/dist/voyager.css'
|
||||
|
||||
const fetcher = (qry, respType) => {
|
||||
return fetch('/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(qry),
|
||||
credentials: 'include'
|
||||
}).then(response => {
|
||||
if (respType === 'json') {
|
||||
return response.json()
|
||||
} else {
|
||||
return response.text()
|
||||
}
|
||||
}).then(responseBody => {
|
||||
try {
|
||||
return JSON.parse(responseBody)
|
||||
} catch (error) {
|
||||
return responseBody
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
return {
|
||||
selectedTab: '0'
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.renderGraphiQL()
|
||||
},
|
||||
methods: {
|
||||
tabChanged (tabId) {
|
||||
switch (tabId) {
|
||||
case '1':
|
||||
this.renderVoyager()
|
||||
break
|
||||
}
|
||||
},
|
||||
renderGraphiQL() {
|
||||
ReactDOM.render(
|
||||
React.createElement(GraphiQL, {
|
||||
fetcher: graphQLParams => {
|
||||
return fetch('/graphql', {
|
||||
method: 'post',
|
||||
headers: {
|
||||
'Accept': 'application/json',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(graphQLParams),
|
||||
credentials: 'include'
|
||||
}).then(function (response) {
|
||||
return response.text()
|
||||
}).then(function (responseBody) {
|
||||
try {
|
||||
return JSON.parse(responseBody)
|
||||
} catch (error) {
|
||||
return responseBody
|
||||
}
|
||||
})
|
||||
},
|
||||
fetcher: qry => fetcher(qry, 'text'),
|
||||
query: null,
|
||||
response: null,
|
||||
variables: null,
|
||||
@@ -55,6 +77,15 @@ export default {
|
||||
}),
|
||||
document.getElementById('graphiql')
|
||||
)
|
||||
},
|
||||
renderVoyager() {
|
||||
ReactDOM.render(
|
||||
React.createElement(Voyager, {
|
||||
introspection: qry => fetcher({ query: qry }, 'json'),
|
||||
workerURI: '/js/voyager.worker.js'
|
||||
}),
|
||||
document.getElementById('voyager')
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,85 +110,9 @@ export default {
|
||||
background-color: initial;
|
||||
box-shadow: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.cm-s-wikijs-dark.CodeMirror {
|
||||
background: darken(mc('grey','900'), 3%);
|
||||
color: #e0e0e0;
|
||||
}
|
||||
.cm-s-wikijs-dark div.CodeMirror-selected {
|
||||
background: mc('blue','800');
|
||||
}
|
||||
.cm-s-wikijs-dark .cm-matchhighlight {
|
||||
background: mc('blue','800');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-line::selection, .cm-s-wikijs-dark .CodeMirror-line > span::selection, .cm-s-wikijs-dark .CodeMirror-line > span > span::selection {
|
||||
background: mc('red', '500');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-line::-moz-selection, .cm-s-wikijs-dark .CodeMirror-line > span::-moz-selection, .cm-s-wikijs-dark .CodeMirror-line > span > span::-moz-selection {
|
||||
background: mc('red', '500');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-gutters {
|
||||
background: darken(mc('grey','900'), 6%);
|
||||
border-right: 1px solid mc('grey','900');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-guttermarker {
|
||||
color: #ac4142;
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-guttermarker-subtle {
|
||||
color: #505050;
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-linenumber {
|
||||
color: mc('grey','800');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-cursor {
|
||||
border-left: 1px solid #b0b0b0;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-comment {
|
||||
color: mc('orange','800');
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-atom {
|
||||
color: #aa759f;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-number {
|
||||
color: #aa759f;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-property, .cm-s-wikijs-dark span.cm-attribute {
|
||||
color: #90a959;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-keyword {
|
||||
color: #ac4142;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-string {
|
||||
color: #f4bf75;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-variable {
|
||||
color: #90a959;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-variable-2 {
|
||||
color: #6a9fb5;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-def {
|
||||
color: #d28445;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-bracket {
|
||||
color: #e0e0e0;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-tag {
|
||||
color: #ac4142;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-link {
|
||||
color: #aa759f;
|
||||
}
|
||||
.cm-s-wikijs-dark span.cm-error {
|
||||
background: #ac4142;
|
||||
color: #b0b0b0;
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-activeline-background {
|
||||
background: mc('grey','900');
|
||||
}
|
||||
.cm-s-wikijs-dark .CodeMirror-matchingbracket {
|
||||
text-decoration: underline;
|
||||
color: white !important;
|
||||
}
|
||||
#voyager {
|
||||
height: calc(100vh - 250px);
|
||||
}
|
||||
</style>
|
||||
|
||||
45
client/components/admin-editor.vue
Normal file
45
client/components/admin-editor.vue
Normal file
@@ -0,0 +1,45 @@
|
||||
<template lang='pug'>
|
||||
v-card(flat)
|
||||
v-card(color='grey lighten-5')
|
||||
.pa-3.pt-4
|
||||
.headline.primary--text Editor
|
||||
.subheading.grey--text Configure the content editor
|
||||
v-tabs(color='grey lighten-4', fixed-tabs, slider-color='primary', show-arrows)
|
||||
v-tab(key='settings'): v-icon settings
|
||||
v-tab(key='code') Markdown
|
||||
|
||||
v-tab-item(key='settings', :transition='false', :reverse-transition='false')
|
||||
v-card.pa-3
|
||||
v-form
|
||||
v-radio-group(v-model='selectedEditor')
|
||||
v-radio(v-for='(editor, n) in editors', :key='n', :label='editor.text', :value='editor.value', color='primary')
|
||||
v-divider
|
||||
v-btn(color='primary')
|
||||
v-icon(left) chevron_right
|
||||
| Set Editor
|
||||
v-btn(icon)
|
||||
v-icon.grey--text refresh
|
||||
v-tab-item(key='code', :transition='false', :reverse-transition='false')
|
||||
v-card.pa-3
|
||||
v-form
|
||||
v-subheader Editor Configuration
|
||||
.body-1 This editor has no configuration options you can modify.
|
||||
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
editors: [
|
||||
{ text: 'Markdown (default)', value: 'code' }
|
||||
],
|
||||
selectedEditor: 'code'
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
||||
</style>
|
||||
108
client/components/admin-groups.vue
Normal file
108
client/components/admin-groups.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template lang='pug'>
|
||||
v-card(flat)
|
||||
v-card(flat, color='grey lighten-5').pa-3.pt-4
|
||||
.headline.blue--text.text--darken-2 Groups
|
||||
.subheading.grey--text Manage groups
|
||||
v-card
|
||||
v-card-title
|
||||
v-btn(color='primary', dark)
|
||||
v-icon(left) add
|
||||
| New Group
|
||||
v-btn(icon)
|
||||
v-icon.grey--text refresh
|
||||
v-spacer
|
||||
v-text-field(append-icon='search', label='Search', single-line, hide-details, v-model='search')
|
||||
v-data-table(
|
||||
v-model='selected'
|
||||
:items='items',
|
||||
:headers='headers',
|
||||
:search='search',
|
||||
:pagination.sync='pagination',
|
||||
:rows-per-page-items='[15]'
|
||||
select-all,
|
||||
hide-actions,
|
||||
disable-initial-sort
|
||||
)
|
||||
template(slot='headers', slot-scope='props')
|
||||
tr
|
||||
th(width='50')
|
||||
th.text-xs-right(
|
||||
width='80'
|
||||
:class='[`column sortable`, pagination.descending ? `desc` : `asc`, pagination.sortBy === `id` ? `active` : ``]'
|
||||
@click='changeSort(`id`)'
|
||||
)
|
||||
v-icon(small) arrow_upward
|
||||
| ID
|
||||
th.text-xs-left(
|
||||
v-for='header in props.headers'
|
||||
:key='header.text'
|
||||
:width='header.width'
|
||||
:class='[`column sortable`, pagination.descending ? `desc` : `asc`, header.value === pagination.sortBy ? `active` : ``]'
|
||||
@click='changeSort(header.value)'
|
||||
)
|
||||
| {{ header.text }}
|
||||
v-icon(small) arrow_upward
|
||||
template(slot='items', slot-scope='props')
|
||||
tr(:active='props.selected')
|
||||
td
|
||||
v-checkbox(hide-details, :input-value='props.selected', color='blue darken-2', @click='props.selected = !props.selected')
|
||||
td.text-xs-right {{ props.item.id }}
|
||||
td {{ props.item.name }}
|
||||
td {{ props.item.userCount }}
|
||||
td: v-btn(icon): v-icon.grey--text.text--darken-1 more_horiz
|
||||
template(slot='no-data')
|
||||
v-alert(icon='warning', :value='true') No users to display!
|
||||
.text-xs-center.py-2(v-if='items.length > 15')
|
||||
v-pagination(v-model='pagination.page', :length='pages')
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
selected: [],
|
||||
pagination: {},
|
||||
items: [
|
||||
{ id: 1, name: 'Administrators', userCount: 1 },
|
||||
{ id: 2, name: 'Users', userCount: 23 }
|
||||
],
|
||||
headers: [
|
||||
{ text: 'Name', value: 'name' },
|
||||
{ text: 'Users', value: 'userCount', width: 200 },
|
||||
{ text: '', value: 'actions', sortable: false, width: 50 }
|
||||
],
|
||||
search: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
pages () {
|
||||
if (this.pagination.rowsPerPage == null || this.pagination.totalItems == null) {
|
||||
return 0
|
||||
}
|
||||
|
||||
return Math.ceil(this.pagination.totalItems / this.pagination.rowsPerPage)
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
changeSort (column) {
|
||||
if (this.pagination.sortBy === column) {
|
||||
this.pagination.descending = !this.pagination.descending
|
||||
} else {
|
||||
this.pagination.sortBy = column
|
||||
this.pagination.descending = false
|
||||
}
|
||||
},
|
||||
toggleAll () {
|
||||
if (this.selected.length) {
|
||||
this.selected = []
|
||||
} else {
|
||||
this.selected = this.items.slice()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
||||
</style>
|
||||
19
client/components/admin-rendering.vue
Normal file
19
client/components/admin-rendering.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template lang='pug'>
|
||||
v-container(fluid, fill-height)
|
||||
v-layout(row wrap)
|
||||
v-flex(xs12)
|
||||
.headline.primary--text Content Rendering
|
||||
.subheading.grey--text Configure how content is rendered
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
||||
</style>
|
||||
19
client/components/admin-stats.vue
Normal file
19
client/components/admin-stats.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template lang='pug'>
|
||||
v-container(fluid, fill-height)
|
||||
v-layout(row wrap)
|
||||
v-flex(xs12)
|
||||
.headline.primary--text Statistics
|
||||
.subheading.grey--text Useful information about your wiki
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang='scss'>
|
||||
|
||||
</style>
|
||||
@@ -82,9 +82,13 @@ const router = new VueRouter({
|
||||
{ path: '/dashboard', component: () => import(/* webpackChunkName: "admin" */ './admin-dashboard.vue') },
|
||||
{ path: '/general', component: () => import(/* webpackChunkName: "admin" */ './admin-general.vue') },
|
||||
{ path: '/locale', component: () => import(/* webpackChunkName: "admin" */ './admin-locale.vue') },
|
||||
{ path: '/stats', component: () => import(/* webpackChunkName: "admin" */ './admin-stats.vue') },
|
||||
{ path: '/theme', component: () => import(/* webpackChunkName: "admin" */ './admin-theme.vue') },
|
||||
{ path: '/groups', component: () => import(/* webpackChunkName: "admin" */ './admin-groups.vue') },
|
||||
{ path: '/users', component: () => import(/* webpackChunkName: "admin" */ './admin-users.vue') },
|
||||
{ path: '/auth', component: () => import(/* webpackChunkName: "admin" */ './admin-auth.vue') },
|
||||
{ path: '/rendering', component: () => import(/* webpackChunkName: "admin" */ './admin-rendering.vue') },
|
||||
{ path: '/editor', component: () => import(/* webpackChunkName: "admin" */ './admin-editor.vue') },
|
||||
{ path: '/logging', component: () => import(/* webpackChunkName: "admin" */ './admin-logging.vue') },
|
||||
{ path: '/search', component: () => import(/* webpackChunkName: "admin" */ './admin-search.vue') },
|
||||
{ path: '/storage', component: () => import(/* webpackChunkName: "admin" */ './admin-storage.vue') },
|
||||
|
||||
@@ -1,30 +1,39 @@
|
||||
<template lang="pug">
|
||||
.login(:class='{ "is-error": error }')
|
||||
.login-container(:class='{ "is-expanded": strategies.length > 1, "is-loading": isLoading }')
|
||||
.login-providers(v-show='strategies.length > 1')
|
||||
button(v-for='strategy in strategies', :class='{ "is-active": strategy.key === selectedStrategy }', @click='selectStrategy(strategy.key, strategy.useForm)', :title='strategy.title')
|
||||
em(v-html='strategy.icon')
|
||||
span {{ strategy.title }}
|
||||
.login-providers-fill
|
||||
.login-frame(v-show='screen === "login"')
|
||||
h1 {{ siteTitle }}
|
||||
h2 {{ $t('auth:loginRequired') }}
|
||||
input(type='text', ref='iptEmail', v-model='username', :placeholder='$t("auth:fields.emailUser")')
|
||||
input(type='password', ref='iptPassword', v-model='password', :placeholder='$t("auth:fields.password")', @keyup.enter='login')
|
||||
button.button.is-blue.is-fullwidth(@click='login')
|
||||
span {{ $t('auth:actions.login') }}
|
||||
.login-frame(v-show='screen === "tfa"')
|
||||
.login-frame-icon
|
||||
svg.icons.is-48(role='img')
|
||||
title {{ $t('auth:tfa.title') }}
|
||||
use(xlink:href='#nc-key')
|
||||
h2 {{ $t('auth:tfa.subtitle') }}
|
||||
input(type='text', ref='iptTFA', v-model='securityCode', :placeholder='$t("auth:tfa.placeholder")', @keyup.enter='verifySecurityCode')
|
||||
button.button.is-blue.is-fullwidth(@click='verifySecurityCode')
|
||||
span {{ $t('auth:tfa.verifyToken') }}
|
||||
.login-copyright
|
||||
span {{ $t('footer.poweredBy') }}
|
||||
a(href='https://wiki.js.org', rel='external', title='Wiki.js') Wiki.js
|
||||
v-app
|
||||
.login(:class='{ "is-error": error }')
|
||||
.login-container(:class='{ "is-expanded": strategies.length > 1, "is-loading": isLoading }')
|
||||
.login-providers(v-show='strategies.length > 1')
|
||||
button(v-for='strategy in strategies', :class='{ "is-active": strategy.key === selectedStrategy }', @click='selectStrategy(strategy.key, strategy.useForm)', :title='strategy.title')
|
||||
em(v-html='strategy.icon')
|
||||
span {{ strategy.title }}
|
||||
.login-providers-fill
|
||||
.login-frame(v-show='screen === "login"')
|
||||
h1.text-xs-center.display-1 {{ siteTitle }}
|
||||
h2.text-xs-center.subheading {{ $t('auth:loginRequired') }}
|
||||
v-text-field(solo, ref='iptEmail', v-model='username', :placeholder='$t("auth:fields.emailUser")')
|
||||
v-text-field.mt-2(
|
||||
solo,
|
||||
ref='iptPassword',
|
||||
v-model='password',
|
||||
:append-icon='hidePassword ? "visibility" : "visibility_off"',
|
||||
:append-icon-cb='() => (hidePassword = !hidePassword)',
|
||||
:type='hidePassword ? "password" : "text"',
|
||||
:placeholder='$t("auth:fields.password")',
|
||||
@keyup.enter='login'
|
||||
)
|
||||
v-btn.mt-3(block, large, color='primary', @click='login') {{ $t('auth:actions.login') }}
|
||||
.login-frame(v-show='screen === "tfa"')
|
||||
.login-frame-icon
|
||||
svg.icons.is-48(role='img')
|
||||
title {{ $t('auth:tfa.title') }}
|
||||
use(xlink:href='#nc-key')
|
||||
h2 {{ $t('auth:tfa.subtitle') }}
|
||||
input(type='text', ref='iptTFA', v-model='securityCode', :placeholder='$t("auth:tfa.placeholder")', @keyup.enter='verifySecurityCode')
|
||||
button.button.is-blue.is-fullwidth(@click='verifySecurityCode')
|
||||
span {{ $t('auth:tfa.verifyToken') }}
|
||||
.login-copyright
|
||||
span {{ $t('footer.poweredBy') }}
|
||||
a(href='https://wiki.js.org', rel='external', title='Wiki.js') Wiki.js
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -41,6 +50,7 @@ export default {
|
||||
screen: 'login',
|
||||
username: '',
|
||||
password: '',
|
||||
hidePassword: true,
|
||||
securityCode: '',
|
||||
loginToken: '',
|
||||
isLoading: false
|
||||
@@ -408,10 +418,7 @@ export default {
|
||||
width: 400px;
|
||||
padding: 1rem;
|
||||
color: mc('grey', '700');
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
text-align: center;
|
||||
display: block;
|
||||
|
||||
@include until($tablet) {
|
||||
width: 100%;
|
||||
@@ -421,7 +428,7 @@ export default {
|
||||
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
font-weight: 600;
|
||||
font-weight: 400;
|
||||
color: mc('light-blue', '700');
|
||||
text-shadow: 1px 1px 0 #FFF;
|
||||
padding: 0;
|
||||
@@ -436,47 +443,6 @@ export default {
|
||||
padding: 0;
|
||||
margin: 0 0 25px 0;
|
||||
}
|
||||
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
input[type=text], input[type=password] {
|
||||
width: 100%;
|
||||
border: 1px solid rgba(mc('blue-grey','500'), .5);
|
||||
border-radius: 3px;
|
||||
background-color: rgba(255,255,255,.9);
|
||||
box-shadow: inset 0 0 0 3px rgba(255,255,255, .25);
|
||||
padding: 0 15px;
|
||||
height: 40px;
|
||||
margin: 0 0 10px 0;
|
||||
color: mc('grey', '700');
|
||||
font-weight: 600;
|
||||
font-size: .8rem;
|
||||
transition: all 0.4s ease;
|
||||
text-align: center;
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: mc('light-blue','500');
|
||||
background-color: rgba(255,255,255,1);
|
||||
box-shadow: inset 0 0 8px rgba(mc('light-blue','500'), .5);
|
||||
color: mc('light-blue', '800');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.button {
|
||||
background-image: linear-gradient(to bottom, mc('blue', '400') 0%, mc('blue', '600') 50%, mc('blue', '700') 100%);
|
||||
background-repeat: no-repeat;
|
||||
background-size: 100% 200%;
|
||||
|
||||
&:hover {
|
||||
background-position-y: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&-tfa {
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
<template lang="pug">
|
||||
.toggle(:class='{ "is-active": value }', @click='changeToggle')
|
||||
.toggle-container
|
||||
.toggle-pin
|
||||
.toggle-text {{ desc }}
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'toggle',
|
||||
props: ['value', 'desc'],
|
||||
data () {
|
||||
return { }
|
||||
},
|
||||
methods: {
|
||||
changeToggle() {
|
||||
this.$emit('input', !this.value)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -4,20 +4,15 @@
|
||||
@import "base/base";
|
||||
@import 'base/icons';
|
||||
|
||||
@import "../libs/animate/animate";
|
||||
// @import "../libs/animate/animate";
|
||||
|
||||
@import 'components/button';
|
||||
@import 'components/markdown-content';
|
||||
@import 'components/navigator';
|
||||
@import 'components/toggle';
|
||||
@import 'components/typography';
|
||||
|
||||
// @import '../libs/twemoji/twemoji-awesome';
|
||||
@import '../libs/prism/prism.css';
|
||||
// @import 'node_modules/diff2html/dist/diff2html.min';
|
||||
|
||||
@import 'node_modules/graphiql/graphiql';
|
||||
|
||||
@import 'pages/welcome';
|
||||
|
||||
@import 'layout/_rtl';
|
||||
|
||||
@@ -42,15 +42,6 @@ .is-hidden {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.is-hidden-until-scroll {
|
||||
max-height: 0;
|
||||
overflow: hidden;
|
||||
transition: all .6s ease;
|
||||
}
|
||||
.is-sticky .is-hidden-until-scroll {
|
||||
max-height: 30px;
|
||||
}
|
||||
|
||||
.is-hidden-mobile {
|
||||
@include mobile {
|
||||
display: none !important;
|
||||
|
||||
@@ -325,27 +325,3 @@ @function material-color($color-name, $color-variant: '500') {
|
||||
@function mc($color-name, $color-variant: '500') {
|
||||
@return material-color($color-name, $color-variant);
|
||||
}
|
||||
|
||||
@mixin md-elevation-0 {
|
||||
box-shadow: none !important;
|
||||
}
|
||||
|
||||
@mixin md-elevation-1 {
|
||||
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14), 0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
|
||||
}
|
||||
|
||||
@mixin md-elevation-2 {
|
||||
box-shadow: 0 4px 5px 0 rgba(0, 0, 0, 0.14), 0 1px 10px 0 rgba(0, 0, 0, 0.12), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
@mixin md-elevation-3 {
|
||||
box-shadow: 0 6px 10px 0 rgba(0, 0, 0, 0.14), 0 1px 18px 0 rgba(0, 0, 0, 0.12), 0 3px 5px -1px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
@mixin md-elevation-4 {
|
||||
box-shadow: 0 8px 10px 1px rgba(0, 0, 0, 0.14), 0 3px 14px 2px rgba(0, 0, 0, 0.12), 0 5px 5px -3px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
|
||||
@mixin md-elevation-5 {
|
||||
box-shadow: 0 16px 24px 2px rgba(0, 0, 0, 0.14), 0 6px 30px 5px rgba(0, 0, 0, 0.12), 0 8px 10px -5px rgba(0, 0, 0, 0.3);
|
||||
}
|
||||
@@ -1,136 +0,0 @@
|
||||
.button {
|
||||
background-color: mc('orange','600');
|
||||
color: #FFF;
|
||||
border: 1px solid mc('orange','700');
|
||||
border-radius: 3px;
|
||||
display: inline-flex;
|
||||
height: 40px;
|
||||
align-items: center;
|
||||
padding: 0 15px;
|
||||
font-size: 13px;
|
||||
font-weight: 600;
|
||||
font-family: $core-font-standard;
|
||||
margin: 0;
|
||||
transition: all .4s ease;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
text-transform: uppercase;
|
||||
|
||||
span {
|
||||
font-weight: 600;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
line-height: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
i {
|
||||
margin-right: 8px;
|
||||
font-size: 14px;
|
||||
line-height: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
outline: none;
|
||||
border-color: #FFF;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: mc('orange','800');
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
@each $color, $colorvalue in $material-colors {
|
||||
&.is-#{$color} {
|
||||
background-color: mc($color, '600');
|
||||
border-color: mc($color,'700');
|
||||
color: #FFF;
|
||||
|
||||
&.is-outlined {
|
||||
background-color: #FFF;
|
||||
color: mc($color,'700');
|
||||
}
|
||||
|
||||
&.is-inverted {
|
||||
background-color: rgba(mc($color, '800'), 0);
|
||||
border-color: mc($color, '500');
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: mc($color,'800');
|
||||
color: #FFF;
|
||||
animation: none;
|
||||
}
|
||||
|
||||
&:focus {
|
||||
box-shadow: inset 0 0 0 3px rgba(255,255,255, .4);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
&.is-icon-only {
|
||||
i {
|
||||
margin-right: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&.is-featured {
|
||||
animation: btnInvertedPulse .6s ease alternate infinite;
|
||||
}
|
||||
|
||||
&.is-fullwidth {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&.is-disabled, &:disabled {
|
||||
background-color: mc('grey', '300');
|
||||
border: 1px solid mc('grey','400');
|
||||
color: mc('grey', '500');
|
||||
cursor: default;
|
||||
transition: none;
|
||||
|
||||
&:hover {
|
||||
background-color: mc('grey', '300') !important;
|
||||
color: mc('grey', '500') !important;
|
||||
}
|
||||
}
|
||||
|
||||
&.is-small {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.button-group {
|
||||
|
||||
.button {
|
||||
border-radius: 0;
|
||||
margin-left: 1px;
|
||||
|
||||
&:first-child {
|
||||
margin-left: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@include keyframes(btnInvertedPulse) {
|
||||
0% {
|
||||
background-color: rgba(mc('grey', '500'), 0);
|
||||
}
|
||||
100% {
|
||||
background-color: rgba(mc('grey', '500'), 0.25);
|
||||
}
|
||||
}
|
||||
@@ -1,118 +0,0 @@
|
||||
|
||||
.panel-aside {
|
||||
background-color: mc('blue-grey', '800');
|
||||
border: 1px solid mc('blue-grey', '800');
|
||||
border-bottom-left-radius: 8px;
|
||||
padding: 20px;
|
||||
color: mc('blue-grey','100');
|
||||
|
||||
label {
|
||||
color: #FFF;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.panel {
|
||||
background-color: #FFF;
|
||||
box-shadow: 0 0 12px 0 rgba(mc('grey','800'), .10), 1px 6px 8px 0 rgba(mc('grey','800'), .10);
|
||||
padding: 0 0 1px 0;
|
||||
border-radius: 4px;
|
||||
|
||||
.panel-title {
|
||||
border-bottom: 1px solid darken($color-bg, 5%);
|
||||
padding: 0 15px;
|
||||
color: $color-text;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
height: 40px;
|
||||
|
||||
&.is-featured {
|
||||
border-top-left-radius: 4px;
|
||||
border-top-right-radius: 4px;
|
||||
background-color: mc('blue', '700');
|
||||
background-image: linear-gradient(to bottom, mc('blue', '700') 0%, mc('blue', '800') 100%);
|
||||
border-bottom-color: mc('blue', '900');
|
||||
box-shadow: inset 0 0 0 1px mc('blue', '600'), inset 0 0 0px 2px rgba(mc('blue', '800'), .5);
|
||||
color: #FFF;
|
||||
|
||||
> i::before {
|
||||
@include spinner(#FFF, 0.4s, 18px);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
& + .panel-content {
|
||||
box-shadow: inset 0 0 0 1px #FFF, inset 0 30px 80px -25px mc('blue', '100');
|
||||
}
|
||||
|
||||
> span {
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
> i {
|
||||
display: flex;
|
||||
width: 18px;
|
||||
align-items: center;
|
||||
|
||||
&::before {
|
||||
content: " ";
|
||||
@include spinner(mc($primary,'500'), 0.4s, 18px);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.panel-content {
|
||||
padding: 0 15px;
|
||||
|
||||
&.is-text {
|
||||
padding: 25px;
|
||||
|
||||
p + p, p + h3 {
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
h3 {
|
||||
margin-bottom: 15px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
ul li {
|
||||
color: mc('grey', '700');
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: 500;
|
||||
color: mc($primary,'800');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.panel-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: flex-end;
|
||||
height: 50px;
|
||||
background-color: $color-bg;
|
||||
padding: 0 15px;
|
||||
margin: 0 1px;
|
||||
border-bottom-left-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
position: relative;
|
||||
|
||||
.button + .button {
|
||||
margin-left: 10px;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+ .panel {
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,67 +0,0 @@
|
||||
.toggle {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 24px;
|
||||
cursor: pointer;
|
||||
margin: 5px 5px 5px 0;
|
||||
|
||||
& + & {
|
||||
margin-left: 15px;
|
||||
}
|
||||
|
||||
&-container {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
height: 24px;
|
||||
width: 50px;
|
||||
background-color: mc('blue-grey', '200');
|
||||
border-radius: 12px;
|
||||
padding: 2px;
|
||||
transition: background-color .5s ease;
|
||||
}
|
||||
|
||||
&-pin {
|
||||
display: flex;
|
||||
background-color: #FFF;
|
||||
border-radius:10px;
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
transition: all .5s ease;
|
||||
}
|
||||
|
||||
&-text {
|
||||
padding-left: 10px;
|
||||
color: mc('grey', '700');
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.toggle-container {
|
||||
background-color: mc('grey', '400');
|
||||
}
|
||||
}
|
||||
|
||||
&.is-active {
|
||||
.toggle-container {
|
||||
background-color: mc('indigo', '500');
|
||||
}
|
||||
.toggle-pin {
|
||||
margin-left: 28px;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* THEME OVERRIDE - START */
|
||||
|
||||
@each $color, $colorvalue in $material-colors {
|
||||
.is-primary-#{$color} .toggle {
|
||||
&.is-active {
|
||||
.toggle-container {
|
||||
background-color: mc($color, '500');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* THEME OVERRIDE - END */
|
||||
@@ -1,16 +0,0 @@
|
||||
|
||||
h1 {
|
||||
font-size: 28px;
|
||||
}
|
||||
h2 {
|
||||
font-size: 18px;
|
||||
}
|
||||
h3 {
|
||||
font-size: 16px;
|
||||
}
|
||||
|
||||
@each $color, $colorvalue in $material-colors {
|
||||
i.is-#{$color} {
|
||||
color: mc($color, '600');
|
||||
}
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
@charset "utf-8";
|
||||
|
||||
$primary: 'indigo';
|
||||
|
||||
@import "base/variables";
|
||||
@import "base/colors";
|
||||
@import "base/reset";
|
||||
@import "base/mixins";
|
||||
@import "base/fonts";
|
||||
@import "base/base";
|
||||
|
||||
@import "libs/animate";
|
||||
|
||||
@import 'components/button';
|
||||
@import 'components/grid';
|
||||
@import 'components/typography';
|
||||
|
||||
@import 'pages/error';
|
||||
@@ -1,14 +0,0 @@
|
||||
module.exports = {
|
||||
plugins: {
|
||||
'autoprefixer': {},
|
||||
'cssnano': {
|
||||
preset: ['default', {
|
||||
discardComments: {
|
||||
removeAll: true
|
||||
}
|
||||
}]
|
||||
},
|
||||
'postcss-flexbugs-fixes': {},
|
||||
'postcss-flexibility': {}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
{
|
||||
"disallowDuplicateAttributes": true,
|
||||
"disallowIdAttributeWithStaticValue": true,
|
||||
"disallowMultipleLineBreaks": true,
|
||||
"requireClassLiteralsBeforeAttributes": true,
|
||||
"requireIdLiteralsBeforeAttributes": true,
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireLowerCaseAttributes": true,
|
||||
"requireLowerCaseTags": true,
|
||||
"requireSpaceAfterCodeOperator": true,
|
||||
"requireStrictEqualityOperators": true,
|
||||
"validateAttributeQuoteMarks": "'",
|
||||
"validateAttributeSeparator": ", ",
|
||||
"validateDivTags": true,
|
||||
"validateIndentation": 2
|
||||
}
|
||||
@@ -1,262 +0,0 @@
|
||||
const path = require('path')
|
||||
const fs = require('fs-extra')
|
||||
const webpack = require('webpack')
|
||||
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
const HtmlWebpackPugPlugin = require('html-webpack-pug-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
|
||||
|
||||
const babelConfig = fs.readJsonSync(path.join(process.cwd(), '.babelrc'))
|
||||
const postCSSConfig = {
|
||||
config: {
|
||||
path: path.join(process.cwd(), 'dev/config/postcss.config.js')
|
||||
}
|
||||
}
|
||||
const cacheDir = '.webpack-cache/cache'
|
||||
const babelDir = path.join(process.cwd(), '.webpack-cache/babel')
|
||||
|
||||
process.noDeprecation = true
|
||||
|
||||
module.exports = {
|
||||
entry: {
|
||||
client: './client/index.js'
|
||||
},
|
||||
output: {
|
||||
path: path.join(process.cwd(), 'assets'),
|
||||
publicPath: '/',
|
||||
filename: 'js/[name].js',
|
||||
chunkFilename: 'js/[name].js',
|
||||
globalObject: 'this'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
...babelConfig,
|
||||
cacheDirectory: babelDir
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: postCSSConfig
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: postCSSConfig
|
||||
},
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.styl$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: postCSSConfig
|
||||
},
|
||||
'stylus-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
loaders: {
|
||||
css: [
|
||||
'vue-style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: postCSSConfig
|
||||
}
|
||||
],
|
||||
scss: [
|
||||
'vue-style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
{
|
||||
loader: 'postcss-loader',
|
||||
options: postCSSConfig
|
||||
},
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: false
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'sass-resources-loader',
|
||||
options: {
|
||||
resources: path.join(process.cwd(), '/client/scss/global.scss')
|
||||
}
|
||||
}
|
||||
],
|
||||
js: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
babelrc: path.join(process.cwd(), '.babelrc'),
|
||||
cacheDirectory: babelDir
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|gif)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 8192
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
exclude: [
|
||||
path.join(process.cwd(), 'client/svg')
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[name].[ext]',
|
||||
outputPath: 'svg/'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
include: [
|
||||
path.join(process.cwd(), 'client/svg')
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'raw-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.flow$/,
|
||||
loader: 'ignore-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.BannerPlugin('Wiki.js - wiki.js.org - Licensed under AGPL'),
|
||||
new CopyWebpackPlugin([
|
||||
{ from: 'client/static' }
|
||||
], {
|
||||
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: 'css/bundle.css',
|
||||
chunkFilename: 'css/[name].css'
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'dev/templates/master.pug',
|
||||
filename: '../server/views/master.pug',
|
||||
hash: true,
|
||||
inject: 'head'
|
||||
}),
|
||||
new HtmlWebpackPugPlugin(),
|
||||
new ScriptExtHtmlWebpackPlugin({
|
||||
sync: 'runtime.js',
|
||||
defaultAttribute: 'async'
|
||||
})
|
||||
],
|
||||
optimization: {
|
||||
namedModules: true,
|
||||
namedChunks: true,
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
default: {
|
||||
minChunks: 2,
|
||||
priority: -20,
|
||||
reuseExistingChunk: true
|
||||
},
|
||||
vendor: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
priority: -10
|
||||
}
|
||||
}
|
||||
},
|
||||
runtimeChunk: 'single'
|
||||
},
|
||||
resolve: {
|
||||
mainFields: ['browser', 'main', 'module'],
|
||||
symlinks: true,
|
||||
alias: {
|
||||
'@': path.join(process.cwd(), 'client'),
|
||||
'vue$': 'vue/dist/vue.esm.js',
|
||||
'mdi': path.resolve(process.cwd(), 'node_modules/vue-material-design-icons'),
|
||||
// Duplicates fixes:
|
||||
'apollo-link': path.join(process.cwd(), 'node_modules/apollo-link'),
|
||||
'apollo-utilities': path.join(process.cwd(), 'node_modules/apollo-utilities'),
|
||||
'uc.micro': path.join(process.cwd(), 'node_modules/uc.micro')
|
||||
},
|
||||
extensions: [
|
||||
'.js',
|
||||
'.json',
|
||||
'.vue'
|
||||
],
|
||||
modules: [
|
||||
'node_modules'
|
||||
]
|
||||
},
|
||||
node: {
|
||||
fs: 'empty'
|
||||
},
|
||||
stats: {
|
||||
children: false,
|
||||
entrypoints: false
|
||||
},
|
||||
target: 'web'
|
||||
}
|
||||
@@ -1,24 +1,198 @@
|
||||
const webpack = require('webpack')
|
||||
const merge = require('webpack-merge')
|
||||
const path = require('path')
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const WriteFilePlugin = require('write-file-webpack-plugin')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const HtmlWebpackPugPlugin = require('html-webpack-pug-plugin')
|
||||
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
|
||||
const WriteFilePlugin = require('write-file-webpack-plugin')
|
||||
|
||||
const common = require('./webpack.common.js')
|
||||
const babelConfig = fs.readJsonSync(path.join(process.cwd(), '.babelrc'))
|
||||
const cacheDir = '.webpack-cache/cache'
|
||||
const babelDir = path.join(process.cwd(), '.webpack-cache/babel')
|
||||
|
||||
module.exports = merge(common, {
|
||||
process.noDeprecation = true
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: {
|
||||
client: ['./client/index.js', 'webpack-hot-middleware/client']
|
||||
},
|
||||
output: {
|
||||
path: path.join(process.cwd(), 'assets'),
|
||||
publicPath: '/',
|
||||
filename: 'js/[name].js',
|
||||
chunkFilename: 'js/[name].js',
|
||||
globalObject: 'this',
|
||||
pathinfo: true
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
...babelConfig,
|
||||
cacheDirectory: babelDir
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'postcss-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.styl$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
'stylus-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
loaders: {
|
||||
scss: [
|
||||
'vue-style-loader',
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: false
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'sass-resources-loader',
|
||||
options: {
|
||||
resources: path.join(process.cwd(), '/client/scss/global.scss')
|
||||
}
|
||||
}
|
||||
],
|
||||
js: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
babelrc: path.join(process.cwd(), '.babelrc'),
|
||||
cacheDirectory: babelDir
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|gif)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 8192
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
exclude: [
|
||||
path.join(process.cwd(), 'client/svg')
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[name].[ext]',
|
||||
outputPath: 'svg/'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
include: [
|
||||
path.join(process.cwd(), 'client/svg')
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'raw-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /.jsx$/,
|
||||
loader: 'babel-loader',
|
||||
exclude: /node_modules/,
|
||||
options: {
|
||||
presets: ['es2015', 'react']
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.flow$/,
|
||||
loader: 'ignore-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new CopyWebpackPlugin([
|
||||
{ from: 'client/static' },
|
||||
{ from: './node_modules/graphql-voyager/dist/voyager.worker.js', to: 'js/' }
|
||||
], {}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'dev/templates/master.pug',
|
||||
filename: '../server/views/master.pug',
|
||||
hash: false,
|
||||
inject: 'head'
|
||||
}),
|
||||
new HtmlWebpackPugPlugin(),
|
||||
new SimpleProgressWebpackPlugin({
|
||||
format: 'compact'
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': { NODE_ENV: '"development"' },
|
||||
'__REACT_DEVTOOLS_GLOBAL_HOOK__': '({ isDisabled: true })'
|
||||
}),
|
||||
new WriteFilePlugin(),
|
||||
@@ -27,5 +201,54 @@ module.exports = merge(common, {
|
||||
/node_modules/
|
||||
])
|
||||
],
|
||||
optimization: {
|
||||
namedModules: true,
|
||||
namedChunks: true,
|
||||
splitChunks: {
|
||||
cacheGroups: {
|
||||
default: {
|
||||
minChunks: 2,
|
||||
priority: -20,
|
||||
reuseExistingChunk: true
|
||||
},
|
||||
vendor: {
|
||||
test: /[\\/]node_modules[\\/]/,
|
||||
minChunks: 2,
|
||||
priority: -10
|
||||
}
|
||||
}
|
||||
},
|
||||
runtimeChunk: 'single'
|
||||
},
|
||||
resolve: {
|
||||
mainFields: ['browser', 'main', 'module'],
|
||||
symlinks: true,
|
||||
alias: {
|
||||
'@': path.join(process.cwd(), 'client'),
|
||||
'vue$': 'vue/dist/vue.esm.js',
|
||||
'mdi': path.resolve(process.cwd(), 'node_modules/vue-material-design-icons'),
|
||||
// Duplicates fixes:
|
||||
'apollo-link': path.join(process.cwd(), 'node_modules/apollo-link'),
|
||||
'apollo-utilities': path.join(process.cwd(), 'node_modules/apollo-utilities'),
|
||||
'uc.micro': path.join(process.cwd(), 'node_modules/uc.micro')
|
||||
},
|
||||
extensions: [
|
||||
'.js',
|
||||
'.json',
|
||||
'.jsx',
|
||||
'.vue'
|
||||
],
|
||||
modules: [
|
||||
'node_modules'
|
||||
]
|
||||
},
|
||||
node: {
|
||||
fs: 'empty'
|
||||
},
|
||||
stats: {
|
||||
children: false,
|
||||
entrypoints: false
|
||||
},
|
||||
target: 'web',
|
||||
watch: true
|
||||
})
|
||||
}
|
||||
|
||||
@@ -1,18 +1,209 @@
|
||||
const merge = require('webpack-merge')
|
||||
const webpack = require('webpack')
|
||||
const path = require('path')
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const CleanWebpackPlugin = require('clean-webpack-plugin')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const HtmlWebpackPugPlugin = require('html-webpack-pug-plugin')
|
||||
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||
const OfflinePlugin = require('offline-plugin')
|
||||
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
|
||||
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
|
||||
const SimpleProgressWebpackPlugin = require('simple-progress-webpack-plugin')
|
||||
|
||||
const common = require('./webpack.common.js')
|
||||
const babelConfig = fs.readJsonSync(path.join(process.cwd(), '.babelrc'))
|
||||
const cacheDir = '.webpack-cache/cache'
|
||||
const babelDir = path.join(process.cwd(), '.webpack-cache/babel')
|
||||
|
||||
module.exports = merge(common, {
|
||||
process.noDeprecation = true
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: {
|
||||
client: './client/index.js'
|
||||
},
|
||||
output: {
|
||||
path: path.join(process.cwd(), 'assets'),
|
||||
publicPath: '/',
|
||||
filename: 'js/[name].js',
|
||||
chunkFilename: 'js/[name].js',
|
||||
globalObject: 'this'
|
||||
},
|
||||
module: {
|
||||
rules: []
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
...babelConfig,
|
||||
cacheDirectory: babelDir
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
'postcss-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
'style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: false
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.styl$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
'stylus-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader',
|
||||
options: {
|
||||
loaders: {
|
||||
scss: [
|
||||
'vue-style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
sourceMap: false
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'sass-resources-loader',
|
||||
options: {
|
||||
resources: path.join(process.cwd(), '/client/scss/global.scss')
|
||||
}
|
||||
}
|
||||
],
|
||||
js: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
babelrc: path.join(process.cwd(), '.babelrc'),
|
||||
cacheDirectory: babelDir
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|gif)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 8192
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
exclude: [
|
||||
path.join(process.cwd(), 'client/svg')
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[name].[ext]',
|
||||
outputPath: 'svg/'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
include: [
|
||||
path.join(process.cwd(), 'client/svg')
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'raw-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /.jsx$/,
|
||||
loader: 'babel-loader',
|
||||
exclude: /node_modules/,
|
||||
options: {
|
||||
presets: ['es2015', 'react']
|
||||
}
|
||||
},
|
||||
{
|
||||
test: /\.flow$/,
|
||||
loader: 'ignore-loader'
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new webpack.BannerPlugin('Wiki.js - wiki.js.org - Licensed under AGPL'),
|
||||
new CopyWebpackPlugin([
|
||||
{ from: 'client/static' },
|
||||
{ from: './node_modules/graphql-voyager/dist/voyager.worker.js', to: 'js/' }
|
||||
], {}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: 'css/bundle.css',
|
||||
chunkFilename: 'css/[name].css'
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'dev/templates/master.pug',
|
||||
filename: '../server/views/master.pug',
|
||||
hash: true,
|
||||
inject: 'head'
|
||||
}),
|
||||
new HtmlWebpackPugPlugin(),
|
||||
new ScriptExtHtmlWebpackPlugin({
|
||||
sync: 'runtime.js',
|
||||
defaultAttribute: 'async'
|
||||
}),
|
||||
new SimpleProgressWebpackPlugin({
|
||||
format: 'expanded'
|
||||
}),
|
||||
@@ -48,5 +239,44 @@ module.exports = merge(common, {
|
||||
},
|
||||
safeToUseOptionalCaches: true
|
||||
})
|
||||
]
|
||||
})
|
||||
],
|
||||
optimization: {
|
||||
namedModules: true,
|
||||
namedChunks: true,
|
||||
splitChunks: {
|
||||
name: 'vendor',
|
||||
minChunks: 2
|
||||
},
|
||||
runtimeChunk: 'single'
|
||||
},
|
||||
resolve: {
|
||||
mainFields: ['browser', 'main', 'module'],
|
||||
symlinks: true,
|
||||
alias: {
|
||||
'@': path.join(process.cwd(), 'client'),
|
||||
'vue$': 'vue/dist/vue.esm.js',
|
||||
'mdi': path.resolve(process.cwd(), 'node_modules/vue-material-design-icons'),
|
||||
// Duplicates fixes:
|
||||
'apollo-link': path.join(process.cwd(), 'node_modules/apollo-link'),
|
||||
'apollo-utilities': path.join(process.cwd(), 'node_modules/apollo-utilities'),
|
||||
'uc.micro': path.join(process.cwd(), 'node_modules/uc.micro')
|
||||
},
|
||||
extensions: [
|
||||
'.js',
|
||||
'.json',
|
||||
'jsx',
|
||||
'.vue'
|
||||
],
|
||||
modules: [
|
||||
'node_modules'
|
||||
]
|
||||
},
|
||||
node: {
|
||||
fs: 'empty'
|
||||
},
|
||||
stats: {
|
||||
children: false,
|
||||
entrypoints: false
|
||||
},
|
||||
target: 'web'
|
||||
}
|
||||
|
||||
40
package.json
40
package.json
@@ -11,7 +11,7 @@
|
||||
"build": "webpack --profile --config dev/webpack/webpack.prod.js",
|
||||
"build:locales": "node dev/tasks/localization",
|
||||
"watch": "webpack --config dev/webpack/webpack.dev.js",
|
||||
"test": "eslint --ext .js,.vue . && jest"
|
||||
"test": "eslint --format codeframe --ext .js,.vue . && pug-lint server/views && jest"
|
||||
},
|
||||
"bin": {
|
||||
"wiki": "wiki.js"
|
||||
@@ -174,6 +174,7 @@
|
||||
"file-loader": "1.1.11",
|
||||
"graphiql": "0.11.11",
|
||||
"graphql-tag": "^2.8.0",
|
||||
"graphql-voyager": "1.0.0-rc.15",
|
||||
"hammerjs": "2.0.8",
|
||||
"html-webpack-plugin": "3.0.6",
|
||||
"html-webpack-pug-plugin": "0.3.0",
|
||||
@@ -187,9 +188,11 @@
|
||||
"node-sass": "4.7.2",
|
||||
"offline-plugin": "4.9.0",
|
||||
"optimize-css-assets-webpack-plugin": "4.0.0",
|
||||
"postcss-cssnext": "3.1.0",
|
||||
"postcss-flexbugs-fixes": "3.3.0",
|
||||
"postcss-flexibility": "2.0.0",
|
||||
"postcss-loader": "2.1.1",
|
||||
"postcss-import": "11.1.0",
|
||||
"postcss-loader": "2.1.2",
|
||||
"postcss-selector-parser": "3.1.1",
|
||||
"pug-lint": "2.5.0",
|
||||
"pug-loader": "2.3.0",
|
||||
@@ -249,6 +252,39 @@
|
||||
"classNameTemplate": "{classname}-{title}",
|
||||
"titleTemplate": "{classname}-{title}"
|
||||
},
|
||||
"postcss": {
|
||||
"plugins": {
|
||||
"autoprefixer": {},
|
||||
"cssnano": {
|
||||
"preset": [
|
||||
"default",
|
||||
{
|
||||
"discardComments": {
|
||||
"removeAll": true
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"postcss-flexbugs-fixes": {},
|
||||
"postcss-flexibility": {}
|
||||
}
|
||||
},
|
||||
"pugLintConfig": {
|
||||
"disallowDuplicateAttributes": true,
|
||||
"disallowIdAttributeWithStaticValue": true,
|
||||
"disallowMultipleLineBreaks": true,
|
||||
"requireClassLiteralsBeforeAttributes": true,
|
||||
"requireIdLiteralsBeforeAttributes": true,
|
||||
"requireLineFeedAtFileEnd": true,
|
||||
"requireLowerCaseAttributes": true,
|
||||
"requireLowerCaseTags": true,
|
||||
"requireSpaceAfterCodeOperator": true,
|
||||
"requireStrictEqualityOperators": true,
|
||||
"validateAttributeQuoteMarks": "'",
|
||||
"validateAttributeSeparator": ", ",
|
||||
"validateDivTags": true,
|
||||
"validateIndentation": 2
|
||||
},
|
||||
"nodemonConfig": {
|
||||
"exec": "node server --dev",
|
||||
"ignore": [
|
||||
|
||||
45
server/graph/schemas/system.graphql
Normal file
45
server/graph/schemas/system.graphql
Normal file
@@ -0,0 +1,45 @@
|
||||
# ===============================================
|
||||
# SYSTEM
|
||||
# ===============================================
|
||||
|
||||
extend type Query {
|
||||
system: SystemQuery
|
||||
}
|
||||
|
||||
extend type Mutation {
|
||||
system: SystemMutation
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# QUERIES
|
||||
# -----------------------------------------------
|
||||
|
||||
type SystemQuery {
|
||||
info: SystemInfo
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# MUTATIONS
|
||||
# -----------------------------------------------
|
||||
|
||||
type SystemMutation {
|
||||
todo: String
|
||||
}
|
||||
|
||||
# -----------------------------------------------
|
||||
# TYPES
|
||||
# -----------------------------------------------
|
||||
|
||||
type SystemInfo {
|
||||
currentVersion: String
|
||||
latestVersion: String
|
||||
latestVersionReleaseDate: Date
|
||||
operatingSystem: String
|
||||
hostname: String
|
||||
cpuCores: Int
|
||||
ramTotal: Int
|
||||
workingDirectory: String
|
||||
nodeVersion: String
|
||||
redisVersion: String
|
||||
postgreVersion: String
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
extends ../master.pug
|
||||
|
||||
block body
|
||||
body
|
||||
#app.is-fullscreen
|
||||
login
|
||||
navigator
|
||||
#app.is-fullscreen
|
||||
login
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
extends ../master.pug
|
||||
|
||||
block body
|
||||
body
|
||||
#app.is-fullscreen
|
||||
v-app
|
||||
.onboarding
|
||||
img(src='/svg/logo-wikijs.svg', alt='Wiki.js')
|
||||
h1= t('welcome.title')
|
||||
h2= t('welcome.subtitle')
|
||||
v-btn(color='primary', href='/e/home')= t('welcome.createhome')
|
||||
#app.is-fullscreen
|
||||
v-app
|
||||
.onboarding
|
||||
img(src='/svg/logo-wikijs.svg', alt='Wiki.js')
|
||||
h1= t('welcome.title')
|
||||
h2= t('welcome.subtitle')
|
||||
v-btn(color='primary', href='/e/home')= t('welcome.createhome')
|
||||
|
||||
@@ -27,8 +27,8 @@ html
|
||||
|
||||
block head
|
||||
|
||||
link(href="/css/client.css?89183d15bb0e30aac49f" rel="stylesheet")
|
||||
script(type="text/javascript" src="/js/runtime.js?89183d15bb0e30aac49f")
|
||||
script(type="text/javascript" src="/js/client.js?89183d15bb0e30aac49f" async)
|
||||
link(href="/css/client.css?c473342a20546c545ebc" rel="stylesheet")
|
||||
script(type="text/javascript" src="/js/runtime.js?c473342a20546c545ebc")
|
||||
script(type="text/javascript" src="/js/client.js?c473342a20546c545ebc" async)
|
||||
body
|
||||
block body
|
||||
|
||||
77
test/lint.js
77
test/lint.js
@@ -1,77 +0,0 @@
|
||||
'use strict'
|
||||
|
||||
const fs = require('fs-extra')
|
||||
const colors = require('colors')
|
||||
|
||||
expect.extend({
|
||||
/**
|
||||
* Expect ESLint results to have no errors
|
||||
* @param {*} received ESLint results
|
||||
* @param {*} argument Arguments
|
||||
* @returns {object} Matcher result
|
||||
*/
|
||||
toESLint (received, argument) {
|
||||
if (received && received.errorCount > 0) {
|
||||
let errorMsgBuf = []
|
||||
for (let i = 0; i < received.results.length; i++) {
|
||||
const result = received.results[i]
|
||||
if (result.errorCount <= 0) {
|
||||
continue
|
||||
}
|
||||
|
||||
for (let x = 0; x < result.messages.length; x++) {
|
||||
const m = result.messages[x]
|
||||
errorMsgBuf.push(colors.grey(`└── ${result.filePath}\t${m.line}:${m.column}\t${m.message}`))
|
||||
}
|
||||
}
|
||||
if (errorMsgBuf.length > 0) {
|
||||
return {
|
||||
message: () => (errorMsgBuf.join(`\n`)),
|
||||
pass: false
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
pass: true
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Expect PugLint results to have no errors
|
||||
* @param {*} received PugLint results
|
||||
* @param {*} argument Arguments
|
||||
* @returns {object} Matcher result
|
||||
*/
|
||||
toPugLint (received, argument) {
|
||||
if (received && received.length > 0) {
|
||||
let errorMsgBuf = []
|
||||
for (let i = 0; i < received.length; i++) {
|
||||
errorMsgBuf.push(colors.grey(`└── ${received[i].message}`))
|
||||
}
|
||||
return {
|
||||
message: () => (errorMsgBuf.join(`\n`)),
|
||||
pass: false
|
||||
}
|
||||
}
|
||||
return {
|
||||
pass: true
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
describe('Code Linting', () => {
|
||||
// it('should pass ESLint validation', () => {
|
||||
// const CLIEngine = require('eslint').CLIEngine
|
||||
// const cli = new CLIEngine()
|
||||
// let report = cli.executeOnFiles(['**/*.js', '**/*.vue'])
|
||||
// expect(report).toESLint()
|
||||
// })
|
||||
|
||||
it('should pass PugLint validation', () => {
|
||||
const PugLint = require('pug-lint')
|
||||
const lint = new PugLint()
|
||||
const pugConfig = fs.readJsonSync('tools/pug-lintrc.json')
|
||||
lint.configure(pugConfig)
|
||||
let report = lint.checkPath('./server/views')
|
||||
expect(report).toPugLint()
|
||||
})
|
||||
})
|
||||
5
wiki.js
5
wiki.js
@@ -84,7 +84,10 @@ const init = {
|
||||
console.info('>>> Starting Wiki.js in DEVELOPER mode...')
|
||||
require('./server')
|
||||
|
||||
const devWatcher = chokidar.watch('./server')
|
||||
const devWatcher = chokidar.watch([
|
||||
'./server',
|
||||
'!./server/views/master.pug'
|
||||
])
|
||||
devWatcher.on('ready', () => {
|
||||
devWatcher.on('all', () => {
|
||||
console.warn('--- >>>>>>>>>>>>>>>>>>>>>>>>>>>> ---')
|
||||
|
||||
Reference in New Issue
Block a user