@canopycanopycanopy/b-ber-cli 1.2.13-react-reader.67 → 1.2.13-react-reader.68
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/commands/build.js +34 -8
- package/dist/commands/new.js +4 -31
- package/dist/lib/config-options.js +30 -2
- package/package.json +6 -6
package/dist/commands/build.js
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
4
|
+
|
|
5
|
+
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
6
|
+
|
|
7
|
+
var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
8
|
+
|
|
9
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
10
|
+
|
|
11
|
+
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
12
|
+
|
|
13
|
+
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
14
|
+
|
|
15
|
+
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
16
|
+
|
|
3
17
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
4
18
|
|
|
5
19
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
@@ -10,12 +24,14 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
10
24
|
|
|
11
25
|
exports.default = void 0;
|
|
12
26
|
|
|
13
|
-
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
14
|
-
|
|
15
27
|
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
|
16
28
|
|
|
17
29
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
18
30
|
|
|
31
|
+
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
32
|
+
|
|
33
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
34
|
+
|
|
19
35
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
|
20
36
|
|
|
21
37
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -36,23 +52,33 @@ var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logg
|
|
|
36
52
|
|
|
37
53
|
var _configOptions = require("../lib/config-options");
|
|
38
54
|
|
|
39
|
-
const _excluded = ["_", "$0"];
|
|
55
|
+
const _excluded = ["_", "$0", "config"];
|
|
56
|
+
|
|
57
|
+
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
58
|
+
|
|
59
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context, _context2; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context = ownKeys(Object(source), !0)).call(_context, function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
60
|
+
|
|
40
61
|
// Leading pipe ensures that the `all` command can be run without arguments
|
|
41
62
|
const command = 'build [|epub|mobi|pdf|reader|sample|web]';
|
|
42
63
|
const describe = 'Build a project';
|
|
43
64
|
|
|
44
65
|
const noop = () => {};
|
|
45
66
|
|
|
46
|
-
const handler = argv => {
|
|
67
|
+
const handler = async argv => {
|
|
47
68
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
|
48
69
|
const {
|
|
49
70
|
_: desiredSequences,
|
|
50
|
-
$0
|
|
71
|
+
$0,
|
|
72
|
+
config
|
|
51
73
|
} = argv,
|
|
52
74
|
configOptions = (0, _objectWithoutProperties2.default)(argv, _excluded);
|
|
53
|
-
const configEntries = (0, _entries.default)(configOptions);
|
|
54
75
|
const sequence = (0, _createBuildSequence.default)(desiredSequences);
|
|
55
|
-
const subSequence = (0, _reduce.default)(sequence).call(sequence, (a, c) => (0, _concat.default)(a).call(a, ..._sequences.default[c]), []);
|
|
76
|
+
const subSequence = (0, _reduce.default)(sequence).call(sequence, (a, c) => (0, _concat.default)(a).call(a, ..._sequences.default[c]), []); // Set up the config object that's going to be passed into the `init` function
|
|
77
|
+
|
|
78
|
+
let projectConfig = {}; // Check if a config files has been specified
|
|
79
|
+
|
|
80
|
+
if (config) projectConfig = await (0, _configOptions.parseConfigFile)(config);
|
|
81
|
+
projectConfig = _objectSpread(_objectSpread({}, projectConfig), configOptions);
|
|
56
82
|
|
|
57
83
|
_State.default.update('sequence', subSequence);
|
|
58
84
|
|
|
@@ -66,7 +92,7 @@ const handler = argv => {
|
|
|
66
92
|
_State.default.update('build', build); // Apply the config options that may have been passed in via CLI flags
|
|
67
93
|
|
|
68
94
|
|
|
69
|
-
for (const [key, val] of
|
|
95
|
+
for (const [key, val] of (0, _entries.default)(projectConfig)) {
|
|
70
96
|
if (!_State.default.has(`config.${key}`)) {
|
|
71
97
|
_bBerLogger.default.warn('Invalid configuration option [%s]', key);
|
|
72
98
|
|
package/dist/commands/new.js
CHANGED
|
@@ -30,18 +30,12 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/he
|
|
|
30
30
|
|
|
31
31
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
|
32
32
|
|
|
33
|
-
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
34
|
-
|
|
35
|
-
var _path = _interopRequireDefault(require("path"));
|
|
36
|
-
|
|
37
33
|
var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
|
|
38
34
|
|
|
39
35
|
var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
|
|
40
36
|
|
|
41
37
|
var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
|
|
42
38
|
|
|
43
|
-
var _YamlAdaptor = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/YamlAdaptor"));
|
|
44
|
-
|
|
45
39
|
var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
|
|
46
40
|
|
|
47
41
|
var _configOptions = require("../lib/config-options");
|
|
@@ -68,39 +62,18 @@ const handler = async argv => {
|
|
|
68
62
|
name,
|
|
69
63
|
config
|
|
70
64
|
} = argv,
|
|
71
|
-
|
|
65
|
+
configOptions = (0, _objectWithoutProperties2.default)(argv, _excluded); // Set up the config object that's going to be passed into the `init` function
|
|
72
66
|
|
|
73
67
|
let projectConfig = {}; // Check if a config files has been specified
|
|
74
68
|
|
|
75
|
-
if (config)
|
|
76
|
-
const ext = _path.default.extname(config);
|
|
77
|
-
|
|
78
|
-
const configPath = _path.default.resolve(process.cwd(), config);
|
|
79
|
-
|
|
80
|
-
if (!(await _fsExtra.default.pathExists(config))) {
|
|
81
|
-
_bBerLogger.default.error('Could not find config at %s', configPath);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
if (/^\.(?:ya?ml|json)/i.test(ext) === false) {
|
|
85
|
-
_bBerLogger.default.error('Config file must have a .json or .yaml/.yml file extension');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const contents = await _fsExtra.default.readFile(config);
|
|
89
|
-
|
|
90
|
-
if (/^\.ya?ml/i.test(ext)) {
|
|
91
|
-
projectConfig = _YamlAdaptor.default.parse(contents);
|
|
92
|
-
} else {
|
|
93
|
-
projectConfig = JSON.parse(contents);
|
|
94
|
-
}
|
|
95
|
-
} // Override the values specified in the config file with values
|
|
69
|
+
if (config) projectConfig = await (0, _configOptions.parseConfigFile)(config); // Override the values specified in the config file with values
|
|
96
70
|
// that have been explicitly provided on the CLI. Allows using the
|
|
97
71
|
// config file as a template that can be overridden, e.g.,
|
|
98
72
|
// bber new foo --config my-generic-conf.yaml --base_path /foo
|
|
99
73
|
|
|
74
|
+
projectConfig = _objectSpread(_objectSpread({}, projectConfig), configOptions); // Remove blacklisted and unsupported config options
|
|
100
75
|
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
for (const [key, val] of (0, _entries.default)(projectConfig)) {
|
|
76
|
+
for (const [key] of (0, _entries.default)(projectConfig)) {
|
|
104
77
|
if (!_State.default.has(`config.${key}`)) {
|
|
105
78
|
_bBerLogger.default.warn('Invalid configuration option [%s]', key);
|
|
106
79
|
|
|
@@ -8,11 +8,19 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
exports.blacklistedConfigOptions = void 0;
|
|
11
|
+
exports.parseConfigFile = exports.blacklistedConfigOptions = void 0;
|
|
12
12
|
exports.withConfigOptions = withConfigOptions;
|
|
13
13
|
|
|
14
14
|
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
15
15
|
|
|
16
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
17
|
+
|
|
18
|
+
var _path = _interopRequireDefault(require("path"));
|
|
19
|
+
|
|
20
|
+
var _YamlAdaptor = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/YamlAdaptor"));
|
|
21
|
+
|
|
22
|
+
var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
|
|
23
|
+
|
|
16
24
|
// Attributes not currently configurable via the CLI:
|
|
17
25
|
// ibooks_specified_fonts always set to `true`
|
|
18
26
|
// autoprefixer_options no JSON support
|
|
@@ -87,4 +95,24 @@ function withConfigOptions(yargs) {
|
|
|
87
95
|
}
|
|
88
96
|
|
|
89
97
|
const blacklistedConfigOptions = new _set.default(['ibooks_specified_fonts', 'autoprefixer_options', 'downloads', 'ui_options']);
|
|
90
|
-
exports.blacklistedConfigOptions = blacklistedConfigOptions;
|
|
98
|
+
exports.blacklistedConfigOptions = blacklistedConfigOptions;
|
|
99
|
+
|
|
100
|
+
const parseConfigFile = async configFile => {
|
|
101
|
+
const ext = _path.default.extname(configFile);
|
|
102
|
+
|
|
103
|
+
const configPath = _path.default.resolve(process.cwd(), configFile);
|
|
104
|
+
|
|
105
|
+
if (!(await _fsExtra.default.pathExists(configPath))) {
|
|
106
|
+
_bBerLogger.default.error(`Could not find config at [${configPath}]`);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (/^\.(?:ya?ml|json)/i.test(ext) === false) {
|
|
110
|
+
_bBerLogger.default.error('Config file must have a .json or .yaml/.yml file extension');
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const contents = await _fsExtra.default.readFile(configPath);
|
|
114
|
+
if (/^\.ya?ml/i.test(ext)) return _YamlAdaptor.default.parse(contents);
|
|
115
|
+
return JSON.parse(contents);
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
exports.parseConfigFile = parseConfigFile;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canopycanopycanopy/b-ber-cli",
|
|
3
|
-
"version": "1.2.13-react-reader.
|
|
3
|
+
"version": "1.2.13-react-reader.68+e7d3e3df",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -22,11 +22,11 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@babel/runtime-corejs3": "^7.10.5",
|
|
25
|
-
"@canopycanopycanopy/b-ber-lib": "1.2.
|
|
25
|
+
"@canopycanopycanopy/b-ber-lib": "1.2.15",
|
|
26
26
|
"@canopycanopycanopy/b-ber-logger": "1.2.12",
|
|
27
|
-
"@canopycanopycanopy/b-ber-shapes-sequences": "1.2.
|
|
28
|
-
"@canopycanopycanopy/b-ber-tasks": "1.2.
|
|
29
|
-
"@canopycanopycanopy/b-ber-templates": "1.2.
|
|
27
|
+
"@canopycanopycanopy/b-ber-shapes-sequences": "1.2.12",
|
|
28
|
+
"@canopycanopycanopy/b-ber-tasks": "1.2.15",
|
|
29
|
+
"@canopycanopycanopy/b-ber-templates": "1.2.15",
|
|
30
30
|
"fs-extra": "^8.1.0",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"lodash.has": "latest",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"url": "https://maxwellsimmer.com"
|
|
60
60
|
}
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "e7d3e3df3e8791944b2be202edd928217793c1d8"
|
|
63
63
|
}
|