mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-08-22 22:10:54 +00:00
Developer improvements. Start using babel as the parser for eslint to add support for webpack's dynamic import syntax. Move most babel config into the babel build file to make sure nothing weird happens with eslint. Commit package-lock. Clean up gitignore a bit. Fix linting issues with the webpack build files.
This commit is contained in:
parent
41e80fd94c
commit
9ac7e8a209
11 changed files with 9071 additions and 23 deletions
3
.babelrc
3
.babelrc
|
@ -1,4 +1,3 @@
|
||||||
{
|
{
|
||||||
"presets": ["env"],
|
"plugins": ["syntax-dynamic-import"]
|
||||||
"plugins": ["syntax-dynamic-import", "transform-runtime"]
|
|
||||||
}
|
}
|
|
@ -4,6 +4,7 @@ module.exports = {
|
||||||
"es6": true
|
"es6": true
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
|
"parser": "babel-eslint",
|
||||||
"parserOptions": {
|
"parserOptions": {
|
||||||
"ecmaVersion": 8,
|
"ecmaVersion": 8,
|
||||||
"sourceType": "module"
|
"sourceType": "module"
|
||||||
|
|
9
.gitignore
vendored
9
.gitignore
vendored
|
@ -1,17 +1,10 @@
|
||||||
node_modules
|
node_modules
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
build
|
|
||||||
dist
|
dist
|
||||||
Extension Building
|
Extension Building
|
||||||
Old Files
|
|
||||||
badges
|
badges
|
||||||
cdn
|
cdn
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
*.iml
|
*.iml
|
||||||
script.js
|
credentials.json
|
||||||
script.min.js
|
|
||||||
*.min.css
|
|
||||||
credentials.json
|
|
||||||
|
|
||||||
/socketserver/cmd/socketserver/socketserver
|
|
9035
package-lock.json
generated
Normal file
9035
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
|
@ -13,6 +13,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"babel-core": "^6.26.0",
|
"babel-core": "^6.26.0",
|
||||||
|
"babel-eslint": "^8.2.2",
|
||||||
"babel-loader": "^7.1.4",
|
"babel-loader": "^7.1.4",
|
||||||
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
"babel-plugin-syntax-dynamic-import": "^6.18.0",
|
||||||
"babel-plugin-transform-runtime": "^6.23.0",
|
"babel-plugin-transform-runtime": "^6.23.0",
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
import {EventEmitter} from 'utilities/events';
|
import {EventEmitter} from 'utilities/events';
|
||||||
import Module from 'utilities/module';
|
import Module from 'utilities/module';
|
||||||
import {has} from 'utilities/object';
|
|
||||||
|
|
||||||
|
|
||||||
export default class Fine extends Module {
|
export default class Fine extends Module {
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const CleanPlugin = require('clean-webpack-plugin');
|
|
||||||
|
/* global module __dirname */
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
entry: {
|
entry: {
|
||||||
|
@ -20,7 +21,6 @@ module.exports = {
|
||||||
jsonpFunction: 'ffzWebpackJsonp'
|
jsonpFunction: 'ffzWebpackJsonp'
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new CleanPlugin(['dist']),
|
|
||||||
new webpack.ExtendedAPIPlugin()
|
new webpack.ExtendedAPIPlugin()
|
||||||
],
|
],
|
||||||
module: {
|
module: {
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
const merge = require('webpack-merge');
|
const merge = require('webpack-merge');
|
||||||
const common = require('./webpack.web.common.js');
|
const common = require('./webpack.web.common.js');
|
||||||
|
const path = require('path');
|
||||||
|
|
||||||
|
const CleanPlugin = require('clean-webpack-plugin');
|
||||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||||
const ManifestPlugin = require('webpack-manifest-plugin');
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
||||||
|
|
||||||
|
/* global module __dirname */
|
||||||
|
|
||||||
const config = module.exports = merge(common, {
|
const config = module.exports = merge(common, {
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
|
|
||||||
|
@ -11,11 +15,18 @@ const config = module.exports = merge(common, {
|
||||||
rules: [{
|
rules: [{
|
||||||
test: /\.js$/,
|
test: /\.js$/,
|
||||||
exclude: /node_modules/,
|
exclude: /node_modules/,
|
||||||
loader: 'babel-loader'
|
use: {
|
||||||
|
loader: 'babel-loader',
|
||||||
|
options: {
|
||||||
|
presets: ['env'],
|
||||||
|
plugins: ['transform-runtime']
|
||||||
|
}
|
||||||
|
}
|
||||||
}]
|
}]
|
||||||
},
|
},
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
|
new CleanPlugin(['dist/babel']),
|
||||||
new UglifyJSPlugin({
|
new UglifyJSPlugin({
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
uglifyOptions: {
|
uglifyOptions: {
|
||||||
|
@ -30,9 +41,9 @@ const config = module.exports = merge(common, {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
new ManifestPlugin({
|
new ManifestPlugin({
|
||||||
map: (data) => {
|
map: data => {
|
||||||
if ( data.name.endsWith('.scss') )
|
if ( data.name.endsWith('.scss') )
|
||||||
data.name = data.name.substr(0,data.name.length - 5) + '.css';
|
data.name = `${data.name.substr(0,data.name.length - 5)}.css`;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -41,6 +52,7 @@ const config = module.exports = merge(common, {
|
||||||
|
|
||||||
output: {
|
output: {
|
||||||
publicPath: '//cdn.frankerfacez.com/script/babel/',
|
publicPath: '//cdn.frankerfacez.com/script/babel/',
|
||||||
|
path: path.resolve(__dirname, 'dist/babel'),
|
||||||
filename: '[name].[hash].js'
|
filename: '[name].[hash].js'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -56,8 +68,8 @@ const config = module.exports = merge(common, {
|
||||||
// But it works.
|
// But it works.
|
||||||
|
|
||||||
for(const rule of config.module.rules) {
|
for(const rule of config.module.rules) {
|
||||||
if ( rule.use )
|
if ( Array.isArray(rule.use) )
|
||||||
for(const use of rule.use)
|
for(const use of rule.use)
|
||||||
if ( use.options && use.options.name && use.options.name.startsWith('[name].') )
|
if ( use.options && use.options.name && use.options.name.startsWith('[name].') )
|
||||||
use.options.name = '[name].[hash].' + use.options.name.slice(7)
|
use.options.name = `[name].[hash].${use.options.name.slice(7)}`;
|
||||||
}
|
}
|
|
@ -2,6 +2,8 @@ const path = require('path');
|
||||||
const merge = require('webpack-merge');
|
const merge = require('webpack-merge');
|
||||||
const common = require('./webpack.common.js');
|
const common = require('./webpack.common.js');
|
||||||
|
|
||||||
|
/* global module __dirname */
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
resolve: {
|
resolve: {
|
||||||
alias: {
|
alias: {
|
||||||
|
|
|
@ -5,6 +5,8 @@ const common = require('./webpack.web.common.js');
|
||||||
|
|
||||||
const CopyPlugin = require('copy-webpack-plugin');
|
const CopyPlugin = require('copy-webpack-plugin');
|
||||||
|
|
||||||
|
/* global module */
|
||||||
|
|
||||||
module.exports = merge(common, {
|
module.exports = merge(common, {
|
||||||
devtool: 'inline-source-map',
|
devtool: 'inline-source-map',
|
||||||
|
|
||||||
|
|
|
@ -4,13 +4,17 @@ const common = require('./webpack.web.common.js');
|
||||||
const CopyPlugin = require('copy-webpack-plugin');
|
const CopyPlugin = require('copy-webpack-plugin');
|
||||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||||
const ManifestPlugin = require('webpack-manifest-plugin');
|
const ManifestPlugin = require('webpack-manifest-plugin');
|
||||||
|
const CleanPlugin = require('clean-webpack-plugin');
|
||||||
|
|
||||||
const uglify = require('uglify-es');
|
const uglify = require('uglify-es');
|
||||||
|
|
||||||
|
/* global module Buffer */
|
||||||
|
|
||||||
const config = module.exports = merge(common, {
|
const config = module.exports = merge(common, {
|
||||||
devtool: 'source-map',
|
devtool: 'source-map',
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
|
new CleanPlugin(['dist']),
|
||||||
new UglifyJSPlugin({
|
new UglifyJSPlugin({
|
||||||
sourceMap: true,
|
sourceMap: true,
|
||||||
uglifyOptions: {
|
uglifyOptions: {
|
||||||
|
@ -28,7 +32,7 @@ const config = module.exports = merge(common, {
|
||||||
{
|
{
|
||||||
from: './src/entry.js',
|
from: './src/entry.js',
|
||||||
to: 'script.min.js',
|
to: 'script.min.js',
|
||||||
transform: (content) => {
|
transform: content => {
|
||||||
const text = content.toString('utf8');
|
const text = content.toString('utf8');
|
||||||
const minified = uglify.minify(text);
|
const minified = uglify.minify(text);
|
||||||
return (minified && minified.code) ? Buffer.from(minified.code) : content;
|
return (minified && minified.code) ? Buffer.from(minified.code) : content;
|
||||||
|
@ -36,9 +40,9 @@ const config = module.exports = merge(common, {
|
||||||
}
|
}
|
||||||
]),
|
]),
|
||||||
new ManifestPlugin({
|
new ManifestPlugin({
|
||||||
map: (data) => {
|
map: data => {
|
||||||
if ( data.name.endsWith('.scss') )
|
if ( data.name.endsWith('.scss') )
|
||||||
data.name = data.name.substr(0,data.name.length - 5) + '.css';
|
data.name = `${data.name.substr(0,data.name.length - 5)}.css`;
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@ -62,8 +66,8 @@ const config = module.exports = merge(common, {
|
||||||
// But it works.
|
// But it works.
|
||||||
|
|
||||||
for(const rule of config.module.rules) {
|
for(const rule of config.module.rules) {
|
||||||
if ( rule.use )
|
if ( Array.isArray(rule.use) )
|
||||||
for(const use of rule.use)
|
for(const use of rule.use)
|
||||||
if ( use.options && use.options.name && use.options.name.startsWith('[name].') )
|
if ( use.options && use.options.name && use.options.name.startsWith('[name].') )
|
||||||
use.options.name = '[name].[hash].' + use.options.name.slice(7)
|
use.options.name = `[name].[hash].${use.options.name.slice(7)}`;
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue