mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
update browser stuff and browser eslint (#1938)
* Update browser.js * Update .eslintrc.json * Update package.json * Update package.json * stop doing manually what webpack can do for us * Update .eslintrc.json * Update package.json
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
"es6": true,
|
||||
"node": true
|
||||
},
|
||||
"overrides": [
|
||||
{ "files": ["*.browser.js"], "env": { "browser": true } }
|
||||
],
|
||||
"rules": {
|
||||
"no-await-in-loop": "warn",
|
||||
"no-compare-neg-zero": "error",
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
const browser = typeof window !== 'undefined';
|
||||
const webpack = !!process.env.__DISCORD_WEBPACK__;
|
||||
|
||||
const Discord = require('./');
|
||||
|
||||
module.exports = Discord;
|
||||
if (browser && webpack) window.Discord = Discord; // eslint-disable-line no-undef
|
||||
// eslint-disable-next-line no-console
|
||||
else if (!browser) console.warn('Warning: Attempting to use browser version of Discord.js in a non-browser environment!');
|
||||
@@ -8,7 +8,7 @@
|
||||
"test": "npm run lint && npm run docs:test",
|
||||
"docs": "docgen --source src --custom docs/index.yml --output docs/docs.json --jsdoc jsdoc.json",
|
||||
"docs:test": "docgen --source src --custom docs/index.yml --jsdoc jsdoc.json",
|
||||
"lint": "eslint src",
|
||||
"lint": "eslint src *.js",
|
||||
"lint:fix": "eslint --fix src",
|
||||
"webpack": "parallel-webpack"
|
||||
},
|
||||
|
||||
@@ -12,11 +12,6 @@ const createConfig = options => {
|
||||
const plugins = [
|
||||
new webpack.DefinePlugin({ 'global.GENTLY': false }),
|
||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||
new webpack.DefinePlugin({
|
||||
'process.env': {
|
||||
__DISCORD_WEBPACK__: '"true"',
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
if (options.minify) {
|
||||
@@ -31,10 +26,12 @@ const createConfig = options => {
|
||||
const filename = `./webpack/discord${process.env.VERSIONED === 'false' ? '' : '.' + version}${options.minify ? '.min' : ''}.js`; // eslint-disable-line
|
||||
|
||||
return {
|
||||
entry: './browser.js',
|
||||
entry: './src/index.js',
|
||||
output: {
|
||||
path: __dirname,
|
||||
filename,
|
||||
library: 'Discord',
|
||||
libraryTarget: 'window',
|
||||
},
|
||||
module: {
|
||||
rules: [
|
||||
|
||||
Reference in New Issue
Block a user