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

Configuration code style #56

Merged
merged 4 commits into from
Nov 20, 2018
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

},
"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"
]
}
32 changes: 16 additions & 16 deletions tsconfig.server.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,27 @@
"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": [
"es5",
"esnext"
"es5",
"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,
} ),
);
},
};