neex 0.6.62 → 0.6.64

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.
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -13,6 +36,19 @@ const figures_1 = __importDefault(require("figures"));
13
36
  const path_1 = __importDefault(require("path"));
14
37
  const fs_1 = __importDefault(require("fs"));
15
38
  const lodash_1 = require("lodash");
39
+ async function isCommandAvailable(command) {
40
+ try {
41
+ const { exec } = await Promise.resolve().then(() => __importStar(require('child_process')));
42
+ return new Promise((resolve) => {
43
+ exec(`command -v ${command}`, (error) => {
44
+ resolve(!error);
45
+ });
46
+ });
47
+ }
48
+ catch (e) {
49
+ return false;
50
+ }
51
+ }
16
52
  class DevManager {
17
53
  constructor(options) {
18
54
  this.process = null;
@@ -46,20 +82,24 @@ class DevManager {
46
82
  }
47
83
  }
48
84
  }
49
- getExecuteCommand() {
85
+ async getExecuteCommand() {
50
86
  if (this.options.execCommand) {
51
87
  const parts = this.options.execCommand.split(' ');
52
88
  return { command: parts[0], args: [...parts.slice(1), this.options.file] };
53
89
  }
54
90
  // Default to tsx for TypeScript files
55
- const args = ['--loader', 'tsx', this.options.file];
91
+ const tsxExists = await isCommandAvailable('tsx');
92
+ if (!tsxExists) {
93
+ throw new Error('`tsx` command not found. Please install `tsx`');
94
+ }
95
+ const args = [this.options.file];
56
96
  if (this.options.inspect) {
57
97
  args.unshift('--inspect');
58
98
  }
59
99
  if (this.options.inspectBrk) {
60
100
  args.unshift('--inspect-brk');
61
101
  }
62
- return { command: 'node', args };
102
+ return { command: 'tsx', args };
63
103
  }
64
104
  clearConsole() {
65
105
  if (this.options.clearConsole && process.stdout.isTTY) {
@@ -72,7 +112,7 @@ class DevManager {
72
112
  return;
73
113
  }
74
114
  this.loadEnvFile();
75
- const { command, args } = this.getExecuteCommand();
115
+ const { command, args } = await this.getExecuteCommand();
76
116
  if (this.options.verbose) {
77
117
  logger_manager_js_1.loggerManager.printLine(`Executing: ${command} ${args.join(' ')}`, 'info');
78
118
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neex",
3
- "version": "0.6.62",
3
+ "version": "0.6.64",
4
4
  "description": "The Modern Build System for Polyrepo-in-Monorepo Architecture",
5
5
  "main": "dist/src/index.js",
6
6
  "types": "dist/src/index.d.ts",