@canopycanopycanopy/b-ber-cli 2.0.0 → 3.0.2

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 CHANGED
@@ -1,31 +1,19 @@
1
1
  "use strict";
2
2
 
3
3
  var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
4
-
5
4
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
-
7
5
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
8
-
9
6
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
10
-
11
7
  _Object$defineProperty(exports, "__esModule", {
12
8
  value: true
13
9
  });
14
-
15
10
  exports.default = bber;
16
-
17
11
  var _yargs = _interopRequireDefault(require("yargs"));
18
-
19
12
  var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
20
-
21
13
  var commands = _interopRequireWildcard(require("./commands"));
22
-
23
14
  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
15
  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
-
27
16
  const LINE_LENGTH = 70;
28
-
29
17
  function bber() {
30
18
  const showCustomHelp = () => console.log(`
31
19
  Usage: bber <command> [options]
@@ -40,6 +28,5 @@ function bber() {
40
28
 
41
29
  bber version ${_State.default.version}
42
30
  `);
43
-
44
31
  return _yargs.default.command(commands.build).command(commands.generate).command(commands.opf).command(commands.theme).command(commands.serve).command(commands.new).command(commands.cover).command(commands.deploy).command(commands.check).help(false).fail(showCustomHelp).demandCommand().wrap(LINE_LENGTH).argv;
45
32
  }
@@ -1,130 +1,89 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
4
-
5
4
  var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
6
-
7
5
  var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
8
-
9
6
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
10
-
11
7
  var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
12
-
13
8
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
14
-
15
9
  var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
16
-
17
10
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
18
-
19
11
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
20
-
21
12
  _Object$defineProperty(exports, "__esModule", {
22
13
  value: true
23
14
  });
24
-
25
15
  exports.default = void 0;
26
-
27
16
  var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
28
-
29
17
  var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
30
-
31
18
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
32
-
33
19
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
34
-
35
20
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
36
-
37
21
  var _path = _interopRequireDefault(require("path"));
38
-
39
22
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
40
-
41
23
  var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
42
-
43
24
  var _createBuildSequence = _interopRequireDefault(require("@canopycanopycanopy/b-ber-shapes-sequences/create-build-sequence"));
44
-
45
25
  var _sequences = _interopRequireDefault(require("@canopycanopycanopy/b-ber-shapes-sequences/sequences"));
46
-
47
26
  var _Project = _interopRequireDefault(require("@canopycanopycanopy/b-ber-templates/Project"));
48
-
49
27
  var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
50
-
51
28
  var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
52
-
53
29
  var _configOptions = require("../lib/config-options");
54
-
55
30
  const _excluded = ["_", "$0", "config"];
56
-
57
31
  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
32
  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
33
  // Leading pipe ensures that the `all` command can be run without arguments
62
34
  const command = 'build [|epub|mobi|pdf|reader|sample|web]';
63
35
  const describe = 'Build a project';
64
-
65
36
  const noop = () => {};
66
-
67
37
  const handler = async argv => {
68
38
  process.env.NODE_ENV = process.env.NODE_ENV || 'development';
69
39
  const {
70
- _: desiredSequences,
71
- $0,
72
- config
73
- } = argv,
74
- configOptions = (0, _objectWithoutProperties2.default)(argv, _excluded);
40
+ _: desiredSequences,
41
+ $0,
42
+ config
43
+ } = argv,
44
+ configOptions = (0, _objectWithoutProperties2.default)(argv, _excluded);
75
45
  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
46
+ const subSequence = (0, _reduce.default)(sequence).call(sequence, (a, c) => (0, _concat.default)(a).call(a, ..._sequences.default[c]), []);
77
47
 
78
- let projectConfig = {}; // Check if a config files has been specified
48
+ // Set up the config object that's going to be passed into the `init` function
49
+ let projectConfig = {};
79
50
 
51
+ // Check if a config files has been specified
80
52
  if (config) projectConfig = await (0, _configOptions.parseConfigFile)(config);
81
53
  projectConfig = _objectSpread(_objectSpread({}, projectConfig), configOptions);
82
-
83
54
  _State.default.update('sequence', subSequence);
84
-
85
55
  _bBerLogger.default.registerSequence(_State.default, command, subSequence);
