mirror of
https://github.com/requarks/wiki.git
synced 2026-08-26 21:27:10 -05:00
chore: purge legacy code
This commit is contained in:
@@ -1,45 +0,0 @@
|
||||
case $MATRIXENV in
|
||||
postgres)
|
||||
echo "Using PostgreSQL..."
|
||||
docker run -d -p 5432:5432 --name db --network="host" -e "POSTGRES_PASSWORD=Password123!" -e "POSTGRES_USER=wiki" -e "POSTGRES_DB=wiki" postgres:11
|
||||
while ! docker exec db psql -U wiki -d wiki -c "SELECT 1" &> /dev/null ; do
|
||||
echo "Waiting for database connection..."
|
||||
sleep 2
|
||||
done
|
||||
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=postgres" -e "DB_HOST=localhost" -e "DB_PORT=5432" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
|
||||
;;
|
||||
mysql)
|
||||
echo "Using MySQL..."
|
||||
docker run -d -p 3306:3306 --name db --network="host" -e "MYSQL_ROOT_PASSWORD=Password123!" -e "MYSQL_USER=wiki" -e "MYSQL_PASSWORD=Password123!" -e "MYSQL_DATABASE=wiki" mysql:8
|
||||
while ! docker exec db mysql --user=root --password=Password123! -e "SELECT 1" &> /dev/null ; do
|
||||
echo "Waiting for database connection..."
|
||||
sleep 2
|
||||
done
|
||||
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mysql" -e "DB_HOST=localhost" -e "DB_PORT=3306" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
|
||||
;;
|
||||
mariadb)
|
||||
echo "Using MariaDB..."
|
||||
docker run -d -p 3306:3306 --name db --network="host" -e "MYSQL_ROOT_PASSWORD=Password123!" -e "MYSQL_USER=wiki" -e "MYSQL_PASSWORD=Password123!" -e "MYSQL_DATABASE=wiki" mariadb:10
|
||||
while ! docker exec db mysql --user=root --password=Password123! -e "SELECT 1" &> /dev/null ; do
|
||||
echo "Waiting for database connection..."
|
||||
sleep 2
|
||||
done
|
||||
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mariadb" -e "DB_HOST=localhost" -e "DB_PORT=3306" -e "DB_NAME=wiki" -e "DB_USER=wiki" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
|
||||
;;
|
||||
mssql)
|
||||
echo "Using MS SQL Server..."
|
||||
docker run -d -p 1433:1433 --name db --network="host" -e "SA_PASSWORD=Password123!" -e "ACCEPT_EULA=Y" mcr.microsoft.com/mssql/server:2019-latest
|
||||
while ! docker exec db /opt/mssql-tools/bin/sqlcmd -S localhost -U SA -P "Password123!" -Q 'CREATE DATABASE wiki' &> /dev/null ; do
|
||||
echo "Waiting for database connection..."
|
||||
sleep 2
|
||||
done
|
||||
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=mssql" -e "DB_HOST=localhost" -e "DB_PORT=1433" -e "DB_NAME=wiki" -e "DB_USER=SA" -e "DB_PASS=Password123!" requarks/wiki:canary-$REL_VERSION_STRICT
|
||||
;;
|
||||
sqlite)
|
||||
echo "Using SQLite..."
|
||||
docker run -d -p 3000:3000 --name wiki --network="host" -e "DB_TYPE=sqlite" -e "DB_FILEPATH=db.sqlite" requarks/wiki:canary-$REL_VERSION_STRICT
|
||||
;;
|
||||
*)
|
||||
echo "Invalid DB Type!"
|
||||
;;
|
||||
esac
|
||||
@@ -1,32 +0,0 @@
|
||||
/// <reference types="Cypress" />
|
||||
|
||||
describe('Setup', () => {
|
||||
it('Load the setup page', () => {
|
||||
cy.visit('/')
|
||||
cy.contains('You are about to install Wiki.js').should('exist')
|
||||
})
|
||||
it('Enter administrator email address', () => {
|
||||
cy.get('.v-input').contains('Administrator Email').next('input').click().type('test@example.com')
|
||||
})
|
||||
it('Enter a password', () => {
|
||||
cy.get('.v-input').contains('Password').next('input').click().type('12345678')
|
||||
cy.get('.v-input').contains('Confirm Password').next('input').click().type('12345678')
|
||||
})
|
||||
it('Enter a Site URL', () => {
|
||||
cy.get('.v-input').contains('Site URL').next('input').click().clear().type('http://localhost:3000')
|
||||
})
|
||||
it('Disable Telemetry', () => {
|
||||
cy.contains('Telemetry').next('.v-input').click()
|
||||
})
|
||||
it('Press Install', () => {
|
||||
cy.get('.v-card__actions').find('button').click()
|
||||
})
|
||||
it('Wait for install success', () => {
|
||||
cy.contains('Installation complete!', {timeout: 30000}).should('exist')
|
||||
})
|
||||
// -> Disabled because of origin change errors during CI tests
|
||||
//
|
||||
// it('Redirect to login page', () => {
|
||||
// cy.location('pathname', {timeout: 10000}).should('include', '/login')
|
||||
// })
|
||||
})
|
||||
@@ -1,21 +0,0 @@
|
||||
/// <reference types="cypress" />
|
||||
// ***********************************************************
|
||||
// This example plugins/index.js can be used to load plugins
|
||||
//
|
||||
// You can change the location of this file or turn off loading
|
||||
// the plugins file with the 'pluginsFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/plugins-guide
|
||||
// ***********************************************************
|
||||
|
||||
// This function is called when a project is opened or re-opened (e.g. due to
|
||||
// the project's config changing)
|
||||
|
||||
/**
|
||||
* @type {Cypress.PluginConfig}
|
||||
*/
|
||||
module.exports = (on, config) => {
|
||||
// `on` is used to hook into various events Cypress emits
|
||||
// `config` is the resolved Cypress config
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
// ***********************************************
|
||||
// This example commands.js shows you how to
|
||||
// create various custom commands and overwrite
|
||||
// existing commands.
|
||||
//
|
||||
// For more comprehensive examples of custom
|
||||
// commands please read more here:
|
||||
// https://on.cypress.io/custom-commands
|
||||
// ***********************************************
|
||||
//
|
||||
//
|
||||
// -- This is a parent command --
|
||||
// Cypress.Commands.add("login", (email, password) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a child command --
|
||||
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This is a dual command --
|
||||
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
|
||||
//
|
||||
//
|
||||
// -- This will overwrite an existing command --
|
||||
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
|
||||
@@ -1,20 +0,0 @@
|
||||
// ***********************************************************
|
||||
// This example support/index.js is processed and
|
||||
// loaded automatically before your test files.
|
||||
//
|
||||
// This is a great place to put global configuration and
|
||||
// behavior that modifies Cypress.
|
||||
//
|
||||
// You can change the location of this file or turn off
|
||||
// automatically serving support files with the
|
||||
// 'supportFile' configuration option.
|
||||
//
|
||||
// You can read more here:
|
||||
// https://on.cypress.io/configuration
|
||||
// ***********************************************************
|
||||
|
||||
// Import commands.js using ES2015 syntax:
|
||||
import './commands'
|
||||
|
||||
// Alternatively you can use CommonJS syntax:
|
||||
// require('./commands')
|
||||
@@ -1,88 +0,0 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
// ===========================================
|
||||
// Wiki.js DEV UTILITY
|
||||
// Licensed under AGPLv3
|
||||
// ===========================================
|
||||
|
||||
const _ = require('lodash')
|
||||
const chalk = require('chalk')
|
||||
|
||||
const init = {
|
||||
dev() {
|
||||
const webpack = require('webpack')
|
||||
const chokidar = require('chokidar')
|
||||
|
||||
console.info(chalk.yellow.bold('--- ====================== ---'))
|
||||
console.info(chalk.yellow.bold('--- Wiki.js DEVELOPER MODE ---'))
|
||||
console.info(chalk.yellow.bold('--- ====================== ---'))
|
||||
|
||||
global.DEV = true
|
||||
global.WP_CONFIG = require('./webpack/webpack.dev.js')
|
||||
global.WP = webpack(global.WP_CONFIG)
|
||||
global.WP_DEV = {
|
||||
devMiddleware: require('webpack-dev-middleware')(global.WP, {
|
||||
publicPath: global.WP_CONFIG.output.publicPath
|
||||
}),
|
||||
hotMiddleware: require('webpack-hot-middleware')(global.WP)
|
||||
}
|
||||
global.WP_DEV.devMiddleware.waitUntilValid(() => {
|
||||
console.info(chalk.yellow.bold('>>> Starting Wiki.js in DEVELOPER mode...'))
|
||||
require('../server')
|
||||
|
||||
process.stdin.setEncoding('utf8')
|
||||
process.stdin.on('data', data => {
|
||||
if (_.trim(data) === 'rs') {
|
||||
console.warn(chalk.yellow.bold('--- >>>>>>>>>>>>>>>>>>>>>>>> ---'))
|
||||
console.warn(chalk.yellow.bold('--- Manual restart requested ---'))
|
||||
console.warn(chalk.yellow.bold('--- <<<<<<<<<<<<<<<<<<<<<<<< ---'))
|
||||
this.reload()
|
||||
}
|
||||
})
|
||||
|
||||
const devWatcher = chokidar.watch([
|
||||
'./server',
|
||||
'!./server/views/master.pug'
|
||||
], {
|
||||
cwd: process.cwd(),
|
||||
ignoreInitial: true,
|
||||
atomic: 400
|
||||
})
|
||||
devWatcher.on('ready', () => {
|
||||
devWatcher.on('all', _.debounce(() => {
|
||||
console.warn(chalk.yellow.bold('--- >>>>>>>>>>>>>>>>>>>>>>>>>>>> ---'))
|
||||
console.warn(chalk.yellow.bold('--- Changes detected: Restarting ---'))
|
||||
console.warn(chalk.yellow.bold('--- <<<<<<<<<<<<<<<<<<<<<<<<<<<< ---'))
|
||||
this.reload()
|
||||
}, 500))
|
||||
})
|
||||
})
|
||||
},
|
||||
async reload() {
|
||||
console.warn(chalk.yellow('--- Gracefully stopping server...'))
|
||||
await global.WIKI.kernel.shutdown(true)
|
||||
|
||||
console.warn(chalk.yellow('--- Purging node modules cache...'))
|
||||
|
||||
global.WIKI = {}
|
||||
Object.keys(require.cache).forEach(id => {
|
||||
if (/[/\\]server[/\\]/.test(id)) {
|
||||
delete require.cache[id]
|
||||
}
|
||||
})
|
||||
Object.keys(module.constructor._pathCache).forEach(cacheKey => {
|
||||
if (/[/\\]server[/\\]/.test(cacheKey)) {
|
||||
delete module.constructor._pathCache[cacheKey]
|
||||
}
|
||||
})
|
||||
|
||||
console.warn(chalk.yellow('--- Unregistering process listeners...'))
|
||||
|
||||
process.removeAllListeners('unhandledRejection')
|
||||
process.removeAllListeners('uncaughtException')
|
||||
|
||||
require('../server')
|
||||
}
|
||||
}
|
||||
|
||||
init.dev()
|
||||
@@ -1,108 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"runtime"
|
||||
|
||||
"github.com/bugsnag/bugsnag-go"
|
||||
"github.com/fatih/color"
|
||||
"gopkg.in/AlecAivazis/survey.v1"
|
||||
)
|
||||
|
||||
var qs = []*survey.Question{
|
||||
{
|
||||
Name: "location",
|
||||
Prompt: &survey.Input{
|
||||
Message: "Where do you want to install Wiki.js?",
|
||||
Default: "./wiki",
|
||||
},
|
||||
Validate: survey.Required,
|
||||
},
|
||||
{
|
||||
Name: "dbtype",
|
||||
Prompt: &survey.Select{
|
||||
Message: "Select a DB Driver:",
|
||||
Options: []string{"MariabDB", "MS SQL Server", "MySQL", "PostgreSQL", "SQLite"},
|
||||
Default: "PostgreSQL",
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "port",
|
||||
Prompt: &survey.Input{
|
||||
Message: "Server Port:",
|
||||
Default: "3000",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
func main() {
|
||||
bugsnag.Configure(bugsnag.Configuration{
|
||||
APIKey: "37770b3b08864599fd47c4edba5aa656",
|
||||
ReleaseStage: "dev",
|
||||
})
|
||||
|
||||
bold := color.New(color.FgWhite).Add(color.Bold)
|
||||
|
||||
logo := `
|
||||
__ __ _ _ _ _
|
||||
/ / /\ \ (_) | _(_) (_)___
|
||||
\ \/ \/ / | |/ / | | / __|
|
||||
\ /\ /| | <| |_ | \__ \
|
||||
\/ \/ |_|_|\_\_(_)/ |___/
|
||||
|__/
|
||||
`
|
||||
color.Yellow(logo)
|
||||
|
||||
bold.Println("\nInstaller for Wiki.js 2.x")
|
||||
fmt.Printf("%s-%s\n\n", runtime.GOOS, runtime.GOARCH)
|
||||
|
||||
// Check system requirements
|
||||
|
||||
bold.Println("Verifying system requirements...")
|
||||
CheckNodeJs()
|
||||
CheckRAM()
|
||||
fmt.Println()
|
||||
|
||||
// the answers will be written to this struct
|
||||
answers := struct {
|
||||
Location string
|
||||
DBType string `survey:"dbtype"`
|
||||
Port int
|
||||
}{}
|
||||
|
||||
// perform the questions
|
||||
err := survey.Ask(qs, &answers)
|
||||
if err != nil {
|
||||
fmt.Println(err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
fmt.Printf("%s chose %d.", answers.Location, answers.Port)
|
||||
|
||||
// Download archives...
|
||||
|
||||
bold.Println("\nDownloading packages...")
|
||||
|
||||
// uiprogress.Start()
|
||||
// bar := uiprogress.AddBar(100)
|
||||
|
||||
// bar.AppendCompleted()
|
||||
// bar.PrependElapsed()
|
||||
|
||||
// for bar.Incr() {
|
||||
// time.Sleep(time.Millisecond * 20)
|
||||
// }
|
||||
|
||||
finish := `
|
||||
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
| |
|
||||
| Open http://localhost:3000/ in your browser |
|
||||
| to complete the installation! |
|
||||
| |
|
||||
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
|
||||
`
|
||||
color.Yellow("\n\n" + finish)
|
||||
|
||||
fmt.Println("Press any key to continue.")
|
||||
fmt.Scanln()
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os/exec"
|
||||
|
||||
"github.com/blang/semver"
|
||||
"github.com/fatih/color"
|
||||
"github.com/pbnjay/memory"
|
||||
)
|
||||
|
||||
const nodejsSemverRange = ">=8.11.4 <11.0.0"
|
||||
const ramMin = 768
|
||||
|
||||
// CheckNodeJs checks if Node.js is installed and has minimal supported version
|
||||
func CheckNodeJs() bool {
|
||||
cmd := exec.Command("node", "-v")
|
||||
cmdOutput, err := cmd.CombinedOutput()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
validRange := semver.MustParseRange(nodejsSemverRange)
|
||||
nodeVersion, err := semver.ParseTolerant(string(cmdOutput[:]))
|
||||
if !validRange(nodeVersion) {
|
||||
panic(fmt.Errorf(color.RedString("Error: Installed Node.js version %s is not supported! %s\n"), nodeVersion, nodejsSemverRange))
|
||||
}
|
||||
|
||||
fmt.Printf(color.GreenString("✔")+" Node.js %s: OK\n", nodeVersion.String())
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// CheckRAM checks if system total RAM meets requirements
|
||||
func CheckRAM() bool {
|
||||
var totalRAM = memory.TotalMemory() / 1024 / 1024
|
||||
if totalRAM < ramMin {
|
||||
panic(fmt.Errorf(color.RedString("Error: System does not meet RAM requirements. %s MB minimum.\n"), ramMin))
|
||||
}
|
||||
|
||||
fmt.Printf(color.GreenString("✔")+" Total System RAM %d MB: OK\n", totalRAM)
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// CheckNetworkAccess checks if download server can be reached
|
||||
func CheckNetworkAccess() bool {
|
||||
// TODO
|
||||
return true
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
<config>
|
||||
</config>
|
||||
@@ -1,84 +0,0 @@
|
||||
doctype html
|
||||
html(lang=siteConfig.lang)
|
||||
head
|
||||
meta(http-equiv='X-UA-Compatible', content='IE=edge')
|
||||
meta(charset='UTF-8')
|
||||
meta(name='viewport', content='user-scalable=yes, width=device-width, initial-scale=1, maximum-scale=5')
|
||||
meta(name='theme-color', content='#1976d2')
|
||||
meta(name='msapplication-TileColor', content='#1976d2')
|
||||
meta(name='msapplication-TileImage', content='/_assets-legacy/favicons/mstile-150x150.png')
|
||||
|
||||
title= pageMeta.title + ' | ' + config.title
|
||||
|
||||
//- SEO / OpenGraph
|
||||
meta(name='description', content=pageMeta.description)
|
||||
meta(property='og:title', content=pageMeta.title)
|
||||
meta(property='og:type', content='website')
|
||||
meta(property='og:description', content=pageMeta.description)
|
||||
meta(property='og:image', content=pageMeta.image)
|
||||
meta(property='og:url', content=pageMeta.url)
|
||||
meta(property='og:site_name', content=config.title)
|
||||
|
||||
//- Favicon
|
||||
link(rel='apple-touch-icon', sizes='180x180', href='/_assets-legacy/favicons/apple-touch-icon.png')
|
||||
link(rel='icon', type='image/png', sizes='192x192', href='/_assets-legacy/favicons/android-chrome-192x192.png')
|
||||
link(rel='icon', type='image/png', sizes='32x32', href='/_assets-legacy/favicons/favicon-32x32.png')
|
||||
link(rel='icon', type='image/png', sizes='16x16', href='/_assets-legacy/favicons/favicon-16x16.png')
|
||||
link(rel='mask-icon', href='/_assets-legacy/favicons/safari-pinned-tab.svg', color='#1976d2')
|
||||
link(rel='manifest', href='/_assets-legacy/manifest.json')
|
||||
|
||||
//- Site Properties
|
||||
script.
|
||||
var siteId = "!{siteId}"
|
||||
var siteConfig = !{JSON.stringify(siteConfig)}
|
||||
var siteLangs = !{JSON.stringify(langs)}
|
||||
|
||||
//- Dev Mode Warning
|
||||
if devMode
|
||||
script.
|
||||
siteConfig.devMode = true
|
||||
|
||||
//- CSS
|
||||
<% for (var index in htmlWebpackPlugin.files.css) { %>
|
||||
<% if (htmlWebpackPlugin.files.cssIntegrity) { %>
|
||||
link(
|
||||
type='text/css'
|
||||
rel='stylesheet'
|
||||
href='<%= htmlWebpackPlugin.files.css[index] %>'
|
||||
integrity=config.security.securitySRI ? '<%= htmlWebpackPlugin.files.cssIntegrity[index] %>' : false
|
||||
crossorigin='<%= webpackConfig.output.crossOriginLoading %>'
|
||||
)
|
||||
<% } else { %>
|
||||
link(
|
||||
type='text/css'
|
||||
rel='stylesheet'
|
||||
href='<%= htmlWebpackPlugin.files.css[index] %>'
|
||||
)
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
//- JS
|
||||
<% for (var index in htmlWebpackPlugin.files.js) { %>
|
||||
<% if (htmlWebpackPlugin.files.jsIntegrity) { %>
|
||||
script(
|
||||
type='text/javascript'
|
||||
src='<%= htmlWebpackPlugin.files.js[index] %>'
|
||||
integrity=config.security.securitySRI ? '<%= htmlWebpackPlugin.files.jsIntegrity[index] %>' : false
|
||||
crossorigin='<%= webpackConfig.output.crossOriginLoading %>'
|
||||
)
|
||||
<% } else { %>
|
||||
script(
|
||||
type='text/javascript'
|
||||
src='<%= htmlWebpackPlugin.files.js[index] %>'
|
||||
)
|
||||
<% } %>
|
||||
<% } %>
|
||||
|
||||
!= analyticsCode.head
|
||||
|
||||
block head
|
||||
|
||||
body
|
||||
!= analyticsCode.bodyStart
|
||||
block body
|
||||
!= analyticsCode.bodyEnd
|
||||
@@ -1,267 +0,0 @@
|
||||
const webpack = require('webpack')
|
||||
const path = require('path')
|
||||
const fs = require('fs-extra')
|
||||
const yargs = require('yargs').argv
|
||||
const _ = require('lodash')
|
||||
|
||||
const { VueLoaderPlugin } = require('vue-loader')
|
||||
const CopyWebpackPlugin = require('copy-webpack-plugin')
|
||||
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||
const HtmlWebpackPugPlugin = require('html-webpack-pug-plugin')
|
||||
const MomentTimezoneDataPlugin = require('moment-timezone-data-webpack-plugin')
|
||||
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
|
||||
const WriteFilePlugin = require('write-file-webpack-plugin')
|
||||
const WebpackBarPlugin = require('webpackbar')
|
||||
|
||||
const babelConfig = fs.readJsonSync(path.join(process.cwd(), '.babelrc'))
|
||||
const cacheDir = '.webpack-cache/cache'
|
||||
const babelDir = path.join(process.cwd(), '.webpack-cache/babel')
|
||||
|
||||
process.noDeprecation = true
|
||||
|
||||
fs.emptyDirSync(path.join(process.cwd(), 'assets-legacy'))
|
||||
|
||||
module.exports = {
|
||||
mode: 'development',
|
||||
entry: {
|
||||
app: ['./client/index-app.js', 'webpack-hot-middleware/client']
|
||||
},
|
||||
output: {
|
||||
path: path.join(process.cwd(), 'assets-legacy'),
|
||||
publicPath: '/_assets-legacy/',
|
||||
filename: 'js/[name].js',
|
||||
chunkFilename: 'js/[name].js',
|
||||
globalObject: 'this',
|
||||
pathinfo: true,
|
||||
crossOriginLoading: 'use-credentials'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: (modulePath) => {
|
||||
return modulePath.includes('node_modules') && !modulePath.includes('vuetify')
|
||||
},
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'babel-loader',
|
||||
options: {
|
||||
...babelConfig,
|
||||
cacheDirectory: babelDir
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.css$/,
|
||||
use: [
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'postcss-loader'
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.sass$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
implementation: require('sass'),
|
||||
sourceMap: false,
|
||||
sassOptions: {
|
||||
fiber: false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
implementation: require('sass'),
|
||||
sourceMap: false,
|
||||
sassOptions: {
|
||||
fiber: false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'sass-resources-loader',
|
||||
options: {
|
||||
resources: path.join(process.cwd(), '/client/scss/global.scss')
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader'
|
||||
},
|
||||
{
|
||||
test: /\.pug$/,
|
||||
exclude: [
|
||||
path.join(process.cwd(), 'dev')
|
||||
],
|
||||
loader: 'pug-plain-loader'
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|gif)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 8192
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
exclude: [
|
||||
path.join(process.cwd(), 'node_modules/grapesjs')
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[name].[ext]',
|
||||
outputPath: 'svg/'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(graphql|gql)$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{ loader: 'graphql-persisted-document-loader' },
|
||||
{ loader: 'graphql-tag/loader' }
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(woff2|woff|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
|
||||
use: [{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[name].[ext]',
|
||||
outputPath: 'fonts/'
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
loader: 'webpack-modernizr-loader',
|
||||
test: /\.modernizrrc\.js$/
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
new VuetifyLoaderPlugin(),
|
||||
new MomentTimezoneDataPlugin({
|
||||
startYear: 2017,
|
||||
endYear: (new Date().getFullYear()) + 5
|
||||
}),
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{ from: 'client/static' },
|
||||
{ from: './node_modules/prismjs/components', to: 'js/prism' }
|
||||
]
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'dev/templates/base.pug',
|
||||
filename: '../server/views/base.pug',
|
||||
hash: false,
|
||||
inject: false
|
||||
}),
|
||||
new HtmlWebpackPugPlugin(),
|
||||
new WebpackBarPlugin({
|
||||
name: 'Client Assets'
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('development'),
|
||||
'process.env.CURRENT_THEME': JSON.stringify(_.defaultTo(yargs.theme, 'default'))
|
||||
}),
|
||||
new WriteFilePlugin(),
|
||||
new webpack.HotModuleReplacementPlugin(),
|
||||
new webpack.WatchIgnorePlugin([
|
||||
/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',
|
||||
'gql': path.join(process.cwd(), 'client/graph'),
|
||||
// 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'),
|
||||
'modernizr$': path.resolve(process.cwd(), 'client/.modernizrrc.js')
|
||||
},
|
||||
extensions: [
|
||||
'.js',
|
||||
'.json',
|
||||
'.vue'
|
||||
],
|
||||
modules: [
|
||||
'node_modules'
|
||||
]
|
||||
},
|
||||
node: {
|
||||
fs: 'empty'
|
||||
},
|
||||
stats: {
|
||||
children: false,
|
||||
entrypoints: false
|
||||
},
|
||||
target: 'web',
|
||||
watch: true
|
||||
}
|
||||
@@ -1,274 +0,0 @@
|
||||
const webpack = require('webpack')
|
||||
const path = require('path')
|
||||
const fs = require('fs-extra')
|
||||
const yargs = require('yargs').argv
|
||||
const _ = require('lodash')
|
||||
|
||||
const { VueLoaderPlugin } = require('vue-loader')
|
||||
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 MomentTimezoneDataPlugin = require('moment-timezone-data-webpack-plugin')
|
||||
const OptimizeCssAssetsPlugin = require('optimize-css-assets-webpack-plugin')
|
||||
const ScriptExtHtmlWebpackPlugin = require('script-ext-html-webpack-plugin')
|
||||
const VuetifyLoaderPlugin = require('vuetify-loader/lib/plugin')
|
||||
const WebpackBarPlugin = require('webpackbar')
|
||||
|
||||
const now = Math.round(Date.now() / 1000)
|
||||
|
||||
const babelConfig = fs.readJsonSync(path.join(process.cwd(), '.babelrc'))
|
||||
const cacheDir = '.webpack-cache/cache'
|
||||
const babelDir = path.join(process.cwd(), '.webpack-cache/babel')
|
||||
|
||||
process.noDeprecation = true
|
||||
|
||||
fs.emptyDirSync(path.join(process.cwd(), 'assets-legacy'))
|
||||
|
||||
module.exports = {
|
||||
mode: 'production',
|
||||
entry: {
|
||||
app: './client/index-app.js'
|
||||
},
|
||||
output: {
|
||||
path: path.join(process.cwd(), 'assets-legacy'),
|
||||
publicPath: '/_assets-legacy/',
|
||||
filename: `js/[name].js?${now}`,
|
||||
chunkFilename: `js/[name].js?${now}`,
|
||||
globalObject: 'this',
|
||||
crossOriginLoading: 'use-credentials'
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.js$/,
|
||||
exclude: (modulePath) => {
|
||||
return modulePath.includes('node_modules') && !modulePath.includes('vuetify')
|
||||
},
|
||||
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: /\.sass$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
'style-loader',
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
implementation: require('sass'),
|
||||
sourceMap: false,
|
||||
sassOptions: {
|
||||
fiber: false
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.scss$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'cache-loader',
|
||||
options: {
|
||||
cacheDirectory: cacheDir
|
||||
}
|
||||
},
|
||||
'style-loader',
|
||||
MiniCssExtractPlugin.loader,
|
||||
'css-loader',
|
||||
'postcss-loader',
|
||||
{
|
||||
loader: 'sass-loader',
|
||||
options: {
|
||||
implementation: require('sass'),
|
||||
sourceMap: false,
|
||||
sassOptions: {
|
||||
fiber: false
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
loader: 'sass-resources-loader',
|
||||
options: {
|
||||
resources: path.join(process.cwd(), '/client/scss/global.scss')
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.vue$/,
|
||||
loader: 'vue-loader'
|
||||
},
|
||||
{
|
||||
test: /\.pug$/,
|
||||
exclude: [
|
||||
path.join(process.cwd(), 'dev')
|
||||
],
|
||||
loader: 'pug-plain-loader'
|
||||
},
|
||||
{
|
||||
test: /\.(png|jpg|gif)$/,
|
||||
use: [
|
||||
{
|
||||
loader: 'url-loader',
|
||||
options: {
|
||||
limit: 8192
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.svg$/,
|
||||
exclude: [
|
||||
path.join(process.cwd(), 'node_modules/grapesjs')
|
||||
],
|
||||
use: [
|
||||
{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[name].[ext]',
|
||||
outputPath: 'svg/'
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(graphql|gql)$/,
|
||||
exclude: /node_modules/,
|
||||
use: [
|
||||
{ loader: 'graphql-persisted-document-loader' },
|
||||
{ loader: 'graphql-tag/loader' }
|
||||
]
|
||||
},
|
||||
{
|
||||
test: /\.(woff2|woff|ttf|eot)(\?v=\d+\.\d+\.\d+)?$/,
|
||||
use: [{
|
||||
loader: 'file-loader',
|
||||
options: {
|
||||
name: '[name].[ext]',
|
||||
outputPath: 'fonts/'
|
||||
}
|
||||
}]
|
||||
},
|
||||
{
|
||||
loader: 'webpack-modernizr-loader',
|
||||
test: /\.modernizrrc\.js$/
|
||||
}
|
||||
]
|
||||
},
|
||||
plugins: [
|
||||
new VueLoaderPlugin(),
|
||||
new VuetifyLoaderPlugin(),
|
||||
new webpack.BannerPlugin('Wiki.js - wiki.js.org - Licensed under AGPL'),
|
||||
new MomentTimezoneDataPlugin({
|
||||
startYear: 2017,
|
||||
endYear: (new Date().getFullYear()) + 5
|
||||
}),
|
||||
new CopyWebpackPlugin({
|
||||
patterns: [
|
||||
{ from: 'client/static' },
|
||||
{ from: './node_modules/prismjs/components', to: 'js/prism' }
|
||||
]
|
||||
}),
|
||||
new MiniCssExtractPlugin({
|
||||
filename: 'css/bundle.[hash].css',
|
||||
chunkFilename: 'css/[name].[chunkhash].css'
|
||||
}),
|
||||
new HtmlWebpackPlugin({
|
||||
template: 'dev/templates/base.pug',
|
||||
filename: '../server/views/base.pug',
|
||||
hash: false,
|
||||
inject: false
|
||||
}),
|
||||
new HtmlWebpackPugPlugin(),
|
||||
new ScriptExtHtmlWebpackPlugin({
|
||||
sync: 'runtime.js',
|
||||
defaultAttribute: 'async'
|
||||
}),
|
||||
new WebpackBarPlugin({
|
||||
name: 'Client Assets'
|
||||
}),
|
||||
new CleanWebpackPlugin(),
|
||||
new OptimizeCssAssetsPlugin({
|
||||
cssProcessorOptions: { discardComments: { removeAll: true } },
|
||||
canPrint: true
|
||||
}),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env.NODE_ENV': JSON.stringify('production'),
|
||||
'process.env.CURRENT_THEME': JSON.stringify(_.defaultTo(yargs.theme, 'default'))
|
||||
}),
|
||||
new webpack.optimize.MinChunkSizePlugin({
|
||||
minChunkSize: 50000
|
||||
})
|
||||
],
|
||||
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',
|
||||
'gql': path.join(process.cwd(), 'client/graph'),
|
||||
// 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'),
|
||||
'modernizr$': path.resolve(process.cwd(), 'client/.modernizrrc.js')
|
||||
},
|
||||
extensions: [
|
||||
'.js',
|
||||
'.json',
|
||||
'.vue'
|
||||
],
|
||||
modules: [
|
||||
'node_modules'
|
||||
]
|
||||
},
|
||||
node: {
|
||||
fs: 'empty'
|
||||
},
|
||||
stats: {
|
||||
children: false,
|
||||
entrypoints: false
|
||||
},
|
||||
target: 'web'
|
||||
}
|
||||
Reference in New Issue
Block a user