@canopycanopycanopy/b-ber-cli 1.2.16 → 3.0.0
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/app.js +7 -1
- package/dist/commands/build.js +67 -7
- package/dist/commands/new.js +25 -95
- package/dist/lib/config-options.js +118 -0
- package/package.json +9 -8
package/dist/app.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
4
|
+
|
|
3
5
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
4
6
|
|
|
5
|
-
var
|
|
7
|
+
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
6
8
|
|
|
7
9
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
8
10
|
|
|
@@ -18,6 +20,10 @@ var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State
|
|
|
18
20
|
|
|
19
21
|
var commands = _interopRequireWildcard(require("./commands"));
|
|
20
22
|
|
|
23
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof _WeakMap !== "function") return null; var cacheBabelInterop = new _WeakMap(); var cacheNodeInterop = new _WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
|
+
|
|
25
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = _Object$defineProperty && _Object$getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? _Object$getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { _Object$defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
|
+
|
|
21
27
|
const LINE_LENGTH = 70;
|
|
22
28
|
|
|
23
29
|
function bber() {
|
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");
|
|
@@ -14,6 +28,12 @@ var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-sta
|
|
|
14
28
|
|
|
15
29
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
16
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
|
+
|
|
35
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
|
36
|
+
|
|
17
37
|
var _path = _interopRequireDefault(require("path"));
|
|
18
38
|
|
|
19
39
|
var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
|
|
@@ -30,25 +50,65 @@ var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
|
|
|
30
50
|
|
|
31
51
|
var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
|
|
32
52
|
|
|
33
|
-
|
|
53
|
+
var _configOptions = require("../lib/config-options");
|
|
54
|
+
|
|
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
|
+
|
|
61
|
+
// Leading pipe ensures that the `all` command can be run without arguments
|
|
34
62
|
const command = 'build [|epub|mobi|pdf|reader|sample|web]';
|
|
35
63
|
const describe = 'Build a project';
|
|
36
64
|
|
|
37
|
-
const
|
|
65
|
+
const noop = () => {};
|
|
66
|
+
|
|
67
|
+
const handler = async argv => {
|
|
38
68
|
process.env.NODE_ENV = process.env.NODE_ENV || 'development';
|
|
39
|
-
const
|
|
40
|
-
|
|
69
|
+
const {
|
|
70
|
+
_: desiredSequences,
|
|
71
|
+
$0,
|
|
72
|
+
config
|
|
73
|
+
} = argv,
|
|
74
|
+
configOptions = (0, _objectWithoutProperties2.default)(argv, _excluded);
|
|
75
|
+
const sequence = (0, _createBuildSequence.default)(desiredSequences);
|
|
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);
|
|
41
82
|
|
|
42
83
|
_State.default.update('sequence', subSequence);
|
|
43
84
|
|
|
44
85
|
_bBerLogger.default.registerSequence(_State.default, command, subSequence);
|
|
45
86
|
|
|
46
87
|
const run = buildTasks => {
|
|
47
|
-
const build = buildTasks.shift();
|
|
88
|
+
const build = buildTasks.shift(); // Reset any previous changes to state and update the build type
|
|
48
89
|
|
|
49
90
|
_State.default.reset();
|
|
50
91
|
|
|
51
|
-
_State.default.update('build', build);
|
|
92
|
+
_State.default.update('build', build); // Apply the config options that may have been passed in via CLI flags
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
for (const [key, val] of (0, _entries.default)(projectConfig)) {
|
|
96
|
+
if (!_State.default.has(`config.${key}`)) {
|
|
97
|
+
_bBerLogger.default.warn('Invalid configuration option [%s]', key);
|
|
98
|
+
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
if (_configOptions.blacklistedConfigOptions.has(key)) {
|
|
103
|
+
_bBerLogger.default.warn('Disallowed configuration option [%s]', key);
|
|
104
|
+
|
|
105
|
+
continue;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
_bBerLogger.default.notice('Applying configuration option [%s]:[%s]', key, val);
|
|
109
|
+
|
|
110
|
+
_State.default.update(`config.${key}`, val);
|
|
111
|
+
}
|
|
52
112
|
|
|
53
113
|
return (0, _bBerTasks.serialize)(_sequences.default[build]).then(() => {
|
|
54
114
|
if (buildTasks.length) run(buildTasks);
|
|
@@ -63,7 +123,7 @@ const handler = argv => {
|
|
|
63
123
|
}).then(() => run(sequence)).catch(console.error);
|
|
64
124
|
};
|
|
65
125
|
|
|
66
|
-
const builder = yargs => yargs.command('', 'Build all formats',
|
|
126
|
+
const builder = yargs => (0, _configOptions.withConfigOptions)(yargs).command('', 'Build all formats', noop, handler).command('epub', 'Build an Epub', noop, handler).command('mobi', 'Build a Mobi', noop, handler).command('pdf', 'Build a PDF', noop, handler).command('reader', 'Build for the b-ber-reader format', noop, handler).command('sample', 'Build a sample Epub', noop, handler).command('web', 'Build for web', noop, handler).command('xml', 'Build for XML', noop, handler).help('h').alias('h', 'help');
|
|
67
127
|
|
|
68
128
|
var _default = {
|
|
69
129
|
command,
|
package/dist/commands/new.js
CHANGED
|
@@ -24,95 +24,35 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
24
24
|
|
|
25
25
|
exports.default = void 0;
|
|
26
26
|
|
|
27
|
+
var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
|
|
28
|
+
|
|
27
29
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
28
30
|
|
|
29
31
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
|
|
30
32
|
|
|
31
|
-
var
|
|
32
|
-
|
|
33
|
-
var _path = _interopRequireDefault(require("path"));
|
|
33
|
+
var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
|
|
34
34
|
|
|
35
35
|
var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
|
|
36
36
|
|
|
37
37
|
var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
|
|
38
38
|
|
|
39
|
-
var _YamlAdaptor = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/YamlAdaptor"));
|
|
40
|
-
|
|
41
39
|
var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
|
|
42
40
|
|
|
41
|
+
var _configOptions = require("../lib/config-options");
|
|
42
|
+
|
|
43
43
|
const _excluded = ["_", "$0", "name", "config"];
|
|
44
44
|
|
|
45
|
-
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object);
|
|
45
|
+
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; }
|
|
46
46
|
|
|
47
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
47
|
+
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; }
|
|
48
48
|
|
|
49
49
|
const command = 'new <name>';
|
|
50
50
|
const describe = 'Create a new project';
|
|
51
51
|
|
|
52
|
-
const builder = yargs => yargs.positional('name', {
|
|
52
|
+
const builder = yargs => (0, _configOptions.withConfigOptions)(yargs.positional('name', {
|
|
53
53
|
describe: 'New project name',
|
|
54
54
|
type: 'string'
|
|
55
|
-
}).
|
|
56
|
-
describe: 'The default build environment',
|
|
57
|
-
type: 'string' // default: 'development',
|
|
58
|
-
|
|
59
|
-
}).option('theme', {
|
|
60
|
-
describe: 'Default theme name',
|
|
61
|
-
type: 'string' // default: 'b-ber-theme-serif',
|
|
62
|
-
|
|
63
|
-
}).option('src', {
|
|
64
|
-
describe: 'The name of the source directory',
|
|
65
|
-
type: 'string' // default: 'src',
|
|
66
|
-
|
|
67
|
-
}).option('dist', {
|
|
68
|
-
describe: 'The name of the dist directory',
|
|
69
|
-
type: 'string' // default: 'dist',
|
|
70
|
-
|
|
71
|
-
}).option('cache', {
|
|
72
|
-
describe: 'Whether to enable caching',
|
|
73
|
-
type: 'boolean' // default: false,
|
|
74
|
-
|
|
75
|
-
}).option('themes_directory', {
|
|
76
|
-
describe: 'Relative or absolute path to the directory for third-party themes',
|
|
77
|
-
type: 'string' // default: './themes',
|
|
78
|
-
|
|
79
|
-
}).option('ignore', {
|
|
80
|
-
describe: 'Array of files or folders to ignore during the build',
|
|
81
|
-
type: 'array' // default: [],
|
|
82
|
-
|
|
83
|
-
}).option('base_path', {
|
|
84
|
-
describe: 'Base path appended to the URL for the reader build',
|
|
85
|
-
type: 'string' // default: '/',
|
|
86
|
-
|
|
87
|
-
}).option('remote_url', {
|
|
88
|
-
describe: 'URL at which the reader build will be made public',
|
|
89
|
-
type: 'string' // default: 'http://localhost:4000/',
|
|
90
|
-
|
|
91
|
-
}).option('reader_url', {
|
|
92
|
-
describe: 'URL that hosts the assets for the reader reader build',
|
|
93
|
-
type: 'string' // default: 'http://localhost:4000/project-reader',
|
|
94
|
-
|
|
95
|
-
}).option('bucket_url', {
|
|
96
|
-
describe: 'The S3 bucket URL where the remote project will be deployed to if hosting on S3',
|
|
97
|
-
type: 'string' // default: '',
|
|
98
|
-
|
|
99
|
-
}).option('private', {
|
|
100
|
-
describe: 'If the web and reader builds should be discoverable by search engines',
|
|
101
|
-
type: 'boolean' // default: false,
|
|
102
|
-
|
|
103
|
-
}).option('remote_javascripts', {
|
|
104
|
-
describe: 'Remotely hosted JavaScript files for the reader',
|
|
105
|
-
type: 'array' // default: [],
|
|
106
|
-
|
|
107
|
-
}).option('remote_stylesheets', {
|
|
108
|
-
describe: 'Remotely hosted stylesheets files for the reader',
|
|
109
|
-
type: 'array' // default: [],
|
|
110
|
-
|
|
111
|
-
}).option('config', {
|
|
112
|
-
describe: 'Path to a JSON or YAML configuration file that will extend the base configuration',
|
|
113
|
-
type: 'string' // default: '',
|
|
114
|
-
|
|
115
|
-
}).fail((msg, err) => (0, _utils.fail)(msg, err, yargs)).help('h').alias('h', 'help').usage(`\nUsage: $0 new "My Project"\n\n${describe}`);
|
|
55
|
+
})).fail((msg, err) => (0, _utils.fail)(msg, err, yargs)).help('h').alias('h', 'help').usage(`\nUsage: $0 new "My Project"\n\n${describe}`);
|
|
116
56
|
|
|
117
57
|
const handler = async argv => {
|
|
118
58
|
// Extract CLI options and get the config file option in case there is one
|
|
@@ -122,42 +62,32 @@ const handler = async argv => {
|
|
|
122
62
|
name,
|
|
123
63
|
config
|
|
124
64
|
} = argv,
|
|
125
|
-
|
|
65
|
+
configOptions = (0, _objectWithoutProperties2.default)(argv, _excluded); // Set up the config object that's going to be passed into the `init` function
|
|
126
66
|
|
|
127
67
|
let projectConfig = {}; // Check if a config files has been specified
|
|
128
68
|
|
|
129
|
-
if (config)
|
|
130
|
-
|
|
69
|
+
if (config) projectConfig = await (0, _configOptions.parseConfigFile)(config); // Override the values specified in the config file with values
|
|
70
|
+
// that have been explicitly provided on the CLI. Allows using the
|
|
71
|
+
// config file as a template that can be overridden, e.g.,
|
|
72
|
+
// bber new foo --config my-generic-conf.yaml --base_path /foo
|
|
131
73
|
|
|
132
|
-
|
|
74
|
+
projectConfig = _objectSpread(_objectSpread({}, projectConfig), configOptions); // Remove blacklisted and unsupported config options
|
|
133
75
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
76
|
+
for (const [key] of (0, _entries.default)(projectConfig)) {
|
|
77
|
+
if (!_State.default.has(`config.${key}`)) {
|
|
78
|
+
_bBerLogger.default.warn('Invalid configuration option [%s]', key);
|
|
137
79
|
|
|
138
|
-
|
|
139
|
-
|
|
80
|
+
delete projectConfig[key];
|
|
81
|
+
continue;
|
|
140
82
|
}
|
|
141
83
|
|
|
142
|
-
|
|
84
|
+
if (_configOptions.blacklistedConfigOptions.has(key)) {
|
|
85
|
+
_bBerLogger.default.warn('Disallowed configuration option [%s]', key);
|
|
143
86
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
} else {
|
|
147
|
-
projectConfig = JSON.parse(contents);
|
|
87
|
+
delete projectConfig[key];
|
|
88
|
+
continue;
|
|
148
89
|
}
|
|
149
|
-
}
|
|
150
|
-
// that have been explicitly provided on the CLI. Allows using the
|
|
151
|
-
// config file as a template that can be overridden, e.g.,
|
|
152
|
-
// bber new foo --config my-generic-conf.yaml --base_path /foo
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
projectConfig = _objectSpread(_objectSpread({}, projectConfig), rest); // Attributes not currently configurable via the CLI:
|
|
156
|
-
// ibooks_specified_fonts
|
|
157
|
-
// autoprefixer_options
|
|
158
|
-
// base_url
|
|
159
|
-
// downloads
|
|
160
|
-
// ui_options
|
|
90
|
+
}
|
|
161
91
|
|
|
162
92
|
const initializer = new _bBerTasks.init({
|
|
163
93
|
name,
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
6
|
+
|
|
7
|
+
_Object$defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
exports.parseConfigFile = exports.blacklistedConfigOptions = void 0;
|
|
12
|
+
exports.withConfigOptions = withConfigOptions;
|
|
13
|
+
|
|
14
|
+
var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
|
|
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
|
+
|
|
24
|
+
// Attributes not currently configurable via the CLI:
|
|
25
|
+
// ibooks_specified_fonts always set to `true`
|
|
26
|
+
// autoprefixer_options no JSON support
|
|
27
|
+
// downloads no JSON support
|
|
28
|
+
// ui_options no JSON support
|
|
29
|
+
function withConfigOptions(yargs) {
|
|
30
|
+
return yargs.option('env', {
|
|
31
|
+
describe: 'The default build environment',
|
|
32
|
+
type: 'string' // default: 'development',
|
|
33
|
+
|
|
34
|
+
}).option('theme', {
|
|
35
|
+
describe: 'Default theme name',
|
|
36
|
+
type: 'string' // default: 'b-ber-theme-serif',
|
|
37
|
+
|
|
38
|
+
}).option('src', {
|
|
39
|
+
describe: 'The name of the source directory',
|
|
40
|
+
type: 'string' // default: 'src',
|
|
41
|
+
|
|
42
|
+
}).option('dist', {
|
|
43
|
+
describe: 'The name of the dist directory',
|
|
44
|
+
type: 'string' // default: 'dist',
|
|
45
|
+
|
|
46
|
+
}).option('cache', {
|
|
47
|
+
describe: 'Whether to enable caching',
|
|
48
|
+
type: 'boolean' // default: false,
|
|
49
|
+
|
|
50
|
+
}).option('themes_directory', {
|
|
51
|
+
describe: 'Relative or absolute path to the directory for third-party themes',
|
|
52
|
+
type: 'string' // default: './themes',
|
|
53
|
+
|
|
54
|
+
}).option('ignore', {
|
|
55
|
+
describe: 'Array of files or folders to ignore during the build',
|
|
56
|
+
type: 'array' // default: [],
|
|
57
|
+
|
|
58
|
+
}).option('base_path', {
|
|
59
|
+
describe: 'Base path appended to the URL for the reader build',
|
|
60
|
+
type: 'string' // default: '/',
|
|
61
|
+
|
|
62
|
+
}).option('remote_url', {
|
|
63
|
+
describe: 'URL at which the reader build will be made public',
|
|
64
|
+
type: 'string' // default: 'http://localhost:4000/',
|
|
65
|
+
|
|
66
|
+
}).option('reader_url', {
|
|
67
|
+
describe: 'URL that hosts the assets for the reader reader build',
|
|
68
|
+
type: 'string' // default: 'http://localhost:4000/project-reader',
|
|
69
|
+
|
|
70
|
+
}).option('base_url', {
|
|
71
|
+
describe: 'URL to map assets for the web build',
|
|
72
|
+
type: 'string' // default: '',
|
|
73
|
+
|
|
74
|
+
}).option('bucket_url', {
|
|
75
|
+
describe: 'The S3 bucket URL where the remote project will be deployed to if hosting on S3',
|
|
76
|
+
type: 'string' // default: '',
|
|
77
|
+
|
|
78
|
+
}).option('private', {
|
|
79
|
+
describe: 'If the web and reader builds should be discoverable by search engines',
|
|
80
|
+
type: 'boolean' // default: false,
|
|
81
|
+
|
|
82
|
+
}).option('remote_javascripts', {
|
|
83
|
+
describe: 'Remotely hosted JavaScript files for the reader',
|
|
84
|
+
type: 'array' // default: [],
|
|
85
|
+
|
|
86
|
+
}).option('remote_stylesheets', {
|
|
87
|
+
describe: 'Remotely hosted stylesheets files for the reader',
|
|
88
|
+
type: 'array' // default: [],
|
|
89
|
+
|
|
90
|
+
}).option('config', {
|
|
91
|
+
describe: 'Path to a JSON or YAML configuration file that will extend the base configuration',
|
|
92
|
+
type: 'string' // default: '',
|
|
93
|
+
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const blacklistedConfigOptions = new _set.default(['ibooks_specified_fonts', 'autoprefixer_options', 'downloads', 'ui_options']);
|
|
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": "
|
|
3
|
+
"version": "3.0.0",
|
|
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": "
|
|
26
|
-
"@canopycanopycanopy/b-ber-logger": "
|
|
27
|
-
"@canopycanopycanopy/b-ber-shapes-sequences": "
|
|
28
|
-
"@canopycanopycanopy/b-ber-tasks": "
|
|
29
|
-
"@canopycanopycanopy/b-ber-templates": "
|
|
25
|
+
"@canopycanopycanopy/b-ber-lib": "3.0.0",
|
|
26
|
+
"@canopycanopycanopy/b-ber-logger": "3.0.0",
|
|
27
|
+
"@canopycanopycanopy/b-ber-shapes-sequences": "3.0.0",
|
|
28
|
+
"@canopycanopycanopy/b-ber-tasks": "3.0.0",
|
|
29
|
+
"@canopycanopycanopy/b-ber-templates": "3.0.0",
|
|
30
30
|
"fs-extra": "^8.1.0",
|
|
31
31
|
"lodash": "^4.17.21",
|
|
32
32
|
"lodash.has": "latest",
|
|
@@ -38,8 +38,9 @@
|
|
|
38
38
|
"@babel/core": "^7.10.5",
|
|
39
39
|
"@babel/node": "^7.8.7",
|
|
40
40
|
"@babel/preset-env": "^7.10.4",
|
|
41
|
+
"browserslist": "^4.17.4",
|
|
41
42
|
"jest": "^26.6.3",
|
|
42
|
-
"rimraf": "^2.
|
|
43
|
+
"rimraf": "^2.7.1"
|
|
43
44
|
},
|
|
44
45
|
"files": [
|
|
45
46
|
"dist"
|
|
@@ -58,5 +59,5 @@
|
|
|
58
59
|
"url": "https://maxwellsimmer.com"
|
|
59
60
|
}
|
|
60
61
|
],
|
|
61
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "676dbec7fbdcc46eb8168f1d437d294ed549e2e8"
|
|
62
63
|
}
|