├── .editorconfig ├── .gitignore ├── .prettierrc ├── eslint.config.js ├── package.json └── src ├── constants └── contacts.js ├── db └── db.json ├── index.js ├── scripts ├── addOneContact.js ├── countContacts.js ├── generateContacts.js ├── getAllContacts.js ├── removeAllContacts.js └── removeLastContact.js └── utils ├── createFakeContact.js ├── readContacts.js └── writeContacts.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | end_of_line = lf 5 | charset = utf-8 6 | trim_trailing_whitespace = true 7 | insert_final_newline = true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | 3 | .env 4 | 5 | .vscode 6 | .DS_Store 7 | .idea -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "semi": true, 3 | "singleQuote": true, 4 | "trailingComma": "all", 5 | "printWidth": 80 6 | } 7 | -------------------------------------------------------------------------------- /eslint.config.js: -------------------------------------------------------------------------------- 1 | import globals from 'globals'; 2 | import pluginJs from '@eslint/js'; 3 | 4 | export default [ 5 | pluginJs.configs.recommended, 6 | { 7 | files: ['src/**/*.js'], 8 | languageOptions: { globals: globals.node }, 9 | rules: { 10 | semi: 'error', 11 | 'no-unused-vars': ['error', { args: 'none' }], 12 | 'no-undef': 'error', 13 | }, 14 | }, 15 | ]; 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "goit-node-js", 3 | "version": "1.0.0", 4 | "description": "goit-node-js", 5 | "type": "module", 6 | "main": "index.js", 7 | "scripts": { 8 | "get-all": "node src/scripts/getAllContacts", 9 | "generate": "node src/scripts/generateContacts.js", 10 | "add-one": "node src/scripts/addOneContact.js", 11 | "count": "node src/scripts/countContacts.js", 12 | "remove-last": "node src/scripts/removeLastContact.js", 13 | "remove-all": "node src/scripts/removeAllContacts.js" 14 | }, 15 | "keywords": [], 16 | "author": "", 17 | "license": "ISC", 18 | "devDependencies": { 19 | "@eslint/js": "^9.2.0", 20 | "eslint": "^9.2.0", 21 | "globals": "^15.1.0" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/constants/contacts.js: -------------------------------------------------------------------------------- 1 | export const PATH_DB = 2 | -------------------------------------------------------------------------------- /src/db/db.json: -------------------------------------------------------------------------------- 1 | [] -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/goitacademy/nodejs-hw-01-template/56d7b9af65564cc5d6de0bc7d3b506f4a1a6e139/src/index.js -------------------------------------------------------------------------------- /src/scripts/addOneContact.js: -------------------------------------------------------------------------------- 1 | export const addOneContact = async () => {}; 2 | 3 | addOneContact(); 4 | -------------------------------------------------------------------------------- /src/scripts/countContacts.js: -------------------------------------------------------------------------------- 1 | export const countContacts = async () => {}; 2 | 3 | console.log(await countContacts()); 4 | -------------------------------------------------------------------------------- /src/scripts/generateContacts.js: -------------------------------------------------------------------------------- 1 | const generateContacts = async (number) => {}; 2 | 3 | generateContacts(5); 4 | -------------------------------------------------------------------------------- /src/scripts/getAllContacts.js: -------------------------------------------------------------------------------- 1 | export const getAllContacts = async () => {}; 2 | 3 | console.log(await getAllContacts()); 4 | -------------------------------------------------------------------------------- /src/scripts/removeAllContacts.js: -------------------------------------------------------------------------------- 1 | export const removeAllContacts = async () => {}; 2 | 3 | removeAllContacts(); 4 | -------------------------------------------------------------------------------- /src/scripts/removeLastContact.js: -------------------------------------------------------------------------------- 1 | export const removeLastContact = async () => {}; 2 | 3 | removeLastContact(); 4 | -------------------------------------------------------------------------------- /src/utils/createFakeContact.js: -------------------------------------------------------------------------------- 1 | import { faker } from "@faker-js/faker"; 2 | 3 | export const createFakeContact = () => ({ 4 | id: faker.string.uuid(), 5 | name: faker.person.fullName(), 6 | phone: faker.phone.number(), 7 | email: faker.internet.email(), 8 | job: faker.person.jobTitle(), 9 | }); 10 | -------------------------------------------------------------------------------- /src/utils/readContacts.js: -------------------------------------------------------------------------------- 1 | import { PATH_DB } from '../constants/contacts.js'; 2 | 3 | export const readContacts = async () => {}; 4 | -------------------------------------------------------------------------------- /src/utils/writeContacts.js: -------------------------------------------------------------------------------- 1 | import { PATH_DB } from '../constants/contacts.js'; 2 | 3 | export const writeContacts = async (updatedContacts) => {}; 4 | --------------------------------------------------------------------------------