datagrok-tools 4.7.9 → 4.7.11
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/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install datagrok-tools -g
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
Enter developer keys and set the default server. The developer key can be retrieved from your user profile (for
|
|
20
|
-
example, see https://public.datagrok.ai/u).
|
|
20
|
+
example, see <https://public.datagrok.ai/u>).
|
|
21
21
|
2. Create a new package by running this command:
|
|
22
22
|
|
|
23
23
|
```shell
|
|
@@ -98,3 +98,22 @@ Read more about package development in [Datagrok's documentation](https://datagr
|
|
|
98
98
|
- `--suffix`: a string containing package version hash
|
|
99
99
|
|
|
100
100
|
Running `grok publish` is the same as running `grok publish defaultHost --build --debug`.
|
|
101
|
+
- `check` checks package content (function signatures, import statements of external modules,
|
|
102
|
+
etc.). The check is also run during package publication.
|
|
103
|
+
- `test` runs package tests. First, it builds a package and publishes it (these
|
|
104
|
+
steps can be skipped with flags `--skip-build` and `--skip-publish`
|
|
105
|
+
correspondingly).
|
|
106
|
+
|
|
107
|
+
```shell
|
|
108
|
+
cd <package-name>
|
|
109
|
+
grok test
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
The default host from the `config.yaml` file is used. You
|
|
113
|
+
can specify another server alias via the `--host` option (e.g., `grok test
|
|
114
|
+
--host=dev`). The results are printed to the terminal. To see tests execution,
|
|
115
|
+
pass the `--gui` flag that disables the headless browser mode. If you want to
|
|
116
|
+
save a test run result, add the `--csv` flag (the report will be saved in a
|
|
117
|
+
CSV file in the package folder). You can find more details in [local package testing
|
|
118
|
+
instructions](https://datagrok.ai/help/develop/how-to/test-packages#local-testing).
|
|
119
|
+
- `link` / `unlink` commands are used for public plugins development to (un)link `datagrok-api` and libraries.
|
package/bin/commands/check.js
CHANGED
|
@@ -15,6 +15,8 @@ exports.extractExternals = extractExternals;
|
|
|
15
15
|
|
|
16
16
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
17
|
|
|
18
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
19
|
+
|
|
18
20
|
var _fs = _interopRequireDefault(require("fs"));
|
|
19
21
|
|
|
20
22
|
var _path = _interopRequireDefault(require("path"));
|
|
@@ -48,10 +50,7 @@ function check(args) {
|
|
|
48
50
|
|
|
49
51
|
var stats = _fs["default"].statSync(filepath);
|
|
50
52
|
|
|
51
|
-
if (stats.isDirectory() && utils.isPackageDir(filepath))
|
|
52
|
-
console.log("Checking package ".concat(file, "..."));
|
|
53
|
-
runChecks(filepath);
|
|
54
|
-
}
|
|
53
|
+
if (stats.isDirectory() && utils.isPackageDir(filepath)) runChecks(filepath);
|
|
55
54
|
});
|
|
56
55
|
} else {
|
|
57
56
|
if (!utils.isPackageDir(curDir)) {
|
|
@@ -59,7 +58,6 @@ function check(args) {
|
|
|
59
58
|
return false;
|
|
60
59
|
}
|
|
61
60
|
|
|
62
|
-
console.log("Checking package ".concat(_path["default"].basename(curDir), "..."));
|
|
63
61
|
runChecks(curDir);
|
|
64
62
|
}
|
|
65
63
|
|
|
@@ -76,6 +74,7 @@ function check(args) {
|
|
|
76
74
|
var funcFiles = jsTsFiles.filter(function (f) {
|
|
77
75
|
return packageFiles.includes(f);
|
|
78
76
|
});
|
|
77
|
+
var warnings = [];
|
|
79
78
|
|
|
80
79
|
var webpackConfigPath = _path["default"].join(packagePath, 'webpack.config.js');
|
|
81
80
|
|
|
@@ -87,11 +86,16 @@ function check(args) {
|
|
|
87
86
|
});
|
|
88
87
|
|
|
89
88
|
var externals = extractExternals(content);
|
|
90
|
-
if (externals)
|
|
89
|
+
if (externals) warnings.push.apply(warnings, (0, _toConsumableArray2["default"])(checkImportStatements(packagePath, jsTsFiles, externals)));
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
|
|
94
|
-
|
|
92
|
+
warnings.push.apply(warnings, (0, _toConsumableArray2["default"])(checkFuncSignatures(packagePath, funcFiles)));
|
|
93
|
+
warnings.push.apply(warnings, (0, _toConsumableArray2["default"])(checkPackageFile(packagePath)));
|
|
94
|
+
|
|
95
|
+
if (warnings.length) {
|
|
96
|
+
console.log("Checking package ".concat(_path["default"].basename(packagePath), "..."));
|
|
97
|
+
warn(warnings);
|
|
98
|
+
} else console.log("Checking package ".concat(_path["default"].basename(packagePath), "...\t\t\t\u2713 OK"));
|
|
95
99
|
}
|
|
96
100
|
|
|
97
101
|
return true;
|
|
@@ -221,10 +225,31 @@ function checkFuncSignatures(packagePath, files) {
|
|
|
221
225
|
message: message
|
|
222
226
|
};
|
|
223
227
|
},
|
|
224
|
-
|
|
228
|
+
viewer: function viewer(_ref3) {
|
|
225
229
|
var inputs = _ref3.inputs,
|
|
226
|
-
outputs = _ref3.outputs
|
|
227
|
-
|
|
230
|
+
outputs = _ref3.outputs;
|
|
231
|
+
var value = true;
|
|
232
|
+
var message = '';
|
|
233
|
+
|
|
234
|
+
if (inputs.length !== 0) {
|
|
235
|
+
value = false;
|
|
236
|
+
message += 'Viewer functions should take no arguments\n';
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
if (outputs.length > 1 || outputs.length === 1 && outputs[0].type !== 'viewer') {
|
|
240
|
+
value = false;
|
|
241
|
+
message += 'Viewers must have one output of type "viewer"\n';
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
value: value,
|
|
246
|
+
message: message
|
|
247
|
+
};
|
|
248
|
+
},
|
|
249
|
+
fileViewer: function fileViewer(_ref4) {
|
|
250
|
+
var inputs = _ref4.inputs,
|
|
251
|
+
outputs = _ref4.outputs,
|
|
252
|
+
tags = _ref4.tags;
|
|
228
253
|
var value = true;
|
|
229
254
|
var message = '';
|
|
230
255
|
|
|
@@ -250,8 +275,8 @@ function checkFuncSignatures(packagePath, files) {
|
|
|
250
275
|
message: message
|
|
251
276
|
};
|
|
252
277
|
},
|
|
253
|
-
fileExporter: function fileExporter(
|
|
254
|
-
var description =
|
|
278
|
+
fileExporter: function fileExporter(_ref5) {
|
|
279
|
+
var description = _ref5.description;
|
|
255
280
|
var value = true;
|
|
256
281
|
var message = '';
|
|
257
282
|
|
|
@@ -265,8 +290,8 @@ function checkFuncSignatures(packagePath, files) {
|
|
|
265
290
|
message: message
|
|
266
291
|
};
|
|
267
292
|
},
|
|
268
|
-
packageSettingsEditor: function packageSettingsEditor(
|
|
269
|
-
var outputs =
|
|
293
|
+
packageSettingsEditor: function packageSettingsEditor(_ref6) {
|
|
294
|
+
var outputs = _ref6.outputs;
|
|
270
295
|
var value = true;
|
|
271
296
|
var message = '';
|
|
272
297
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
# #{PACKAGE_NAME}
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`#{PACKAGE_NAME}` is a [package](https://datagrok.ai/help/develop/develop#packages) for the [Datagrok](https://datagrok.ai) platform
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
|
|
13
13
|
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
14
14
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
15
|
-
|
|
15
|
+
"sourceMap": true, /* Generates corresponding '.map' file. */
|
|
16
16
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
|
17
17
|
// "outDir": "./", /* Redirect output structure to the directory. */
|
|
18
18
|
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
package/package.json
CHANGED