@canopycanopycanopy/b-ber-cli 1.2.10 → 1.2.12

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,10 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
4
-
5
3
  var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
6
4
 
7
- var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
5
+ var _interopRequireWildcard = require("@babel/runtime-corejs3/helpers/interopRequireWildcard");
8
6
 
9
7
  var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
10
8
 
@@ -20,10 +18,6 @@ var _State = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/State
20
18
 
21
19
  var commands = _interopRequireWildcard(require("./commands"));
22
20
 
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
-
27
21
  const LINE_LENGTH = 70;
28
22
 
29
23
  function bber() {
@@ -1,31 +1,167 @@
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
 
19
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
20
+
5
21
  _Object$defineProperty(exports, "__esModule", {
6
22
  value: true
7
23
  });
8
24
 
9
25
  exports.default = void 0;
10
26
 
27
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
28
+
29
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/objectWithoutProperties"));
30
+
31
+ var _fsExtra = _interopRequireDefault(require("fs-extra"));
32
+
33
+ var _path = _interopRequireDefault(require("path"));
34
+
11
35
  var _bBerTasks = require("@canopycanopycanopy/b-ber-tasks");
12
36
 
13
37
  var _utils = require("@canopycanopycanopy/b-ber-lib/utils");
14
38
 
39
+ var _YamlAdaptor = _interopRequireDefault(require("@canopycanopycanopy/b-ber-lib/YamlAdaptor"));
40
+
41
+ var _bBerLogger = _interopRequireDefault(require("@canopycanopycanopy/b-ber-logger"));
42
+
43
+ const _excluded = ["_", "$0", "name", "config"];
44
+
45
+ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); if (enumerableOnly) symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
46
+
47
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { var _context; _forEachInstanceProperty(_context = ownKeys(Object(source), true)).call(_context, function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (_Object$getOwnPropertyDescriptors) { _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)); } else { var _context2; _forEachInstanceProperty(_context2 = ownKeys(Object(source))).call(_context2, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } } return target; }
48
+
15
49
  const command = 'new <name>';
16
50
  const describe = 'Create a new project';
17
51
 
18
52
  const builder = yargs => yargs.positional('name', {
19
53
  describe: 'New project name',
20
54
  type: 'string'
55
+ }).option('env', {
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
+
21
115
  }).fail((msg, err) => (0, _utils.fail)(msg, err, yargs)).help('h').alias('h', 'help').usage(`\nUsage: $0 new "My Project"\n\n${describe}`);
22
116
 
23
- const handler = argv => {
117
+ const handler = async argv => {
118
+ // Extract CLI options and get the config file option in case there is one
24
119
  const {
25
- name
26
- } = argv;
120
+ _,
121
+ $0,
122
+ name,
123
+ config
124
+ } = argv,
125
+ rest = (0, _objectWithoutProperties2.default)(argv, _excluded); // Set up the config object that's going to be passed into the `init` function
126
+
127
+ let projectConfig = {}; // Check if a config files has been specified
128
+
129
+ if (config) {
130
+ const ext = _path.default.extname(config);
131
+
132
+ const configPath = _path.default.resolve(process.cwd(), config);
133
+
134
+ if (!(await _fsExtra.default.pathExists(config))) {
135
+ _bBerLogger.default.error('Could not find config at %s', configPath);
136
+ }
137
+
138
+ if (/^\.(?:ya?ml|json)/i.test(ext) === false) {
139
+ _bBerLogger.default.error('Config file must have a .json or .yaml/.yml file extension');
140
+ }
141
+
142
+ const contents = await _fsExtra.default.readFile(config);
143
+
144
+ if (/^\.ya?ml/i.test(ext)) {
145
+ projectConfig = _YamlAdaptor.default.parse(contents);
146
+ } else {
147
+ projectConfig = JSON.parse(contents);
148
+ }
149
+ } // Override the values specified in the config file with values
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
161
+
27
162
  const initializer = new _bBerTasks.init({
28
- name
163
+ name,
164
+ config: projectConfig
29
165
  });
30
166
  initializer.start();
31
167
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@canopycanopycanopy/b-ber-cli",
3
- "version": "1.2.10",
3
+ "version": "1.2.12",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -22,13 +22,15 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@babel/runtime-corejs3": "^7.10.5",
25
- "@canopycanopycanopy/b-ber-lib": "1.2.10",
26
- "@canopycanopycanopy/b-ber-logger": "1.2.10",
27
- "@canopycanopycanopy/b-ber-shapes-sequences": "1.2.2",
28
- "@canopycanopycanopy/b-ber-tasks": "1.2.10",
29
- "@canopycanopycanopy/b-ber-templates": "1.2.10",
25
+ "@canopycanopycanopy/b-ber-lib": "1.2.12",
26
+ "@canopycanopycanopy/b-ber-logger": "1.2.12",
27
+ "@canopycanopycanopy/b-ber-shapes-sequences": "1.2.12",
28
+ "@canopycanopycanopy/b-ber-tasks": "1.2.12",
29
+ "@canopycanopycanopy/b-ber-templates": "1.2.12",
30
30
  "fs-extra": "^8.1.0",
31
+ "lodash": "^4.17.21",
31
32
  "lodash.has": "latest",
33
+ "tar": "^6.1.11",
32
34
  "yargs": "^13.3.0"
33
35
  },
34
36
  "devDependencies": {
@@ -56,5 +58,5 @@
56
58
  "url": "https://maxwellsimmer.com"
57
59
  }
58
60
  ],
59
- "gitHead": "2851c865a57746417975cedb733f79b42d3f0084"
61
+ "gitHead": "84df51c85877eeadd71f5b5372e1d5c08580e883"
60
62
  }