-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
executable file
·53 lines (40 loc) · 1.19 KB
/
index.js
File metadata and controls
executable file
·53 lines (40 loc) · 1.19 KB
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
48
#!/usr/bin/env node
import chalk from 'chalk';
import clear from 'clear';
import figlet from 'figlet';
import files from './lib/files.js';
import github from './lib/github.js';
import repo from './lib/repo.js';
(async () => {
const printScreen = () => {
clear();
console.log(
chalk.blueBright(
figlet.textSync('Git Init', {
font: 'Star Wars',
horizontalLayout: 'full'
})
)
);
};
const getGithubToken = async () => {
const args = process.argv;
let token;
if (args.length > 2 && args[2] === '--reset') {
token = await github.createGithubToken();
}
else {
token = github.getStoredGithubToken();
if (!token) token = await github.createGithubToken();
};
return github.getGithubAuthToken(token);
};
// start app
printScreen();
files.gitDirectoryExists('.git');
// github processes
const octokit = await getGithubToken();
const url = await repo.createRemoteRepo(octokit);
await repo.createGitIgnore();
await repo.createLocalRepo(url);
})();