Skip to content

Commit 080d7d9

Browse files
committed
update to latest react and add npm run reset
1 parent 981724f commit 080d7d9

File tree

5 files changed

+22
-25
lines changed

5 files changed

+22
-25
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242
"node-sass": "^4.12.0",
4343
"node-watch": "^0.6.3",
4444
"prop-types": "^15.7.2",
45-
"react": "^16.10.0",
46-
"react-dom": "^16.10.0",
45+
"react": "^16.10.1",
46+
"react-dom": "^16.10.1",
4747
"sass-loader": "^8.0.0",
4848
"webpack": "^4.41.0",
4949
"webpack-cli": "^3.3.9"
@@ -53,8 +53,8 @@
5353
"build:asset": "babel-node ./tool/build.asset.js",
5454
"build:page": "babel-node ./tool/build.page.js",
5555
"build:bundle": "babel-node ./tool/build.bundle.js",
56-
"build:water": "",
5756
"build": "npm run clean:target; npm run build:asset; npm run build:bundle; npm run build:page;",
57+
"reset": "rm -rf node_modules/ && rm package-lock.json && npm i && npm run build",
5858
"start": "babel-node ./tool/build.watcher.js"
5959
}
6060
}

src/scripts/client/util/browser.util.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,4 @@ module.exports = {
5555
trackEvent,
5656
createGAScript
5757
};
58+
//

src/scripts/model/header.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
"use strict";
2-
31
const HeaderModel = {
42
homeLink: {name: "Home", href: "./", img: "img/logo.png"},
53
bannerLink: {name: "Banner Ad", href: "", img: "http://placehold.it/420x60"},

tool/base.config.js

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import path from 'path';
2-
32
const pkg = require("../package.json");
3+
44
const APP_NAME = pkg.name;
5-
const CUR_DIR = path.normalize(__dirname + "/..");
5+
const CUR_DIR = path.resolve(__dirname, "..");
66

7-
const SRC_BASE = "/src";
8-
const TAR_BASE = "/target";
9-
const VENDOR_BASE = "/vendor";
7+
const SRC_BASE = "src";
8+
const TAR_BASE = "target";
9+
const VEN_BASE = "vendor";
1010

1111
const CSS_BUNDLE_NAME = APP_NAME + "-bundle.min.css";
1212
const JS_BUNDLE_NAME = APP_NAME + "-bundle.min.js";
@@ -16,24 +16,22 @@ const Config = {
1616
CUR_DIR,
1717
TRACK_ID: "UA-xxx-1111",
1818
APP_NAME,
19-
SRC_BASE,
20-
TAR_BASE,
2119
src: {
22-
path: CUR_DIR + SRC_BASE,
23-
js_path: CUR_DIR + SRC_BASE + "/scripts",
24-
js_entry: CUR_DIR + SRC_BASE + "/scripts/client/main.js",
25-
sass_path: CUR_DIR + SRC_BASE + "/styles",
26-
img_path: CUR_DIR + SRC_BASE + "/images",
27-
vendor_css: CUR_DIR + VENDOR_BASE + "/css",
28-
vendor_js: CUR_DIR + VENDOR_BASE + "/js"
20+
path: path.join(CUR_DIR, SRC_BASE),
21+
js_path: path.join(CUR_DIR, SRC_BASE, "scripts"),
22+
js_entry: path.join(CUR_DIR, SRC_BASE, "scripts", "client", "main.js"),
23+
sass_path: path.join(CUR_DIR, SRC_BASE, "styles"),
24+
img_path: path.join(CUR_DIR, SRC_BASE, "images"),
25+
vendor_css: path.join(CUR_DIR, VEN_BASE, "css"),
26+
vendor_js: path.join(CUR_DIR, VEN_BASE, "js")
2927
},
3028
target: {
31-
path: CUR_DIR + TAR_BASE,
29+
path: path.join(CUR_DIR, TAR_BASE),
30+
js_path: path.join(CUR_DIR, TAR_BASE, "js"),
31+
css_path: path.join(CUR_DIR, TAR_BASE, "css"),
32+
img_path: path.join(CUR_DIR, TAR_BASE, "img"),
3233
js_bundle: JS_BUNDLE_NAME,
33-
css_bundle: "../css/" + CSS_BUNDLE_NAME,
34-
js_path: CUR_DIR + TAR_BASE + "/js",
35-
css_path: CUR_DIR + TAR_BASE + "/css",
36-
img_path: CUR_DIR + TAR_BASE + "/img"
34+
css_bundle: `..${path.sep}css${path.sep}${CSS_BUNDLE_NAME}`
3735
},
3836
root_files: "*(*.png|*.xml|*.ico|*.txt|*.html|.htaccess|site.webmanifest)",
3937
image_files: ['**/*.jp*g', '**/*.png', '**/*.gif', '**/*.svg']

tool/build.watcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function startWatchNonBundle() {
9999
console.log(`☯︎ start to watch ...`);
100100
watch(Conf.src.path, {
101101
recursive: true,
102-
filter: f => !/(\/client\/|\/styles\/)/i.test(f),
102+
filter: f => !/([/\\\\]client[/\\\\]|[/\\\\]styles[/\\\\])/gi.test(f),
103103
delay: 500
104104
}, (evt, f) => {
105105
console.log(`☯︎ watcher evt=${evt} name=${f}`);

0 commit comments

Comments
 (0)