genie-setup 1.0.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.
Files changed (2) hide show
  1. package/index.js +66 -0
  2. package/package.json +11 -0
package/index.js ADDED
@@ -0,0 +1,66 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { execSync } = require('child_process');
4
+ const fs = require('fs');
5
+ const path = require('path');
6
+
7
+ const REPO_URL = 'https://github.com/loser40/genie.git';
8
+ const PROJECT_NAME = 'genie';
9
+
10
+ // Helper function to run terminal commands natively
11
+ const run = (command, silent = false) => {
12
+ try {
13
+ return execSync(command, { stdio: silent ? 'pipe' : 'inherit', encoding: 'utf-8' });
14
+ } catch (error) {
15
+ if (!silent) console.error(`\nāŒ Failed to execute: ${command}`);
16
+ return null;
17
+ }
18
+ };
19
+
20
+ console.log("šŸ§ž Summoning GENIE Setup...\n");
21
+
22
+ // 1. Check Node.js Version (Requiring v18+)
23
+ const nodeVersion = process.version;
24
+ const majorVersion = parseInt(nodeVersion.replace('v', '').split('.')[0], 10);
25
+
26
+ if (majorVersion < 18) {
27
+ console.error(`āŒ GENIE requires Node.js v18 or higher. You are currently running ${nodeVersion}.`);
28
+ console.error(`Please update Node.js from https://nodejs.org/ and try again.`);
29
+ process.exit(1);
30
+ }
31
+ console.log(`āœ… Node version ${nodeVersion} is compatible.`);
32
+
33
+ // 2. Check for Git
34
+ if (!run('git --version', true)) {
35
+ console.error(`āŒ Git is not installed on your system. Please install Git to continue.`);
36
+ process.exit(1);
37
+ }
38
+
39
+ // 3. Check and Auto-Install pnpm
40
+ const pnpmCheck = run('pnpm --version', true);
41
+ if (!pnpmCheck) {
42
+ console.log(`āš ļø pnpm not found. Installing pnpm globally...`);
43
+ run('npm install -g pnpm');
44
+ console.log(`āœ… pnpm installed successfully.`);
45
+ } else {
46
+ console.log(`āœ… pnpm version ${pnpmCheck.trim()} found.`);
47
+ }
48
+
49
+ // 4. Clone the Loser40 Repo
50
+ if (fs.existsSync(PROJECT_NAME)) {
51
+ console.log(`āš ļø Directory '${PROJECT_NAME}' already exists. Skipping clone.`);
52
+ } else {
53
+ console.log(`\nšŸ“„ Cloning GENIE repository from ${REPO_URL}...`);
54
+ run(`git clone ${REPO_URL}`);
55
+ }
56
+
57
+ // 5. Navigate, Install, and Launch!
58
+ console.log(`\nšŸ“¦ Installing GENIE dependencies...`);
59
+ const projectPath = path.join(process.cwd(), PROJECT_NAME);
60
+ process.chdir(projectPath);
61
+
62
+ run('pnpm install');
63
+
64
+ console.log(`\nšŸš€ GENIE is ready! Starting the core process...`);
65
+ // Change this next line to whatever command actually boots up your app (e.g., pnpm run dev, pnpm start)
66
+ run('pnpm start');
package/package.json ADDED
@@ -0,0 +1,11 @@
1
+ {
2
+ "name": "genie-setup",
3
+ "version": "1.0.0",
4
+ "description": "Universal installer for GENIE",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "genie-setup": "./index.js"
8
+ },
9
+ "author": "loser40",
10
+ "license": "MIT"
11
+ }