datagrok-tools 4.7.8 → 4.7.10

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.
@@ -10,6 +10,7 @@ Object.defineProperty(exports, "__esModule", {
10
10
  exports.check = check;
11
11
  exports.checkFuncSignatures = checkFuncSignatures;
12
12
  exports.checkImportStatements = checkImportStatements;
13
+ exports.checkPackageFile = checkPackageFile;
13
14
  exports.extractExternals = extractExternals;
14
15
 
15
16
  var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
@@ -220,10 +221,31 @@ function checkFuncSignatures(packagePath, files) {
220
221
  message: message
221
222
  };
222
223
  },
223
- fileViewer: function fileViewer(_ref3) {
224
+ viewer: function viewer(_ref3) {
224
225
  var inputs = _ref3.inputs,
225
- outputs = _ref3.outputs,
226
- tags = _ref3.tags;
226
+ outputs = _ref3.outputs;
227
+ var value = true;
228
+ var message = '';
229
+
230
+ if (inputs.length !== 0) {
231
+ value = false;
232
+ message += 'Viewer functions should take no arguments\n';
233
+ }
234
+
235
+ if (outputs.length > 1 || outputs.length === 1 && outputs[0].type !== 'viewer') {
236
+ value = false;
237
+ message += 'Viewers must have one output of type "viewer"\n';
238
+ }
239
+
240
+ return {
241
+ value: value,
242
+ message: message
243
+ };
244
+ },
245
+ fileViewer: function fileViewer(_ref4) {
246
+ var inputs = _ref4.inputs,
247
+ outputs = _ref4.outputs,
248
+ tags = _ref4.tags;
227
249
  var value = true;
228
250
  var message = '';
229
251
 
@@ -249,8 +271,8 @@ function checkFuncSignatures(packagePath, files) {
249
271
  message: message
250
272
  };
251
273
  },
252
- fileExporter: function fileExporter(_ref4) {
253
- var description = _ref4.description;
274
+ fileExporter: function fileExporter(_ref5) {
275
+ var description = _ref5.description;
254
276
  var value = true;
255
277
  var message = '';
256
278
 
@@ -264,8 +286,8 @@ function checkFuncSignatures(packagePath, files) {
264
286
  message: message
265
287
  };
266
288
  },
267
- packageSettingsEditor: function packageSettingsEditor(_ref5) {
268
- var outputs = _ref5.outputs;
289
+ packageSettingsEditor: function packageSettingsEditor(_ref6) {
290
+ var outputs = _ref6.outputs;
269
291
  var value = true;
270
292
  var message = '';
271
293
 
@@ -62,7 +62,7 @@ function processPackage(_x, _x2, _x3, _x4, _x5, _x6) {
62
62
 
63
63
  function _processPackage() {
64
64
  _processPackage = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(debug, rebuild, host, devKey, packageName, suffix) {
65
- var timestamps, url, zip, localTimestamps, files, isWebpack, distFiles, contentValidationLog, checkStart, jsTsFiles, webpackConfigPath, content, externals, importWarnings, funcFiles, funcWarnings, uploadPromise, log;
65
+ var timestamps, url, zip, localTimestamps, files, isWebpack, distFiles, contentValidationLog, checkStart, jsTsFiles, webpackConfigPath, content, externals, importWarnings, funcFiles, funcWarnings, packageWarnings, uploadPromise, log;
66
66
  return _regenerator["default"].wrap(function _callee3$(_context3) {
67
67
  while (1) {
68
68
  switch (_context3.prev = _context3.next) {
@@ -179,6 +179,8 @@ function _processPackage() {
179
179
  });
180
180
  funcWarnings = (0, _check.checkFuncSignatures)(curDir, funcFiles);
181
181
  contentValidationLog += funcWarnings.join('\n') + (funcWarnings.length ? '\n' : '');
182
+ packageWarnings = (0, _check.checkPackageFile)(curDir);
183
+ contentValidationLog += packageWarnings.join('\n') + (packageWarnings.length ? '\n' : '');
182
184
  console.log("Checks finished in ".concat(Date.now() - checkStart, " ms"));
183
185
  files.forEach(function (file) {
184
186
  var fullPath = file;
@@ -265,21 +267,21 @@ function _processPackage() {
265
267
  })["catch"](function (error) {
266
268
  console.error(error);
267
269
  });
268
- _context3.next = 50;
270
+ _context3.next = 52;
269
271
  return zip.finalize();
270
272
 
271
- case 50:
272
- _context3.prev = 50;
273
- _context3.next = 53;
273
+ case 52:
274
+ _context3.prev = 52;
275
+ _context3.next = 55;
274
276
  return uploadPromise;
275
277
 
276
- case 53:
278
+ case 55:
277
279
  log = _context3.sent;
278
280
 
279
281
  _fs["default"].unlinkSync('zip');
280
282
 
281
283
  if (!(log['#type'] === 'ApiError')) {
282
- _context3.next = 61;
284
+ _context3.next = 63;
283
285
  break;
284
286
  }
285
287
 
@@ -287,29 +289,29 @@ function _processPackage() {
287
289
  console.error(log['innerMessage']);
288
290
  return _context3.abrupt("return", 1);
289
291
 
290
- case 61:
292
+ case 63:
291
293
  console.log(log);
292
294
  color.warn(contentValidationLog);
293
295
 
294
- case 63:
295
- _context3.next = 69;
296
+ case 65:
297
+ _context3.next = 71;
296
298
  break;
297
299
 
298
- case 65:
299
- _context3.prev = 65;
300
- _context3.t1 = _context3["catch"](50);
300
+ case 67:
301
+ _context3.prev = 67;
302
+ _context3.t1 = _context3["catch"](52);
301
303
  console.error(_context3.t1);
302
304
  return _context3.abrupt("return", 1);
303
305
 
304
- case 69:
306
+ case 71:
305
307
  return _context3.abrupt("return", 0);
306
308
 
307
- case 70:
309
+ case 72:
308
310
  case "end":
309
311
  return _context3.stop();
310
312
  }
311
313
  }
312
- }, _callee3, null, [[3, 14], [50, 65]]);
314
+ }, _callee3, null, [[3, 14], [52, 67]]);
313
315
  }));
314
316
  return _processPackage.apply(this, arguments);
315
317
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.7.8",
3
+ "version": "4.7.10",
4
4
  "description": "Utility to upload and publish packages to Datagrok",
5
5
  "homepage": "https://github.com/datagrok-ai/public/tree/master/tools#readme",
6
6
  "dependencies": {