datagrok-tools 4.13.20 → 4.13.21
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 +7 -0
- package/bin/commands/check.js +33 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
# Datagrok-tools changelog
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
## 4.13.21 (2024-09-17)
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* Grok check updated for release candidate versions
|
|
9
|
+
|
|
4
10
|
## 4.13.20 (2024-08-28)
|
|
5
11
|
|
|
6
12
|
### Features
|
|
7
13
|
|
|
8
14
|
* Grok link command fixes
|
|
15
|
+
|
|
9
16
|
## 4.13.19 (2024-08-27)
|
|
10
17
|
|
|
11
18
|
### Features
|
package/bin/commands/check.js
CHANGED
|
@@ -27,6 +27,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
27
27
|
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; } } }; }
|
|
28
28
|
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); }
|
|
29
29
|
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; }
|
|
30
|
+
var warns = ['Latest package version', 'Datagrok API version should contain'];
|
|
30
31
|
function check(args) {
|
|
31
32
|
var nOptions = Object.keys(args).length - 1;
|
|
32
33
|
if (args['_'].length !== 1 || nOptions > 2 || nOptions > 0 && !args.r && !args.recursive) return false;
|
|
@@ -59,7 +60,9 @@ function runChecks(packagePath) {
|
|
|
59
60
|
}));
|
|
60
61
|
var webpackConfigPath = _path["default"].join(packagePath, 'webpack.config.js');
|
|
61
62
|
var isWebpack = _fs["default"].existsSync(webpackConfigPath);
|
|
63
|
+
var isReleaseCandidateVersion = false;
|
|
62
64
|
var externals = null;
|
|
65
|
+
if (/\d+.\d+.\d+-rc(.[A-Za-z0-9]*.[A-Za-z0-9]*)?/.test(json.version)) isReleaseCandidateVersion = true;
|
|
63
66
|
if (isWebpack) {
|
|
64
67
|
var content = _fs["default"].readFileSync(webpackConfigPath, {
|
|
65
68
|
encoding: 'utf-8'
|
|
@@ -73,9 +76,10 @@ function runChecks(packagePath) {
|
|
|
73
76
|
errors.push.apply(errors, (0, _toConsumableArray2["default"])(checkFuncSignatures(packagePath, funcFiles)));
|
|
74
77
|
errors.push.apply(errors, (0, _toConsumableArray2["default"])(checkPackageFile(packagePath, json, {
|
|
75
78
|
isWebpack: isWebpack,
|
|
76
|
-
externals: externals
|
|
79
|
+
externals: externals,
|
|
80
|
+
isReleaseCandidateVersion: isReleaseCandidateVersion
|
|
77
81
|
})));
|
|
78
|
-
warnings.push.apply(warnings, (0, _toConsumableArray2["default"])(checkChangelog(packagePath, json)));
|
|
82
|
+
if (!isReleaseCandidateVersion) warnings.push.apply(warnings, (0, _toConsumableArray2["default"])(checkChangelog(packagePath, json)));
|
|
79
83
|
if (warnings.length) {
|
|
80
84
|
console.log("".concat(_path["default"].basename(packagePath), " warnings"));
|
|
81
85
|
warn(warnings);
|
|
@@ -93,7 +97,6 @@ function runChecks(packagePath) {
|
|
|
93
97
|
console.log("Checking package ".concat(_path["default"].basename(packagePath), "...\t\t\t\u2713 OK"));
|
|
94
98
|
return true;
|
|
95
99
|
}
|
|
96
|
-
var warns = ['Latest package version', 'Datagrok API version should contain'];
|
|
97
100
|
function runChecksRec(dir) {
|
|
98
101
|
var files = _fs["default"].readdirSync(dir);
|
|
99
102
|
var _iterator = _createForOfIteratorHelper(files),
|
|
@@ -424,7 +427,7 @@ function checkPackageFile(packagePath, json, options) {
|
|
|
424
427
|
if (json.version.includes('beta') && isPublicPackage) warnings.push('File "package.json": public package cannot be beta version.');
|
|
425
428
|
var api = (_json$dependencies = json.dependencies) === null || _json$dependencies === void 0 ? void 0 : _json$dependencies['datagrok-api'];
|
|
426
429
|
if (api) {
|
|
427
|
-
if (api === '../../js-api') {} else if (api === 'latest') warnings.push('File "package.json": you should specify Datagrok API version constraint (for example ^1.16.0, >=1.16.0).');else if (!/^(\^|>|<|~).+/.test(api)) warnings.push('File "package.json": Datagrok API version should starts with > | >= | ~ | ^ | < | <=');
|
|
430
|
+
if (api === '../../js-api') {} else if (api === 'latest') warnings.push('File "package.json": you should specify Datagrok API version constraint (for example ^1.16.0, >=1.16.0).');else if ((options === null || options === void 0 ? void 0 : options.isReleaseCandidateVersion) === false && !/^(\^|>|<|~).+/.test(api)) warnings.push('File "package.json": Datagrok API version should starts with > | >= | ~ | ^ | < | <=');
|
|
428
431
|
}
|
|
429
432
|
var dt = (_json$devDependencies = (_json$devDependencies2 = json.devDependencies) === null || _json$devDependencies2 === void 0 ? void 0 : _json$devDependencies2['datagrok-tools']) !== null && _json$devDependencies !== void 0 ? _json$devDependencies : (_json$dependencies2 = json.dependencies) === null || _json$dependencies2 === void 0 ? void 0 : _json$dependencies2['datagrok-tools'];
|
|
430
433
|
if (dt && dt !== 'latest') warnings.push('File "package.json": "datagrok-tools" dependency must be "latest" version.');
|
|
@@ -464,6 +467,30 @@ function checkPackageFile(packagePath, json, options) {
|
|
|
464
467
|
_iterator8.f();
|
|
465
468
|
}
|
|
466
469
|
}
|
|
470
|
+
if ((options === null || options === void 0 ? void 0 : options.isReleaseCandidateVersion) === true) {
|
|
471
|
+
var hasRCDependency = false;
|
|
472
|
+
for (var _i2 = 0, _Object$keys = Object.keys((_json$dependencies3 = json.dependencies) !== null && _json$dependencies3 !== void 0 ? _json$dependencies3 : {}); _i2 < _Object$keys.length; _i2++) {
|
|
473
|
+
var _json$dependencies3, _json$dependencies4;
|
|
474
|
+
var dependency = _Object$keys[_i2];
|
|
475
|
+
if (/\d+.\d+.\d+-rc(.[A-Za-z0-9]*.[A-Za-z0-9]*)?/.test(((_json$dependencies4 = json.dependencies) !== null && _json$dependencies4 !== void 0 ? _json$dependencies4 : {})[dependency])) {
|
|
476
|
+
hasRCDependency = true;
|
|
477
|
+
break;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
if (!hasRCDependency) {
|
|
481
|
+
for (var _i3 = 0, _Object$keys2 = Object.keys((_json$dependencies5 = json.dependencies) !== null && _json$dependencies5 !== void 0 ? _json$dependencies5 : {}); _i3 < _Object$keys2.length; _i3++) {
|
|
482
|
+
var _json$dependencies5, _json$dependencies6, _json$devDependencies3;
|
|
483
|
+
var _dependency = _Object$keys2[_i3];
|
|
484
|
+
console.log(_dependency);
|
|
485
|
+
console.log(((_json$dependencies6 = json.dependencies) !== null && _json$dependencies6 !== void 0 ? _json$dependencies6 : {})[_dependency]);
|
|
486
|
+
if (/\d+.\d+.\d+-rc(.[A-Za-z0-9]*.[A-Za-z0-9]*)?/.test(((_json$devDependencies3 = json.devDependencies) !== null && _json$devDependencies3 !== void 0 ? _json$devDependencies3 : {})[_dependency])) {
|
|
487
|
+
hasRCDependency = true;
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
if (!hasRCDependency) warnings.push('Release candidate error: Current package doesnt have any dependencies from any release candidate package ');
|
|
493
|
+
}
|
|
467
494
|
return warnings;
|
|
468
495
|
}
|
|
469
496
|
function checkChangelog(packagePath, json) {
|
|
@@ -551,9 +578,9 @@ function checkScriptNames(packagePath) {
|
|
|
551
578
|
try {
|
|
552
579
|
if (_fs["default"].existsSync(packagePath)) {
|
|
553
580
|
var filesInDirectory = getAllFilesInDirectory(packagePath);
|
|
554
|
-
for (var
|
|
581
|
+
for (var _i4 = 0, _filesInDirectory = filesInDirectory; _i4 < _filesInDirectory.length; _i4++) {
|
|
555
582
|
var _fileName$match;
|
|
556
|
-
var fileName = _filesInDirectory[
|
|
583
|
+
var fileName = _filesInDirectory[_i4];
|
|
557
584
|
if (((_fileName$match = fileName.match(new RegExp('^[A-Za-z0-9._-]*$'))) === null || _fileName$match === void 0 ? void 0 : _fileName$match.length) !== 1) warnings.push("".concat(fileName, ": file name contains inappropriate symbols"));
|
|
558
585
|
}
|
|
559
586
|
}
|
package/package.json
CHANGED