starlight-cli 1.0.4 → 1.0.5
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/index.js +1 -3
- package/package.json +1 -1
- package/install.js +0 -64
package/index.js
CHANGED
package/package.json
CHANGED
package/install.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
const https = require('https');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { execSync } = require('child_process');
|
|
6
|
-
|
|
7
|
-
const DOWNLOAD_URL =
|
|
8
|
-
'https://github.com/developerdominex/dominexmacedon/releases/download/programming/starlight.exe';
|
|
9
|
-
|
|
10
|
-
const INSTALL_DIR = 'C:\\Starlight\\bin';
|
|
11
|
-
const EXE_PATH = path.join(INSTALL_DIR, 'starlight.exe');
|
|
12
|
-
|
|
13
|
-
// Ensure install directory exists
|
|
14
|
-
fs.mkdirSync(INSTALL_DIR, { recursive: true });
|
|
15
|
-
|
|
16
|
-
console.log('Downloading Starlight...');
|
|
17
|
-
|
|
18
|
-
function download(url, dest) {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
https.get(url, res => {
|
|
21
|
-
if ([301, 302].includes(res.statusCode)) {
|
|
22
|
-
return download(res.headers.location, dest).then(resolve).catch(reject);
|
|
23
|
-
}
|
|
24
|
-
if (res.statusCode !== 200) {
|
|
25
|
-
reject(new Error(`HTTP ${res.statusCode}`));
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
const file = fs.createWriteStream(dest);
|
|
30
|
-
res.pipe(file);
|
|
31
|
-
|
|
32
|
-
file.on('finish', () => file.close(resolve));
|
|
33
|
-
file.on('error', err => {
|
|
34
|
-
fs.unlinkSync(dest);
|
|
35
|
-
reject(err);
|
|
36
|
-
});
|
|
37
|
-
}).on('error', reject);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
(async () => {
|
|
42
|
-
try {
|
|
43
|
-
await download(DOWNLOAD_URL, EXE_PATH);
|
|
44
|
-
console.log(`Downloaded to: ${EXE_PATH}`);
|
|
45
|
-
|
|
46
|
-
// Add to PATH permanently
|
|
47
|
-
try {
|
|
48
|
-
execSync(`setx PATH "%PATH%;${INSTALL_DIR}"`, { stdio: 'ignore' });
|
|
49
|
-
console.log('PATH updated for future sessions.');
|
|
50
|
-
} catch {
|
|
51
|
-
console.warn('Could not update PATH permanently (may already exist or too long).');
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// Add to PATH for current session
|
|
55
|
-
process.env.PATH = `${INSTALL_DIR};${process.env.PATH}`;
|
|
56
|
-
console.log('PATH updated for current session.');
|
|
57
|
-
|
|
58
|
-
console.log('Starlight installation completed successfully!');
|
|
59
|
-
process.exit(0);
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.error('Download or installation failed:', err.message);
|
|
62
|
-
process.exit(1);
|
|
63
|
-
}
|
|
64
|
-
})();
|