@zimbra/zimlet-cli 12.12.0 → 14.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/.browserslistrc +1 -0
- package/dist/cli.js +11 -17
- package/dist/commands/create.js +206 -324
- package/dist/commands/package.js +144 -93
- package/dist/entry.js +14 -12
- package/dist/index.js +89 -114
- package/dist/lib/async-command.js +8 -14
- package/dist/lib/setup.js +55 -133
- package/dist/lib/webpack/transform-config.js +8 -8
- package/dist/shims/@apollo/client/index.js +92 -82
- package/dist/shims/@apollo/client/react/components/index.js +6 -6
- package/dist/shims/@apollo/client/react/hoc/index.js +8 -8
- package/dist/shims/@apollo/client/react/index.js +16 -16
- package/dist/shims/@zimbra-client/blocks/index.js +28 -28
- package/dist/shims/@zimbra-client/browser/index.js +4 -4
- package/dist/shims/@zimbra-client/components/index.js +53 -49
- package/dist/shims/@zimbra-client/constants/index.js +7 -7
- package/dist/shims/@zimbra-client/enhancers/index.js +10 -10
- package/dist/shims/@zimbra-client/errors/index.js +5 -5
- package/dist/shims/@zimbra-client/graphql/index.js +32 -26
- package/dist/shims/@zimbra-client/hooks/graphql/index.js +8 -8
- package/dist/shims/@zimbra-client/hooks/index.js +10 -6
- package/dist/shims/@zimbra-client/platform/index.js +5 -5
- package/dist/shims/@zimbra-client/util/contacts/index.js +4 -4
- package/dist/shims/@zimbra-client/util/index.js +15 -11
- package/dist/shims/@zimbra-client/util/redux/index.js +8 -8
- package/dist/shims/clipboard-polyfill/index.js +4 -4
- package/dist/shims/index.js +2 -2
- package/dist/shims/moment/index.js +43 -43
- package/dist/shims/preact/compat/index.js +40 -52
- package/dist/shims/preact/hooks/index.js +14 -14
- package/dist/shims/preact/index.js +15 -15
- package/dist/shims/preact-context-provider/index.js +6 -6
- package/dist/shims/preact-i18n/index.js +12 -12
- package/dist/shims/preact-pwa-install/index.js +3 -3
- package/dist/shims/preact-render-to-string/index.js +5 -5
- package/dist/shims/preact-router/index.js +9 -9
- package/dist/shims/preact-router/match/index.js +4 -4
- package/dist/shims/react-redux/index.js +16 -16
- package/dist/shims/recompose/index.js +46 -46
- package/dist/shims/redux-actions/index.js +9 -9
- package/dist/util.js +11 -11
- package/dist/zimlet-style-loader.js +8 -4
- package/package-lock.json +5450 -5941
- package/package.json +42 -45
package/dist/index.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
5
|
-
|
|
6
4
|
Object.defineProperty(exports, "__esModule", {
|
|
7
5
|
value: true
|
|
8
6
|
});
|
|
9
|
-
exports["default"] = run;
|
|
10
7
|
exports.configure = configure;
|
|
8
|
+
exports.default = run;
|
|
11
9
|
|
|
12
10
|
var _fs = _interopRequireDefault(require("fs"));
|
|
13
11
|
|
|
@@ -37,90 +35,69 @@ var _shims = require("./shims");
|
|
|
37
35
|
|
|
38
36
|
var _copyWebpackPlugin = _interopRequireDefault(require("copy-webpack-plugin"));
|
|
39
37
|
|
|
40
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
41
|
-
|
|
42
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (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; }
|
|
43
|
-
|
|
44
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
45
|
-
|
|
46
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
47
|
-
|
|
48
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
49
|
-
|
|
50
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
51
|
-
|
|
52
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
53
|
-
|
|
54
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
55
|
-
|
|
56
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
38
|
+
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); }
|
|
57
39
|
|
|
58
|
-
function
|
|
40
|
+
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; }
|
|
59
41
|
|
|
60
|
-
function
|
|
61
|
-
|
|
62
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
42
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
63
43
|
|
|
64
44
|
function run(args, callback) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
compiler.hooks.failed.tap('zimlet-cli',
|
|
45
|
+
let config = configure(args);
|
|
46
|
+
let compiler = (0, _webpack.default)(config);
|
|
47
|
+
const preferredPort = config.devServer && +config.devServer.port;
|
|
48
|
+
compiler.hooks.failed.tap('zimlet-cli', err => {
|
|
69
49
|
console.error(err.stack || err);
|
|
70
50
|
if (err.details) console.error(err.details);
|
|
71
51
|
});
|
|
72
|
-
compiler.hooks.done.tap('zimlet-cli',
|
|
73
|
-
|
|
52
|
+
compiler.hooks.done.tap('zimlet-cli', stats => {
|
|
53
|
+
let info = stats.toJson();
|
|
74
54
|
|
|
75
55
|
if (stats.hasErrors()) {
|
|
76
|
-
process.stdout.write(_chalk
|
|
77
|
-
info.errors.forEach(
|
|
78
|
-
return console.error(err);
|
|
79
|
-
});
|
|
56
|
+
process.stdout.write(_chalk.default.red('Build failed!\n\n'));
|
|
57
|
+
info.errors.forEach(err => console.error(err));
|
|
80
58
|
} else {
|
|
81
59
|
if (stats.hasWarnings()) {
|
|
82
|
-
info.warnings.forEach(
|
|
83
|
-
return console.warn(err);
|
|
84
|
-
});
|
|
60
|
+
info.warnings.forEach(err => console.warn(err));
|
|
85
61
|
}
|
|
86
62
|
|
|
87
|
-
process.stdout.write(_chalk
|
|
63
|
+
process.stdout.write(_chalk.default.green('Compiled successfully!\n\n'));
|
|
88
64
|
|
|
89
65
|
if (config.devServer) {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
66
|
+
let {
|
|
67
|
+
https,
|
|
68
|
+
host,
|
|
69
|
+
port
|
|
70
|
+
} = config.devServer;
|
|
71
|
+
let protocol = https ? 'https' : 'http';
|
|
95
72
|
if (host === '0.0.0.0') host = 'localhost';
|
|
96
|
-
|
|
97
|
-
|
|
73
|
+
let serverAddr = `${protocol}://${host}:${_chalk.default.bold(port)}/index.js`;
|
|
74
|
+
let localIpAddr = `${protocol}://${_ip.default.address()}:${_chalk.default.bold(port)}/index.js`;
|
|
98
75
|
|
|
99
76
|
if (preferredPort !== config.devServer.port) {
|
|
100
|
-
process.stdout.write(
|
|
77
|
+
process.stdout.write(`NOTE: Port ${preferredPort} is not available, using ${port} instead.\n\n`);
|
|
101
78
|
}
|
|
102
79
|
|
|
103
80
|
process.stdout.write('You can view the application in browser.\n\n');
|
|
104
|
-
process.stdout.write(
|
|
105
|
-
process.stdout.write(
|
|
81
|
+
process.stdout.write(`${_chalk.default.bold('Local:')} ${serverAddr}\n`);
|
|
82
|
+
process.stdout.write(`${_chalk.default.bold('On Your Network:')} ${localIpAddr}\n`);
|
|
106
83
|
}
|
|
107
84
|
}
|
|
108
85
|
});
|
|
109
86
|
|
|
110
87
|
if (config.devServer) {
|
|
111
|
-
(0, _getPort
|
|
88
|
+
(0, _getPort.default)({
|
|
112
89
|
port: (0, _getPort.makeRange)(preferredPort, preferredPort + 100)
|
|
113
|
-
}).then(
|
|
90
|
+
}).then(port => {
|
|
114
91
|
if (config.devServer.port !== port) {
|
|
115
92
|
config.devServer.port = port;
|
|
116
93
|
}
|
|
117
94
|
|
|
118
|
-
new _webpackDevServer
|
|
95
|
+
new _webpackDevServer.default(compiler, config.devServer).listen(config.devServer.port);
|
|
119
96
|
});
|
|
120
97
|
} else {
|
|
121
|
-
compiler.run(
|
|
98
|
+
compiler.run((err, stats) => {
|
|
122
99
|
if (!err && stats.hasErrors()) {
|
|
123
|
-
err =
|
|
100
|
+
err = `${stats.toJson().errors.length} errors`;
|
|
124
101
|
}
|
|
125
102
|
|
|
126
103
|
callback(err, null);
|
|
@@ -130,17 +107,17 @@ function run(args, callback) {
|
|
|
130
107
|
|
|
131
108
|
function configure(env) {
|
|
132
109
|
env = env || {};
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
110
|
+
const watch = env.watch || env.w || process.env.NODE_ENV === 'dev' || process.env.NODE_ENV === 'development';
|
|
111
|
+
const PROD = !watch;
|
|
112
|
+
let https = !(process.env.HTTPS === 'false' || env.https === false),
|
|
136
113
|
host = process.env.HOST || env.host || 'localhost',
|
|
137
114
|
port = process.env.PORT || env.port || 8081;
|
|
138
|
-
|
|
115
|
+
let cwd = env.cwd = process.cwd(),
|
|
139
116
|
context = cwd,
|
|
140
117
|
pkg;
|
|
141
118
|
|
|
142
119
|
try {
|
|
143
|
-
pkg = require(_path
|
|
120
|
+
pkg = require(_path.default.resolve(cwd, 'package.json'));
|
|
144
121
|
} catch (e) {}
|
|
145
122
|
|
|
146
123
|
if (!pkg) {
|
|
@@ -150,26 +127,25 @@ function configure(env) {
|
|
|
150
127
|
} // entry point (initial file to load)
|
|
151
128
|
|
|
152
129
|
|
|
153
|
-
|
|
130
|
+
let entry = _path.default.resolve(cwd, pkg.module || pkg['jsnext:main'] || pkg.main);
|
|
154
131
|
|
|
155
|
-
if (isDir(entry)) entry = _path
|
|
132
|
+
if (isDir(entry)) entry = _path.default.resolve(entry, 'index.js'); // attempt to use ./src dir if present:
|
|
156
133
|
|
|
157
|
-
if (isDir(_path
|
|
134
|
+
if (isDir(_path.default.resolve(cwd, 'src'))) context = _path.default.resolve(context, 'src'); // normalize desination dir
|
|
158
135
|
|
|
159
|
-
|
|
136
|
+
let dest = _path.default.resolve(cwd, env.dest || 'build'); // use absolute paths
|
|
160
137
|
|
|
161
138
|
|
|
162
|
-
context = _path
|
|
163
|
-
|
|
164
|
-
|
|
139
|
+
context = _path.default.resolve(context);
|
|
140
|
+
let componentDirs = [_path.default.resolve(context, 'components'), _path.default.resolve(context, 'screens'), _path.default.resolve(context, 'pages')];
|
|
141
|
+
let cssLoaderOptions = {
|
|
165
142
|
sourceMap: watch && !PROD
|
|
166
143
|
};
|
|
167
|
-
|
|
144
|
+
let postCssLoaderOptions = {
|
|
168
145
|
sourceMap: true,
|
|
169
146
|
postcssOptions: {
|
|
170
147
|
config: false,
|
|
171
|
-
plugins: [(0, _postcssPresetEnv
|
|
172
|
-
browsers: ['last 2 versions', 'not ie > 0', 'iOS >= 8'],
|
|
148
|
+
plugins: [(0, _postcssPresetEnv.default)({
|
|
173
149
|
stage: 3,
|
|
174
150
|
autoprefixer: true,
|
|
175
151
|
features: {
|
|
@@ -177,50 +153,46 @@ function configure(env) {
|
|
|
177
153
|
// disable customProperties plugin so css variables and :root blocks are preserved
|
|
178
154
|
'custom-properties': false
|
|
179
155
|
}
|
|
180
|
-
}), (0, _postcssDiscardComments
|
|
156
|
+
}), (0, _postcssDiscardComments.default)({
|
|
181
157
|
removeAll: true
|
|
182
158
|
})]
|
|
183
159
|
}
|
|
184
160
|
};
|
|
185
|
-
|
|
186
|
-
|
|
161
|
+
let cssModulesRegexp = (0, _util.crossPlatformPathRegex)(/(?:([^/@]+?)(?:-(?:pages?|components?|screens?))?\/)?src\/(?:pages|components|screens)\/(.+?)(\/[a-z0-9._-]+[.](less|css))?$/);
|
|
162
|
+
let webpackConfig = {
|
|
187
163
|
mode: PROD ? 'production' : 'development',
|
|
188
|
-
context
|
|
189
|
-
entry: _path
|
|
164
|
+
context,
|
|
165
|
+
entry: _path.default.resolve(__dirname, 'entry.js'),
|
|
190
166
|
output: {
|
|
191
167
|
path: dest,
|
|
192
|
-
filename:
|
|
168
|
+
filename: `index.js`,
|
|
193
169
|
chunkFilename: '[name].[chunkhash:8].chunk.js',
|
|
194
170
|
// NOTE: Explicit public path is required in order to make HMR work within an sourceless iframe.
|
|
195
171
|
// This is due to a bug in webpack-dev-server that uses the document protocol for all https pages:
|
|
196
172
|
// https://github.com/webpack/webpack-dev-server/blob/c490b245ad65f315762e03e51710f7f7177b1e7b/client/index.js#L188-L190
|
|
197
|
-
publicPath: watch ?
|
|
173
|
+
publicPath: watch ? `http${https ? 's' : ''}://${host}:${port}/` : env.publicpath || '/'
|
|
198
174
|
},
|
|
199
175
|
resolve: {
|
|
200
176
|
extensions: ['.mjs', '.jsx', '.js', '.json', '.css', '.less'],
|
|
201
177
|
mainFields: ['browser', 'module', 'jsnext:main', 'main'],
|
|
202
|
-
modules: [_path
|
|
203
|
-
alias:
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}
|
|
212
|
-
|
|
213
|
-
shimAliases[name] = (0, _shims.getShimPath)(name);
|
|
214
|
-
return shimAliases;
|
|
215
|
-
}, {})), {}, {
|
|
178
|
+
modules: [_path.default.resolve(cwd, 'node_modules'), 'node_modules'],
|
|
179
|
+
alias: { ..._shims.SHIMMED_MODULES.reduce((shimAliases, name) => {
|
|
180
|
+
if (Array.isArray(name)) {
|
|
181
|
+
// If module name is an Array, the first element is the root name of the module
|
|
182
|
+
[name] = name;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
shimAliases[name] = (0, _shims.getShimPath)(name);
|
|
186
|
+
return shimAliases;
|
|
187
|
+
}, {}),
|
|
216
188
|
react: (0, _shims.getShimPath)('preact/compat'),
|
|
217
189
|
'react-dom': (0, _shims.getShimPath)('preact/compat'),
|
|
218
|
-
style: _path
|
|
219
|
-
'zimlet-cli-entrypoint': _path
|
|
220
|
-
}
|
|
190
|
+
style: _path.default.resolve(context, 'style'),
|
|
191
|
+
'zimlet-cli-entrypoint': _path.default.resolve(context, entry)
|
|
192
|
+
}
|
|
221
193
|
},
|
|
222
194
|
resolveLoader: {
|
|
223
|
-
modules: [_path
|
|
195
|
+
modules: [_path.default.resolve(__dirname, 'loaders'), _path.default.resolve(__dirname, '..', 'node_modules'), _path.default.resolve(cwd, 'node_modules')]
|
|
224
196
|
},
|
|
225
197
|
module: {
|
|
226
198
|
rules: [{
|
|
@@ -231,7 +203,8 @@ function configure(env) {
|
|
|
231
203
|
comments: true,
|
|
232
204
|
presets: [[require.resolve('@babel/preset-env'), {
|
|
233
205
|
loose: true,
|
|
234
|
-
modules: false
|
|
206
|
+
modules: false,
|
|
207
|
+
bugfixes: true
|
|
235
208
|
}]],
|
|
236
209
|
plugins: [require.resolve('@babel/plugin-syntax-dynamic-import'), [require.resolve('@babel/plugin-proposal-decorators'), {
|
|
237
210
|
legacy: true
|
|
@@ -246,16 +219,16 @@ function configure(env) {
|
|
|
246
219
|
// include: /(^|\/)src\/(?:components|screens)\//,
|
|
247
220
|
include: componentDirs,
|
|
248
221
|
use: [{
|
|
249
|
-
loader: _path
|
|
222
|
+
loader: _path.default.resolve(__dirname, 'zimlet-style-loader.js')
|
|
250
223
|
}, {
|
|
251
224
|
loader: 'css-loader',
|
|
252
|
-
options:
|
|
225
|
+
options: { ...cssLoaderOptions,
|
|
253
226
|
modules: {
|
|
254
227
|
localIdentRegExp: cssModulesRegexp,
|
|
255
228
|
localIdentName: '[1]_[2]_[local]'
|
|
256
229
|
},
|
|
257
230
|
importLoaders: 1
|
|
258
|
-
}
|
|
231
|
+
}
|
|
259
232
|
}, {
|
|
260
233
|
loader: 'postcss-loader',
|
|
261
234
|
options: postCssLoaderOptions
|
|
@@ -267,7 +240,7 @@ function configure(env) {
|
|
|
267
240
|
// exclude: /(^|\/)src\/(?:components|screens)\//,
|
|
268
241
|
exclude: componentDirs,
|
|
269
242
|
use: [{
|
|
270
|
-
loader: _path
|
|
243
|
+
loader: _path.default.resolve(__dirname, 'zimlet-style-loader.js')
|
|
271
244
|
}, {
|
|
272
245
|
loader: 'css-loader',
|
|
273
246
|
options: cssLoaderOptions
|
|
@@ -292,23 +265,23 @@ function configure(env) {
|
|
|
292
265
|
__dirname: false,
|
|
293
266
|
setImmediate: false
|
|
294
267
|
} : {},
|
|
295
|
-
plugins: [].concat(PROD ? [new _webpack
|
|
268
|
+
plugins: [].concat(PROD ? [new _webpack.default.HashedModuleIdsPlugin()] : [new _webpack.default.HotModuleReplacementPlugin()], new _webpack.default.LoaderOptionsPlugin({
|
|
296
269
|
minimize: PROD,
|
|
297
270
|
debug: !PROD
|
|
298
|
-
}), new _progressBarWebpackPlugin
|
|
299
|
-
format:
|
|
271
|
+
}), new _progressBarWebpackPlugin.default({
|
|
272
|
+
format: '\u001b[90m\u001b[44mBuild\u001b[49m\u001b[39m [:bar] \u001b[32m\u001b[1m:percent\u001b[22m\u001b[39m (:elapseds) \u001b[2m:msg\u001b[22m',
|
|
300
273
|
renderThrottle: 100,
|
|
301
274
|
summary: false
|
|
302
|
-
}), new _webpack
|
|
275
|
+
}), new _webpack.default.DefinePlugin({
|
|
303
276
|
'process.env.NODE_ENV': JSON.stringify(PROD ? 'production' : 'development')
|
|
304
|
-
}), isFile(_path
|
|
277
|
+
}), isFile(_path.default.resolve(cwd, 'config_template.xml')) && new _copyWebpackPlugin.default({
|
|
305
278
|
patterns: [{
|
|
306
|
-
from: _path
|
|
307
|
-
to: _path
|
|
279
|
+
from: _path.default.join(cwd, 'config_template.xml'),
|
|
280
|
+
to: _path.default.join(dest, 'config_template.xml')
|
|
308
281
|
}]
|
|
309
282
|
})).filter(Boolean),
|
|
310
283
|
watchOptions: {
|
|
311
|
-
ignored: ['build', dest, _path
|
|
284
|
+
ignored: ['build', dest, _path.default.resolve(cwd, 'node_modules')]
|
|
312
285
|
},
|
|
313
286
|
stats: 'errors-only',
|
|
314
287
|
devtool: watch ? 'cheap-module-eval-source-map' : 'source-map'
|
|
@@ -316,21 +289,23 @@ function configure(env) {
|
|
|
316
289
|
|
|
317
290
|
if (watch) {
|
|
318
291
|
webpackConfig.devServer = {
|
|
319
|
-
host
|
|
320
|
-
port
|
|
292
|
+
host,
|
|
293
|
+
port,
|
|
321
294
|
hot: !process.env.DISABLE_HOT,
|
|
322
|
-
https
|
|
295
|
+
https,
|
|
323
296
|
compress: true,
|
|
324
297
|
publicPath: '/',
|
|
325
298
|
contentBase: context,
|
|
326
299
|
disableHostCheck: true,
|
|
327
|
-
|
|
300
|
+
|
|
301
|
+
before(app) {
|
|
328
302
|
app.use(require('cors')({
|
|
329
303
|
maxAge: 3600
|
|
330
304
|
}));
|
|
331
305
|
},
|
|
306
|
+
|
|
332
307
|
watchOptions: {
|
|
333
|
-
ignored: ['build', dest, _path
|
|
308
|
+
ignored: ['build', dest, _path.default.resolve(cwd, 'node_modules')]
|
|
334
309
|
},
|
|
335
310
|
overlay: false,
|
|
336
311
|
noInfo: true,
|
|
@@ -339,18 +314,18 @@ function configure(env) {
|
|
|
339
314
|
};
|
|
340
315
|
}
|
|
341
316
|
|
|
342
|
-
(0, _transformConfig
|
|
317
|
+
(0, _transformConfig.default)(env, webpackConfig);
|
|
343
318
|
return webpackConfig;
|
|
344
319
|
}
|
|
345
320
|
|
|
346
321
|
function isDir(filepath) {
|
|
347
322
|
try {
|
|
348
|
-
return !!_fs
|
|
323
|
+
return !!_fs.default.statSync(filepath).isDirectory();
|
|
349
324
|
} catch (err) {}
|
|
350
325
|
}
|
|
351
326
|
|
|
352
327
|
function isFile(filepath) {
|
|
353
328
|
try {
|
|
354
|
-
return !!_fs
|
|
329
|
+
return !!_fs.default.statSync(filepath).isFile();
|
|
355
330
|
} catch (err) {}
|
|
356
331
|
}
|
|
@@ -3,13 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports
|
|
7
|
-
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
11
|
-
|
|
12
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
6
|
+
exports.default = asyncCommand;
|
|
13
7
|
|
|
14
8
|
function done(err, result) {
|
|
15
9
|
if (err) {
|
|
@@ -22,14 +16,14 @@ function done(err, result) {
|
|
|
22
16
|
}
|
|
23
17
|
|
|
24
18
|
function asyncCommand(options) {
|
|
25
|
-
return
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, done);
|
|
19
|
+
return { ...options,
|
|
20
|
+
|
|
21
|
+
handler(argv) {
|
|
22
|
+
let r = options.handler(argv, done);
|
|
23
|
+
if (r && r.then) r.then(result => done(null, result), done);
|
|
31
24
|
}
|
|
32
|
-
|
|
25
|
+
|
|
26
|
+
};
|
|
33
27
|
}
|
|
34
28
|
|
|
35
29
|
module.exports = exports.default;
|
package/dist/lib/setup.js
CHANGED
|
@@ -3,155 +3,77 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.install = install;
|
|
7
6
|
exports.addScripts = addScripts;
|
|
8
7
|
exports.initGit = initGit;
|
|
8
|
+
exports.install = install;
|
|
9
9
|
|
|
10
10
|
var _crossSpawnPromise = _interopRequireDefault(require("cross-spawn-promise"));
|
|
11
11
|
|
|
12
12
|
var _util = require("../util");
|
|
13
13
|
|
|
14
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : {
|
|
15
|
-
|
|
16
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
17
|
-
|
|
18
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
15
|
|
|
20
16
|
function install(cwd, isYarn) {
|
|
21
|
-
|
|
22
|
-
return (0, _crossSpawnPromise
|
|
23
|
-
cwd
|
|
17
|
+
let cmd = isYarn ? 'yarn' : 'npm';
|
|
18
|
+
return (0, _crossSpawnPromise.default)(cmd, ['install'], {
|
|
19
|
+
cwd,
|
|
24
20
|
stdio: 'ignore'
|
|
25
21
|
});
|
|
26
22
|
}
|
|
27
23
|
|
|
28
|
-
function addScripts(
|
|
29
|
-
return
|
|
24
|
+
async function addScripts(obj, cwd, isYarn) {
|
|
25
|
+
return {
|
|
26
|
+
build: 'zimlet build',
|
|
27
|
+
watch: 'zimlet watch',
|
|
28
|
+
package: 'zimlet package'
|
|
29
|
+
};
|
|
30
30
|
} // Initializes the folder using `git init` and a proper `.gitignore` file
|
|
31
31
|
// if `git` is present in the $PATH.
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
break;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
cwd = target;
|
|
75
|
-
_context2.next = 5;
|
|
76
|
-
return (0, _crossSpawnPromise["default"])('git', ['init'], {
|
|
77
|
-
cwd: cwd
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
case 5:
|
|
81
|
-
_context2.next = 7;
|
|
82
|
-
return (0, _crossSpawnPromise["default"])('git', ['add', '-A'], {
|
|
83
|
-
cwd: cwd
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
case 7:
|
|
87
|
-
defaultGitUser = 'Zimlet CLI';
|
|
88
|
-
defaultGitEmail = 'zimlet-cli@users.noreply.github.com';
|
|
89
|
-
_context2.prev = 9;
|
|
90
|
-
_context2.next = 12;
|
|
91
|
-
return (0, _crossSpawnPromise["default"])('git', ['config', 'user.name']);
|
|
92
|
-
|
|
93
|
-
case 12:
|
|
94
|
-
gitUser = _context2.sent.toString();
|
|
95
|
-
_context2.next = 19;
|
|
96
|
-
break;
|
|
97
|
-
|
|
98
|
-
case 15:
|
|
99
|
-
_context2.prev = 15;
|
|
100
|
-
_context2.t0 = _context2["catch"](9);
|
|
101
|
-
(0, _util.warn)("Git config value of user.name not defined. Defaulting to ".concat(defaultGitUser, " for initial commit message."));
|
|
102
|
-
gitUser = defaultGitUser;
|
|
103
|
-
|
|
104
|
-
case 19:
|
|
105
|
-
_context2.prev = 19;
|
|
106
|
-
_context2.next = 22;
|
|
107
|
-
return (0, _crossSpawnPromise["default"])('git', ['config', 'user.email']);
|
|
108
|
-
|
|
109
|
-
case 22:
|
|
110
|
-
gitEmail = _context2.sent.toString();
|
|
111
|
-
_context2.next = 29;
|
|
112
|
-
break;
|
|
113
|
-
|
|
114
|
-
case 25:
|
|
115
|
-
_context2.prev = 25;
|
|
116
|
-
_context2.t1 = _context2["catch"](19);
|
|
117
|
-
(0, _util.warn)("Git config value of user.email not defined. Defaulting to ".concat(defaultGitEmail, " for initial commit message."));
|
|
118
|
-
gitEmail = defaultGitEmail;
|
|
119
|
-
|
|
120
|
-
case 29:
|
|
121
|
-
_context2.prev = 29;
|
|
122
|
-
_context2.next = 32;
|
|
123
|
-
return (0, _crossSpawnPromise["default"])('git', ['commit', '-m', 'initial commit from zimlet-cli'], {
|
|
124
|
-
cwd: cwd,
|
|
125
|
-
env: {
|
|
126
|
-
GIT_COMMITTER_NAME: gitUser,
|
|
127
|
-
GIT_COMMITTER_EMAIL: gitEmail,
|
|
128
|
-
GIT_AUTHOR_NAME: gitUser,
|
|
129
|
-
GIT_AUTHOR_EMAIL: gitEmail
|
|
130
|
-
}
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
case 32:
|
|
134
|
-
_context2.next = 37;
|
|
135
|
-
break;
|
|
136
|
-
|
|
137
|
-
case 34:
|
|
138
|
-
_context2.prev = 34;
|
|
139
|
-
_context2.t2 = _context2["catch"](29);
|
|
140
|
-
(0, _util.warn)("could not make initial git commit: ".concat(_context2.t2));
|
|
141
|
-
|
|
142
|
-
case 37:
|
|
143
|
-
_context2.next = 40;
|
|
144
|
-
break;
|
|
145
|
-
|
|
146
|
-
case 39:
|
|
147
|
-
(0, _util.warn)('Could not locate `git` binary in `$PATH`. Skipping!');
|
|
148
|
-
|
|
149
|
-
case 40:
|
|
150
|
-
case "end":
|
|
151
|
-
return _context2.stop();
|
|
34
|
+
async function initGit(target) {
|
|
35
|
+
let git = (0, _util.hasCommand)('git');
|
|
36
|
+
|
|
37
|
+
if (git) {
|
|
38
|
+
const cwd = target;
|
|
39
|
+
await (0, _crossSpawnPromise.default)('git', ['init'], {
|
|
40
|
+
cwd
|
|
41
|
+
});
|
|
42
|
+
await (0, _crossSpawnPromise.default)('git', ['add', '-A'], {
|
|
43
|
+
cwd
|
|
44
|
+
});
|
|
45
|
+
let gitUser, gitEmail;
|
|
46
|
+
const defaultGitUser = 'Zimlet CLI';
|
|
47
|
+
const defaultGitEmail = 'zimlet-cli@users.noreply.github.com';
|
|
48
|
+
|
|
49
|
+
try {
|
|
50
|
+
gitUser = (await (0, _crossSpawnPromise.default)('git', ['config', 'user.name'])).toString();
|
|
51
|
+
} catch (e) {
|
|
52
|
+
(0, _util.warn)(`Git config value of user.name not defined. Defaulting to ${defaultGitUser} for initial commit message.`);
|
|
53
|
+
gitUser = defaultGitUser;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
try {
|
|
57
|
+
gitEmail = (await (0, _crossSpawnPromise.default)('git', ['config', 'user.email'])).toString();
|
|
58
|
+
} catch (e) {
|
|
59
|
+
(0, _util.warn)(`Git config value of user.email not defined. Defaulting to ${defaultGitEmail} for initial commit message.`);
|
|
60
|
+
gitEmail = defaultGitEmail;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
await (0, _crossSpawnPromise.default)('git', ['commit', '-m', 'initial commit from zimlet-cli'], {
|
|
65
|
+
cwd,
|
|
66
|
+
env: {
|
|
67
|
+
GIT_COMMITTER_NAME: gitUser,
|
|
68
|
+
GIT_COMMITTER_EMAIL: gitEmail,
|
|
69
|
+
GIT_AUTHOR_NAME: gitUser,
|
|
70
|
+
GIT_AUTHOR_EMAIL: gitEmail
|
|
152
71
|
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
|
|
72
|
+
});
|
|
73
|
+
} catch (e) {
|
|
74
|
+
(0, _util.warn)(`could not make initial git commit: ${e}`);
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
(0, _util.warn)('Could not locate `git` binary in `$PATH`. Skipping!');
|
|
78
|
+
}
|
|
157
79
|
}
|