Skip to content

Commit

Permalink
Fixed build issues
Browse files Browse the repository at this point in the history
- Now pre build files and ship them when publishing
  • Loading branch information
dozoisch committed Feb 22, 2017
1 parent 03ec9ae commit bb8c3d4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 21 deletions.
2 changes: 2 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yarn.lock
.travis.yml
28 changes: 14 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,50 +26,50 @@
"url": "git://github.com/mongo-express/mongo-express.git"
},
"dependencies": {
"assets-webpack-plugin": "^3.5.1",
"async": "2.0.1",
"babel-core": "^6.23.1",
"babel-loader": "^6.3.2",
"babel-preset-es2015": "^6.22.0",
"basic-auth-connect": "^1.0.0",
"body-parser": "1.15.2",
"bootstrap": "^3.3.7",
"busboy": "^0.2.13",
"clean-webpack-plugin": "^0.1.15",
"cli-color": "^1.1.0",
"codemirror": "^5.23.0",
"commander": "^2.9.0",
"cookie-parser": "1.4.3",
"copy-webpack-plugin": "^4.0.1",
"csurf": "1.9.0",
"errorhandler": "1.4.3",
"express": "4.14.0",
"express-session": "1.14.1",
"flat": "^2.0.1",
"gridfs-stream": "^1.1.1",
"jquery": "^3.1.1",
"json2csv": "^3.7.1",
"lodash": "~4.17.4",
"method-override": "2.3.6",
"mongodb": "2.2.24",
"morgan": "1.7.0",
"renderjson": "^1.2.3",
"serve-favicon": "2.3.0",
"swig-templates": "2.0.2",
"update-notifier": "1.0.2",
"webpack": "^2.2.1"
"update-notifier": "1.0.2"
},
"devDependencies": {
"assets-webpack-plugin": "^3.5.1",
"babel-core": "^6.23.1",
"babel-loader": "^6.3.2",
"babel-preset-es2015": "^6.22.0",
"bootstrap": "^3.3.7",
"chai": "3.5.0",
"clean-webpack-plugin": "^0.1.15",
"codemirror": "^5.23.0",
"concurrently": "^3.3.0",
"copy-webpack-plugin": "^4.0.1",
"eslint": "~3.9.1",
"eslint-config-airbnb-base": "^8.0.0",
"eslint-plugin-import": "^1.16.0",
"eslint-plugin-lodash": "^2.3.5",
"jquery": "^3.1.1",
"mocha": "3.0.2",
"nodemon": "^1.11.0",
"pre-commit": "1.1.3",
"supertest": "^3.0.0"
"supertest": "^3.0.0",
"renderjson ": "^1.2.3",
"webpack": "^2.2.1"
},
"engines": {
"node": ">=4.0.0",
Expand All @@ -85,7 +85,7 @@
"test": "npm run mocha && npm run lint",
"mocha": "NODE_ENV=test mocha",
"test-watch": "NODE_ENV=test mocha --watch --reporter spec",
"postinstall": "npm run build"
"prepublish": "npm run build"
},
"pre-commit": [
"test"
Expand Down
22 changes: 15 additions & 7 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ const isProd = !isDev;

const fileSuffix = isDev ? '' : '-[chunkhash].min';

function resolveModulePath(name) {
const packageJson = '/package.json';
return require.resolve(`${name}${packageJson}`).replace(packageJson, '');
}

const codemirrorPath = resolveModulePath('codemirror');
const bootstrapPath = resolveModulePath('bootstrap');

module.exports = {
entry: {
index: './lib/scripts/index.js',
Expand Down Expand Up @@ -62,14 +70,14 @@ module.exports = {
{ from: 'public/images/*', to: 'img/[name].[ext]' },
{ from: 'public/stylesheets/*', to: 'css/[name].[ext]' },

{ from: 'node_modules/codemirror/lib/codemirror.css', to: 'css/[name].[ext]' },
{ from: 'node_modules/codemirror/theme/*', to: 'css/theme/[name].[ext]' },
{ from: `${codemirrorPath}/lib/codemirror.css`, to: 'css/[name].[ext]' },
{ from: `${codemirrorPath}/theme/*`, to: 'css/theme/[name].[ext]' },

{ from: 'node_modules/bootstrap/dist/fonts/*', to: 'fonts/[name].[ext]' },
{ from: 'node_modules/bootstrap/dist/css/bootstrap.min.css', to: 'css/[name].[ext]' },
{ from: 'node_modules/bootstrap/dist/css/bootstrap.min.css.map', to: 'css/[name].[ext]' },
{ from: 'node_modules/bootstrap/dist/css/bootstrap-theme.min.css', to: 'css/[name].[ext]' },
{ from: 'node_modules/bootstrap/dist/css/bootstrap-theme.min.css.map', to: 'css/[name].[ext]' },
{ from: `${bootstrapPath}/dist/fonts/*`, to: 'fonts/[name].[ext]' },
{ from: `${bootstrapPath}/dist/css/bootstrap.min.css`, to: 'css/[name].[ext]' },
{ from: `${bootstrapPath}/dist/css/bootstrap.min.css.map`, to: 'css/[name].[ext]' },
{ from: `${bootstrapPath}/dist/css/bootstrap-theme.min.css`, to: 'css/[name].[ext]' },
{ from: `${bootstrapPath}/dist/css/bootstrap-theme.min.css.map`, to: 'css/[name].[ext]' },
]),

new AssetsPlugin({ filename: 'build-assets.json' }),
Expand Down

0 comments on commit bb8c3d4

Please sign in to comment.