datagrok-tools 4.11.0 → 4.11.1

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.
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.help = void 0;
7
7
  var HELP = "\nUsage: grok <command>\n\nDatagrok's package management tool\n\nCommands:\n add Add an object template\n api Create wrapper functions\n check Check package content (function signatures, etc.)\n config Create and manage config files\n create Create a package\n init Modify a package template\n link Link `datagrok-api` and libraries for local development\n publish Upload a package\n test Run package tests\n\nTo get help on a particular command, use:\n grok <command> --help\n\nRead more about the package development workflow:\nhttps://datagrok.ai/help/develop/develop\n";
8
8
  var HELP_ADD = "\nUsage: grok add <entity> <name>\n\nAdd an object template to your package:\n\ngrok add app <name>\ngrok add connection <name>\ngrok add detector <semantic-type-name>\ngrok add function [tag] <name>\ngrok add query <name>\ngrok add script [tag] <language> <name>\ngrok add view <name>\ngrok add viewer <name>\ngrok add tests\n\nPlease note that entity names may only include letters and numbers\n\nSupported languages for scripts:\njavascript, julia, node, octave, python, r\n\nAvailable tags:\npanel, init\n";
9
- var HELP_INIT = "\nUsage: grok init\n\nModify a package template by adding config files for linters, IDE, etc.\n\nOptions:\n[--eslint] [--ide] [--test] [--ts]\n\n--eslint Add a configuration for eslint\n--ide Add an IDE-specific configuration for debugging (vscode)\n--test Add tests support (TypeScript packages only)\n--ts Convert a JavaScript package to TypeScript\n";
9
+ var HELP_INIT = "\nUsage: grok init\n\nModify a package template by adding config files for linters, IDE, etc.\n\nOptions:\n[--eslint] [--ide] [--test] [--ts] [--git]\n\n--eslint Add a configuration for eslint\n--ide Add an IDE-specific configuration for debugging (vscode)\n--test Add tests support (TypeScript packages only)\n--ts Convert a JavaScript package to TypeScript\n--git Configure GIT and install commit linting tools.\n Read more: https://datagrok.ai/help/develop/advanced/git-policy\n";
10
10
  var HELP_API = "\nUsage: grok api\n\nCreate wrapper functions for package scripts and queries\n";
11
11
  var HELP_CONFIG = "\nUsage: grok config\n\nCreate or update a configuration file\n\nOptions:\n[--reset] [--server] [--alias] [-k | --key]\n\n--reset Restore the default config file template\n--server Use to add a server to the config (`grok config add --alias alias --server url --key key`)\n--alias Use in conjunction with the `server` option to set the server name\n--key Use in conjunction with the `server` option to set the developer key\n--default Use in conjunction with the `server` option to set the added server as default\n";
12
12
  var HELP_CREATE = "\nUsage: grok create [name]\n\nCreate a package:\n\ngrok create Create a package in the current working directory\ngrok create <name> Create a package in a folder with the specified name\n\nPlease note that the package name may only include letters, numbers, underscores, or hyphens\n\nOptions:\n[--eslint] [--ide] [--js | --ts] [--test]\n\n--eslint Add a configuration for eslint\n--ide Add an IDE-specific configuration for debugging (vscode)\n--js Create a JavaScript package\n--ts Create a TypeScript package (default)\n--test Add tests support (TypeScript packages only)\n";
@@ -10,6 +10,7 @@ var _fs = _interopRequireDefault(require("fs"));
10
10
  var _os = _interopRequireDefault(require("os"));
11
11
  var _path = _interopRequireDefault(require("path"));
12
12
  var _jsYaml = _interopRequireDefault(require("js-yaml"));
13
+ var _child_process = require("child_process");
13
14
  var utils = _interopRequireWildcard(require("../utils/utils"));
14
15
  var color = _interopRequireWildcard(require("../utils/color-utils"));
15
16
  var _configValidator = require("../validators/config-validator");
@@ -26,8 +27,8 @@ var packageJsonPath = _path["default"].join(curDir, 'package.json');
26
27
  var tsConfigPath = _path["default"].join(curDir, 'tsconfig.json');
27
28
  var webpackConfigPath = _path["default"].join(curDir, 'webpack.config.js');
28
29
  var templateDir = _path["default"].join(_path["default"].dirname(_path["default"].dirname(__dirname)), 'package-template');
30
+ var options = ['ide', 'eslint', 'test', 'ts', 'git'];
29
31
  function init(args) {
30
- var options = ['ide', 'eslint', 'test', 'ts'];
31
32
  var nOptions = Object.keys(args).length - 1;
32
33
  var nArgs = args['_'].length;
33
34
  if (nArgs > 1 || nOptions > options.length) {
@@ -54,7 +55,29 @@ function init(args) {
54
55
  }
55
56
  if (hasUnknownOpt) return false;
56
57
  }
57
- if (!utils.isPackageDir(curDir)) {
58
+ if (args.git) {
59
+ (0, _child_process.exec)('git config --global pull.rebase false && ' + 'git config --global branch.master.rebase true && ' + 'git config --global branch.main.rebase true && ' + 'git config --global rebase.autostash true', function (err, stdout, stderr) {
60
+ color.info('Configuring rebase pull strategy...');
61
+ console.log('Read more: https://datagrok.ai/help/develop/advanced/git-policy');
62
+ if (err) throw err;else {
63
+ console.log(stderr, stdout);
64
+ color.success('GIT successfully configured\n');
65
+ }
66
+ });
67
+ (0, _child_process.exec)('npm install --location=global @commitlint/config-conventional @commitlint/cli', function (err, stdout, stderr) {
68
+ color.info('Installing @commitlint/config-conventional and @commitlint/cli...');
69
+ if (err) throw err;else console.log(stderr, stdout);
70
+ });
71
+ (0, _child_process.exec)('pip install pre-commit', function (err, stdout, stderr) {
72
+ color.info('Installing pre-commit...');
73
+ if (err) throw err;else console.log(stderr, stdout);
74
+ (0, _child_process.exec)('pre-commit install --install-hooks --hook-type pre-commit --hook-type commit-msg', function (err, stdout, stderr) {
75
+ color.info('Installing commit hooks...');
76
+ if (err) throw err;else console.log(stderr, stdout);
77
+ });
78
+ });
79
+ }
80
+ if (!utils.isPackageDir(curDir) && (args.ts || args.ide || args.eslint || args.test)) {
58
81
  color.error('File `package.json` not found. Run the command from the package directory');
59
82
  return false;
60
83
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.11.0",
3
+ "version": "4.11.1",
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": {