@fredlackey/devutils 0.0.15 → 0.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fredlackey/devutils",
3
- "version": "0.0.15",
3
+ "version": "0.0.17",
4
4
  "description": "A globally-installable Node.js CLI toolkit for bootstrapping and configuring development environments across any machine.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -11,8 +11,8 @@ const readline = require('readline');
11
11
  const shell = require('../utils/common/shell');
12
12
  const osUtils = require('../utils/common/os');
13
13
 
14
- // Essential tools that DevUtils CLI requires
15
- const ESSENTIAL_TOOLS = [
14
+ // Essential tools that DevUtils CLI requires (shared across all platforms)
15
+ const CORE_TOOLS = [
16
16
  {
17
17
  name: 'git',
18
18
  command: 'git',
@@ -39,6 +39,31 @@ const ESSENTIAL_TOOLS = [
39
39
  }
40
40
  ];
41
41
 
42
+ // Homebrew is required on macOS before installing other tools
43
+ const HOMEBREW_TOOL = {
44
+ name: 'brew',
45
+ command: 'brew',
46
+ description: 'Package manager (required)',
47
+ install: 'homebrew'
48
+ };
49
+
50
+ /**
51
+ * Get the list of essential tools for the current platform.
52
+ * On macOS, Homebrew is included first since other tools depend on it.
53
+ * @returns {Array<object>} Array of tool definitions
54
+ */
55
+ function getEssentialTools() {
56
+ const platform = osUtils.detect();
57
+
58
+ // On macOS, Homebrew must be installed first since all other tools use it
59
+ if (platform.type === 'macos') {
60
+ return [HOMEBREW_TOOL, ...CORE_TOOLS];
61
+ }
62
+
63
+ // On other platforms, just use the core tools
64
+ return CORE_TOOLS;
65
+ }
66
+
42
67
  /**
43
68
  * Create readline interface for prompts
44
69
  * @returns {readline.Interface}
@@ -69,8 +94,9 @@ function confirm(rl, question) {
69
94
  * @returns {Array<object>} Array of missing tools
70
95
  */
71
96
  function checkMissingTools() {
97
+ const tools = getEssentialTools();
72
98
  const missing = [];
73
- for (const tool of ESSENTIAL_TOOLS) {
99
+ for (const tool of tools) {
74
100
  if (!shell.commandExists(tool.command)) {
75
101
  missing.push(tool);
76
102
  }
@@ -83,7 +109,8 @@ function checkMissingTools() {
83
109
  * @returns {Array<{ tool: object, installed: boolean }>}
84
110
  */
85
111
  function getToolStatuses() {
86
- return ESSENTIAL_TOOLS.map(tool => ({
112
+ const tools = getEssentialTools();
113
+ return tools.map(tool => ({
87
114
  tool,
88
115
  installed: shell.commandExists(tool.command)
89
116
  }));
@@ -97,11 +124,18 @@ function getToolStatuses() {
97
124
  async function installTool(tool) {
98
125
  try {
99
126
  const installer = require(`../installs/${tool.install}`);
100
- if (typeof installer.install === 'function') {
101
- return await installer.install();
127
+ if (typeof installer.install !== 'function') {
128
+ console.error(` No install function found for ${tool.name}`);
129
+ return false;
102
130
  }
103
- console.error(` No install function found for ${tool.name}`);
104
- return false;
131
+
132
+ // Run the installer
133
+ await installer.install();
134
+
135
+ // Verify installation by checking if the command now exists
136
+ // This is more reliable than trusting return values from installers
137
+ const isNowInstalled = shell.commandExists(tool.command);
138
+ return isNowInstalled;
105
139
  } catch (err) {
106
140
  console.error(` Failed to install ${tool.name}: ${err.message}`);
107
141
  return false;
@@ -3203,6 +3203,64 @@
3203
3203
  ],
3204
3204
  "test_results": []
3205
3205
  },
3206
+ {
3207
+ "filename": "tfenv.js",
3208
+ "name": "tfenv",
3209
+ "status": "ready",
3210
+ "environments": [
3211
+ "macos",
3212
+ "ubuntu",
3213
+ "debian",
3214
+ "wsl",
3215
+ "raspbian",
3216
+ "amazon_linux",
3217
+ "rhel",
3218
+ "fedora"
3219
+ ],
3220
+ "depends_on": [
3221
+ {
3222
+ "name": "homebrew.js",
3223
+ "priority": 0,
3224
+ "platforms": [
3225
+ "macos"
3226
+ ]
3227
+ },
3228
+ {
3229
+ "name": "git.js",
3230
+ "priority": 0
3231
+ },
3232
+ {
3233
+ "name": "curl.js",
3234
+ "priority": 0
3235
+ },
3236
+ {
3237
+ "name": "unzip.js",
3238
+ "priority": 0
3239
+ }
3240
+ ],
3241
+ "test_results": [
3242
+ {
3243
+ "environment": "ubuntu",
3244
+ "result": "pass"
3245
+ },
3246
+ {
3247
+ "environment": "ubuntu-desktop",
3248
+ "result": "pass"
3249
+ },
3250
+ {
3251
+ "environment": "debian",
3252
+ "result": "pass"
3253
+ },
3254
+ {
3255
+ "environment": "amazonlinux",
3256
+ "result": "pass"
3257
+ },
3258
+ {
3259
+ "environment": "fedora",
3260
+ "result": "pass"
3261
+ }
3262
+ ]
3263
+ },
3206
3264
  {
3207
3265
  "filename": "tidal.js",
3208
3266
  "name": "Tidal",