install-kimchilang 1.0.1
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 +60 -0
- package/package.json +21 -0
package/index.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { execSync } from 'child_process';
|
|
4
|
+
|
|
5
|
+
const COLORS = {
|
|
6
|
+
reset: '\x1b[0m',
|
|
7
|
+
bright: '\x1b[1m',
|
|
8
|
+
green: '\x1b[32m',
|
|
9
|
+
cyan: '\x1b[36m',
|
|
10
|
+
yellow: '\x1b[33m',
|
|
11
|
+
red: '\x1b[31m',
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
function log(message, color = '') {
|
|
15
|
+
console.log(color + message + COLORS.reset);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function run(command, options = {}) {
|
|
19
|
+
try {
|
|
20
|
+
execSync(command, { stdio: 'inherit', ...options });
|
|
21
|
+
return true;
|
|
22
|
+
} catch (error) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function showHelp() {
|
|
28
|
+
log('\n🌶️ install-kimchilang\n', COLORS.bright + COLORS.cyan);
|
|
29
|
+
log('Install KimchiLang globally on your system.\n');
|
|
30
|
+
log('Usage:');
|
|
31
|
+
log(' npx install-kimchilang');
|
|
32
|
+
log(' npx install-kimchilang --help\n');
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Main
|
|
36
|
+
const args = process.argv.slice(2);
|
|
37
|
+
|
|
38
|
+
if (args.includes('--help') || args.includes('-h')) {
|
|
39
|
+
showHelp();
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
log('\n🌶️ Installing KimchiLang...\n', COLORS.bright + COLORS.cyan);
|
|
44
|
+
|
|
45
|
+
// Install kimchilang globally
|
|
46
|
+
log('Installing kimchilang globally...', COLORS.yellow);
|
|
47
|
+
|
|
48
|
+
if (run('npm install -g kimchilang')) {
|
|
49
|
+
log('\n✨ KimchiLang installed successfully!\n', COLORS.bright + COLORS.green);
|
|
50
|
+
log('You can now use:', COLORS.cyan);
|
|
51
|
+
log(' kimchi --help Show help');
|
|
52
|
+
log(' kimchi src.main Run a module');
|
|
53
|
+
log(' kimchi compile app.km Compile a file');
|
|
54
|
+
log(' npx create-kimchi-app Create a new project\n');
|
|
55
|
+
} else {
|
|
56
|
+
log('\n❌ Installation failed.\n', COLORS.red);
|
|
57
|
+
log('Try running with sudo:', COLORS.yellow);
|
|
58
|
+
log(' sudo npm install -g kimchilang\n');
|
|
59
|
+
process.exit(1);
|
|
60
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "install-kimchilang",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Install KimchiLang globally",
|
|
5
|
+
"bin": {
|
|
6
|
+
"install-kimchilang": "./index.js"
|
|
7
|
+
},
|
|
8
|
+
"type": "module",
|
|
9
|
+
"keywords": [
|
|
10
|
+
"kimchi",
|
|
11
|
+
"kimchilang",
|
|
12
|
+
"install",
|
|
13
|
+
"cli"
|
|
14
|
+
],
|
|
15
|
+
"author": "",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/danajanezic/kimchilang"
|
|
20
|
+
}
|
|
21
|
+
}
|