86
-
87
56
  const run = buildTasks => {
88
- const build = buildTasks.shift(); // Reset any previous changes to state and update the build type
57
+ const build = buildTasks.shift();
89
58
 
59
+ // Reset any previous changes to state and update the build type
90
60
  _State.default.reset();
61
+ _State.default.update('build', build);
91
62
 
92
- _State.default.update('build', build); // Apply the config options that may have been passed in via CLI flags
93
-
94
-
63
+ // Apply the config options that may have been passed in via CLI flags
95
64
  for (const [key, val] of (0, _entries.default)(projectConfig)) {
96
65
  if (!_State.default.has(`config.${key}`)) {
97
66
  _bBerLogger.default.warn('Invalid configuration option [%s]', key);
98
-
99
67
  continue;
100
68
  }
101
-
102
69
  if (_configOptions.blacklistedConfigOptions.has(key)) {
103
70
  _bBerLogger.default.warn('Disallowed configuration option [%s]', key);
104
-
105
71
  continue;
106
72
  }
107
-
108
73
  _bBerLogger.default.notice('Applying configuration option [%s]:[%s]', key, val);
109
-
110
74
  _State.default.update(`config.${key}`, val);
111
75
  }
112
-
113
76
  return (0, _bBerTasks.serialize)(_sequences.default[build]).then(() => {
114
77
  if (buildTasks.length) run(buildTasks);
115
78
  });
116
79
  };
117
-
118
80
  const projectPath = _path.default.resolve(_State.default.srcDir);
119
-
120
81
  const files = [..._Project.default.javascripts(projectPath), ..._Project.default.stylesheets(projectPath)];
121
82
  (0, _utils.ensure)({
122
83
  files
123
84
  }).then(() => run(sequence)).catch(console.error);
124
85
  };
125
-
126
86
  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');
