datagrok-tools 5.1.9 → 6.0.0

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/grok.js CHANGED
@@ -10,6 +10,7 @@ const commands = {
10
10
  api: require('./commands/api').api,
11
11
  build: require('./commands/build').build,
12
12
  check: require('./commands/check').check,
13
+ claude: require('./commands/claude').claude,
13
14
  config: require('./commands/config').config,
14
15
  create: require('./commands/create').create,
15
16
  init: require('./commands/init').init,
@@ -32,9 +33,24 @@ if (command in commands) {
32
33
  } else if (argv.all && onPackageCommandNames.includes(command)) {
33
34
  runAllCommand(process.cwd(),
34
35
  `grok ${process.argv.slice(2).join(' ')}`.replace('--all', ''), {});
35
- } else if (!commands[command](argv)) {
36
- console.log(help[command]);
37
- exitWithCode(1);
36
+ } else {
37
+ const result = commands[command](argv);
38
+ if (result && typeof result.then === 'function') {
39
+ result.then((ok) => {
40
+ if (!ok) {
41
+ console.log(help[command]);
42
+ exitWithCode(1);
43
+ }
44
+ }).catch((err) => {
45
+ console.error(err);
46
+ console.log(help[command]);
47
+ exitWithCode(255);
48
+ });
49
+ }
50
+ else if (!result) {
51
+ console.log(help[command]);
52
+ exitWithCode(1);
53
+ }
38
54
  }
39
55
  } catch (err) {
40
56
  console.error(err);
@@ -460,7 +460,7 @@ const reservedDecorators = exports.reservedDecorators = {
460
460
  },
461
461
  model: {
462
462
  metadata: {
463
- tags: [FUNC_TYPES.MODEL],
463
+ role: FUNC_TYPES.MODEL,
464
464
  inputs: [],
465
465
  outputs: []
466
466
  },
@@ -10,6 +10,7 @@
10
10
  "@datagrok-libraries/utils": "^4.6.5"
11
11
  },
12
12
  "devDependencies": {
13
+ "datagrok-tools": "^5.1.5",
13
14
  "webpack": "^5.95.0",
14
15
  "webpack-cli": "^5.1.4"
15
16
  },
@@ -1,28 +1,7 @@
1
1
  const path = require('path');
2
- const {execSync} = require('child_process');
2
+ const FuncGeneratorPlugin = require('datagrok-tools/plugins/func-gen-plugin');
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
-
26
5
  module.exports = {
27
6
  cache: {
28
7
  type: 'filesystem',
@@ -1,27 +1,6 @@
1
1
  const path = require('path');
2
- const {execSync} = require('child_process');
3
2
  const packageName = path.parse(require('./package.json').name).name.toLowerCase().replace(/-/g, '');
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();
3
+ const FuncGeneratorPlugin = require('datagrok-tools/plugins/func-gen-plugin');
25
4
  module.exports = {
26
5
  cache: {
27
6
  type: 'filesystem',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "5.1.9",
3
+ "version": "6.0.0",
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": {