@canopycanopycanopy/b-ber-tasks 1.2.13-react-reader.42 → 1.2.13-react-reader.46
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/reader/index.js +22 -6
- package/package.json +3 -3
package/dist/reader/index.js
CHANGED
|
@@ -36,6 +36,8 @@ var _recursiveReaddir = _interopRequireDefault(require("recursive-readdir"));
|
|
|
36
36
|
|
|
37
37
|
var _has = _interopRequireDefault(require("lodash/has"));
|
|
38
38
|
|
|
39
|
+
/* eslint-disable camelcase */
|
|
40
|
+
|
|
39
41
|
/* eslint-disable class-methods-use-this */
|
|
40
42
|
class Reader {
|
|
41
43
|
constructor() {
|
|
@@ -45,7 +47,8 @@ class Reader {
|
|
|
45
47
|
this.epubAssets = ['META-INF', 'OPS', 'mimetype'];
|
|
46
48
|
this.readerModuleName = '@canopycanopycanopy/b-ber-reader';
|
|
47
49
|
this.readerModuleDistDir = 'dist';
|
|
48
|
-
this.readerAppPath = null;
|
|
50
|
+
this.readerAppPath = null; // eslint-disable-next-line no-constructor-return
|
|
51
|
+
|
|
49
52
|
return this.createOutputDirs().then(() => this.ensureReaderModuleExists()).then(() => this.copyEpubToOutputDir()).then(() => this.writeBookManifest()).then(() => this.writeWebpubManifest()).then(() => this.copyReaderAppToOutputDir()).then(() => this.injectServerDataIntoTemplate()) // .then(() => this.updateLinkedResourcesWithAbsolutePaths())
|
|
50
53
|
.then(() => this.updateAssetURLsWithAbsolutePaths()).then(() => this.injectWebpubManifestLink()).catch(_bBerLogger.default.error);
|
|
51
54
|
}
|
|
@@ -124,6 +127,7 @@ class Reader {
|
|
|
124
127
|
}
|
|
125
128
|
|
|
126
129
|
getBookMetadata(term) {
|
|
130
|
+
if (!term) return _State.default.metadata.json();
|
|
127
131
|
const entry = (0, _find.default)(_State.default.metadata.json(), {
|
|
128
132
|
term
|
|
129
133
|
});
|
|
@@ -135,6 +139,8 @@ class Reader {
|
|
|
135
139
|
}
|
|
136
140
|
|
|
137
141
|
getProjectConfig(term) {
|
|
142
|
+
if (!term) return _State.default.config;
|
|
143
|
+
|
|
138
144
|
if (!(0, _has.default)(_State.default.config, term)) {
|
|
139
145
|
_bBerLogger.default.warn(`Invalid property for config: ${term}`);
|
|
140
146
|
}
|
|
@@ -143,16 +149,26 @@ class Reader {
|
|
|
143
149
|
}
|
|
144
150
|
|
|
145
151
|
writeBookManifest() {
|
|
146
|
-
|
|
152
|
+
// Get metadata for books.json
|
|
153
|
+
const id = this.getBookMetadata('identifier');
|
|
147
154
|
const title = this.getBookMetadata('title');
|
|
148
|
-
const url = `${_bBerLib.Url.trimSlashes(this.remoteURL)}/${this.outputDirName}/${this.createDirname(
|
|
149
|
-
const cover = `${url}/OPS/images/${this.getBookMetadata('cover')}`;
|
|
155
|
+
const url = `${_bBerLib.Url.trimSlashes(this.remoteURL)}/${this.outputDirName}/${this.createDirname(id)}`;
|
|
156
|
+
const cover = `${url}/OPS/images/${this.getBookMetadata('cover')}`; // Get config required by reader for books.json
|
|
157
|
+
|
|
158
|
+
const {
|
|
159
|
+
downloads,
|
|
160
|
+
ui_options,
|
|
161
|
+
layout
|
|
162
|
+
} = this.getProjectConfig();
|
|
150
163
|
const manifest = [{
|
|
151
164
|
title,
|
|
152
165
|
url,
|
|
153
166
|
cover,
|
|
154
|
-
id
|
|
155
|
-
|
|
167
|
+
id,
|
|
168
|
+
downloads,
|
|
169
|
+
ui_options,
|
|
170
|
+
layout
|
|
171
|
+
}]; // Write to an `api` dir in case the app is being deployed statically
|
|
156
172
|
|
|
157
173
|
return _fsExtra.default.writeJson(_path2.default.join(this.apiDir, 'books.json'), manifest);
|
|
158
174
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-tasks",
|
|
3
|
-
"version": "1.2.13-react-reader.
|
|
3
|
+
"version": "1.2.13-react-reader.46+f81c7a90",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@canopycanopycanopy/b-ber-lib": "1.2.15",
|
|
23
23
|
"@canopycanopycanopy/b-ber-logger": "1.2.12",
|
|
24
24
|
"@canopycanopycanopy/b-ber-markdown-renderer": "1.2.15",
|
|
25
|
-
"@canopycanopycanopy/b-ber-reader": "1.2.13-react-reader.
|
|
25
|
+
"@canopycanopycanopy/b-ber-reader": "1.2.13-react-reader.46+f81c7a90",
|
|
26
26
|
"@canopycanopycanopy/b-ber-resources": "1.2.12",
|
|
27
27
|
"@canopycanopycanopy/b-ber-shapes-sequences": "1.2.12",
|
|
28
28
|
"@canopycanopycanopy/b-ber-templates": "1.2.15",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"url": "https://maxwellsimmer.com"
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "f81c7a90944b03e5d9a00eaeb70d6fc3b573fb35"
|
|
80
80
|
}
|