datagrok-tools 4.4.2 → 4.4.3

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.
@@ -201,6 +201,7 @@ function create(args) {
201
201
 
202
202
  if (validName) {
203
203
  var packageDir = curDir;
204
+ var repositoryInfo = null;
204
205
 
205
206
  if (curFolder !== name) {
206
207
  packageDir = _path["default"].join(packageDir, name);
@@ -216,6 +217,40 @@ function create(args) {
216
217
  return false;
217
218
  }
218
219
 
220
+ (0, _child_process.exec)('git rev-parse --is-inside-work-tree', {
221
+ cwd: packageDir
222
+ }, function (err) {
223
+ if (err) return;
224
+ var repository = {
225
+ type: 'git'
226
+ };
227
+ (0, _child_process.exec)('git config --get remote.origin.url', {
228
+ cwd: packageDir
229
+ }, function (err, stdout) {
230
+ if (err) return;
231
+ repository.url = stdout.trim();
232
+ (0, _child_process.exec)('git rev-parse --show-prefix', {
233
+ cwd: packageDir
234
+ }, function (err, stdout) {
235
+ if (err) return;
236
+ var prefix = stdout.trim();
237
+ repository.directory = prefix.endsWith('/') ? prefix.slice(0, -1) : prefix;
238
+ if (repository.type && repository.url && repository.directory) repositoryInfo = repository;
239
+ });
240
+ });
241
+ });
242
+ process.on('beforeExit', function () {
243
+ if (repositoryInfo) {
244
+ var packagePath = _path["default"].join(packageDir, 'package.json');
245
+
246
+ var p = JSON.parse(_fs["default"].readFileSync(packagePath, 'utf-8'));
247
+ p.repository = repositoryInfo;
248
+
249
+ _fs["default"].writeFileSync(packagePath, JSON.stringify(p, null, '\t'), 'utf-8');
250
+ }
251
+
252
+ process.exit();
253
+ });
219
254
  createDirectoryContents(name, config, templateDir, packageDir, args.ide, args.ts, args.eslint, args.jest);
220
255
  console.log(_entHelpers.help["package"](name, args.ts));
221
256
  console.log("\nThe package has the following dependencies:\n".concat(dependencies.join(' '), "\n"));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "datagrok-tools",
3
- "version": "4.4.2",
3
+ "version": "4.4.3",
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": {