mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
wew
This commit is contained in:
@@ -14,8 +14,6 @@ deploy/
|
|||||||
.vscode/
|
.vscode/
|
||||||
docs/
|
docs/
|
||||||
|
|
||||||
webpack/
|
|
||||||
|
|
||||||
# NPM ignore
|
# NPM ignore
|
||||||
.eslintrc.json
|
.eslintrc.json
|
||||||
.gitattributes
|
.gitattributes
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
"docs:test": "docgen --source src --custom docs/index.yml --jsdoc jsdoc.json",
|
"docs:test": "docgen --source src --custom docs/index.yml --jsdoc jsdoc.json",
|
||||||
"lint": "eslint src *.js",
|
"lint": "eslint src *.js",
|
||||||
"lint:fix": "eslint --fix src",
|
"lint:fix": "eslint --fix src",
|
||||||
"webpack": "parallel-webpack"
|
"build:browser": "webpack",
|
||||||
|
"prepublishOnly": "npm run test && npm run build:browser"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -31,6 +32,7 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/hydrabolt/discord.js#readme",
|
"homepage": "https://github.com/hydrabolt/discord.js#readme",
|
||||||
"runkitExampleFilename": "./docs/examples/ping.js",
|
"runkitExampleFilename": "./docs/examples/ping.js",
|
||||||
|
"unpkg": "./webpack/discord.min.js",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"long": "^3.0.0",
|
"long": "^3.0.0",
|
||||||
"pako": "^1.0.0",
|
"pako": "^1.0.0",
|
||||||
@@ -55,7 +57,6 @@
|
|||||||
"eslint": "^4.0.0",
|
"eslint": "^4.0.0",
|
||||||
"jsdoc-strip-async-await": "^0.1.0",
|
"jsdoc-strip-async-await": "^0.1.0",
|
||||||
"json-filter-loader": "^1.0.0",
|
"json-filter-loader": "^1.0.0",
|
||||||
"parallel-webpack": "^2.0.0",
|
|
||||||
"uglifyjs-webpack-plugin": "^1.0.0-beta.2",
|
"uglifyjs-webpack-plugin": "^1.0.0-beta.2",
|
||||||
"webpack": "^3.0.0"
|
"webpack": "^3.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ fi
|
|||||||
|
|
||||||
# Run the build
|
# Run the build
|
||||||
npm run docs
|
npm run docs
|
||||||
VERSIONED=false npm run webpack
|
NODE_ENV=production npm run webpack
|
||||||
|
|
||||||
if [ $DONT_COMMIT == true ]; then
|
if [ $DONT_COMMIT == true ]; then
|
||||||
echo -e "\e[36m\e[1mNot commiting - exiting early"
|
echo -e "\e[36m\e[1mNot commiting - exiting early"
|
||||||
@@ -78,7 +78,6 @@ TARGET_BRANCH="webpack"
|
|||||||
git clone $REPO out -b $TARGET_BRANCH
|
git clone $REPO out -b $TARGET_BRANCH
|
||||||
|
|
||||||
# Move the generated webpack over
|
# Move the generated webpack over
|
||||||
mv webpack/discord.js out/discord.$SOURCE.js
|
|
||||||
mv webpack/discord.min.js out/discord.$SOURCE.min.js
|
mv webpack/discord.min.js out/discord.$SOURCE.min.js
|
||||||
|
|
||||||
# Commit and push
|
# Commit and push
|
||||||
|
|||||||
@@ -1,68 +1,60 @@
|
|||||||
/*
|
|
||||||
ONLY RUN BUILDS WITH `npm run webpack`!
|
|
||||||
DO NOT USE NORMAL WEBPACK! IT WILL NOT WORK!
|
|
||||||
*/
|
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const webpack = require('webpack');
|
const webpack = require('webpack');
|
||||||
const createVariants = require('parallel-webpack').createVariants;
|
|
||||||
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
|
||||||
const version = require('./package.json').version;
|
const version = require('./package.json').version;
|
||||||
|
|
||||||
const createConfig = options => {
|
const plugins = [
|
||||||
const plugins = [
|
new webpack.optimize.ModuleConcatenationPlugin(),
|
||||||
new webpack.optimize.ModuleConcatenationPlugin(),
|
];
|
||||||
];
|
|
||||||
|
|
||||||
if (options.minify) {
|
const prod = process.env.NODE_ENV === 'production';
|
||||||
plugins.push(new UglifyJSPlugin({
|
|
||||||
uglifyOptions: {
|
|
||||||
mangle: { keep_classnames: true },
|
|
||||||
output: { comments: false },
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
// eslint-disable-next-line max-len
|
if (prod) {
|
||||||
const filename = `discord${process.env.VERSIONED === 'false' ? '' : `.${version}`}${options.minify ? '.min' : ''}.js`;
|
plugins.push(new UglifyJSPlugin({
|
||||||
|
uglifyOptions: {
|
||||||
return {
|
mangle: { keep_classnames: true },
|
||||||
entry: './src/index.js',
|
output: { comments: false },
|
||||||
output: {
|
|
||||||
path: path.resolve('./webpack'),
|
|
||||||
filename,
|
|
||||||
library: 'Discord',
|
|
||||||
libraryTarget: 'window',
|
|
||||||
},
|
},
|
||||||
module: {
|
}));
|
||||||
rules: [
|
}
|
||||||
{ test: /\.md$/, loader: 'ignore-loader' },
|
|
||||||
{
|
// eslint-disable-next-line max-len
|
||||||
test: require.resolve('./package.json'),
|
const filename = `discord${process.env.VERSIONED ? `.${version}` : ''}${prod ? '.min' : ''}.js`;
|
||||||
use: {
|
|
||||||
loader: 'json-filter-loader',
|
module.exports = {
|
||||||
options: {
|
entry: './src/index.js',
|
||||||
used: ['version', 'homepage'],
|
output: {
|
||||||
},
|
path: path.resolve('./webpack'),
|
||||||
|
filename,
|
||||||
|
library: 'Discord',
|
||||||
|
libraryTarget: 'umd',
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [
|
||||||
|
{ test: /\.md$/, loader: 'ignore-loader' },
|
||||||
|
{
|
||||||
|
test: require.resolve('./package.json'),
|
||||||
|
use: {
|
||||||
|
loader: 'json-filter-loader',
|
||||||
|
options: {
|
||||||
|
used: ['version', 'homepage'],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
...require('snekfetch/webpack.supplemental').rules,
|
},
|
||||||
],
|
...require('snekfetch/webpack.supplemental').rules,
|
||||||
},
|
],
|
||||||
node: {
|
},
|
||||||
fs: 'empty',
|
node: {
|
||||||
dns: 'mock',
|
fs: 'empty',
|
||||||
tls: 'mock',
|
dns: 'mock',
|
||||||
child_process: 'empty',
|
tls: 'mock',
|
||||||
dgram: 'empty',
|
child_process: 'empty',
|
||||||
__dirname: true,
|
dgram: 'empty',
|
||||||
process: false,
|
__dirname: true,
|
||||||
path: 'empty',
|
process: false,
|
||||||
Buffer: false,
|
path: 'empty',
|
||||||
zlib: 'empty',
|
Buffer: false,
|
||||||
},
|
zlib: 'empty',
|
||||||
plugins,
|
},
|
||||||
};
|
plugins,
|
||||||
};
|
};
|
||||||
|
|
||||||
module.exports = createVariants({}, { minify: [false, true] }, createConfig);
|
|
||||||
|
|||||||
Reference in New Issue
Block a user