Skip to content

Commit f2de25b

Browse files
committed
📦NEW: authentication
1 parent 1032a7c commit f2de25b

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

‎utils/authentication.js‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const fs = require("fs");
2+
const io = require("console-read-write");
3+
const auth = require("./auth");
4+
const { green, red, yellow } = require("chalk");
5+
6+
module.exports = async () => {
7+
if (auth.Authorization === "") {
8+
io.write(
9+
red(
10+
"\n> To use the CLI without any issue, first enter your GitHub access token. THIS IS ONE TIME THING.\n"
11+
)
12+
);
13+
io.write(
14+
green(
15+
"> If you do not know how to create one, check -> https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line\n"
16+
)
17+
);
18+
19+
io.write(yellow("Token: "));
20+
const token = await io.read();
21+
22+
const data = `module.exports = {
23+
Authorization: "Token ${token}",
24+
}`;
25+
26+
fs.writeFile("./utils/auth.js", data, (err) => {});
27+
}
28+
};

0 commit comments

Comments
 (0)