datagrok-tools 4.12.27 → 4.13.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.
@@ -24,7 +24,7 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
24
24
 
25
25
  function test(args) {
26
26
  var options = Object.keys(args).slice(1);
27
- var commandOptions = ['host', 'csv', 'gui', 'catchUnhandled', 'platform', 'core', 'report', 'skip-build', 'skip-publish', 'path', 'record', 'verbose', 'benchmark'];
27
+ var commandOptions = ['host', 'package', 'csv', 'gui', 'catchUnhandled', 'platform', 'core', 'report', 'skip-build', 'skip-publish', 'path', 'record', 'verbose', 'benchmark'];
28
28
  var nArgs = args['_'].length;
29
29
  var curDir = process.cwd();
30
30
  var grokDir = _path["default"].join(_os["default"].homedir(), '.grok');
@@ -32,10 +32,6 @@ function test(args) {
32
32
  if (nArgs > 1 || options.length > commandOptions.length || options.length > 0 && !options.every(function (op) {
33
33
  return commandOptions.includes(op);
34
34
  })) return false;
35
- if (!utils.isPackageDir(curDir)) {
36
- color.error('File `package.json` not found. Run the command from the package directory');
37
- return false;
38
- }
39
35
  if (!_fs["default"].existsSync(confPath)) {
40
36
  color.error("File `".concat(confPath, "` not found. Run `grok config` to set up the config file"));
41
37
  return false;
@@ -55,16 +51,25 @@ function test(args) {
55
51
  process.env.HOST = config["default"];
56
52
  console.log('Environment variable `HOST` is set to', config["default"]);
57
53
  }
58
- var packageData = JSON.parse(_fs["default"].readFileSync(_path["default"].join(curDir, 'package.json'), {
59
- encoding: 'utf-8'
60
- }));
61
- if (packageData.name) {
62
- process.env.TARGET_PACKAGE = utils.kebabToCamelCase(utils.removeScope(packageData.name));
63
- console.log('Environment variable `TARGET_PACKAGE` is set to', process.env.TARGET_PACKAGE);
54
+ if (args["package"]) {
55
+ process.env.TARGET_PACKAGE = utils.kebabToCamelCase(args["package"]);
64
56
  } else {
65
- color.error('Invalid package name. Set the `name` field in `package.json`');
66
- return false;
57
+ if (!utils.isPackageDir(curDir)) {
58
+ color.error('File `package.json` not found. Run the command from the package directory or specify plugin using \'--package\' option');
59
+ return false;
60
+ } else {
61
+ var packageData = JSON.parse(_fs["default"].readFileSync(_path["default"].join(curDir, 'package.json'), {
62
+ encoding: 'utf-8'
63
+ }));
64
+ if (packageData.name) {
65
+ process.env.TARGET_PACKAGE = utils.kebabToCamelCase(packageData.name);
66
+ } else {
67
+ color.error('Invalid package name. Set the `name` field in `package.json`');
68
+ return false;
69
+ }
70
+ }
67
71
  }
72
+ console.log('Environment variable `TARGET_PACKAGE` is set to', process.env.TARGET_PACKAGE);
68
73
  if (args.platform && process.env.TARGET_PACKAGE !== 'ApiTests') {
69
74
  color.error('--platform flag can only be used in the ApiTests package');
70
75
  return false;
@@ -73,11 +78,17 @@ function test(args) {
73
78
  color.error('--core flag can only be used in the DevTools package');
74
79
  return false;
75
80
  }
76
- if (args['skip-build']) {
77
- if (args['skip-publish']) test();else publish(test);
78
- } else build(args['skip-publish'] ? test : function () {
79
- return publish(test);
80
- });
81
+ if (args['skip-publish'] || args["package"]) {
82
+ test();
83
+ } else {
84
+ if (args['skip-build']) {
85
+ publish(test);
86
+ } else {
87
+ build(function () {
88
+ return publish(test);
89
+ });
90
+ }
91
+ }
81
92
  function build(callback) {
82
93
  (0, _child_process.exec)('npm run build', function (err, stdout, stderr) {
83
94
  color.info("Building package...");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.12.27",
3
+ "version": "4.13.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": {