datagrok-tools 5.1.4 → 5.1.6
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 -19
- package/bin/commands/publish.js +1 -3
- package/bin/commands/test.js +23 -0
- package/bin/utils/func-generation.js +1 -1
- package/package-template/package.json +2 -3
- package/package-template/ts.webpack.config.js +22 -1
- package/package-template/webpack.config.js +22 -1
- package/package.json +1 -1
package/bin/commands/check.js
CHANGED
|
@@ -20,13 +20,12 @@ var utils = _interopRequireWildcard(require("../utils/utils"));
|
|
|
20
20
|
var color = _interopRequireWildcard(require("../utils/color-utils"));
|
|
21
21
|
var testUtils = _interopRequireWildcard(require("../utils/test-utils"));
|
|
22
22
|
var _const = require("../utils/const");
|
|
23
|
-
var _child_process = require("child_process");
|
|
24
23
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
25
24
|
const warns = ['Latest package version', 'Datagrok API version should contain'];
|
|
26
25
|
const forbiddenNames = ['function', 'class', 'export'];
|
|
27
26
|
const namesInFiles = new Map();
|
|
28
27
|
function check(args) {
|
|
29
|
-
color.setVerbose(args.verbose || args.v || false);
|
|
28
|
+
if (args.verbose !== undefined || args.v !== undefined) color.setVerbose(args.verbose || args.v || false);
|
|
30
29
|
const curDir = args._.length == 2 ? args._[1] : process.cwd();
|
|
31
30
|
if (args.recursive) return runChecksRec(curDir, args.soft ?? false);else {
|
|
32
31
|
if (!utils.isPackageDir(curDir)) {
|
|
@@ -456,23 +455,8 @@ function checkSourceMap(packagePath) {
|
|
|
456
455
|
// Check if dist files exist
|
|
457
456
|
const distPackage = _path.default.join(packagePath, 'dist', 'package.js');
|
|
458
457
|
const distPackageTest = _path.default.join(packagePath, 'dist', 'package-test.js');
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
// If any dist files are missing, try to build automatically
|
|
462
|
-
if (missingFiles.length > 0) {
|
|
463
|
-
try {
|
|
464
|
-
(0, _child_process.execSync)('npm run build', {
|
|
465
|
-
cwd: packagePath,
|
|
466
|
-
stdio: 'inherit'
|
|
467
|
-
});
|
|
468
|
-
} catch (e) {
|
|
469
|
-
console.warn('Build failed:', e);
|
|
470
|
-
}
|
|
471
|
-
|
|
472
|
-
// Recheck dist files after build
|
|
473
|
-
missingFiles = [distPackage, distPackageTest].filter(f => !_fs.default.existsSync(f));
|
|
474
|
-
missingFiles.forEach(f => warnings.push(`${_path.default.relative(packagePath, f)} file doesnt exist even after build`));
|
|
475
|
-
}
|
|
458
|
+
const missingFiles = [distPackage, distPackageTest].filter(f => !_fs.default.existsSync(f));
|
|
459
|
+
missingFiles.forEach(f => warnings.push(`${_path.default.relative(packagePath, f)} file doesnt exist. Run 'npm run build' first.`));
|
|
476
460
|
}
|
|
477
461
|
return warnings;
|
|
478
462
|
}
|
package/bin/commands/publish.js
CHANGED
|
@@ -184,9 +184,7 @@ async function processPackage(debug, rebuild, host, devKey, packageName, dropDb,
|
|
|
184
184
|
async function publish(args) {
|
|
185
185
|
color.setVerbose(args.verbose || args.v || false);
|
|
186
186
|
if (!args['skip-check'] && !args['all'] && !args['refresh']) (0, _check.check)({
|
|
187
|
-
_: ['check']
|
|
188
|
-
verbose: args.verbose,
|
|
189
|
-
v: args.v
|
|
187
|
+
_: ['check']
|
|
190
188
|
});
|
|
191
189
|
config = _jsYaml.default.load(_fs.default.readFileSync(confPath, {
|
|
192
190
|
encoding: 'utf-8'
|
package/bin/commands/test.js
CHANGED
|
@@ -24,12 +24,35 @@ const grokDir = _path.default.join(_os.default.homedir(), '.grok');
|
|
|
24
24
|
const confPath = _path.default.join(grokDir, 'config.yaml');
|
|
25
25
|
const consoleLogOutputDir = _path.default.join(curDir, 'test-console-output.log');
|
|
26
26
|
const csvReportDir = _path.default.join(curDir, 'test-report.csv');
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Detects if the current directory is within a Dart library folder (d4, xamgle, ddt, dml)
|
|
30
|
+
* and returns the appropriate test category to use.
|
|
31
|
+
* @returns The category string (e.g., "Core: d4") or undefined if not in a recognized Dart folder
|
|
32
|
+
*/
|
|
33
|
+
function detectDartLibraryCategory() {
|
|
34
|
+
const normalizedPath = curDir.replace(/\\/g, '/');
|
|
35
|
+
if (normalizedPath.includes('/d4/') || normalizedPath.endsWith('/d4')) return 'Core: d4';
|
|
36
|
+
if (normalizedPath.includes('/xamgle/') || normalizedPath.endsWith('/xamgle')) return 'Core: xamgle';
|
|
37
|
+
if (normalizedPath.includes('/ddt/') || normalizedPath.endsWith('/ddt')) return 'Core: ddt';
|
|
38
|
+
if (normalizedPath.includes('/dml/') || normalizedPath.endsWith('/dml')) return 'Core: dml';
|
|
39
|
+
return undefined;
|
|
40
|
+
}
|
|
27
41
|
async function test(args) {
|
|
28
42
|
const config = _jsYaml.default.load(_fs.default.readFileSync(confPath, {
|
|
29
43
|
encoding: 'utf-8'
|
|
30
44
|
}));
|
|
31
45
|
isArgsValid(args);
|
|
32
46
|
utils.setHost(args.host, config);
|
|
47
|
+
|
|
48
|
+
// Auto-detect category based on current directory if not specified
|
|
49
|
+
if (!args.category) {
|
|
50
|
+
const detectedCategory = detectDartLibraryCategory();
|
|
51
|
+
if (detectedCategory) {
|
|
52
|
+
args.category = detectedCategory;
|
|
53
|
+
color.info(`Detected Dart library directory, using category: "${detectedCategory}"`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
33
56
|
let packageJsonData = undefined;
|
|
34
57
|
if (!args.package) packageJsonData = JSON.parse(_fs.default.readFileSync(_path.default.join(curDir, 'package.json'), {
|
|
35
58
|
encoding: 'utf-8'
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "#{PACKAGE_NAME_LOWERCASE}",
|
|
3
3
|
"friendlyName": "#{PACKAGE_NAME}",
|
|
4
4
|
"version": "0.0.1",
|
|
5
|
-
"description": "",
|
|
5
|
+
"description": "#{PACKAGE_NAME} package",
|
|
6
6
|
"dependencies": {
|
|
7
7
|
"datagrok-api": "^1.26.0",
|
|
8
8
|
"cash-dom": "^8.1.5",
|
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
"@datagrok-libraries/utils": "^4.6.5"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
|
-
"datagrok-tools": "^4.14.53",
|
|
14
13
|
"webpack": "^5.95.0",
|
|
15
14
|
"webpack-cli": "^5.1.4"
|
|
16
15
|
},
|
|
@@ -18,7 +17,7 @@
|
|
|
18
17
|
"debug-#{PACKAGE_NAME_LOWERCASE}": "webpack && grok publish",
|
|
19
18
|
"release-#{PACKAGE_NAME_LOWERCASE}": "webpack && grok publish --release",
|
|
20
19
|
"build-#{PACKAGE_NAME_LOWERCASE}": "webpack",
|
|
21
|
-
"build": "grok api && grok check && webpack",
|
|
20
|
+
"build": "grok api && grok check --soft && webpack",
|
|
22
21
|
"test": "grok test"
|
|
23
22
|
},
|
|
24
23
|
"canEdit": [
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
-
const
|
|
2
|
+
const {execSync} = require('child_process');
|
|
3
3
|
const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
|
|
4
4
|
|
|
5
|
+
function getDatagrokTools() {
|
|
6
|
+
const pluginPath = 'datagrok-tools/plugins/func-gen-plugin';
|
|
7
|
+
try {
|
|
8
|
+
return require(pluginPath);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
try {
|
|
11
|
+
const globalPath = execSync('npm root -g').toString().trim();
|
|
12
|
+
return require(path.join(globalPath, pluginPath));
|
|
13
|
+
} catch (globalErr) {
|
|
14
|
+
console.error('\n' + '='.repeat(60));
|
|
15
|
+
console.error('ERROR: datagrok-tools not found!');
|
|
16
|
+
console.error('To fix this, please install the tools globally by running:');
|
|
17
|
+
console.error('\n npm install -g datagrok-tools\n');
|
|
18
|
+
console.error('='.repeat(60) + '\n');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const FuncGeneratorPlugin = getDatagrokTools();
|
|
25
|
+
|
|
5
26
|
module.exports = {
|
|
6
27
|
cache: {
|
|
7
28
|
type: 'filesystem',
|
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
|
+
const {execSync} = require('child_process');
|
|
2
3
|
const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
|
|
3
|
-
|
|
4
|
+
|
|
5
|
+
function getDatagrokTools() {
|
|
6
|
+
const pluginPath = 'datagrok-tools/plugins/func-gen-plugin';
|
|
7
|
+
try {
|
|
8
|
+
return require(pluginPath);
|
|
9
|
+
} catch (e) {
|
|
10
|
+
try {
|
|
11
|
+
const globalPath = execSync('npm root -g').toString().trim();
|
|
12
|
+
return require(path.join(globalPath, pluginPath));
|
|
13
|
+
} catch (globalErr) {
|
|
14
|
+
console.error('\n' + '='.repeat(60));
|
|
15
|
+
console.error('ERROR: datagrok-tools not found!');
|
|
16
|
+
console.error('To fix this, please install the tools globally by running:');
|
|
17
|
+
console.error('\n npm install -g datagrok-tools\n');
|
|
18
|
+
console.error('='.repeat(60) + '\n');
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const FuncGeneratorPlugin = getDatagrokTools();
|
|
4
25
|
module.exports = {
|
|
5
26
|
cache: {
|
|
6
27
|
type: 'filesystem',
|
package/package.json
CHANGED