Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Nolway committed Feb 20, 2022
0 parents commit 8123aae
Show file tree
Hide file tree
Showing 59 changed files with 3,481 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended", "prettier"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": "2019",
"sourceType": "module",
"project": "./tsconfig.json"
},
"plugins": ["@typescript-eslint"],
"rules": {
"indent": ["error", "tab"],
"linebreak-style": ["error", "unix"],
"quotes": ["error", "double"],
"semi": ["error", "always"],
"no-throw-literal": "error",
"@typescript-eslint/no-unused-vars": "error",
"@typescript-eslint/consistent-type-definitions": ["error", "type"],
"@typescript-eslint/no-explicit-any": "error"
}
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules
/yarn-error.log
/package-lock.json
/dist
/build
/src/config.ts
1 change: 1 addition & 0 deletions .husky/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
_
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16.14
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"semi": true,
"singleQuote": false,
"arrowParens": "always",
"tabWidth": 4,
"printWidth": 120
}
661 changes: 661 additions & 0 deletions LICENSE.txt

Large diffs are not rendered by default.

140 changes: 140 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
<h1>Woka NFT Generator 🧙‍♂️</h1>
<p>
<img alt="Version" src="https://img.shields.io/badge/version-1.0.0-blue.svg?cacheSeconds=2592000" />
<a href="LICENSE.txt" target="_blank">
<img alt="License: AGPL--3.0" src="https://img.shields.io/badge/License-AGPL--3.0-yellow.svg" />
</a>
</p>

Easily generate your NFT collection from Wokas !

## Requirements

- Node 16.14 <

## Install

```sh
yarn install
cp src/config.dist.ts src/config.ts
```

## Demo

Use the command below, after which the **/build** folder will appear with all the assets and metadata needed to create an NFT collection.

```sh
yarn run generate
```

## Usage

Delete all sample assets in the sub-directories of **/assets** folder and place your assets in the corresponding directories by layers.

Configure the **/src/config.ts** file as needs :

```ts
import { Config } from "./guards/ConfigGuards";

const config: Config = {
blockchain: {
type: "ethereum", // ethereum|solana
metadata: {
/* Ethereum */
// Optional: Manage the NFT name
name: {
prefix: "My awesome Woka edition ", // Optional: NFT name prefix
suffix: " wow !", // Optional: NFT name suffix
},
description: "Awesome Woka", // Description of your NFT
image: "ipfs://mylink/", // Base URI to your avatar files
/* Avalanche */
/*
name: {
prefix: "My awesome Woka edition ",
suffix: " wow !",
},
description: "Awesome Woka",
image: "ipfs://mylink/",
*/
},
},
collection: {
size: 10, // Number of NFTs to be created
crop: {
size: 512, // Optional: Resize of Woka in pixels to stick it above background (must be smaller than the background)
marging: {
// Optional: Add a margin to the woka in pixel
left: 64,
right: 64,
top: 64,
bottom: 64,
},
},
rarity: {
/**
* Give a rarity to a part.
* A table will be displayed after the generation to known how rare a part is.
*
* random: Allow random rarity to all parts.
* delimiter: Allow a rarity by a # in the file name (example: my-body-is-ready#50.png),
* if a file doesn't have a delimiter, the rarity will be set to 100.
* none: Don't give a rarity.
*/
method: "delimiter",
/* random */
edges: {
// Only on random & optional: Delimit the rarity
min: 1, // Min rarity, cannot be under 1
max: 100, // Max rarity
},
},
background: {
/**
* Optional: Method for adding a background (transparent by default)
* image: Get a random background from the backgrounds folder.
* linked: Use the background with the same name in the backgrounds folder.
* color: Use a color.
*/
method: "image",
/*color: {
hex: "#EACCFF",
alpha: 1,
},*/
},
},
};

export default config;
```

Generate your collection with the next command :

```sh
yarn run generate
```

All files needed for an NFT collection are generated in the **/build** folder.

If you want to delete all the generated assets, you can do this:

```sh
yarn run reset
```

## Author

👤 **Nolway (Alexis Faizeau)**

- Website: [alexis-faizeau.com](https://www.alexis-faizeau.com)
- Github: [@Nolway](https://github.com/Nolway)
- LinkedIn: [@alexis-faizeau](https://linkedin.com/in/alexis-faizeau)

## Show your support

Give a ⭐️ if this project helped you!

## 📝 License

Copyright © 2022 [Nolway(Alexis Faizeau)](https://github.com/Nolway).<br />
This project is [AGPL--3.0](LICENSE.txt) licensed.
Binary file added assets/backgrounds/astronomy.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/backgrounds/black.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/backgrounds/colorful.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/backgrounds/triangles.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/backgrounds/white.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/accessory/Chirigurcal Mask#50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/accessory/Mage Stick#50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/accessory/None#500.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/body/Black#5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/body/Brown#50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/body/Pink Skeleton#20.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/body/White Ghost#10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/body/White#50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/clothes/Back Seifuku#70.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/clothes/Black Suit#100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/clothes/Leaf#10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/clothes/White Bikini#30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/clothes/Yellow Think#30.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/eyes/Eyes1#10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/eyes/Eyes2#200.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/eyes/Eyes3#50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/eyes/Eyes4#50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/eyes/Eyes5#50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/hairs/Blond Long#50.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/hairs/Brown Long#100.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/layers/hairs/Brown Short#100.png
Binary file added assets/layers/hairs/Brown#200.png
Binary file added assets/layers/hairs/None#50.png
Binary file added assets/layers/hat/Hats Q#100.png.png
Binary file added assets/layers/hat/Hats R#100.png.png
Binary file added assets/layers/hat/Hats S#100.png.png
Binary file added assets/layers/hat/Hats V#100.png.png
Binary file added assets/layers/hat/Hats W#100.png.png
Binary file added assets/layers/hat/Hats X#100.png
Binary file added assets/layers/hat/Hats Y#100.png.png
Binary file added assets/layers/hat/None#10.png
Binary file added assets/layers/hat/tinfoil_hat1.png
46 changes: 46 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"name": "woka-nft-generator",
"version": "1.0.0",
"description": "Woka NFT Generator",
"repository": "fdgd",
"author": "Nolway (Alexis Faizeau)",
"license": "AGPL-3.0",
"scripts": {
"dev": "tsc --watch",
"generate": "ts-node ./src/generate.ts",
"reset": "ts-node ./src/reset.ts",
"lint": "eslint --ext .js,.ts .",
"format": "prettier --ignore-path .gitignore --write \"**/*.+(js|ts|json)\"",
"prepare": "husky install"
},
"dependencies": {
"chalk": "^4.1.2",
"generic-type-guard": "^3.4.2",
"pngjs": "^6.0.0",
"sha1": "^1.1.1",
"sharp": "^0.30.1",
"ts-node": "^10.5.0"
},
"devDependencies": {
"@types/node": "^17.0.18",
"@types/pngjs": "^6.0.1",
"@types/sha1": "^1.1.3",
"@types/sharp": "^0.29.5",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.3.0",
"husky": ">=6",
"lint-staged": ">=10",
"prettier": "^2.5.1",
"typescript": "^4.5.5"
},
"lint-staged": {
"*.{js,ts}": [
"eslint --fix"
],
"*.{js|ts|json}": [
"prettier --write"
]
}
}
72 changes: 72 additions & 0 deletions src/config.dist.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import { Config } from "./guards/ConfigGuards";

const config: Config = {
blockchain: {
type: "ethereum", // ethereum|solana
metadata: {
/* Ethereum */
// Optional: Manage the NFT name
name: {
prefix: "My awesome Woka edition ", // Optional: NFT name prefix
suffix: " wow !", // Optional: NFT name suffix
},
description: "Awesome Woka", // Description of your NFT
image: "ipfs://mylink/", // Base URI to your avatar files
/* Avalanche */
/*
name: {
prefix: "My awesome Woka edition ",
suffix: " wow !",
},
description: "Awesome Woka",
image: "ipfs://mylink/",
*/
},
},
collection: {
size: 10, // Number of NFTs to be created
crop: {
size: 512, // Optional: Resize of Woka in pixels to stick it above background (must be smaller than the background)
marging: {
// Optional: Add a margin to the woka in pixel
left: 64,
right: 64,
top: 64,
bottom: 64,
},
},
rarity: {
/**
* Give a rarity to a part.
* A table will be displayed after the generation to known how rare a part is.
*
* random: Allow random rarity to all parts.
* delimiter: Allow a rarity by a # in the file name (example: my-body-is-ready#50.png),
* if a file doesn't have a delimiter, the rarity will be set to 100.
* none: Don't give a rarity.
*/
method: "delimiter",
/* random */
edges: {
// Only on random & optional: Delimit the rarity
min: 1, // Min rarity, cannot be under 1
max: 100, // Max rarity
},
},
background: {
/**
* Optional: Method for adding a background (transparent by default)
* image: Get a random background from the backgrounds folder.
* linked: Use the background with the same name in the backgrounds folder.
* color: Use a color.
*/
method: "image",
/*color: {
hex: "#EACCFF",
alpha: 1,
},*/
},
},
};

export default config;
Loading

0 comments on commit 8123aae

Please sign in to comment.