From 3fcd06e417978b9ed7bf739edd90b7609e70ed83 Mon Sep 17 00:00:00 2001 From: btzr-io Date: Sun, 8 Apr 2018 15:27:56 -0600 Subject: [PATCH 1/6] fix fontawesome icons --- package.json | 4 ++++ src/components/footer/index.js | 9 +++++++-- src/components/icon/index.js | 8 +++++++- src/index.html | 6 +----- src/index.js | 7 +++++++ yarn.lock | 32 ++++++++++++++++++++++++++++++++ 6 files changed, 58 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 30f2ef6..ff4fb3a 100644 --- a/package.json +++ b/package.json @@ -53,6 +53,10 @@ "pretty-quick": "^1.4.1" }, "dependencies": { + "@fortawesome/fontawesome": "^1.1.5", + "@fortawesome/fontawesome-free-brands": "^5.0.9", + "@fortawesome/fontawesome-free-solid": "^5.0.9", + "@fortawesome/react-fontawesome": "^0.0.18", "preact": "^8.2.7", "preact-compat": "^3.18.0", "preact-router": "^2.6.0", diff --git a/src/components/footer/index.js b/src/components/footer/index.js index ce250c8..69d120a 100644 --- a/src/components/footer/index.js +++ b/src/components/footer/index.js @@ -10,10 +10,15 @@ export default class Footer extends Component { render() { const { props, state } = this - const year = (new Date()).getFullYear() + const year = new Date().getFullYear() return ( - + ) } } diff --git a/src/components/icon/index.js b/src/components/icon/index.js index 5949250..026d4c0 100644 --- a/src/components/icon/index.js +++ b/src/components/icon/index.js @@ -1,6 +1,12 @@ +import FontAwesomeIcon from '@fortawesome/react-fontawesome' + import style from './style' console.log(style.icon) -const Icon = ({ name }) => +const Icon = ({ name }) => ( + + + +) export default Icon diff --git a/src/index.html b/src/index.html index dd84c5c..6b3f6c8 100644 --- a/src/index.html +++ b/src/index.html @@ -5,16 +5,12 @@ Comic Book Reader - - +
+ + + diff --git a/yarn.lock b/yarn.lock index a1ccbe8..8b8ea45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3566,6 +3566,16 @@ he@1.1.x: version "1.1.1" resolved "https://registry.yarnpkg.com/he/-/he-1.1.1.tgz#93410fd21b009735151f8868c2f271f3427e23fd" +history@^4.7.2: + version "4.7.2" + resolved "https://registry.yarnpkg.com/history/-/history-4.7.2.tgz#22b5c7f31633c5b8021c7f4a8a954ac139ee8d5b" + dependencies: + invariant "^2.2.1" + loose-envify "^1.2.0" + resolve-pathname "^2.2.0" + value-equal "^0.4.0" + warning "^3.0.0" + hmac-drbg@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/hmac-drbg/-/hmac-drbg-1.0.1.tgz#d2745701025a6c775a6c545793ed502fc0c649a1" @@ -3856,7 +3866,7 @@ interpret@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/interpret/-/interpret-1.1.0.tgz#7ed1b1410c6a0e0f78cf95d3b8440c63f78b8614" -invariant@^2.2.0, invariant@^2.2.2: +invariant@^2.2.0, invariant@^2.2.1, invariant@^2.2.2: version "2.2.4" resolved "https://registry.yarnpkg.com/invariant/-/invariant-2.2.4.tgz#610f3c92c9359ce1db616e538008d23ff35158e6" dependencies: @@ -4580,7 +4590,7 @@ longest@^1.0.0, longest@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/longest/-/longest-1.0.1.tgz#30a0b2da38f73770e8294a0d22e6625ed77d0097" -loose-envify@^1.0.0, loose-envify@^1.3.1: +loose-envify@^1.0.0, loose-envify@^1.2.0, loose-envify@^1.3.1: version "1.3.1" resolved "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.3.1.tgz#d1a8ad33fa9ce0e713d65fdd0ac8b748d478c848" dependencies: @@ -6372,6 +6382,10 @@ resolve-from@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/resolve-from/-/resolve-from-3.0.0.tgz#b22c7af7d9d6881bc8b6e653335eebcb0a188748" +resolve-pathname@^2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/resolve-pathname/-/resolve-pathname-2.2.0.tgz#7e9ae21ed815fd63ab189adeee64dc831eefa879" + resolve-url@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/resolve-url/-/resolve-url-0.2.1.tgz#2c637fe77c893afd2a663fe21aa9080068e2052a" @@ -7556,6 +7570,10 @@ validate-npm-package-name@^3.0.0: dependencies: builtins "^1.0.3" +value-equal@^0.4.0: + version "0.4.0" + resolved "https://registry.yarnpkg.com/value-equal/-/value-equal-0.4.0.tgz#c5bdd2f54ee093c04839d71ce2e4758a6890abc7" + vary@~1.1.2: version "1.1.2" resolved "https://registry.yarnpkg.com/vary/-/vary-1.1.2.tgz#2299f02c6ded30d4a5961b0b9f74524a18f634fc" @@ -7636,6 +7654,12 @@ ware@^1.2.0: dependencies: wrap-fn "^0.1.0" +warning@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/warning/-/warning-3.0.0.tgz#32e5377cb572de4ab04753bdf8821c01ed605b7c" + dependencies: + loose-envify "^1.0.0" + watchpack@^1.4.0: version "1.5.0" resolved "https://registry.yarnpkg.com/watchpack/-/watchpack-1.5.0.tgz#231e783af830a22f8966f65c4c4bacc814072eed" From 097471477761e282f78e7df0929298dc7aaad042 Mon Sep 17 00:00:00 2001 From: btzr-io Date: Sun, 8 Apr 2018 16:39:01 -0600 Subject: [PATCH 3/6] fix build --- .prettierrc | 2 +- src/index.js | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.prettierrc b/.prettierrc index 3e71de2..93b6708 100644 --- a/.prettierrc +++ b/.prettierrc @@ -1,6 +1,6 @@ { "trailingComma": "es5", - "printWidth": 100, + "printWidth": 80, "singleQuote": true, "semi": false } diff --git a/src/index.js b/src/index.js index 339edb6..2253299 100644 --- a/src/index.js +++ b/src/index.js @@ -7,9 +7,22 @@ import './style' import fontawesome from '@fortawesome/fontawesome' import brands from '@fortawesome/fontawesome-free-brands' -import solid from '@fortawesome/fontawesome-free-solid' +import faFolder from '@fortawesome/fontawesome-free-solid/faFolder' +import faCog from '@fortawesome/fontawesome-free-solid/faCog' +import faBars from '@fortawesome/fontawesome-free-solid/faBars' +import faBookmark from '@fortawesome/fontawesome-free-solid/faBookmark' +import faArrowDown from '@fortawesome/fontawesome-free-solid/faArrowDown' +import faQuestionCircle from '@fortawesome/fontawesome-free-solid/faQuestionCircle' -fontawesome.library.add(brands, solid) +fontawesome.library.add( + brands, + faCog, + faFolder, + faBookmark, + faBars, + faQuestionCircle, + faArrowDown +) render(
From 5d13988d2caae8a0ee6cc8def1baa30adf120bf9 Mon Sep 17 00:00:00 2001 From: Baltazar Gomez Date: Sun, 8 Apr 2018 17:10:59 -0600 Subject: [PATCH 4/6] add preview --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 63f321e..0379b53 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -http://comic-book-reader.com - > ### :warning: Warning > This branch is a port to Preact, and does not work yet! +> :rocket: Preview: https://btzr-io.github.io/comic_book_reader/ + # Comic Book Reader * Can read CBR, CBZ, CBT, and PDF files From fc06b2fbc93e5c66dc668e6970919ddc44fef519 Mon Sep 17 00:00:00 2001 From: btzr-io Date: Sun, 8 Apr 2018 17:13:38 -0600 Subject: [PATCH 5/6] update build --- package.json | 11 ++++------- src/static.html | 52 ++++++++++++++++++++++++------------------------- 2 files changed, 30 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index ffcfe86..b69ba53 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,7 @@ "version": "0.1.0", "description": "A browser based touch friendly comic book reader", "homepage": "https://github.com/workhorsy/comic_book_reader", - "keywords": [ - "comics" - ], + "keywords": ["comics"], "author": "Matthew Brennan Jones ", "contributors": [ "Baltazar Gomez (https://github.com/btzr-io)" @@ -19,7 +17,8 @@ "scripts": { "test": "eslint src && preact test", "start": "if-env NODE_ENV=production && npm run -s serve || npm run -s dev", - "build": "preact build -p --template src/static.html", + "build": + "preact build --production --no-prerender --template src/static.html", "serve": "npm run build && preact serve", "dev": "preact watch --template src/index.html", "lint": "eslint src", @@ -43,9 +42,7 @@ } } }, - "eslintIgnore": [ - "src/lib/*" - ], + "eslintIgnore": ["src/lib/*"], "devDependencies": { "all-contributors-cli": "^4.11.1", "eslint": "^4.2.0", diff --git a/src/static.html b/src/static.html index c6703ee..8ed869c 100644 --- a/src/static.html +++ b/src/static.html @@ -1,32 +1,32 @@ - + - - - Comic Book Reader - - + + <%= htmlWebpackPlugin.options.title %> + + + + + <% if (htmlWebpackPlugin.options.manifest.theme_color) { %> + + <% } %> + <% for (var chunk of webpack.chunks) { %> + <% if (chunk.names.length === 1 && chunk.names[0] === 'polyfills') continue; %> + <% for (var file of chunk.files) { %> + <% if (htmlWebpackPlugin.options.preload && file.match(/\.(js|css)$/)) { %> + + <% } else if (file.match(/manifest\.json$/)) { %> + + <% } %> + <% } %> + <% } %> + -
- - + <%= htmlWebpackPlugin.options.ssr({ + url: '/' + }) %> + + From d4ee2a47fe41c1af9387fb95e814f2202157b49d Mon Sep 17 00:00:00 2001 From: btzr-io Date: Sun, 8 Apr 2018 19:25:49 -0600 Subject: [PATCH 6/6] update build to static app --- package.json | 2 +- preact.config.js | 7 +++++++ src/static.html | 10 +++++----- 3 files changed, 13 insertions(+), 6 deletions(-) create mode 100644 preact.config.js diff --git a/package.json b/package.json index b69ba53..043939a 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "test": "eslint src && preact test", "start": "if-env NODE_ENV=production && npm run -s serve || npm run -s dev", "build": - "preact build --production --no-prerender --template src/static.html", + "preact build --production --no-prerender --config preact.config.js --template src/static.html", "serve": "npm run build && preact serve", "dev": "preact watch --template src/index.html", "lint": "eslint src", diff --git a/preact.config.js b/preact.config.js new file mode 100644 index 0000000..d4c0601 --- /dev/null +++ b/preact.config.js @@ -0,0 +1,7 @@ +export default function(config, env, helpers) { + /** you can change config here **/ + env.ASSETS = '/assets/' + if (env.production) { + config.output.publicPath = './' + } +} diff --git a/src/static.html b/src/static.html index 8ed869c..0649299 100644 --- a/src/static.html +++ b/src/static.html @@ -6,7 +6,7 @@ - + <% if (htmlWebpackPlugin.options.manifest.theme_color) { %> <% } %> @@ -14,9 +14,9 @@ <% if (chunk.names.length === 1 && chunk.names[0] === 'polyfills') continue; %> <% for (var file of chunk.files) { %> <% if (htmlWebpackPlugin.options.preload && file.match(/\.(js|css)$/)) { %> - + <% } else if (file.match(/manifest\.json$/)) { %> - + <% } %> <% } %> <% } %> @@ -24,9 +24,9 @@ <%= htmlWebpackPlugin.options.ssr({ - url: '/' + url: './' }) %> - +