diff --git a/README.md b/README.md index 04080ac..ff13b1d 100644 --- a/README.md +++ b/README.md @@ -2,57 +2,33 @@ https://getcryptoaddress.github.io/ - - https://github.com/user-attachments/assets/6f1da5d9-89b0-4f50-a6e5-951d7f7ff3c9 +## Description +Get Crypto Address is an open-source tool that allows you to generate +cryptocurrency addresses and create paper wallets. It's free, offline, and +open-source. -## Project Setup - -```sh -npm install -``` - -### Compile and Hot-Reload for Development - -```sh -npm run dev -``` - -### Type-Check, Compile and Minify for Production - -```sh -npm run build -``` +### What Sets Us Apart? -### Run Unit Tests with [Vitest](https://vitest.dev/) +1. **Supports Bitcoin Address Formats**: + - P2PKH + - P2WPKH + - Taproot -```sh -npm run test:unit -``` +2. **Ethereum Support**: + - Generate Ethereum addresses and private keys. -### Run End-to-End Tests with [Playwright](https://playwright.dev) +3. **Custom Paper Wallet Designs**: + - Create a unique, personalized design for your paper wallet. -```sh -# Install browsers for the first run -npx playwright install +--- -# When testing on CI, must build the project first -npm run build +## Contributing -# Runs the end-to-end tests -npm run test:e2e -# Runs the tests only on Chromium -npm run test:e2e -- --project=chromium -# Runs the tests of a specific file -npm run test:e2e -- tests/example.spec.ts -# Runs the tests in debug mode -npm run test:e2e -- --debug -``` +We welcome feedback, contributions, and suggestions to help us improve and +expand Get Crypto Address. Your support and ideas are greatly appreciated! -### Lint with [ESLint](https://eslint.org/) +- [CONTRIBUTING.md](docs/CONTRIBUTING.md) -```sh -npm run lint -``` diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md new file mode 100644 index 0000000..42370d1 --- /dev/null +++ b/docs/CONTRIBUTING.md @@ -0,0 +1,77 @@ +# Contributing to Get Crypto Address + +Thank you for considering contributing to Get Crypto Address! +We appreciate your interest in helping us improve the project. +This guide provides instructions and best practices to make contributing as +smooth as possible. + +## 1. Setting Up the Local Development Environment for Pull Requests + +To get started with contributing, you'll need to set up the project on your +local machine. Please follow these steps: + +1. **Clone the repository**: + Clone the repository to your local machine using SSH or HTTPS: + ```shell + git clone git@github.com:getCryptoAddress/getCryptoAddress.github.io.git + # or: + # git clone https://github.com/getCryptoAddress/getCryptoAddress.github.io.git + + cd getCryptoAddress.github.io + ``` +2. **Install [Node.js](https://nodejs.org/)**: + Ensure that you have [Node.js](https://nodejs.org/) installed. + The required version can be found in the `engine.node` field in the + [package.json](../package.json) file. +3. **Install project dependencies**: + Once Node.js is set up, install the project dependencies using npm: + ```shell + npm install + ``` +4. **Run the project locally**: + Start the local development server to ensure everything works as expected. + ```shell + npm run dev + ``` +5. **Make your changes**: + Make the necessary changes to the project and test them locally. +6. **Test your changes**: + Run the unit tests to ensure that your changes don't break existing + functionality. + ```shell + npm run test:unit + ``` + Run the end-to-end tests via [Playwright](https://playwright.dev) + to ensure that your changes don't break the user + interface. + ```shell + # Install browsers for the first run + npx playwright install + + # Runs the end-to-end tests + npm run test:e2e + # Runs the tests only on Chromium + npm run test:e2e -- --project=chromium + # Runs the tests of a specific file + npm run test:e2e -- tests/example.spec.ts + # Runs the tests in debug mode + npm run test:e2e -- --debug + ``` + Build the project for production to ensure that your changes don't introduce + any issues. + ```shell + npm run build; + npm run prerender; + PLAYWRIGHT_USE_BUILD=1 npm run test:e2e; + ``` + +7. **Commit your changes**: + Once you're satisfied with your changes, commit them to your fork. + Don't forget about [Eslint](https://eslint.org/) + and [Prettier](https://prettier.io/). + You can run them with: + ```shell + npm run lint; + npm run format; + ``` + diff --git a/node/humans/addSection.mjs b/node/humans/addSection.mjs new file mode 100644 index 0000000..966caae --- /dev/null +++ b/node/humans/addSection.mjs @@ -0,0 +1,35 @@ +const newLine = "\n"; +const newParagraph = "\n\n"; + +/** + * Add spaces to the beginning of a string + * @param {string} str + * @returns {string} + */ +function addSpaces(str) { + return " ".repeat(2) + str.trim(); +} + +/** + * Add a section to the humans.txt file + * @example + * ```js + * addSection("Site", [ + * ["Site: Get Crypto Address", "URL: https://getcryptoaddress.github.io"], + * ]), + * ``` + * @param {string} title + * @param {string[][]} content + */ +export function addSection(title, content) { + return ( + `/* ${title} */` + + newLine + + content + .filter(Boolean) + .map((contentLine) => + contentLine.filter(Boolean).map(addSpaces).join(newLine), + ) + .join(newParagraph) + ); +} diff --git a/node/humans/generateHumans.mjs b/node/humans/generateHumans.mjs new file mode 100644 index 0000000..c030819 --- /dev/null +++ b/node/humans/generateHumans.mjs @@ -0,0 +1,23 @@ +import fs from "node:fs"; +import path from "node:path"; +import { addSection } from "./addSection.mjs"; + +export default async function generateHumans(pageFolder) { + const content = [ + addSection("TEAM", [ + [ + "Developer: Get Crypto Address", + "Site: https://getcryptoaddress.github.io", + "GitHub: https://github.com/getCryptoAddress/", + ], + ]), + addSection("SITE", [ + [ + `Last build: ${new Date().toUTCString()}`, + "Programming languages: JavaScript, TypeScript", + "Technologies: Vite, Vue, Playwright, Vitest", + ], + ]), + ].join("\n\n"); + fs.writeFileSync(path.join(pageFolder, "humans.txt"), content, "utf8"); +} diff --git a/prerender.mjs b/prerender.mjs index dece925..e75af0c 100644 --- a/prerender.mjs +++ b/prerender.mjs @@ -3,6 +3,7 @@ import path from "node:path"; import { createServer } from "vite"; import { addInlineStylesHashesToHtml } from "./node/csp/addInlineStylesHashesToHtml.mjs"; import { getInlineStylesHashes } from "./node/csp/getInlineStylesHashes.mjs"; +import generateHumans from "./node/humans/generateHumans.mjs"; import generateSitemap from "./node/sitemap/generateSitemap.mjs"; // todo refactor file, separate into functions @@ -19,6 +20,7 @@ const { render, routes } = await vite.ssrLoadModule("/src/entry-server.ts"); const routerPaths = routes.map((route) => route.path); generateSitemap(routerPaths, "https://getcryptoaddress.github.io", "dist"); +generateHumans("dist"); for (const routerPath of routerPaths) { const { appHtml, ctx } = await render(routerPath);