@canopycanopycanopy/b-ber-reader 1.2.13-react-reader.6 → 1.2.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.html CHANGED
@@ -1,28 +1,24 @@
1
- <!DOCTYPE html>
1
+ <!doctype html>
2
2
  <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta
6
- name="viewport"
7
- content="width=device-width, initial-scale=1, maximum-scale=3.0, minimum-scale=1"
8
- />
9
- <meta http-equiv="X-UA-Compatible" content="IE=edge" />
10
- <meta name="robots" content="index, follow" />
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=3.0, minimum-scale=1">
6
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
7
+ <meta name="robots" content="index, follow">
11
8
  <title>b-ber-reader</title>
12
9
 
13
- <meta name="description" content="" />
14
- <meta property="og:site_name" content="" />
15
- <meta property="og:url" content="" />
16
- <meta property="og:title" content="" />
17
- <meta property="og:image" content="" />
18
- <meta property="og:description" content="" />
10
+ <!-- meta -->
11
+ <meta name="description" content="">
12
+ <meta property="og:site_name" content="">
13
+ <meta property="og:url" content="">
14
+ <meta property="og:title" content="">
15
+ <meta property="og:image" content="">
16
+ <meta property="og:description" content="">
19
17
 
20
- <link rel="canonical" href="" />
21
- <script defer src="main.818ae91015d8d0fec8e2.js"></script></head>
22
- <body>
18
+ <link rel="canonical" href="">
19
+ <link href="/86c842181d12a633dd25.css" rel="stylesheet"></head>
20
+ <body>
23
21
  <div id="root"></div>
24
- <script id="__server_data__">
25
- window.__SERVER_DATA__ = {}
26
- </script>
27
- </body>
22
+ <script id="__server_data__">window.__SERVER_DATA__ = {};</script>
23
+ <script type="text/javascript" src="/86c842181d12a633dd25.js"></script></body>
28
24
  </html>
package/index.js CHANGED
@@ -1 +1,2 @@
1
+ // required for module resolution
1
2
  module.exports = {}
package/package.json CHANGED
@@ -1,16 +1,20 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-reader",
3
- "version": "1.2.13-react-reader.6+5f5ac8b3",
3
+ "version": "1.2.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "prepublish": "npm test",
8
8
  "preversion": "npm test",
9
- "clean": "rimraf dist",
10
- "test": "echo \"TODO update tests\" # jest",
11
- "serve": "npm run build && nodemon server.js",
12
- "xbuild": "npm run clean && webpack --config ./webpack.config.js --mode production",
13
- "build": "npm run clean && webpack --config ./webpack.config.js --mode development"
9
+ "webpack:src": "npm run clean && NODE_ENV=development webpack --mode development -w --config webpack.config.development.js --progress --profile --colors --verbose",
10
+ "webpack:dist": "npm run clean && NODE_ENV=production webpack --mode production --config webpack.config.production.js --progress --profile --colors",
11
+ "start": "concurrently \"npm run webpack:src\" \"nodemon server.js\"",
12
+ "clean": "rimraf dist && rimraf public",
13
+ "watch": "npm run clean && NODE_ENV=production webpack --mode production -w --config webpack.config.production.js",
14
+ "build": "npm run webpack:dist",
15
+ "serve": "nodemon server.js",
16
+ "test:watch": "jest --watch",
17
+ "test": "jest"
14
18
  },
15
19
  "author": "Triple Canopy <b-ber@canopycanopycanopy.com> (https://triplecanopy.github.io/)",
16
20
  "license": "GPL-3.0-or-later",
@@ -18,27 +22,86 @@
18
22
  "access": "public"
19
23
  },
20
24
  "devDependencies": {
21
- "@babel/core": "^7.16.0",
22
- "@babel/preset-env": "^7.16.0",
23
- "@babel/preset-react": "^7.16.0",
24
- "@canopycanopycanopy/b-ber-reader-react": "1.2.13-react-reader.6+5f5ac8b3",
25
- "babel-loader": "^8.2.3",
26
- "css-loader": "^6.5.1",
27
- "express": "^4.17.3",
28
- "html-webpack-plugin": "^5.5.0",
29
- "nodemon": "^2.0.15",
25
+ "@babel/cli": "^7.10.5",
26
+ "@babel/core": "^7.10.5",
27
+ "@babel/plugin-proposal-class-properties": "^7.10.4",
28
+ "@babel/plugin-proposal-object-rest-spread": "^7.10.4",
29
+ "@babel/plugin-proposal-optional-chaining": "^7.10.4",
30
+ "@babel/plugin-transform-runtime": "^7.10.5",
31
+ "@babel/preset-env": "^7.10.4",
32
+ "@babel/preset-react": "^7.10.4",
33
+ "babel-eslint": "^8.2.2",
34
+ "babel-loader": "^8.0.6",
35
+ "concurrently": "^3.5.1",
36
+ "core-js": "^3.6.4",
37
+ "css-loader": "^0.28.10",
38
+ "eslint": "^6.8.0",
39
+ "eslint-config-airbnb": "^16.1.0",
40
+ "eslint-config-airbnb-base": "^12.1.0",
41
+ "eslint-plugin-babel": "^4.1.2",
42
+ "eslint-plugin-import": "^2.9.0",
43
+ "eslint-plugin-jsx-a11y": "^6.0.3",
44
+ "eslint-plugin-react": "^7.7.0",
45
+ "express": "^4.16.4",
46
+ "extract-text-webpack-plugin": "^4.0.0-beta.0",
47
+ "file-loader": "^1.1.11",
48
+ "html-webpack-plugin": "^3.0.6",
49
+ "jest": "^26.6.3",
50
+ "jest-environment-jsdom": "^23.1.0",
51
+ "jest-environment-jsdom-global": "^1.1.0",
52
+ "material-design-icons": "^3.0.1",
53
+ "nodemon": "^1.18.10",
54
+ "postcss": "^7.0.14",
55
+ "postcss-cssnext": "^3.1.0",
56
+ "postcss-import": "^11.1.0",
57
+ "postcss-loader": "^2.1.1",
58
+ "react-test-renderer": "^16.4.0",
30
59
  "rimraf": "^2.6.3",
31
- "style-loader": "^3.3.1",
32
- "url-loader": "^4.1.1",
33
- "webpack": "^5.64.3",
34
- "webpack-cli": "^4.9.1"
60
+ "sass-loader": "^7.0.3",
61
+ "style-loader": "^0.20.2",
62
+ "sugarss": "^1.0.1",
63
+ "url-loader": "^1.0.1",
64
+ "webpack": "^4.20.2",
65
+ "webpack-bundle-analyzer": "^3.3.2",
66
+ "webpack-cleanup-plugin": "^0.5.1",
67
+ "webpack-cli": "^3.1.1",
68
+ "webpack-dashboard": "^1.1.1",
69
+ "webpack-node-externals": "^1.6.0"
35
70
  },
