From 9d1ae91bc71a746f5694efb5cc370768bd97e927 Mon Sep 17 00:00:00 2001 From: Shawn Erquhart Date: Thu, 1 Mar 2018 16:15:03 -0500 Subject: [PATCH] add dev task that writes output to disk --- package.json | 7 +++++-- webpack.dev-write.js | 9 +++++++++ yarn.lock | 15 +++++++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 webpack.dev-write.js diff --git a/package.json b/package.json index 128cb710..1fa6fb27 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,9 @@ "description": "Netlify CMS lets content editors work on structured content stored in git", "main": "dist/cms.js", "scripts": { - "start": "webpack-dev-server -d --config webpack.dev.js", + "start": "npm run dev", + "dev": "webpack-dev-server -d --config webpack.dev.js", + "dev:write": "webpack-dev-server -d --config webpack.dev-write.js", "test": "jest --coverage", "test:watch": "jest --watch", "build": "cross-env NODE_ENV=production webpack --config webpack.prod.js --display-error-details", @@ -123,7 +125,8 @@ "webpack": "^3.6.0", "webpack-dev-server": "^2.9.1", "webpack-merge": "^4.1.0", - "webpack-postcss-tools": "^1.1.1" + "webpack-postcss-tools": "^1.1.1", + "write-file-webpack-plugin": "^4.2.0" }, "dependencies": { "classnames": "^2.2.5", diff --git a/webpack.dev-write.js b/webpack.dev-write.js new file mode 100644 index 00000000..9186f9ca --- /dev/null +++ b/webpack.dev-write.js @@ -0,0 +1,9 @@ +/* global require */ +const merge = require('webpack-merge'); +const WriteFilePlugin = require('write-file-webpack-plugin'); + +module.exports = merge.smart(require('./webpack.dev.js'), { + plugins: [ + new WriteFilePlugin(), + ], +}); diff --git a/yarn.lock b/yarn.lock index d920d6a2..55904edc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3164,6 +3164,10 @@ fileset@^2.0.2: glob "^7.0.3" minimatch "^3.0.3" +filesize@^3.2.1: + version "3.6.0" + resolved "https://registry.yarnpkg.com/filesize/-/filesize-3.6.0.tgz#22d079615624bb6fd3c04026120628a41b3f4efa" + fill-range@^2.1.0: version "2.2.3" resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-2.2.3.tgz#50b77dfd7e469bc7492470963699fe7a8485a723" @@ -9582,6 +9586,17 @@ write-file-stdout@0.0.2: version "0.0.2" resolved "https://registry.yarnpkg.com/write-file-stdout/-/write-file-stdout-0.0.2.tgz#c252d7c7c5b1b402897630e3453c7bfe690d9ca1" +write-file-webpack-plugin@^4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/write-file-webpack-plugin/-/write-file-webpack-plugin-4.2.0.tgz#7bd18547eaa0ea0b23992fb1e0322e5431d339ef" + dependencies: + chalk "^1.1.1" + debug "^2.6.8" + filesize "^3.2.1" + lodash "^4.5.1" + mkdirp "^0.5.1" + moment "^2.11.2" + write@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/write/-/write-0.2.1.tgz#5fc03828e264cea3fe91455476f7a3c566cb0757"