datagrok-tools 4.6.1 → 4.6.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/bin/commands/check.js +3 -0
- package/bin/commands/publish.js +46 -17
- package/package.json +1 -1
package/bin/commands/check.js
CHANGED
|
@@ -8,6 +8,9 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
value: true
|
|
9
9
|
});
|
|
10
10
|
exports.check = check;
|
|
11
|
+
exports.checkFuncSignatures = checkFuncSignatures;
|
|
12
|
+
exports.checkImportStatements = checkImportStatements;
|
|
13
|
+
exports.extractExternals = extractExternals;
|
|
11
14
|
|
|
12
15
|
var _fs = _interopRequireDefault(require("fs"));
|
|
13
16
|
|
package/bin/commands/publish.js
CHANGED
|
@@ -28,6 +28,8 @@ var _ignoreWalk = _interopRequireDefault(require("ignore-walk"));
|
|
|
28
28
|
|
|
29
29
|
var _jsYaml = _interopRequireDefault(require("js-yaml"));
|
|
30
30
|
|
|
31
|
+
var _check = require("./check");
|
|
32
|
+
|
|
31
33
|
var utils = _interopRequireWildcard(require("../utils/utils"));
|
|
32
34
|
|
|
33
35
|
var color = _interopRequireWildcard(require("../utils/color-utils"));
|
|
@@ -52,13 +54,15 @@ var curDir = process.cwd();
|
|
|
52
54
|
|
|
53
55
|
var packDir = _path["default"].join(curDir, 'package.json');
|
|
54
56
|
|
|
57
|
+
var packageFiles = ['src/package.ts', 'src/detectors.ts', 'src/package.js', 'src/detectors.js', 'src/package-test.ts', 'src/package-test.js', 'package.js', 'detectors.js'];
|
|
58
|
+
|
|
55
59
|
function processPackage(_x, _x2, _x3, _x4, _x5, _x6) {
|
|
56
60
|
return _processPackage.apply(this, arguments);
|
|
57
61
|
}
|
|
58
62
|
|
|
59
63
|
function _processPackage() {
|
|
60
64
|
_processPackage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(debug, rebuild, host, devKey, packageName, suffix) {
|
|
61
|
-
var timestamps, url, zip, localTimestamps, files, isWebpack, distFiles, contentValidationLog, uploadPromise, log;
|
|
65
|
+
var timestamps, url, zip, localTimestamps, files, isWebpack, distFiles, contentValidationLog, checkStart, jsTsFiles, webpackConfigPath, content, externals, importWarnings, funcFiles, funcWarnings, uploadPromise, log;
|
|
62
66
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
63
67
|
while (1) {
|
|
64
68
|
switch (_context3.prev = _context3.next) {
|
|
@@ -151,6 +155,31 @@ function _processPackage() {
|
|
|
151
155
|
|
|
152
156
|
case 34:
|
|
153
157
|
contentValidationLog = '';
|
|
158
|
+
console.log('Starting package checks...');
|
|
159
|
+
checkStart = Date.now();
|
|
160
|
+
jsTsFiles = files.filter(function (f) {
|
|
161
|
+
return !f.startsWith('dist/') && (f.endsWith('.js') || f.endsWith('.ts'));
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
if (isWebpack) {
|
|
165
|
+
webpackConfigPath = _path["default"].join(curDir, 'webpack.config.js');
|
|
166
|
+
content = _fs["default"].readFileSync(webpackConfigPath, {
|
|
167
|
+
encoding: 'utf-8'
|
|
168
|
+
});
|
|
169
|
+
externals = (0, _check.extractExternals)(content);
|
|
170
|
+
|
|
171
|
+
if (externals) {
|
|
172
|
+
importWarnings = (0, _check.checkImportStatements)(curDir, jsTsFiles, externals);
|
|
173
|
+
contentValidationLog += importWarnings.join('\n') + (importWarnings.length ? '\n' : '');
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
funcFiles = jsTsFiles.filter(function (f) {
|
|
178
|
+
return packageFiles.includes(f);
|
|
179
|
+
});
|
|
180
|
+
funcWarnings = (0, _check.checkFuncSignatures)(curDir, funcFiles);
|
|
181
|
+
contentValidationLog += funcWarnings.join('\n') + (funcWarnings.length ? '\n' : '');
|
|
182
|
+
console.log("Checks finished in ".concat(Date.now() - checkStart, " ms"));
|
|
154
183
|
files.forEach(function (file) {
|
|
155
184
|
var fullPath = file;
|
|
156
185
|
|
|
@@ -236,21 +265,21 @@ function _processPackage() {
|
|
|
236
265
|
})["catch"](function (error) {
|
|
237
266
|
console.error(error);
|
|
238
267
|
});
|
|
239
|
-
_context3.next =
|
|
268
|
+
_context3.next = 50;
|
|
240
269
|
return zip.finalize();
|
|
241
270
|
|
|
242
|
-
case
|
|
243
|
-
_context3.prev =
|
|
244
|
-
_context3.next =
|
|
271
|
+
case 50:
|
|
272
|
+
_context3.prev = 50;
|
|
273
|
+
_context3.next = 53;
|
|
245
274
|
return uploadPromise;
|
|
246
275
|
|
|
247
|
-
case
|
|
276
|
+
case 53:
|
|
248
277
|
log = _context3.sent;
|
|
249
278
|
|
|
250
279
|
_fs["default"].unlinkSync('zip');
|
|
251
280
|
|
|
252
281
|
if (!(log['#type'] === 'ApiError')) {
|
|
253
|
-
_context3.next =
|
|
282
|
+
_context3.next = 61;
|
|
254
283
|
break;
|
|
255
284
|
}
|
|
256
285
|
|
|
@@ -258,29 +287,29 @@ function _processPackage() {
|
|
|
258
287
|
console.error(log['innerMessage']);
|
|
259
288
|
return _context3.abrupt("return", 1);
|
|
260
289
|
|
|
261
|
-
case
|
|
290
|
+
case 61:
|
|
262
291
|
console.log(log);
|
|
263
292
|
color.warn(contentValidationLog);
|
|
264
293
|
|
|
265
|
-
case
|
|
266
|
-
_context3.next =
|
|
294
|
+
case 63:
|
|
295
|
+
_context3.next = 69;
|
|
267
296
|
break;
|
|
268
297
|
|
|
269
|
-
case
|
|
270
|
-
_context3.prev =
|
|
271
|
-
_context3.t1 = _context3["catch"](
|
|
298
|
+
case 65:
|
|
299
|
+
_context3.prev = 65;
|
|
300
|
+
_context3.t1 = _context3["catch"](50);
|
|
272
301
|
console.error(_context3.t1);
|
|
273
302
|
return _context3.abrupt("return", 1);
|
|
274
303
|
|
|
275
|
-
case
|
|
304
|
+
case 69:
|
|
276
305
|
return _context3.abrupt("return", 0);
|
|
277
306
|
|
|
278
|
-
case
|
|
307
|
+
case 70:
|
|
279
308
|
case "end":
|
|
280
309
|
return _context3.stop();
|
|
281
310
|
}
|
|
282
311
|
}
|
|
283
|
-
}, _callee3, null, [[3, 14], [
|
|
312
|
+
}, _callee3, null, [[3, 14], [50, 65]]);
|
|
284
313
|
}));
|
|
285
314
|
return _processPackage.apply(this, arguments);
|
|
286
315
|
}
|
|
@@ -294,7 +323,7 @@ function publish(args) {
|
|
|
294
323
|
})) return false;
|
|
295
324
|
|
|
296
325
|
if (args.build && args.rebuild) {
|
|
297
|
-
color.error('Incompatible options: --build and');
|
|
326
|
+
color.error('Incompatible options: --build and --rebuild');
|
|
298
327
|
return false;
|
|
299
328
|
}
|
|
300
329
|
|
package/package.json
CHANGED