Skip to content

Commit

Permalink
Feature/Add Contributing.md and Humans.txt (#38)
Browse files Browse the repository at this point in the history
* Add CONTRIBUTING.md

* Update README.md

* Add humans.txt

* Update README.md
  • Loading branch information
getCryptoAddress authored Nov 8, 2024
1 parent eb99af1 commit 9bacc9c
Show file tree
Hide file tree
Showing 5 changed files with 155 additions and 42 deletions.
60 changes: 18 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```
77 changes: 77 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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;
```
35 changes: 35 additions & 0 deletions node/humans/addSection.mjs
Original file line number Diff line number Diff line change
@@ -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)
);
}
23 changes: 23 additions & 0 deletions node/humans/generateHumans.mjs
Original file line number Diff line number Diff line change
@@ -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");
}
2 changes: 2 additions & 0 deletions prerender.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 9bacc9c

Please sign in to comment.