datagrok-tools 5.1.5 → 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/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'
|
|
@@ -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