127
-
128
87
  var _default = {
129
88
  command,
130
89
  describe,
@@ -1,32 +1,24 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  exports.default = void 0;
10
-
11
8
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
12
-
13
9
  var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
14
-
15
10
  const command = 'check [project]';
16
11
  const describe = 'Validate b-ber project Markdown';
17
-
18
12
  const builder = yargs => yargs.positional('project', {
19
13
  describe: 'Path to the b-ber project',
20
14
  type: 'string'
21
15
  }).help('h').alias('h', 'help').fail((msg, err) => (0, _utils.fail)(msg, err, yargs)).usage(`\nUsage: $0 check\n\n${describe}`);
22
-
23
16
  const handler = argv => {
24
17
  const project = argv.project || process.cwd();
25
18
  (0, _bBerTasks.validate)({
26
19
  project
27
20
  });
28
21
  };
29
-
30
22
  var _default = {
31
23
  command,
32
24
  describe,
@@ -1,24 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  exports.default = void 0;
10
-
11
8
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
12
-
13
9
  var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
14
-
15
10
  const command = 'cover';
16
11
  const describe = 'Generate a project cover';
17
-
18
12
  const builder = yargs => yargs.fail((msg, err) => (0, _utils.fail)(msg, err, yargs)).help('h').alias('h', 'help').usage(`\nUsage: $0 cover\n\n${describe}`);
19
-
20
13
  const handler = () => _bBerTasks.cover.init();
21
-
22
14
  var _default = {
23
15
  command,
24
16
  describe,
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  exports.default = void 0;
10
-
11
8
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
12
-
13
9
  var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
14
-
15
10
  const command = 'deploy [builds...]';
16
11
  const describe = 'Upload a b-ber project to Amazon S3';
17
-
18
12
  const builder = yargs => yargs.option('yes', {
19
13
  alias: 'y',
20
14
  describe: 'Skip all confirmation prompts',
@@ -24,7 +18,6 @@ const builder = yargs => yargs.option('yes', {
24
18
  choices: ['epub', 'mobi', 'reader', 'web', 'pdf', 'xml'],
25
19
  type: 'string'
26
20
  }).help('h').alias('h', 'help').usage(`\nUsage: $0 deploy\n\n${describe}`).fail((msg, err) => (0, _utils.fail)(msg, err, yargs));
27
-
28
21
  const handler = _bBerTasks.deploy;
29
22
  var _default = {
30
23
  command,
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  exports.default = void 0;
10
-
11
8
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
12
-
13
9
  var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
14
-
15
10
  const command = 'generate <title> [type]';
16
11
  const describe = 'Create a new chapter. Accepts arguments for metadata';
17
-
18
12
  const builder = yargs => yargs.positional('title', {
19
13
  describe: 'Page title',
20
14
  type: 'string'
@@ -23,7 +17,6 @@ const builder = yargs => yargs.positional('title', {
23
17
  choices: ['frontmatter', 'bodymatter', 'backmatter'],
24
18
  type: 'string'
25
19
  }).help('h').alias('h', 'help').usage(`\nUsage: $0 generate\n\n${describe}`).fail((msg, err) => (0, _utils.fail)(msg, err, yargs));
26
-
27
20
  const handler = ({
28
21
  title,
29
22
  type
@@ -31,7 +24,6 @@ const handler = ({
31
24
  title,
32
25
  type
33
26
  })).catch(console.error);
34
-
35
27
  var _default = {
36
28
  command,
37
29
  describe,
@@ -1,90 +1,70 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  _Object$defineProperty(exports, "build", {
12
9
  enumerable: true,
13
10
  get: function () {
14
11
  return _build.default;
15
12
  }
16
13
  });
17
-
18
14
  _Object$defineProperty(exports, "check", {
19
15
  enumerable: true,
20
16
  get: function () {
21
17
  return _check.default;
22
18
  }
23
19
  });
24
-
25
20
  _Object$defineProperty(exports, "cover", {
26
21
  enumerable: true,
27
22
  get: function () {
28
23
  return _cover.default;
29
24
  }
30
25
  });
31
-
32
26
  _Object$defineProperty(exports, "deploy", {
33
27
  enumerable: true,
34
28
  get: function () {
35
29
  return _deploy.default;
36
30
  }
37
31
  });
38
-
39
32
  _Object$defineProperty(exports, "generate", {
40
33
  enumerable: true,
41
34
  get: function () {
42
35
  return _generate.default;
43
36
  }
44
37
  });
45
-
46
38
  _Object$defineProperty(exports, "new", {
47
39
  enumerable: true,
48
40
  get: function () {
49
41
  return _new.default;
50
42
  }
51
43
  });
52
-
53
44
  _Object$defineProperty(exports, "opf", {
54
45
  enumerable: true,
55
46
  get: function () {
56
47
  return _opf.default;
57
48
  }
58
49
  });
59
-
60
50
  _Object$defineProperty(exports, "serve", {
61
51
  enumerable: true,
62
52
  get: function () {
63
53
  return _serve.default;
64
54
  }
65
55
  });
66
-
67
56
  _Object$defineProperty(exports, "theme", {
68
57
  enumerable: true,
69
58
  get: function () {
70
59
  return _theme.default;
71
60
  }
72
61
  });
73
-
74
62
  var _build = _interopRequireDefault(require("./build"));
75
-
76
63
  var _cover = _interopRequireDefault(require("./cover"));
77
-
78
64
  var _deploy = _interopRequireDefault(require("./deploy"));
79
-
80
65
  var _generate = _interopRequireDefault(require("./generate"));
81
-
82
66
  var _new = _interopRequireDefault(require("./new"));
83
-
84
67
  var _opf = _interopRequireDefault(require("./opf"));
85
-
86
68
  var _serve = _interopRequireDefault(require("./serve"));
87
-
88
69
  var _theme = _interopRequireDefault(require("./theme"));
89
-
90
70
  var _check = _interopRequireDefault(require("./check"));
@@ -1,101 +1,76 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
4
-
5
4
  var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
6
-
7
5
  var _filterInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
8
-
9
6
  var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
10
-
11
7
  var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
12
-
13
8
  var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
14
-
15
9
  var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
16
-
17
10
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
18
-
19
11
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
20
-
21
12
  _Object$defineProperty(exports, "__esModule", {
22
13
  value: true
23
14
  });
24
-
25
15
  exports.default = void 0;
26
-
27
16
  var _entries = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/entries"));
28
-
29
17
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
30
-
31
18
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
32
-
33
19
  var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State"));
34
-
35
20
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
36
-
37
21
  var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
38
-
39
22
  var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
40
-
41
23
  var _configOptions = require("../lib/config-options");
42
-
43
24
  const _excluded = ["_", "$0", "name", "config"];
44
-
45
25
  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
-
47
26
  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
-
49
27
  const command = 'new <name>';
50
28
  const describe = 'Create a new project';
51
-
52
29
  const builder = yargs => (0, _configOptions.withConfigOptions)(yargs.positional('name', {
53
30
  describe: 'New project name',
54
31
  type: 'string'
55
32
  })).fail((msg, err) => (0, _utils.fail)(msg, err, yargs)).help('h').alias('h', 'help').usage(`\nUsage: $0 new "My Project"\n\n${describe}`);
56
-
57
33
  const handler = async argv => {
58
34
  // Extract CLI options and get the config file option in case there is one
59
35
  const {
60
- _,
61
- $0,
62
- name,
63
- config
64
- } = argv,
65
- configOptions = (0, _objectWithoutProperties2.default)(argv, _excluded); // Set up the config object that's going to be passed into the `init` function
36
+ _,
37
+ $0,
38
+ name,
39
+ config
40
+ } = argv,
41
+ configOptions = (0, _objectWithoutProperties2.default)(argv, _excluded);
42
+
43
+ // Set up the config object that's going to be passed into the `init` function
44
+ let projectConfig = {};
66
45
 
67
- let projectConfig = {}; // Check if a config files has been specified
46
+ // Check if a config files has been specified
47
+ if (config) projectConfig = await (0, _configOptions.parseConfigFile)(config);
68
48
 
69
- if (config) projectConfig = await (0, _configOptions.parseConfigFile)(config); // Override the values specified in the config file with values
49
+ // Override the values specified in the config file with values
70
50
  // that have been explicitly provided on the CLI. Allows using the
71
51
  // config file as a template that can be overridden, e.g.,
72
52
  // bber new foo --config my-generic-conf.yaml --base_path /foo
53
+ projectConfig = _objectSpread(_objectSpread({}, projectConfig), configOptions);
73
54
 
74
- projectConfig = _objectSpread(_objectSpread({}, projectConfig), configOptions); // Remove blacklisted and unsupported config options
75
-
55
+ // Remove blacklisted and unsupported config options
76
56
  for (const [key] of (0, _entries.default)(projectConfig)) {
77
57
  if (!_State.default.has(`config.${key}`)) {
78
58
  _bBerLogger.default.warn('Invalid configuration option [%s]', key);
79
-
80
59
  delete projectConfig[key];
81
60
  continue;
82
61
  }
83
-
84
62
  if (_configOptions.blacklistedConfigOptions.has(key)) {
85
63
  _bBerLogger.default.warn('Disallowed configuration option [%s]', key);
86
-
87
64
  delete projectConfig[key];
88
65
  continue;
89
66
  }
90
67
  }
91
-
92
68
  const initializer = new _bBerTasks.init({
93
69
  name,
94
70
  config: projectConfig
95
71
  });
96
72
  initializer.start();
97
73
  };
98
-
99
74
  var _default = {
100
75
  command,
101
76
  describe,
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  exports.default = void 0;
10
-
11
8
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
12
-
13
9
  const command = 'opf';
14
10
  const describe = 'Generate the opf';
15
-
16
11
  const builder = yargs => yargs.help('h').alias('h', 'help').usage(`\nUsage: $0 opf\n\n${describe}`);
17
-
18
12
  const handler = _bBerTasks.opf;
19
13
  var _default = {
20
14
  command,
@@ -1,38 +1,27 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
9
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
14
-
15
10
  var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
16
-
17
11
  var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
18
-
19
12
  const command = 'serve [build] [opts]';
20
13
  const describe = 'Preview a project in the browser using the `reader` build.';
21
-
22
14
  const handler = yargs => {
23
15
  const {
24
16
  external,
25
17
  build
26
18
  } = yargs;
27
-
28
19
  _bBerLogger.default.notice(`Serving [b-ber-${build}]`);
29
-
30
20
  return (0, _bBerTasks.serve)({
31
21
  build,
32
22
  external
33
23
  });
34
24
  };
35
-
36
25
  const builder = yargs => yargs.positional('build', {
37
26
  describe: 'Build to preview',
38
27
  choices: ['reader', 'web'],
@@ -42,7 +31,6 @@ const builder = yargs => yargs.positional('build', {
42
31
  describe: 'Serve from an externally accessible URL',
43
32
  type: 'boolean'
44
33
  }).help('h').alias('h', 'help').usage(`\nUsage: $0 serve\n\n${describe}`).fail((msg, err) => (0, _utils.fail)(msg, err, yargs));
45
-
46
34
  var _default = {
47
35
  command,
48
36
  describe,
@@ -1,22 +1,15 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.default = void 0;
12
-
13
9
  var _Theme = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/Theme"));
14
-
15
10
  var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
16
-
17
11
  const _command = 'theme <command> [options]';
18
12
  const describe = "Manage a project's theme";
19
-
20
13
  const handler = args => (0, _utils.ensure)().then(() => {
21
14
  const {
22
15
  command,
@@ -24,7 +17,6 @@ const handler = args => (0, _utils.ensure)().then(() => {
24
17
  } = args;
25
18
  return _Theme.default[command](options);
26
19
  }).catch(console.error);
27
-
28
20
  const builder = yargs => yargs.positional('command', {
29
21
  describe: 'Theme command to execute',
30
22
  choices: ['set', 'list'],
@@ -33,7 +25,6 @@ const builder = yargs => yargs.positional('command', {
33
25
  describe: 'Name of the theme to activate',
34
26
  type: 'string'
35
27
  }).help('h').alias('h', 'help').usage(`\nUsage: $0 theme\n\n${describe}`).fail((msg, err) => (0, _utils.fail)(msg, err, yargs));
36
-
37
28
  var _default = {
38
29
  command: _command,
39
30
  describe,
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  _Object$defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
-
9
7
  exports.default = void 0;
10
-
11
8
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
12
-
13
9
  const command = 'xml';
14
10
  const describe = 'Export a project as an XML document';
15
-
16
11
  const builder = yargs => yargs.help('h').alias('h', 'help').usage(`\nUsage: $0 xml\n\n${describe}`);
17
-
18
12
  const handler = _bBerTasks.xml;
19
13
  var _default = {
20
14
  command,
package/dist/index.js CHANGED
@@ -2,18 +2,12 @@
2
2
  "use strict";
3
3
 
4
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
5
-
6
5
  var _indexOf = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/index-of"));
7
-
8
6
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
9
-
10
7
  var _context;
11
-
12
8
  if ((0, _indexOf.default)(_context = process.argv).call(_context, '--version') > -1) {
13
9
  console.log(_fsExtra.default.readJSONSync(require.resolve('../package.json')).version);
14
10
  } else {
15
11
  const bber = require('./app').default; // eslint-disable-line global-require
16
-
17
-
18
12
  bber();
19
13
  }
@@ -1,118 +1,104 @@
1
1
  "use strict";
2
2
 
3
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
4
-
5
4
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
6
-
7
5
  _Object$defineProperty(exports, "__esModule", {
8
6
  value: true
9
7
  });
10
-
11
8
  exports.parseConfigFile = exports.blacklistedConfigOptions = void 0;
12
9
  exports.withConfigOptions = withConfigOptions;
13
-
14
10
  var _set = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/set"));
15
-
16
11
  var _fsExtra = _interopRequireDefault(require("fs-extra"));
17
-
18
12
  var _path = _interopRequireDefault(require("path"));
19
-
20
13
  var _YamlAdaptor = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/YamlAdaptor"));
21
-
22
14
  var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
23
-
24
15
  // Attributes not currently configurable via the CLI:
25
16
  // ibooks_specified_fonts always set to `true`
26
17
  // autoprefixer_options no JSON support
27
18
  // downloads no JSON support
28
19
  // ui_options no JSON support
20
+
29
21
  function withConfigOptions(yargs) {
30
22
  return yargs.option('env', {
31
23
  describe: 'The default build environment',
32
- type: 'string' // default: 'development',
33
-
24
+ type: 'string'
25
+ // default: 'development',
34
26
  }).option('theme', {
35
27
  describe: 'Default theme name',
36
- type: 'string' // default: 'b-ber-theme-serif',
37
-
28
+ type: 'string'
29
+ // default: 'b-ber-theme-serif',
38
30
  }).option('src', {
39
31
  describe: 'The name of the source directory',
40
- type: 'string' // default: 'src',
41
-
32
+ type: 'string'
33
+ // default: 'src',
42
34
  }).option('dist', {
43
35
  describe: 'The name of the dist directory',
44
- type: 'string' // default: 'dist',
45
-
36
+ type: 'string'
37
+ // default: 'dist',
46
38
  }).option('cache', {
47
39
  describe: 'Whether to enable caching',
48
- type: 'boolean' // default: false,
49
-
40
+ type: 'boolean'
41
+ // default: false,
50
42
  }).option('themes_directory', {
51
43
  describe: 'Relative or absolute path to the directory for third-party themes',
52
- type: 'string' // default: './themes',
53
-
44
+ type: 'string'
45
+ // default: './themes',
54
46
  }).option('ignore', {
55
47
  describe: 'Array of files or folders to ignore during the build',
56
- type: 'array' // default: [],
57
-
48
+ type: 'array'
49
+ // default: [],
58
50
  }).option('base_path', {
59
51
  describe: 'Base path appended to the URL for the reader build',
60
- type: 'string' // default: '/',
61
-
52
+ type: 'string'
53
+ // default: '/',
62
54
  }).option('remote_url', {
63
55
  describe: 'URL at which the reader build will be made public',
64
- type: 'string' // default: 'http://localhost:4000/',
65
-
56
+ type: 'string'
57
+ // default: 'http://localhost:4000/',
66
58
  }).option('reader_url', {
67
59
  describe: 'URL that hosts the assets for the reader reader build',
68
- type: 'string' // default: 'http://localhost:4000/project-reader',
69
-
60
+ type: 'string'
61
+ // default: 'http://localhost:4000/project-reader',
70
62
  }).option('base_url', {
71
63
  describe: 'URL to map assets for the web build',
72
- type: 'string' // default: '',
73
-
64
+ type: 'string'
65
+ // default: '',
74
66
  }).option('bucket_url', {
75
67
  describe: 'The S3 bucket URL where the remote project will be deployed to if hosting on S3',
76
- type: 'string' // default: '',
77
-
68
+ type: 'string'
69
+ // default: '',
78
70
  }).option('private', {
79
71
  describe: 'If the web and reader builds should be discoverable by search engines',
80
- type: 'boolean' // default: false,
81
-
72
+ type: 'boolean'
73
+ // default: false,
82
74
  }).option('remote_javascripts', {
83
75
  describe: 'Remotely hosted JavaScript files for the reader',
84
- type: 'array' // default: [],
85
-
76
+ type: 'array'
77
+ // default: [],
86
78
  }).option('remote_stylesheets', {
87
79
  describe: 'Remotely hosted stylesheets files for the reader',
88
- type: 'array' // default: [],
89
-
80
+ type: 'array'
81
+ // default: [],
90
82
  }).option('config', {
91
83
  describe: 'Path to a JSON or YAML configuration file that will extend the base configuration',
92
- type: 'string' // default: '',
93
-
84
+ type: 'string'
85
+ // default: '',
94
86
  });
95
87
  }
96
88
 
97
89
  const blacklistedConfigOptions = new _set.default(['ibooks_specified_fonts', 'autoprefixer_options', 'downloads', 'ui_options']);
98
90
  exports.blacklistedConfigOptions = blacklistedConfigOptions;
99
-
100
91
  const parseConfigFile = async configFile => {
101
92
  const ext = _path.default.extname(configFile);
102
-
103
93
  const configPath = _path.default.resolve(process.cwd(), configFile);
104
-
105
94
  if (!(await _fsExtra.default.pathExists(configPath))) {
106
95
  _bBerLogger.default.error(`Could not find config at [${configPath}]`);
107
96
  }
108
-
109
97
  if (/^\.(?:ya?ml|json)/i.test(ext) === false) {
110
98
  _bBerLogger.default.error('Config file must have a .json or .yaml/.yml file extension');
111
99
  }
112
-
113
100
  const contents = await _fsExtra.default.readFile(configPath);
114
101
  if (/^\.ya?ml/i.test(ext)) return _YamlAdaptor.default.parse(contents);
115
102
  return JSON.parse(contents);
116
103
  };
117
-
118
104
  exports.parseConfigFile = parseConfigFile;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-cli",
3
- "version": "2.0.0",
3
+ "version": "3.0.2",
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": "2.0.0",
26
- "@canopycanopycanopy/b-ber-logger": "2.0.0",
27
- "@canopycanopycanopy/b-ber-shapes-sequences": "2.0.0",
28
- "@canopycanopycanopy/b-ber-tasks": "2.0.0",
29
- "@canopycanopycanopy/b-ber-templates": "2.0.0",
25
+ "@canopycanopycanopy/b-ber-lib": "3.0.2",
26
+ "@canopycanopycanopy/b-ber-logger": "3.0.2",
27
+ "@canopycanopycanopy/b-ber-shapes-sequences": "3.0.2",
28
+ "@canopycanopycanopy/b-ber-tasks": "3.0.2",
29
+ "@canopycanopycanopy/b-ber-templates": "3.0.2",
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": "dbeae192709705f5bc211195ff343cbd999f9caf"
62
+ "gitHead": "1ec8ab9a4030fb59839d347beb04ab7605e3d5dd"
63
63
  }