From d831a2513b79c46063566c3cc3433a9113fcdf4b Mon Sep 17 00:00:00 2001 From: Stefan Natter Date: Tue, 18 Dec 2018 18:06:55 +0100 Subject: [PATCH] fix statics path bug and dist folder when building (#5) --- package.json | 35 ++++++++++++++++++++-------------- src/static/images/350x150.png | Bin 0 -> 912 bytes webpack/common.config.js | 10 ++++++++-- yarn.lock | 2 +- 4 files changed, 30 insertions(+), 17 deletions(-) create mode 100644 src/static/images/350x150.png diff --git a/package.json b/package.json index 98e54de..bbbe8b1 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,19 @@ { "name": "nightlybuilders-react-boilerplate", "version": "0.0.1", - "description": "This boilerplate kick starts your next React based web application.", + "description": + "This boilerplate kick starts your next React based web application.", "repository": { "type": "git", - "url": "git+https://github.com/nightlybuilders/nightlybuilders-react-boilerplate.git" + "url": + "git+https://github.com/nightlybuilders/nightlybuilders-react-boilerplate.git" }, "bugs": { - "url": "https://github.com/nightlybuilders/nightlybuilders-react-boilerplate/issues" + "url": + "https://github.com/nightlybuilders/nightlybuilders-react-boilerplate/issues" }, - "homepage": "https://github.com/nightlybuilders/nightlybuilders-react-boilerplate#readme", + "homepage": + "https://github.com/nightlybuilders/nightlybuilders-react-boilerplate#readme", "main": "src/server/index.js", "author": "Stefan Natter ", "contributors": [ @@ -24,36 +28,38 @@ ], "license": "Apache 2.0", "scripts": { - "build": "cross-env NODE_ENV=production BABEL_ENV=production webpack -p --config webpack/prod.config.js", - "build:analyse": "cross-env NODE_ENV=production BABEL_ENV=production webpack -p --config webpack/prod.analyse.config.js", - "build:dev": "webpack --config webpack/dev.config.js", + "build": + "rimraf cross-env NODE_ENV=production BABEL_ENV=production webpack -p --config webpack/prod.config.js", + "build:analyse": + "npm run prebuild && cross-env NODE_ENV=production BABEL_ENV=production webpack -p --config webpack/prod.analyse.config.js", + "build:dev": "npm run prebuild && webpack --config webpack/dev.config.js", "build:storybook": "build-storybook -o dist/storybook", "format": "eslint --fix ./src/**/*.js", "format:scss": "stylelint --fix ./src/**/*.scss", "lint": "eslint ./**/*.js", "lint:scss": "stylelint ./src/**/*.scss", + "prebuild": "rimraf dist", "precommit": "lint-staged", "start": "npm run build && node .", "storybook": "start-storybook -p 9001 -c storybook", "test": "jest", "test:coverage": "jest --coverage", - "watch:client": "webpack --config webpack/dev.config.js --watch", + "watch:client": + "npm run prebuild && webpack --config webpack/dev.config.js --watch", "watch:server": "nodemon ./src/server", "watch:test": "jest --watch" }, "lint-staged": { - "*.scss": [ - "npm run format:scss", - "git add" - ], + "*.scss": ["npm run format:scss", "git update-index --again"], "*.js": [ "npm run format", - "git add", + "git update-index --again", "jest --findRelatedTests" ] }, "devDependencies": { - "@natterstefan/eslint-config-ns": "git+https://github.com/natterstefan/eslint-config-ns.git#8470efb8bf1eac323eaa93b9d969a2c4ea6e38be", + "@natterstefan/eslint-config-ns": + "git+https://github.com/natterstefan/eslint-config-ns.git#8470efb8bf1eac323eaa93b9d969a2c4ea6e38be", "@storybook/addon-actions": "4.0.0-alpha.14", "@storybook/addon-options": "4.0.0-alpha.14", "@storybook/react": "4.0.0-alpha.14", @@ -136,6 +142,7 @@ "react-router-dom": "4.3.1", "redux": "4.0.0", "redux-thunk": "2.3.0", + "rimraf": "2.6.2", "serialize-javascript": "1.5.0" } } diff --git a/src/static/images/350x150.png b/src/static/images/350x150.png new file mode 100644 index 0000000000000000000000000000000000000000..299c2afa317fcfeff10c02d783e01d96eb6f798c GIT binary patch literal 912 zcmeAS@N?(olHy`uVBq!ia0y~yV2lH@r?D^t$&{0SU4WEyfKQ0)nKNgmO`CS~=+RZH zR?V3+XXD0=+qZAuw{PF##fzuz*1Q2!##!JIS{%*O5{`XX&?XWurR6fe*JyQ7QIbRK58uvX?-kz#?9vM z+-aUwA#DG%&d)K@U^VNGZ zcalAe)x=sOqdMlFvoBw|bwN_ISd6*4{nw+E0vGRV`Db2!?%HBzwM(b4=6Y?h@-oTz z;>ohYkv~0x+=h_Ujz^vMgx!F9B8eCB8++gwJn} zpPZg59OZlLm*a%OrL*7jO76c~7_u+E@)Fz3X*Q{q$8T0@-#hAZysf}D)8RLZY2A6D zy3ad$WWA)D%U9oj_S9T0=(vlA@%9AC{R{6!<=JLVu3P`~>3@T{#d6ZZ58q9d66upK z-tD~D+~4HO65n4>cbr=F{YOyi1v{PgrJw(W*9FhjoVUf$VjcHa&!UYoKOJXJ*e!qK z*9X^^wQHCDIJN4wgjlk@=FZ&PZ(94z?+HhridWmN+Wq`n+^>c^MNf}S64SlPzVva_ z&yQVM{dfMI{yO{X?G^jw-#^`@AOCNe=%m~AvcGbZ>!bUhSV?}jdu@1e@2txrPdYcp zM(n>I?)BYc-WEZhlCFi77AWZ zcKp{>!Kw2WxBlC%{ZjIx!nD->Cq)GrGXid{y>)W#eW!oN=jiLs(NB`Hi<@ebKCPzv zxzTpJDWS5K>dp`5XsnifYgaqT_*LT;#VD#W>~F0}-MF~cb#q;_bk+8cOK_!G ch6kbl7!Um_4&AQN#&)78&qol`;+08KHj5&!@I literal 0 HcmV?d00001 diff --git a/webpack/common.config.js b/webpack/common.config.js index 03f9d49..293d133 100644 --- a/webpack/common.config.js +++ b/webpack/common.config.js @@ -74,8 +74,14 @@ module.exports = { [ { context: './src/static', - from: `${path.resolve(__dirname, '..', 'src', 'static', 'images')}/**/*.+(png|jpg|gif)`, - to: `${BUILD_DIR}/static/images`, + from: `${path.resolve( + __dirname, + '..', + 'src', + 'static', + 'images', + )}/**/*.+(png|jpg|gif|svg)`, + to: `${BUILD_DIR}/static`, }, { context: './src/static', diff --git a/yarn.lock b/yarn.lock index 439b689..a5782a6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -10233,7 +10233,7 @@ right-align@^0.1.1: dependencies: align-text "^0.1.1" -rimraf@2, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: +rimraf@2, rimraf@2.6.2, rimraf@^2.2.8, rimraf@^2.5.4, rimraf@^2.6.1, rimraf@^2.6.2: version "2.6.2" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.6.2.tgz#2ed8150d24a16ea8651e6d6ef0f47c4158ce7a36" dependencies: