datagrok-tools 4.13.66 → 4.13.67

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Datagrok-tools changelog
2
2
 
3
+ ## 4.13.67 (2025-03-26)
4
+
5
+ ### Features
6
+
7
+ * Updated grok link:
8
+ * Excluded diff-grok from linking
9
+ * Added verbose option
10
+ * Updated help
11
+
3
12
  ## 4.13.66 (2025-03-21)
4
13
 
5
14
  ### Features
package/README.md CHANGED
@@ -106,7 +106,9 @@ For more information on configuring connections, refer to the [Connections](http
106
106
  (applies the same options as `create`).
107
107
  - `test` runs package tests. First, it builds a package and publishes it (these
108
108
  steps can be skipped with flags `--skip-build` and `--skip-publish`
109
- correspondingly).
109
+ correspondingly). Also, it can be used to debug tests by using(`gui` and `debug` flags).
110
+ - `testall` runs tests from the packages directory. It works similarly to `test`, but this function allows tests to run
111
+ from different packages in a specified order.
110
112
 
111
113
  ```shell
112
114
  cd <package-name>
@@ -122,19 +124,20 @@ For more information on configuring connections, refer to the [Connections](http
122
124
  instructions](https://datagrok.ai/help/develop/how-to/test-packages#local-testing).
123
125
 
124
126
  Table with all available flags:
125
- | Flag | Description |
126
- |----------------|---------------------------------------------------------------------------|
127
- | catchUnhandled | Whether or not to catch unhandled exceptions during tests |
128
- | category | Runs tests of a specific category |
129
- | csv | Saves tests run results as a CSV file in the package folder |
130
- | gui | Disables the headless browser mode |
131
- | host | Specify server alias |
132
- | record | Records the test execution process in mp4 format |
133
- | report | Sends a report on test results |
134
- | skip-build | Skips package build step |
135
- | skip-publish | Skips package publish step |
136
- | verbose | Prints detailed information about passed and skipped tests in the console |
137
- | platform | Runs only platform tests (applicable for ApiTests package only) |
138
- | core | Runs package & core tests (applicable for DevTools package only) |
127
+ | Flag | Description |
128
+ |----------------|--------------------------------------------------------------------------------------------------------------------------------|
129
+ | catchUnhandled | Whether or not to catch unhandled exceptions during tests |
130
+ | category | Runs tests of a specific category |
131
+ | csv | Saves tests run results as a CSV file in the package folder |
132
+ | gui | Disables the headless browser mode |
133
+ | host | Specify server alias |
134
+ | record | Records the test execution process in mp4 format |
135
+ | report | Sends a report on test results |
136
+ | skip-build | Skips package build step |
137
+ | skip-publish | Skips package publish step |
138
+ | verbose | Prints detailed information about passed and skipped tests in the console |
139
+ | platform | Runs only platform tests (applicable for ApiTests package only) |
140
+ | core | Runs package & core tests (applicable for DevTools package only) |
141
+ | debug | Enables debug point on tests run, so testing would be stopped o debug before each test run (useless without gui mode) |
139
142
 
140
143
  - `link` command is used for public plugins development to link `datagrok-api` and libraries.
@@ -14,7 +14,7 @@ var HELP_PUBLISH = "\nUsage: grok publish [host]\n\nUpload a package\n\nOptions:
14
14
  var HELP_CHECK = "\nUsage: grok check\n\nOptions:\n[-r | --recursive]\n\n--recursive Check all packages in the current directory\n\nCheck package content (function signatures, import statements of external modules, etc.)\n";
15
15
  var HELP_TEST = "\nUsage: grok test\n\nOptions:\n[--package] [--category] [--test] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--link] [--catchUnhandled] [--report] [--record] [--verbose] [--platform] [--benchmark] [--stress-test] --[debug]\n\n--package Specify a package name to run tests for\n--category Specify a category name to run tests for\n--test Specify a test name to run \n--host Host alias as in the config file\n--csv Save the test report in a CSV file\n--gui Launch graphical interface (non-headless mode)\n--debug Enables debug point on tests run (useless without gui mode) \n--catchUnhandled Catch unhandled exceptions during test execution (default=true)\n--report Report failed tests to audit, notifies package author (default=false)\n--skip-build Skip the package build step\n--skip-publish Skip the package publication step\n--link \t Link the package to local utils\n--record Records the test execution process in mp4 format\n--verbose Prints detailed information about passed and skipped tests in the console\n--platform Runs only platform tests (applicable for ApiTests package only)\n--core Runs package & auto tests & core tests (core tests run only from DevTools package)\n--benchmark \t Runs tests in benchmark mode\n--stress-test Runs shuffled stress-test only\n \nRun package tests\n\nSee instructions:\nhttps://datagrok.ai/help/develop/how-to/test-packages#local-testing\n";
16
16
  var HELP_TESTALL = "\nUsage: grok testall\n\nOptions:\n[--packages] [--host] [--csv] [--gui] [--skip-build] [--skip-publish] [--link-package] [--catchUnhandled] [--report] [--record] [--verbose] [--benchmark] [--stress-test] [--order] [--tags] [--testRepeat] [--browsers-count] [--debug]\n\n--packages Specify a packages names to run tests for\n--host Host alias as in the config file\n--csv Save the test report in a CSV file\n--gui Launch graphical interface (non-headless mode)\n--debug Enables debug point on tests run (useless without gui mode) \n--catchUnhandled Catch unhandled exceptions during test execution (default=true)\n--report Report failed tests to audit, notifies packages author (default=false)\n--skip-build Skip the packages build step\n--skip-publish Skip the packages publication step\n--link-package \t Link the packages to local utils\n--record Records the test execution process in mp4 format\n--verbose Prints detailed information about passed and skipped tests in the console\n--core Runs packages & core tests (applicable for DevTools packages only)\n--benchmark \t Runs tests in benchmark mode\n--stress-test Runs shuffled stress-test only\n--order Specify order for tests invocation\n--tags Filter tests by tag name for run\n--testRepeat Set amount of tests repeats\n--browsers-count Set amount of browsers for tests run\n\nRun tests of all or specified packages \n\nSee instructions:\nhttps://datagrok.ai/help/develop/how-to/test-packages#local-testing\n";
17
- var HELP_LINK = "\nUsage: grok link\n\nLink `datagrok-api` and libraries for local development\n";
17
+ var HELP_LINK = "\nUsage: grok link\n\nLink `datagrok-api` and libraries for local development\n\nOptions:\n--dev Links also dev dependencies\n--verbose Prints detailed information about linked packages \n";
18
18
 
19
19
  // const HELP_MIGRATE = `
