@canopycanopycanopy/b-ber-tasks 1.2.13-react-reader.66 → 1.2.13-react-reader.67
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/serve/index.js +43 -37
- package/package.json +7 -7
package/dist/serve/index.js
CHANGED
|
@@ -25,8 +25,7 @@ var _browserSync = require("browser-sync");
|
|
|
25
25
|
var _ = require("..");
|
|
26
26
|
|
|
27
27
|
const browserSync = (0, _browserSync.create)();
|
|
28
|
-
const port = 4000;
|
|
29
|
-
|
|
28
|
+
const port = 4000;
|
|
30
29
|
const debounceSpeed = 500;
|
|
31
30
|
|
|
32
31
|
const config = build => url => () => {
|
|
@@ -50,47 +49,54 @@ let update = async () => {};
|
|
|
50
49
|
|
|
51
50
|
const reload = () => update().then(browserSync.reload);
|
|
52
51
|
|
|
53
|
-
const
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
52
|
+
const browserSyncPlugins = [{
|
|
53
|
+
module: 'bs-html-injector',
|
|
54
|
+
options: {
|
|
55
|
+
files: [{
|
|
56
|
+
match: [_path.default.resolve('_project', '**', '*.scss'), _path.default.resolve('_project', '**', '*.js'), _path.default.resolve('_project', '**', '*.md')],
|
|
57
|
+
fn: (0, _debounce.default)(() => reload(), debounceSpeed, {
|
|
58
|
+
leading: false,
|
|
59
|
+
trailing: true
|
|
60
|
+
})
|
|
61
|
+
}]
|
|
62
|
+
}
|
|
63
|
+
}];
|
|
64
|
+
|
|
65
|
+
const browserSyncMiddleware = (req, res, next) => {
|
|
66
|
+
// Set headers for XHTML files to allow document.write
|
|
67
|
+
if (/\.xhtml$/.test(req.url)) {
|
|
68
|
+
res.setHeader('Content-Type', 'text/html; charset=UTF-8');
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
next();
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const init = build => new _promise.default(resolve => {
|
|
75
|
+
const options = {
|
|
76
|
+
port,
|
|
77
|
+
open: false,
|
|
78
|
+
// Opens browser programatically below
|
|
79
|
+
// reloadDelay: 2000
|
|
80
|
+
// reloadDebounce: 2000
|
|
81
|
+
// reloadThrottle: 2000
|
|
82
|
+
server: {
|
|
83
|
+
baseDir: _path.default.resolve(`project-${build}`),
|
|
84
|
+
middleware: browserSyncMiddleware
|
|
85
|
+
},
|
|
86
|
+
plugins: browserSyncPlugins
|
|
87
|
+
};
|
|
88
|
+
browserSync.init(options, resolve);
|
|
89
|
+
});
|
|
84
90
|
|
|
85
91
|
const serve = async ({
|
|
86
|
-
build,
|
|
92
|
+
build: buildOption,
|
|
87
93
|
external
|
|
88
94
|
}) => {
|
|
89
95
|
const location = external ? 'external' : 'local';
|
|
90
|
-
const
|
|
91
|
-
await init(
|
|
96
|
+
const build = buildOption ?? 'reader';
|
|
97
|
+
await init(build);
|
|
92
98
|
const url = browserSync.getOption('urls').get(location);
|
|
93
|
-
update = config(
|
|
99
|
+
update = config(build)(url);
|
|
94
100
|
await update(); // Update the location in the config object so that a call can be made
|
|
95
101
|
// to openBrowser once the project has been built
|
|
96
102
|
|
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.67+b2fdc973",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@babel/runtime-corejs3": "^7.10.5",
|
|
22
|
-
"@canopycanopycanopy/b-ber-lib": "1.2.
|
|
22
|
+
"@canopycanopycanopy/b-ber-lib": "1.2.13-react-reader.67+b2fdc973",
|
|
23
23
|
"@canopycanopycanopy/b-ber-logger": "1.2.12",
|
|
24
|
-
"@canopycanopycanopy/b-ber-markdown-renderer": "1.2.
|
|
25
|
-
"@canopycanopycanopy/b-ber-reader": "1.2.
|
|
24
|
+
"@canopycanopycanopy/b-ber-markdown-renderer": "1.2.13-react-reader.67+b2fdc973",
|
|
25
|
+
"@canopycanopycanopy/b-ber-reader": "1.2.15",
|
|
26
26
|
"@canopycanopycanopy/b-ber-resources": "1.2.12",
|
|
27
|
-
"@canopycanopycanopy/b-ber-shapes-sequences": "1.2.
|
|
28
|
-
"@canopycanopycanopy/b-ber-templates": "1.2.
|
|
27
|
+
"@canopycanopycanopy/b-ber-shapes-sequences": "1.2.13-react-reader.67+b2fdc973",
|
|
28
|
+
"@canopycanopycanopy/b-ber-templates": "1.2.13-react-reader.67+b2fdc973",
|
|
29
29
|
"@canopycanopycanopy/b-ber-validator": "1.2.12",
|
|
30
30
|
"autoprefixer": "^9.6.1",
|
|
31
31
|
"browser-sync": "^2.27.7",
|
|
@@ -76,5 +76,5 @@
|
|
|
76
76
|
"url": "https://maxwellsimmer.com"
|
|
77
77
|
}
|
|
78
78
|
],
|
|
79
|
-
"gitHead": "
|
|
79
|
+
"gitHead": "b2fdc9731696088030fca0cb8e6ceaa69338ed14"
|
|
80
80
|
}
|