Skip to content

Commit

Permalink
clean up webpack/deploy stuff (discordjs#2044)
Browse files Browse the repository at this point in the history
* fix stuff i think

* Update deploy.sh

* Update deploy.sh
  • Loading branch information
devsnek authored and iCrawl committed Oct 22, 2017
1 parent 296046d commit 339bcfd
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
"discord.js-docgen": "hydrabolt/discord.js-docgen",
"eslint": "^4.0.0",
"jsdoc-strip-async-await": "^0.1.0",
"json-filter-loader": "^1.0.0",
"parallel-webpack": "^2.0.0",
"uglifyjs-webpack-plugin": "^1.0.0-beta.2",
"webpack": "^3.0.0"
Expand Down
3 changes: 2 additions & 1 deletion travis/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ fi
npm run docs
VERSIONED=false npm run webpack

if [ $DONT_COMMIT ]; then
if [ $DONT_COMMIT == true ]; then
echo -e "\e[36m\e[1mNot commiting - exiting early"
exit 0
fi

Expand Down
17 changes: 14 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
DO NOT USE NORMAL WEBPACK! IT WILL NOT WORK!
*/

const path = require('path');
const webpack = require('webpack');
const createVariants = require('parallel-webpack').createVariants;
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const version = require('./package.json').version;

const createConfig = options => {
const plugins = [
new webpack.DefinePlugin({ 'global.GENTLY': false }),
new webpack.optimize.ModuleConcatenationPlugin(),
];

Expand All @@ -23,19 +23,30 @@ const createConfig = options => {
}));
}

const filename = `./webpack/discord${process.env.VERSIONED === 'false' ? '' : '.' + version}${options.minify ? '.min' : ''}.js`; // eslint-disable-line
// eslint-disable-next-line max-len
const filename = `discord${process.env.VERSIONED === 'false' ? '' : `.${version}`}${options.minify ? '.min' : ''}.js`;

return {
entry: './src/index.js',
output: {
path: __dirname,
path: path.resolve('./webpack'),
filename,
library: 'Discord',
libraryTarget: 'window',
},
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,
],
},
node: {
Expand Down

0 comments on commit 339bcfd

Please sign in to comment.