20
20
  // Usage: grok migrate
@@ -17,6 +17,7 @@ function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol
17
17
  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); }
18
18
  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; } /* eslint-disable valid-jsdoc */
19
19
  var repositoryDirNameRegex = new RegExp(_path["default"].join('1', '2')[1] + 'public$');
20
+ var excludedPackages = ['@datagrok/diff-grok'];
20
21
  var curDir = process.cwd();
21
22
  var devMode = false;
22
23
  var repositoryDir = curDir;
@@ -26,6 +27,7 @@ while (_path["default"].dirname(repositoryDir) !== repositoryDir) {
26
27
  if (repositoryDirNameRegex.test(repositoryDir)) break;
27
28
  repositoryDir = _path["default"].dirname(repositoryDir);
28
29
  }
30
+ var verbose = false;
29
31
  var apiDir = _path["default"].join(repositoryDir, 'js-api');
30
32
  var libDir = _path["default"].join(repositoryDir, 'libraries');
31
33
  var packageDir = _path["default"].join(repositoryDir, 'packages');
@@ -37,19 +39,21 @@ function link(_x) {
37
39
  }
38
40
  function _link() {
39
41
  _link = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(args) {
42
+ var _args$verbose;
40
43
  return _regenerator["default"].wrap(function _callee$(_context) {
41
44
  while (1) switch (_context.prev = _context.next) {
42
45
  case 0:
46
+ verbose = (_args$verbose = args.verbose) !== null && _args$verbose !== void 0 ? _args$verbose : false;
43
47
  localPackageDependencies = [];
44
48
  packagesToLink = new Set();
45
49
  if (args.dev !== undefined) devMode = args.dev;
46
50
  collectPackagesData(curDir);
47
- _context.next = 6;
51
+ _context.next = 7;
48
52
  return linkPackages();
49
- case 6:
53
+ case 7:
50
54
  console.log('Package linked');
51
55
  return _context.abrupt("return", true);
52
- case 8:
56
+ case 9:
53
57
  case "end":
54
58
  return _context.stop();
55
59
  }
@@ -95,79 +99,101 @@ function linkPackages() {
95
99
  }
96
100
  function _linkPackages() {
97
101
  _linkPackages = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
98
- var anyChanges, mapElements, _iterator, _step, element, names;
102
+ var anyChanges, _iterator, _step, _element, mapElements, _iterator2, _step2, element, names;
99
103
  return _regenerator["default"].wrap(function _callee2$(_context2) {
100
104
  while (1) switch (_context2.prev = _context2.next) {
101
105
  case 0:
102
106
  anyChanges = true;
103
- case 1:
107
+ _iterator = _createForOfIteratorHelper(excludedPackages);
108
+ try {
109
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
110
+ _element = _step.value;
111
+ packagesToLink["delete"](_element);
112
+ }
113
+ } catch (err) {
114
+ _iterator.e(err);
115
+ } finally {
116
+ _iterator.f();
117
+ }
118
+ if (verbose) {
119
+ console.log('Packages to link:');
120
+ console.log(localPackageDependencies);
121
+ }
122
+ case 4:
104
123
  if (!(anyChanges && packagesToLink.size > 0)) {
105
- _context2.next = 31;
124
+ _context2.next = 37;
106
125
  break;
107
126
  }
108
127
  anyChanges = false;
109
128
  mapElements = localPackageDependencies.filter(function (x) {
110
129
  return x.dependencies.every(function (i) {
111
130
  return !packagesToLink.has(i);
112
- }) && packagesToLink.has(x.name);
131
+ }) && packagesToLink.has(x.name) && !excludedPackages.includes(x.name);
113
132
  });
114
- _iterator = _createForOfIteratorHelper(mapElements);
115
- _context2.prev = 5;
116
- _iterator.s();
117
- case 7:
118
- if ((_step = _iterator.n()).done) {
119
- _context2.next = 19;
133
+ if (!(mapElements.length === 0)) {
134
+ _context2.next = 9;
135
+ break;
136
+ }
137
+ return _context2.abrupt("break", 37);
138
+ case 9:
139
+ _iterator2 = _createForOfIteratorHelper(mapElements);
140
+ _context2.prev = 10;
141
+ _iterator2.s();
142
+ case 12:
143
+ if ((_step2 = _iterator2.n()).done) {
144
+ _context2.next = 25;
120
145
  break;
121
146
  }
122
- element = _step.value;
123
- _context2.next = 11;
147
+ element = _step2.value;
148
+ if (verbose) console.log("Package ".concat(element.name, " linked"));
149
+ _context2.next = 17;
124
150
  return (0, _utils.runScript)("npm install", element.packagePath);
125
- case 11:
126
- _context2.next = 13;
151
+ case 17:
152
+ _context2.next = 19;
127
153
  return (0, _utils.runScript)("npm link ".concat(element.dependencies.join(' ')), element.packagePath);
128
- case 13:
129
- _context2.next = 15;
154
+ case 19:
155
+ _context2.next = 21;
130
156
  return (0, _utils.runScript)("npm link", element.packagePath);
131
- case 15:
157
+ case 21:
132
158
  packagesToLink["delete"](element.name);
133
159
  anyChanges = true;
134
- case 17:
135
- _context2.next = 7;
160
+ case 23:
161
+ _context2.next = 12;
136
162
  break;
137
- case 19:
138
- _context2.next = 24;
163
+ case 25:
164
+ _context2.next = 30;
139
165
  break;
140
- case 21:
141
- _context2.prev = 21;
142
- _context2.t0 = _context2["catch"](5);
143
- _iterator.e(_context2.t0);
144
- case 24:
145
- _context2.prev = 24;
146
- _iterator.f();
147
- return _context2.finish(24);
148
166
  case 27:
167
+ _context2.prev = 27;
168
+ _context2.t0 = _context2["catch"](10);
169
+ _iterator2.e(_context2.t0);
170
+ case 30:
171
+ _context2.prev = 30;
172
+ _iterator2.f();
173
+ return _context2.finish(30);
174
+ case 33:
149
175
  if (!(anyChanges === false)) {
150
- _context2.next = 29;
176
+ _context2.next = 35;
151
177
  break;
152
178
  }
153
179
  throw new Error("There is loop with next packages: ".concat(JSON.stringify(Array.from(packagesToLink)).toString()));
154
- case 29:
155
- _context2.next = 1;
180
+ case 35:
181
+ _context2.next = 4;
156
182
  break;
157
- case 31:
183
+ case 37:
158
184
  names = localPackageDependencies.map(function (x) {
159
185
  return x.name;
160
186
  });
161
- _context2.next = 34;
187
+ _context2.next = 40;
162
188
  return (0, _utils.runScript)("npm install", curDir);
163
- case 34:
164
- _context2.next = 36;
189
+ case 40:
190
+ _context2.next = 42;
165
191
  return (0, _utils.runScript)("npm link ".concat(names.join(' ')), curDir);
166
- case 36:
192
+ case 42:
167
193
  case "end":
168
194
  return _context2.stop();
169
195
  }
170
- }, _callee2, null, [[5, 21, 24, 27]]);
196
+ }, _callee2, null, [[10, 27, 30, 33]]);
171
197
  }));
172
198
  return _linkPackages.apply(this, arguments);
173
199
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.13.66",
3
+ "version": "4.13.67",
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": {