-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/Add Contributing.md and Humans.txt (#38)
* Add CONTRIBUTING.md * Update README.md * Add humans.txt * Update README.md
- Loading branch information
1 parent
eb99af1
commit 9bacc9c
Showing
5 changed files
with
155 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
``` | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters