auto-dev-setup 0.1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 auto-dev-setup contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,191 @@
1
+ # auto-dev-setup
2
+
3
+ A cross-platform command-line tool that automates developer environment setup on Windows, macOS, and Linux.
4
+
5
+ ## Features
6
+
7
+ - **Cross-Platform**: Works consistently on Windows, macOS, and Linux
8
+ - **Interactive Setup**: Guided installation with clear prompts
9
+ - **Idempotent**: Safe to run multiple times
10
+ - **Transparent**: Shows all commands before execution
11
+ - **Modular**: Install only what you need
12
+
13
+ ## What Gets Installed
14
+
15
+ ### Always Installed (Base + Web Stack)
16
+ - **Base Tools**: Git, curl/wget
17
+ - **Node.js** (LTS version)
18
+ - **npm** (configured for global installs)
19
+ - **Visual Studio Code** with essential extensions:
20
+ - ESLint
21
+ - Prettier
22
+ - GitLens
23
+
24
+ ### Optional (Interactive Prompts)
25
+ - **Python Stack**: Python 3, pip, pipx, virtualenv, Jupyter, NumPy, Pandas
26
+ - **Java Stack**: OpenJDK (LTS), JAVA_HOME configuration
27
+
28
+ ## Installation
29
+
30
+ ### npm (Recommended)
31
+
32
+ ```bash
33
+ npm install -g auto-dev-setup
34
+ ```
35
+
36
+ ### pip
37
+
38
+ ```bash
39
+ pip install auto-dev-setup
40
+ ```
41
+
42
+ ### Homebrew (macOS)
43
+
44
+ ```bash
45
+ brew tap yourusername/auto-dev-setup
46
+ brew install auto-dev-setup
47
+ ```
48
+
49
+ ### Development / Local Installation
50
+
51
+ If you're installing from a cloned repository (for development or testing):
52
+
53
+ ```bash
54
+ # Clone the repository
55
+ git clone https://github.com/yourusername/auto-dev-setup.git
56
+ cd auto-dev-setup
57
+
58
+ # Install dependencies first (required!)
59
+ npm install
60
+
61
+ # Then link globally
62
+ npm link
63
+
64
+ # Now you can use the command
65
+ auto-setup --version
66
+ ```
67
+
68
+ **Note:** When installing from npm registry (`npm install -g auto-dev-setup`), dependencies are installed automatically. The extra `npm install` step is only needed for local development.
69
+
70
+ ## Usage
71
+
72
+ ### Run the Setup Wizard
73
+
74
+ ```bash
75
+ auto-setup
76
+ ```
77
+
78
+ This will:
79
+ 1. Detect your platform (Windows/macOS/Linux)
80
+ 2. Install base system tools
81
+ 3. Install the web developer stack
82
+ 4. Prompt for Python stack installation
83
+ 5. Prompt for Java stack installation
84
+ 6. Display a summary of all changes
85
+
86
+ ### Command Options
87
+
88
+ ```bash
89
+ # Run with all stacks (no prompts)
90
+ auto-setup --yes
91
+
92
+ # Skip specific stacks
93
+ auto-setup --skip-python
94
+ auto-setup --skip-java
95
+
96
+ # Check installed tools
97
+ auto-setup check
98
+
99
+ # Display system info
100
+ auto-setup info
101
+
102
+ # Show version
103
+ auto-setup --version
104
+
105
+ # Show help
106
+ auto-setup --help
107
+ ```
108
+
109
+ ## Platform-Specific Behavior
110
+
111
+ ### macOS
112
+ - Installs Xcode Command Line Tools
113
+ - Uses Homebrew for package management
114
+ - Supports both Intel and Apple Silicon
115
+
116
+ ### Linux
117
+ - Detects distribution (Debian/Ubuntu, Fedora/RHEL, Arch, etc.)
118
+ - Uses native package manager (apt, dnf, pacman, etc.)
119
+ - Sets up NodeSource repository for latest Node.js LTS
120
+
121
+ ### Windows
122
+ - Requires PowerShell
123
+ - Uses winget (preferred) or Chocolatey
124
+ - May require Administrator privileges for some installations
125
+
126
+ ## Project Structure
127
+
128
+ ```
129
+ auto-dev-setup/
130
+ ├── bin/
131
+ │ └── auto-setup.js # CLI entry point
132
+ ├── src/
133
+ │ ├── cli.js # Main CLI logic
134
+ │ ├── index.js # Module exports
135
+ │ ├── platform/
136
+ │ │ ├── detector.js # OS/arch/shell detection
137
+ │ │ ├── macos.js # macOS installers
138
+ │ │ ├── linux.js # Linux installers
139
+ │ │ └── windows.js # Windows installers
140
+ │ ├── stacks/
141
+ │ │ ├── base.js # Base tools installer
142
+ │ │ ├── web.js # Web stack installer
143
+ │ │ ├── python.js # Python stack installer
144
+ │ │ └── java.js # Java stack installer
145
+ │ ├── utils/
146
+ │ │ ├── executor.js # Command execution
147
+ │ │ ├── logger.js # Console output
148
+ │ │ ├── prompts.js # User prompts
149
+ │ │ └── verifier.js # Installation verification
150
+ │ └── config/
151
+ │ └── extensions.js # VS Code extensions config
152
+ ├── python/ # pip distribution
153
+ ├── homebrew/ # Homebrew formula
154
+ ├── package.json
155
+ ├── pyproject.toml
156
+ └── README.md
157
+ ```
158
+
159
+ ## Safety
160
+
161
+ - Does **NOT** install paid software
162
+ - Does **NOT** run background services
163
+ - Does **NOT** overwrite config files blindly
164
+ - Always checks before modifying PATH or shell configs
165
+ - Prints all executed commands to terminal
166
+
167
+ ## Requirements
168
+
169
+ - **Node.js** >= 16.0.0 (for npm installation)
170
+ - **Python** >= 3.8 (for pip installation)
171
+ - Internet connection for downloading packages
172
+
173
+ ## Contributing
174
+
175
+ Contributions are welcome! Please feel free to submit a Pull Request.
176
+
177
+ 1. Fork the repository
178
+ 2. Create your feature branch (`git checkout -b feature/amazing-feature`)
179
+ 3. Commit your changes (`git commit -m 'Add some amazing feature'`)
180
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
181
+ 5. Open a Pull Request
182
+
183
+ ## License
184
+
185
+ MIT License - see [LICENSE](LICENSE) for details.
186
+
187
+ ## Acknowledgments
188
+
189
+ - Built with [Commander.js](https://github.com/tj/commander.js)
190
+ - Uses [Inquirer.js](https://github.com/SBoudrias/Inquirer.js) for prompts
191
+ - Styled with [Chalk](https://github.com/chalk/chalk)
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * auto-dev-setup CLI Entry Point
5
+ * Cross-platform developer environment setup tool
6
+ */
7
+
8
+ const { run } = require('../src/cli');
9
+
10
+ run().catch((error) => {
11
+ console.error('Fatal error:', error.message);
12
+ process.exit(1);
13
+ });
package/package.json ADDED
@@ -0,0 +1,58 @@
1
+ {
2
+ "name": "auto-dev-setup",
3
+ "version": "0.1.0",
4
+ "description": "Cross-platform CLI tool to automate developer environment setup on Windows, macOS, and Linux",
5
+ "main": "src/index.js",
6
+ "bin": {
7
+ "auto-setup": "bin/auto-setup.js"
8
+ },
9
+ "scripts": {
10
+ "start": "node bin/auto-setup.js",
11
+ "test": "node --test",
12
+ "lint": "eslint src/",
13
+ "prepublishOnly": "npm test || true"
14
+ },
15
+ "keywords": [
16
+ "developer",
17
+ "setup",
18
+ "cli",
19
+ "automation",
20
+ "cross-platform",
21
+ "devtools",
22
+ "environment",
23
+ "nodejs",
24
+ "python",
25
+ "java"
26
+ ],
27
+ "author": "",
28
+ "license": "MIT",
29
+ "repository": {
30
+ "type": "git",
31
+ "url": ""
32
+ },
33
+ "engines": {
34
+ "node": ">=16.0.0"
35
+ },
36
+ "dependencies": {
37
+ "chalk": "^4.1.2",
38
+ "commander": "^11.1.0",
39
+ "inquirer": "^8.2.6",
40
+ "ora": "^5.4.1",
41
+ "boxen": "^5.1.2",
42
+ "which": "^3.0.1"
43
+ },
44
+ "devDependencies": {
45
+ "eslint": "^8.56.0"
46
+ },
47
+ "files": [
48
+ "bin/",
49
+ "src/",
50
+ "README.md",
51
+ "LICENSE"
52
+ ],
53
+ "os": [
54
+ "darwin",
55
+ "linux",
56
+ "win32"
57
+ ]
58
+ }
package/src/cli.js ADDED
@@ -0,0 +1,295 @@
1
+ /**
2
+ * auto-dev-setup CLI
3
+ * Main CLI entry point with interactive setup flow
4
+ */
5
+
6
+ const { Command } = require('commander');
7
+ const { getPlatformInfo } = require('./platform/detector');
8
+ const { logger, prompts, postinstall } = require('./utils');
9
+ const stacks = require('./stacks');
10
+
11
+ const VERSION = '0.1.0';
12
+
13
+ /**
14
+ * Main CLI execution flow
15
+ */
16
+ async function run() {
17
+ const program = new Command();
18
+
19
+ program
20
+ .name('auto-setup')
21
+ .description(
22
+ 'Cross-platform CLI tool to automate developer environment setup'
23
+ )
24
+ .version(VERSION)
25
+ .option('-y, --yes', 'Skip interactive prompts and install all stacks')
26
+ .option('--skip-python', 'Skip Python stack installation')
27
+ .option('--skip-java', 'Skip Java stack installation')
28
+ .option('--dry-run', 'Show what would be installed without making changes')
29
+ .action(async (options) => {
30
+ await runSetup(options);
31
+ });
32
+
33
+ program
34
+ .command('check')
35
+ .description('Check current system and installed tools')
36
+ .action(async () => {
37
+ await runCheck();
38
+ });
39
+
40
+ program
41
+ .command('info')
42
+ .description('Display system information')
43
+ .action(async () => {
44
+ await runInfo();
45
+ });
46
+
47
+ await program.parseAsync(process.argv);
48
+ }
49
+
50
+ /**
51
+ * Run the main setup flow
52
+ * @param {Object} options - CLI options
53
+ */
54
+ async function runSetup(options) {
55
+ // Display welcome banner
56
+ logger.banner(
57
+ 'auto-dev-setup',
58
+ 'Cross-platform Developer Environment Setup Tool'
59
+ );
60
+
61
+ // Track all results
62
+ const allResults = {
63
+ installed: [],
64
+ skipped: [],
65
+ failed: []
66
+ };
67
+
68
+ let needsRestart = false;
69
+
70
+ try {
71
+ // ========================================
72
+ // STEP 1: Platform Detection
73
+ // ========================================
74
+ logger.section('Step 1: Platform Detection');
75
+
76
+ const platformInfo = getPlatformInfo();
77
+ logger.displayPlatformInfo(platformInfo);
78
+
79
+ // Check for unsupported platforms
80
+ if (!['darwin', 'linux', 'win32'].includes(platformInfo.platform)) {
81
+ logger.error(`Unsupported platform: ${platformInfo.platform}`);
82
+ logger.info('This tool supports Windows, macOS, and Linux only.');
83
+ process.exit(1);
84
+ }
85
+
86
+ // Windows admin warning
87
+ if (platformInfo.platform === 'win32' && !platformInfo.isElevated) {
88
+ logger.warn('Not running as Administrator');
89
+ logger.info(
90
+ 'Some installations may require Administrator privileges.'
91
+ );
92
+ logger.info(
93
+ 'Consider restarting this tool as Administrator for best results.'
94
+ );
95
+ logger.newline();
96
+
97
+ if (!options.yes) {
98
+ const shouldContinue = await prompts.confirm(
99
+ 'Continue without Administrator privileges?',
100
+ true
101
+ );
102
+ if (!shouldContinue) {
103
+ logger.info('Please restart as Administrator and try again.');
104
+ process.exit(0);
105
+ }
106
+ }
107
+ }
108
+
109
+ // ========================================
110
+ // STEP 2: Base System Setup
111
+ // ========================================
112
+ const baseResults = await stacks.base.install();
113
+
114
+ if (baseResults.pending) {
115
+ logger.info('Please complete pending installations and run again.');
116
+ process.exit(0);
117
+ }
118
+
119
+ mergeResults(allResults, baseResults);
120
+ needsRestart = baseResults.installed.length > 0;
121
+
122
+ // ========================================
123
+ // STEP 3: Web Developer Stack (Mandatory)
124
+ // ========================================
125
+ const webResults = await stacks.web.install();
126
+ mergeResults(allResults, webResults);
127
+ needsRestart = needsRestart || webResults.installed.length > 0;
128
+
129
+ // ========================================
130
+ // STEP 4: Python Stack (Interactive)
131
+ // ========================================
132
+ let installPython = options.yes && !options.skipPython;
133
+
134
+ if (!options.yes && !options.skipPython) {
135
+ installPython = await prompts.promptPythonStack();
136
+ }
137
+
138
+ if (installPython) {
139
+ const pythonResults = await stacks.python.install();
140
+ mergeResults(allResults, pythonResults);
141
+ needsRestart = needsRestart || pythonResults.installed.length > 0;
142
+ } else {
143
+ logger.section('Step 4: Python Development Environment');
144
+ logger.info('Skipped by user choice');
145
+ allResults.skipped.push('Python Stack');
146
+ }
147
+
148
+ // ========================================
149
+ // STEP 5: Java Stack (Interactive)
150
+ // ========================================
151
+ let installJava = options.yes && !options.skipJava;
152
+
153
+ if (!options.yes && !options.skipJava) {
154
+ installJava = await prompts.promptJavaStack();
155
+ }
156
+
157
+ if (installJava) {
158
+ const javaResults = await stacks.java.install();
159
+ mergeResults(allResults, javaResults);
160
+ needsRestart = needsRestart || javaResults.installed.length > 0;
161
+ } else {
162
+ logger.section('Step 5: Java Development Environment');
163
+ logger.info('Skipped by user choice');
164
+ allResults.skipped.push('Java Stack');
165
+ }
166
+
167
+ // ========================================
168
+ // STEP 6: Post-Installation Configuration
169
+ // ========================================
170
+ logger.section('Step 6: Post-Installation Configuration');
171
+
172
+ // Ensure all paths are properly configured
173
+ const pathResult = await postinstall.ensurePathsConfigured();
174
+ if (pathResult.added.length > 0) {
175
+ logger.success('PATH updated for the following:');
176
+ for (const pathInfo of pathResult.added) {
177
+ logger.listItem(`${pathInfo.name}: ${pathInfo.path}`);
178
+ }
179
+ needsRestart = true;
180
+ } else {
181
+ logger.success('All required paths already configured');
182
+ }
183
+
184
+ // Verify tools are accessible
185
+ const toolVerification = postinstall.verifyToolsAccessible();
186
+ if (toolVerification.notAccessible.length > 0) {
187
+ logger.newline();
188
+ logger.warn('Some tools may not be accessible until terminal restart:');
189
+ for (const tool of toolVerification.notAccessible) {
190
+ logger.listItem(tool);
191
+ }
192
+ }
193
+
194
+ // ========================================
195
+ // STEP 7: Final Summary
196
+ // ========================================
197
+ logger.section('Step 7: Final Summary');
198
+ logger.displaySummary(
199
+ allResults.installed,
200
+ allResults.skipped,
201
+ allResults.failed
202
+ );
203
+
204
+ if (needsRestart) {
205
+ logger.warn('Terminal restart required');
206
+ logger.info(
207
+ 'Please restart your terminal for all changes to take effect.'
208
+ );
209
+ logger.newline();
210
+
211
+ // Show platform-specific reload command
212
+ if (platformInfo.platform === 'win32') {
213
+ logger.info('Close and reopen PowerShell/Terminal to refresh your environment.');
214
+ } else {
215
+ const shellConfig = platformInfo.shell.configFile;
216
+ if (shellConfig && shellConfig !== 'N/A') {
217
+ logger.info(`Or run: source ${shellConfig}`);
218
+ }
219
+ }
220
+ }
221
+
222
+ if (allResults.failed.length === 0) {
223
+ logger.complete();
224
+ } else {
225
+ logger.warn(
226
+ `Setup completed with ${allResults.failed.length} failed installation(s).`
227
+ );
228
+ logger.info('Review the errors above and try installing failed components manually.');
229
+ }
230
+ } catch (error) {
231
+ logger.error(`Setup failed: ${error.message}`);
232
+ logger.newline();
233
+ logger.info('If this is a permissions issue, try running as Administrator/sudo.');
234
+ process.exit(1);
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Run system check
240
+ */
241
+ async function runCheck() {
242
+ logger.banner('System Check', 'Verifying installed development tools');
243
+
244
+ const platformInfo = getPlatformInfo();
245
+ logger.displayPlatformInfo(platformInfo);
246
+
247
+ const { verifier } = require('./utils');
248
+ const allVerifications = verifier.runAllVerifications();
249
+
250
+ logger.section('Base Tools');
251
+ verifier.displayVerification(allVerifications.base);
252
+
253
+ logger.section('Web Stack');
254
+ verifier.displayVerification(allVerifications.web);
255
+
256
+ logger.section('Python Stack');
257
+ verifier.displayVerification(allVerifications.python);
258
+
259
+ logger.section('Java Stack');
260
+ verifier.displayVerification(allVerifications.java);
261
+ }
262
+
263
+ /**
264
+ * Display system information
265
+ */
266
+ async function runInfo() {
267
+ logger.banner('System Information', 'auto-dev-setup v' + VERSION);
268
+
269
+ const platformInfo = getPlatformInfo();
270
+ logger.displayPlatformInfo(platformInfo);
271
+ }
272
+
273
+ /**
274
+ * Merge results from a stack installation
275
+ * @param {Object} allResults - Accumulated results
276
+ * @param {Object} stackResults - Results from single stack
277
+ */
278
+ function mergeResults(allResults, stackResults) {
279
+ if (stackResults.installed) {
280
+ allResults.installed.push(...stackResults.installed);
281
+ }
282
+ if (stackResults.skipped) {
283
+ allResults.skipped.push(...stackResults.skipped);
284
+ }
285
+ if (stackResults.failed) {
286
+ allResults.failed.push(...stackResults.failed);
287
+ }
288
+ }
289
+
290
+ module.exports = {
291
+ run,
292
+ runSetup,
293
+ runCheck,
294
+ runInfo
295
+ };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * VS Code Extensions Configuration
3
+ */
4
+
5
+ const VSCODE_EXTENSIONS = {
6
+ essential: [
7
+ {
8
+ id: 'dbaeumer.vscode-eslint',
9
+ name: 'ESLint',
10
+ description: 'Integrates ESLint JavaScript into VS Code'
11
+ },
12
+ {
13
+ id: 'esbenp.prettier-vscode',
14
+ name: 'Prettier',
15
+ description: 'Code formatter using prettier'
16
+ },
17
+ {
18
+ id: 'eamodio.gitlens',
19
+ name: 'GitLens',
20
+ description: 'Supercharge Git within VS Code'
21
+ }
22
+ ],
23
+ python: [
24
+ {
25
+ id: 'ms-python.python',
26
+ name: 'Python',
27
+ description: 'Python language support'
28
+ },
29
+ {
30
+ id: 'ms-python.vscode-pylance',
31
+ name: 'Pylance',
32
+ description: 'Python language server'
33
+ },
34
+ {
35
+ id: 'ms-toolsai.jupyter',
36
+ name: 'Jupyter',
37
+ description: 'Jupyter notebook support'
38
+ }
39
+ ],
40
+ java: [
41
+ {
42
+ id: 'vscjava.vscode-java-pack',
43
+ name: 'Java Extension Pack',
44
+ description: 'Popular extensions for Java development'
45
+ }
46
+ ]
47
+ };
48
+
49
+ module.exports = {
50
+ VSCODE_EXTENSIONS
51
+ };
package/src/index.js ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * auto-dev-setup
3
+ * Cross-platform developer environment setup tool
4
+ */
5
+
6
+ const { run } = require('./cli');
7
+ const platform = require('./platform');
8
+ const stacks = require('./stacks');
9
+ const utils = require('./utils');
10
+
11
+ module.exports = {
12
+ run,
13
+ platform,
14
+ stacks,
15
+ utils
16
+ };