Skip to content
This repository has been archived by the owner on Mar 1, 2019. It is now read-only.

Commit

Permalink
Merge pull request #56 from wmde/config-cs
Browse files Browse the repository at this point in the history
Configuration code style
  • Loading branch information
jakobw authored Nov 20, 2018
2 parents bb53b5f + efecc92 commit 9becdd3
Show file tree
Hide file tree
Showing 9 changed files with 139 additions and 132 deletions.
8 changes: 4 additions & 4 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/app'
]
}
presets: [
'@vue/app',
],
};
58 changes: 29 additions & 29 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,31 @@
module.exports = {
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.all.json',
},
},
moduleFileExtensions: [
'js',
'jsx',
'json',
'vue',
'ts',
'tsx'
],
transform: {
'^.+\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.tsx?$': 'ts-jest'
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1'
},
setupTestFrameworkScriptFile: '<rootDir>/tests/config/setup.ts',
snapshotSerializers: [
'jest-serializer-vue'
],
testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'
],
testURL: 'http://localhost/'
globals: {
'ts-jest': {
tsConfigFile: './tsconfig.all.json',
},
},
moduleFileExtensions: [
'js',
'jsx',
'json',
'vue',
'ts',
'tsx',
],
transform: {
'^.+\\.vue$': 'vue-jest',
'.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub',
'^.+\\.tsx?$': 'ts-jest',
},
moduleNameMapper: {
'^@/(.*)$': '<rootDir>/src/$1',
},
setupTestFrameworkScriptFile: '<rootDir>/tests/config/setup.ts',
snapshotSerializers: [
'jest-serializer-vue',
],
testMatch: [
'**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)',
],
testURL: 'http://localhost/',
};
16 changes: 8 additions & 8 deletions jsduck.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"--title": "Wikibase Termbox - Documentation",
"--output": "docs",
"--processes": "0",
"--warnings-exit-nonzero": true,
"--builtin-classes": true,
"--warnings": ["-all"],
"--": [
]
"--title": "Wikibase Termbox - Documentation",
"--output": "docs",
"--processes": "0",
"--warnings-exit-nonzero": true,
"--builtin-classes": true,
"--warnings": ["-all"],
"--": [
]
}
8 changes: 4 additions & 4 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
plugins: {
autoprefixer: {}
}
}
plugins: {
autoprefixer: {},
},
};
30 changes: 16 additions & 14 deletions tsconfig.all.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,33 @@
"module": "esnext",
"sourceMap": true,
"typeRoots": [
"./src/types",
"./src/types/client",
"./src/types/server",
"./node_modules/@types"
"./src/types",
"./src/types/client",
"./src/types/server",
"./node_modules/@types"
],
"types": [
"webpack-env",
"jest",
"node"
"webpack-env",
"jest",
"node"
],
"lib": [
"esnext",
"es5",
"dom",
"dom.iterable",
"scripthost"
]
],
"allowJs": true
},
"include": [
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.ts",
"tests/**/*.tsx"
"./*.js",
"src/**/*.ts",
"src/**/*.tsx",
"src/**/*.vue",
"tests/**/*.ts",
"tests/**/*.ts",
"tests/**/*.tsx"
],
"exclude": [
"node_modules"
Expand Down
24 changes: 12 additions & 12 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
"module": "esnext",
"sourceMap": true,
"typeRoots": [
"./src/types",
"./src/types/client",
"./node_modules/@types"
"./src/types",
"./src/types/client",
"./node_modules/@types"
],
"types": [
"webpack-env",
"jest",
"node"
"webpack-env",
"jest",
"node"
],
"lib": [
"esnext",
Expand All @@ -22,11 +22,11 @@
]
},
"exclude": [
"node_modules",
"src/types/**/*",
"src/mock-data/**/*",
"src/mockup-entry.ts",
"src/server/**/*",
"src/server-entry.ts"
"node_modules",
"src/types/**/*",
"src/mock-data/**/*",
"src/mockup-entry.ts",
"src/server/**/*",
"src/server-entry.ts"
]
}
30 changes: 15 additions & 15 deletions tsconfig.server.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,26 @@
"module": "commonjs",
"sourceMap": true,
"typeRoots": [
"./src/types",
"./src/types/server",
"./node_modules/@types"
"./src/types",
"./src/types/server",
"./node_modules/@types"
],
"types": [
"webpack-env",
"jest",
"node",
"express"
"webpack-env",
"jest",
"node",
"express"
],
"lib": [
"esnext"
"esnext"
]
},
"exclude": [
"node_modules",
"src/types/client/**/*",
"src/mock-data/**/*",
"src/mockup-entry.ts",
"src/client/**/*",
"src/client-entry.ts"
]
"node_modules",
"src/types/client/**/*",
"src/mock-data/**/*",
"src/mockup-entry.ts",
"src/client/**/*",
"src/client-entry.ts"
]
}
5 changes: 5 additions & 0 deletions tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,10 @@
"interface-name": false,
"ordered-imports": false,
"object-literal-sort-keys": false
},
"jsRules": {
"quotemark": [ true, "single" ],
"indent": [ true, "tabs" ],
"object-literal-sort-keys": false
}
}
92 changes: 46 additions & 46 deletions vue.config.js
Original file line number Diff line number Diff line change
@@ -1,53 +1,53 @@
const VueSSRServerPlugin = require('vue-server-renderer/server-plugin')
const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
const VueSSRServerPlugin = require( 'vue-server-renderer/server-plugin' );
const VueSSRClientPlugin = require( 'vue-server-renderer/client-plugin' );

