diff --git a/package-lock.json b/package-lock.json index b41b65d..b4ccb2a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -6717,6 +6717,11 @@ } } }, + "webpack-shell-plugin": { + "version": "0.5.0", + "resolved": "https://registry.npmjs.org/webpack-shell-plugin/-/webpack-shell-plugin-0.5.0.tgz", + "integrity": "sha1-Kbih2A3erg3bEOcpZn9yhlPCx0I=" + }, "webpack-sources": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz", diff --git a/package.json b/package.json index ee79d73..73392b9 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,8 @@ "stylus-loader": "^3.0.1", "tslint": "^5.8.0", "tslint-microsoft-contrib": "^5.0.1", - "webpack": "^3.10.0" + "webpack": "^3.10.0", + "webpack-shell-plugin": "^0.5.0" }, "devDependencies": { "typescript": "^2.6.2", diff --git a/scripts/build.js b/scripts/build.js index 6120934..72f2d77 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -39,6 +39,6 @@ marked.setOptions({ }); const convertToMarkdown = (data, file) => fs.writeFile(`../public/posts/${file.split('.')[0]}.html`, (marked(data)), err => { - if (err) throw err; + if (err) console.error(err); console.log(`Converted ${file} to hml`); }); \ No newline at end of file diff --git a/webpack.config.js b/webpack.config.js index c36e11d..3f69767 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -1,6 +1,7 @@ const webpack = require('webpack'); const path = require('path'); const copyWebpackPlugin = require('copy-webpack-plugin'); +const shellWebpackPlugin = require('webpack-shell-plugin'); module.exports = { entry: './src/index.ts', @@ -31,6 +32,9 @@ module.exports = { from: './src/index.html', to: './public/index.html' }] - ) + ), + new shellWebpackPlugin({ + onBuildStart: ['node ./scripts/build'] + }) ] } \ No newline at end of file