datagrok-tools 4.12.22 → 4.12.23
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/bin/commands/publish.js +59 -19
- package/package.json +1 -1
package/bin/commands/publish.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.processPackage = processPackage;
|
|
9
9
|
exports.publish = publish;
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
12
13
|
var _archiverPromise = _interopRequireDefault(require("archiver-promise"));
|
|
13
14
|
var _fs = _interopRequireDefault(require("fs"));
|
|
@@ -21,10 +22,10 @@ var utils = _interopRequireWildcard(require("../utils/utils"));
|
|
|
21
22
|
var color = _interopRequireWildcard(require("../utils/color-utils"));
|
|
22
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
23
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
25
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
26
|
+
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); }
|
|
27
|
+
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; } // @ts-ignore
|
|
24
28
|
// @ts-ignore
|
|
25
|
-
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
|
|
28
29
|
var grokDir = _path["default"].join(_os["default"].homedir(), '.grok');
|
|
29
30
|
var confPath = _path["default"].join(grokDir, 'config.yaml');
|
|
30
31
|
var confTemplateDir = _path["default"].join(_path["default"].dirname(_path["default"].dirname(__dirname)), 'config-template.yaml');
|
|
@@ -39,7 +40,7 @@ function processPackage(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
|
39
40
|
}
|
|
40
41
|
function _processPackage() {
|
|
41
42
|
_processPackage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(debug, rebuild, host, devKey, packageName, suffix) {
|
|
42
|
-
var timestamps, url, zip, localTimestamps, files, isWebpack, distFiles, contentValidationLog, checkStart, jsTsFiles, packageFilePath, json, webpackConfigPath, content, externals, importWarnings, funcFiles, funcWarnings, packageWarnings, changelogWarnings, uploadPromise, log;
|
|
43
|
+
var timestamps, url, zip, localTimestamps, files, isWebpack, distFiles, contentValidationLog, checkStart, jsTsFiles, packageFilePath, json, webpackConfigPath, content, externals, importWarnings, funcFiles, funcWarnings, packageWarnings, changelogWarnings, reg, errs, uploadPromise, log;
|
|
43
44
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
44
45
|
while (1) switch (_context3.prev = _context3.next) {
|
|
45
46
|
case 0:
|
|
@@ -144,6 +145,8 @@ function _processPackage() {
|
|
|
144
145
|
changelogWarnings = (0, _check.checkChangelog)(curDir, json);
|
|
145
146
|
contentValidationLog += changelogWarnings.join('\n') + (packageWarnings.length ? '\n' : '');
|
|
146
147
|
console.log("Checks finished in ".concat(Date.now() - checkStart, " ms"));
|
|
148
|
+
reg = new RegExp(/\${(\w*)}/g);
|
|
149
|
+
errs = [];
|
|
147
150
|
files.forEach(function (file) {
|
|
148
151
|
var fullPath = file;
|
|
149
152
|
var relativePath = _path["default"].relative(curDir, fullPath);
|
|
@@ -166,11 +169,48 @@ function _processPackage() {
|
|
|
166
169
|
console.log("Skipping ".concat(canonicalRelativePath));
|
|
167
170
|
return;
|
|
168
171
|
}
|
|
172
|
+
if (canonicalRelativePath.startsWith('connections/')) {
|
|
173
|
+
var f = _fs["default"].readFileSync(fullPath, {
|
|
174
|
+
encoding: 'utf-8'
|
|
175
|
+
});
|
|
176
|
+
var matches = (0, _toConsumableArray2["default"])(f.matchAll(reg));
|
|
177
|
+
var _iterator = _createForOfIteratorHelper(matches),
|
|
178
|
+
_step;
|
|
179
|
+
try {
|
|
180
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
181
|
+
var m = _step.value;
|
|
182
|
+
var envVar = process.env[m[1]];
|
|
183
|
+
if (!envVar) {
|
|
184
|
+
errs.push("".concat(canonicalRelativePath, ": cannot find environment variable \"").concat(m[1], "\""));
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
f = f.replace(m[0], envVar);
|
|
188
|
+
}
|
|
189
|
+
} catch (err) {
|
|
190
|
+
_iterator.e(err);
|
|
191
|
+
} finally {
|
|
192
|
+
_iterator.f();
|
|
193
|
+
}
|
|
194
|
+
zip.append(f, {
|
|
195
|
+
name: relativePath
|
|
196
|
+
});
|
|
197
|
+
console.log("Adding ".concat(canonicalRelativePath, "..."));
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
169
200
|
zip.append(_fs["default"].createReadStream(fullPath), {
|
|
170
201
|
name: relativePath
|
|
171
202
|
});
|
|
172
203
|
console.log("Adding ".concat(canonicalRelativePath, "..."));
|
|
173
204
|
});
|
|
205
|
+
if (!errs.length) {
|
|
206
|
+
_context3.next = 55;
|
|
207
|
+
break;
|
|
208
|
+
}
|
|
209
|
+
errs.forEach(function (e) {
|
|
210
|
+
return console.log('\x1b[31m%s\x1b[0m', e);
|
|
211
|
+
});
|
|
212
|
+
return _context3.abrupt("return", 1);
|
|
213
|
+
case 55:
|
|
174
214
|
zip.append(JSON.stringify(localTimestamps), {
|
|
175
215
|
name: 'timestamps.json'
|
|
176
216
|
});
|
|
@@ -215,40 +255,40 @@ function _processPackage() {
|
|
|
215
255
|
})["catch"](function (error) {
|
|
216
256
|
console.error(error);
|
|
217
257
|
});
|
|
218
|
-
_context3.next =
|
|
258
|
+
_context3.next = 61;
|
|
219
259
|
return zip.finalize();
|
|
220
|
-
case
|
|
221
|
-
_context3.prev =
|
|
222
|
-
_context3.next =
|
|
260
|
+
case 61:
|
|
261
|
+
_context3.prev = 61;
|
|
262
|
+
_context3.next = 64;
|
|
223
263
|
return uploadPromise;
|
|
224
|
-
case
|
|
264
|
+
case 64:
|
|
225
265
|
log = _context3.sent;
|
|
226
266
|
_fs["default"].unlinkSync('zip');
|
|
227
267
|
if (!(log['#type'] === 'ApiError')) {
|
|
228
|
-
_context3.next =
|
|
268
|
+
_context3.next = 72;
|
|
229
269
|
break;
|
|
230
270
|
}
|
|
231
271
|
color.error(log['message']);
|
|
232
272
|
console.error(log['innerMessage']);
|
|
233
273
|
return _context3.abrupt("return", 1);
|
|
234
|
-
case
|
|
274
|
+
case 72:
|
|
235
275
|
console.log(log);
|
|
236
276
|
color.warn(contentValidationLog);
|
|
237
|
-
case
|
|
238
|
-
_context3.next =
|
|
277
|
+
case 74:
|
|
278
|
+
_context3.next = 80;
|
|
239
279
|
break;
|
|
240
|
-
case
|
|
241
|
-
_context3.prev =
|
|
242
|
-
_context3.t1 = _context3["catch"](
|
|
280
|
+
case 76:
|
|
281
|
+
_context3.prev = 76;
|
|
282
|
+
_context3.t1 = _context3["catch"](61);
|
|
243
283
|
console.error(_context3.t1);
|
|
244
284
|
return _context3.abrupt("return", 1);
|
|
245
|
-
case
|
|
285
|
+
case 80:
|
|
246
286
|
return _context3.abrupt("return", 0);
|
|
247
|
-
case
|
|
287
|
+
case 81:
|
|
248
288
|
case "end":
|
|
249
289
|
return _context3.stop();
|
|
250
290
|
}
|
|
251
|
-
}, _callee3, null, [[3, 14], [
|
|
291
|
+
}, _callee3, null, [[3, 14], [61, 76]]);
|
|
252
292
|
}));
|
|
253
293
|
return _processPackage.apply(this, arguments);
|
|
254
294
|
}
|
package/package.json
CHANGED