Skip to content

Commit 4b57f60

Browse files
committed
updated readme and index.js for help logs
1 parent b46d1c8 commit 4b57f60

File tree

3 files changed

+47
-5
lines changed

3 files changed

+47
-5
lines changed

README.md

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Node, npm learning second homework
88

9-
Npm package used: [faker](https://www.npmjs.com/package/@faker-js/faker)
9+
Writing and reading data to files, readline , imports, exports, npm packages install, validation, terminal application.
1010

1111
<!-- ![alt app screenshot](./img/screenshot.png) -->
1212

@@ -45,9 +45,37 @@ Npm package used: [faker](https://www.npmjs.com/package/@faker-js/faker)
4545
- Show red messages on error;
4646
- If registration successful show green message "Registration successful";
4747

48-
<!-- ### 🏁 Getting started
48+
### 🏁 Getting started
4949

5050
**Must have [Node.js](https://nodejs.org)** installed
5151

5252
1. Clone the repo
53-
2. Go into project directory and Install NPM packages -->
53+
2. Go into project directory and Install NPM packages
54+
55+
```sh
56+
npm install
57+
```
58+
59+
3. run index.js for help
60+
61+
```sh
62+
node .
63+
```
64+
65+
4. use application:
66+
67+
```sh
68+
npm run task1
69+
```
70+
71+
```sh
72+
npm run task2
73+
```
74+
75+
```sh
76+
npm run task3
77+
```
78+
79+
```sh
80+
npm run bonus
81+
```

index.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import c from "chalk";
2+
import { EOL } from "os";
3+
console.log(EOL);
4+
console.log(`to run TASK 1:`, c.bgYellow("npm run task1"), "or", c.bgYellow("node ./src/task-1.js"));
5+
console.log(c.dim("It will save random user data to ./database/task-1/people.txt file"));
6+
console.log(EOL);
7+
console.log(`to run TASK 2:`, c.bgYellow("npm run task2"), "or", c.bgYellow("node ./src/task-2.js"));
8+
console.log(c.dim("It will save random user data to ./database/task-2/people.txt file only after successful login"));
9+
console.log(EOL);
10+
console.log(`to run TASK 3:`, c.bgYellow("npm run task3"), "or", c.bgYellow("node ./src/task-3.js"));
11+
console.log(c.dim("After successful login you will be able to save random user data to ./database/task-3/people.txt file or read data from that file"));
12+
console.log(EOL);
13+
console.log(`to run TASK BONUS:`, c.bgYellow("npm run bonus"), "or", c.bgYellow("node ./src/task-bonus.js"));
14+
console.log(c.dim("You will be prompted to enter registration details. Your details will be validated and saved to ./database/task-bonus/registration.txt file"));

src/task-bonus.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ printIntro();
1515
/// Get registration inputs
1616
let details = await getUserDetails();
1717

18-
/// Read adn parse current file data
18+
/// Read and parse current file data
1919
let currentData = JSON.parse(await readFileData());
2020

2121
/// Append new data to array
@@ -25,7 +25,7 @@ currentData.push(details);
2525
await writeDataToFile(JSON.stringify(currentData));
2626

2727
/// Log Success message
28-
closeProgram(c.green("Duomenys faile sėkmingai išsaugoti"));
28+
closeProgram(c.green("Registration successful"));
2929

3030
async function getUserDetails() {
3131
let userDetails = {

0 commit comments

Comments
 (0)