-
Notifications
You must be signed in to change notification settings - Fork 1
/
bin.js
executable file
·47 lines (37 loc) · 1.27 KB
/
bin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env node
import fs from 'fs';
import inquirer from 'inquirer';
import { exec } from 'child_process';
import { promisify } from 'util';
import path from 'path';
const execAsync = promisify(exec);
async function main() {
const currentDirectory = process.cwd();
const answers = await inquirer.prompt([
{
type: 'confirm',
name: 'proceedDownload',
message: `Proceed download oss-translator in ${currentDirectory}?`,
default: true
}
]);
if (answers.proceedDownload) {
// Clone the repository
const cloneCommand = 'git clone https://github.com/koundinyad/translator.git';
console.log('Cloning repository...');
await execAsync(cloneCommand);
console.log('oss-translator downloaded successfully.');
// Add 'translator' directory to .gitignore
const gitignorePath = path.join(currentDirectory, '.gitignore');
fs.appendFileSync(gitignorePath, 'translator\n', 'utf8');
console.log('Added "translator" directory to .gitignore.');
console.log('To run the project, follow these steps:');
console.log('1. Change directory to the cloned repository:');
console.log(' cd translator');
console.log('2. Install dependencies:');
console.log(' npm install');
console.log('3. Run the development server:');
console.log(' npm run dev');
}
}
main();