const TARGET_NODE = process.env.WEBPACK_TARGET === 'node'
const DEV_MODE = process.env.WEBPACK_TARGET === 'dev'
const filePrefix = 'wikibase.termbox.'
const TARGET_NODE = process.env.WEBPACK_TARGET === 'node';
const DEV_MODE = process.env.WEBPACK_TARGET === 'dev';
const filePrefix = 'wikibase.termbox.';

const target = TARGET_NODE
? 'server'
: 'client'
? 'server'
: 'client';

module.exports = {
outputDir: TARGET_NODE ? 'serverDist' : 'dist',
configureWebpack: () => ({
entry: DEV_MODE ? [ './src/mockup-entry.ts', `./src/${target}-entry.ts` ] : `./src/${target}-entry.ts`,
target: TARGET_NODE ? 'node' : 'web',
node: TARGET_NODE ? undefined : false,
plugins: [
TARGET_NODE
? new VueSSRServerPlugin()
: new VueSSRClientPlugin()
],
output: {
libraryTarget: TARGET_NODE
? 'commonjs2'
: undefined,
filename: `${filePrefix}[name].js`
},
optimization: {
splitChunks: undefined
}
}),
chainWebpack: config => {
config.optimization.delete('splitChunks')
outputDir: TARGET_NODE ? 'serverDist' : 'dist',
configureWebpack: () => ( {
entry: DEV_MODE ? [ './src/mockup-entry.ts', `./src/${target}-entry.ts` ] : `./src/${target}-entry.ts`,
target: TARGET_NODE ? 'node' : 'web',
node: TARGET_NODE ? undefined : false,
plugins: [
TARGET_NODE
? new VueSSRServerPlugin()
: new VueSSRClientPlugin(),
],
output: {
libraryTarget: TARGET_NODE
? 'commonjs2'
: undefined,
filename: `${filePrefix}[name].js`,
},
optimization: {
splitChunks: undefined,
},
} ),
chainWebpack: config => {
config.optimization.delete( 'splitChunks' );

if ( process.env.NODE_ENV === 'production' ) {
config.plugin('extract-css')
.tap(([options, ...args]) => [
Object.assign({}, options, { filename: `${filePrefix}[name].css` }),
...args
])
}
if ( process.env.NODE_ENV === 'production' ) {
config.plugin( 'extract-css' )
.tap( ( [ options, ...args ] ) => [
Object.assign( {}, options, { filename: `${filePrefix}[name].css` } ),
...args,
] );
}

config.module
.rule('vue')
.use('vue-loader')
.tap(options =>
Object.assign(options, {
optimizeSSR: false
})
)
}
}
config.module
.rule( 'vue' )
.use( 'vue-loader' )
.tap( options =>
Object.assign( options, {
optimizeSSR: false,
} ),
);
},
};

0 comments on commit 9becdd3

Please sign in to comment.