36
71
  "dependencies": {
72
+ "autoprefixer": "^9.6.1",
73
+ "axios": "^0.21.1",
74
+ "classnames": "^2.2.5",
75
+ "css-tree": "^1.0.0-alpha.28",
76
+ "cssnano": "^4.1.10",
77
+ "detect-browser": "^2.1.0",
78
+ "handlebars": "^4.7.7",
79
+ "history": "^4.7.2",
80
+ "html-to-react": "^1.4.3",
81
+ "js-string-escape": "^1.0.1",
82
+ "lodash": "^4.17.21",
83
+ "object-fit-images": "^3.2.3",
84
+ "prop-types": "^15.6.1",
85
+ "quote": "^0.4.0",
37
86
  "react": "^16.2.0",
38
- "react-dom": "^16.2.0"
87
+ "react-attr-converter": "^0.3.1",
88
+ "react-dom": "^16.2.0",
89
+ "react-player": "^1.15.2",
90
+ "react-redux": "^7.1.3",
91
+ "redux": "^4.0.5",
92
+ "redux-thunk": "^2.3.0",
93
+ "resize-observer-polyfill": "^1.5.0",
94
+ "sass": "^1.49.8",
95
+ "setimmediate": "^1.0.5",
96
+ "tar": "^6.1.11",
97
+ "url-search-params-polyfill": "^4.0.0",
98
+ "xml-js": "^1.6.2",
99
+ "xmlhttprequest-ssl": "^2.0.0"
39
100
  },
40
101
  "files": [
41
- "dist"
102
+ "dist",
103
+ "!dist/report.html",
104
+ "server.js"
42
105
  ],
43
106
  "repository": {
44
107
  "type": "git",
@@ -54,5 +117,5 @@
54
117
  "url": "https://maxwellsimmer.com"
55
118
  }
56
119
  ],
57
- "gitHead": "5f5ac8b3704149ac656dd852aaac311eea945d65"
120
+ "gitHead": "af49c5bfb3f662b112bc3685a55564d4e12b9073"
58
121
  }
package/server.js ADDED
@@ -0,0 +1,61 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
2
+ /*
3
+
4
+ Add compiled b-ber reader projects to an epub dir in b-ber-reader. These will be
5
+ served when running `npm start` from the b-ber-reader dir at
6
+ http://localhost:4000 or at the provided hostname and port
7
+
8
+ */
9
+
10
+ const fs = require('fs')
11
+ const nodeUrl = require('url')
12
+ const path = require('path')
13
+ const express = require('express')
14
+
15
+ const HOST = process.env.BBER_HOST || 'localhost'
16
+ const PORT = process.env.BBER_PORT || 4000
17
+ const BASE_DIR = 'epub'
18
+ const baseURL = `http://${HOST}:${PORT}/`
19
+
20
+ const router = express.Router()
21
+ const app = express()
22
+
23
+ const bookDirs = fs
24
+ .readdirSync(`./${BASE_DIR}`)
25
+ .filter(a => /^\./.test(a) === false)
26
+
27
+ const id = () => String(Math.random()).slice(2)
28
+
29
+ const url = dir => `${baseURL}${BASE_DIR}/${dir}`
30
+
31
+ const cover = dir => {
32
+ const image = fs
33
+ .readdirSync(`./${BASE_DIR}/${dir}/OPS/images`)
34
+ .find(img => /__bber_cover__/.test(img))
35
+
36
+ if (!image)
37
+ return `http://via.placeholder.com/400x600/4D50C1/fff/?text=${dir}`
38
+
39
+ return nodeUrl.resolve(`${baseURL}${BASE_DIR}/${dir}/OPS/images/`, image)
40
+ }
41
+
42
+ const manifest = bookDirs.map(dir => ({
43
+ id: id(),
44
+ title: dir,
45
+ url: url(dir),
46
+ cover: cover(dir),
47
+ }))
48
+
49
+ const api = router.get('/books.json', (_, res) => {
50
+ return res.json(manifest)
51
+ })
52
+
53
+ app.use(express.static('public'))
54
+ app.use(`/${BASE_DIR}`, express.static(path.join(__dirname, BASE_DIR)))
55
+ app.use('/api', api)
56
+ app.get('*', (_, res) =>
57
+ res.sendFile(path.join(__dirname, 'public', 'index.html'))
58
+ )
59
+ app.listen(PORT, HOST, () => {
60
+ console.log(`Listening on ${baseURL}`)
61
+ })