LivingDead NFT Project
|
@ -0,0 +1,142 @@
|
|||
# Logs
|
||||
|
||||
logs
|
||||
_.log
|
||||
npm-debug.log_
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
lerna-debug.log\*
|
||||
|
||||
# Diagnostic reports (https://nodejs.org/api/report.html)
|
||||
|
||||
report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json
|
||||
|
||||
# Runtime data
|
||||
|
||||
pids
|
||||
_.pid
|
||||
_.seed
|
||||
\*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
|
||||
coverage
|
||||
\*.lcov
|
||||
|
||||
# nyc test coverage
|
||||
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
||||
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
|
||||
build/
|
||||
dist/
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
|
||||
typings/
|
||||
|
||||
# TypeScript cache
|
||||
|
||||
\*.tsbuildinfo
|
||||
|
||||
# Optional npm cache directory
|
||||
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
|
||||
.eslintcache
|
||||
|
||||
# Microbundle cache
|
||||
|
||||
.rpt2_cache/
|
||||
.rts2_cache_cjs/
|
||||
.rts2_cache_es/
|
||||
.rts2_cache_umd/
|
||||
|
||||
# Optional REPL history
|
||||
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
|
||||
\*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
|
||||
.env
|
||||
.env.test
|
||||
|
||||
# parcel-bundler cache (https://parceljs.org/)
|
||||
|
||||
.cache
|
||||
|
||||
# Next.js build output
|
||||
|
||||
.next
|
||||
|
||||
# Nuxt.js build / generate output
|
||||
|
||||
.nuxt
|
||||
dist
|
||||
|
||||
# Gatsby files
|
||||
|
||||
.cache/
|
||||
|
||||
# Comment in the public line in if your project uses Gatsby and _not_ Next.js
|
||||
|
||||
# https://nextjs.org/blog/next-9-1#public-directory-support
|
||||
|
||||
# public
|
||||
|
||||
# vuepress build output
|
||||
|
||||
.vuepress/dist
|
||||
|
||||
# Serverless directories
|
||||
|
||||
.serverless/
|
||||
|
||||
# FuseBox cache
|
||||
|
||||
.fusebox/
|
||||
|
||||
# DynamoDB Local files
|
||||
|
||||
.dynamodb/
|
||||
|
||||
# TernJS port file
|
||||
|
||||
.tern-port
|
||||
|
||||
# OSX
|
||||
|
||||
.DS_Store
|
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2021 HashLips
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,313 @@
|
|||
# Welcome to HashLips 👄
|
||||
|
||||
![](https://github.com/HashLips/hashlips_art_engine/blob/main/logo.png)
|
||||
|
||||
All the code in these repos was created and explained by HashLips on the main YouTube channel.
|
||||
|
||||
To find out more please visit:
|
||||
|
||||
[📺 YouTube](https://www.youtube.com/channel/UC1LV4_VQGBJHTJjEWUmy8nA)
|
||||
|
||||
[👄 Discord](https://discord.com/invite/qh6MWhMJDN)
|
||||
|
||||
[💬 Telegram](https://t.me/hashlipsnft)
|
||||
|
||||
[🐦 Twitter](https://twitter.com/hashlipsnft)
|
||||
|
||||
[ℹ️ Website](https://hashlips.online/HashLips)
|
||||
|
||||
# HashLips Art Engine 🔥
|
||||
|
||||
![](https://github.com/HashLips/hashlips_art_engine/blob/main/banner.png)
|
||||
|
||||
Create generative art by using the canvas api and node js. Before you use the generation engine, make sure you have node.js(v10.18.0) installed.
|
||||
|
||||
## Installation 🛠️
|
||||
|
||||
If you are cloning the project then run this first, otherwise you can download the source code on the release page and skip this step.
|
||||
|
||||
```sh
|
||||
git clone https://github.com/HashLips/hashlips_art_engine.git
|
||||
```
|
||||
|
||||
Go to the root of your folder and run this command if you have yarn installed.
|
||||
|
||||
```sh
|
||||
yarn install
|
||||
```
|
||||
|
||||
Alternatively you can run this command if you have node installed.
|
||||
|
||||
```sh
|
||||
npm install
|
||||
```
|
||||
|
||||
## Usage ℹ️
|
||||
|
||||
Create your different layers as folders in the 'layers' directory, and add all the layer assets in these directories. You can name the assets anything as long as it has a rarity weight attached in the file name like so: `example element#70.png`. You can optionally change the delimiter `#` to anything you would like to use in the variable `rarityDelimiter` in the `src/config.js` file.
|
||||
|
||||
Once you have all your layers, go into `src/config.js` and update the `layerConfigurations` objects `layersOrder` array to be your layer folders name in order of the back layer to the front layer.
|
||||
|
||||
_Example:_ If you were creating a portrait design, you might have a background, then a head, a mouth, eyes, eyewear, and then headwear, so your `layersOrder` would look something like this:
|
||||
|
||||
```js
|
||||
const layerConfigurations = [
|
||||
{
|
||||
growEditionSizeTo: 100,
|
||||
layersOrder: [
|
||||
{ name: "Head" },
|
||||
{ name: "Mouth" },
|
||||
{ name: "Eyes" },
|
||||
{ name: "Eyeswear" },
|
||||
{ name: "Headwear" },
|
||||
],
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
The `name` of each layer object represents the name of the folder (in `/layers/`) that the images reside in.
|
||||
|
||||
Optionally you can now add multiple different `layerConfigurations` to your collection. Each configuration can be unique and have different layer orders, use the same layers or introduce new ones. This gives the artist flexibility when it comes to fine tuning their collections to their needs.
|
||||
|
||||
_Example:_ If you were creating a portrait design, you might have a background, then a head, a mouth, eyes, eyewear, and then headwear and you want to create a new race or just simple re-order the layers or even introduce new layers, then you're `layerConfigurations` and `layersOrder` would look something like this:
|
||||
|
||||
```js
|
||||
const layerConfigurations = [
|
||||
{
|
||||
// Creates up to 50 artworks
|
||||
growEditionSizeTo: 50,
|
||||
layersOrder: [
|
||||
{ name: "Background" },
|
||||
{ name: "Head" },
|
||||
{ name: "Mouth" },
|
||||
{ name: "Eyes" },
|
||||
{ name: "Eyeswear" },
|
||||
{ name: "Headwear" },
|
||||
],
|
||||
},
|
||||
{
|
||||
// Creates an additional 100 artworks
|
||||
growEditionSizeTo: 150,
|
||||
layersOrder: [
|
||||
{ name: "Background" },
|
||||
{ name: "Head" },
|
||||
{ name: "Eyes" },
|
||||
{ name: "Mouth" },
|
||||
{ name: "Eyeswear" },
|
||||
{ name: "Headwear" },
|
||||
{ name: "AlienHeadwear" },
|
||||
],
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
Update your `format` size, ie the outputted image size, and the `growEditionSizeTo` on each `layerConfigurations` object, which is the amount of variation outputted.
|
||||
|
||||
You can mix up the `layerConfigurations` order on how the images are saved by setting the variable `shuffleLayerConfigurations` in the `config.js` file to true. It is false by default and will save all images in numerical order.
|
||||
|
||||
If you want to have logs to debug and see what is happening when you generate images you can set the variable `debugLogs` in the `config.js` file to true. It is false by default, so you will only see general logs.
|
||||
|
||||
If you want to play around with different blending modes, you can add a `blend: MODE.colorBurn` field to the layersOrder `options` object.
|
||||
|
||||
If you need a layers to have a different opacity then you can add the `opacity: 0.7` field to the layersOrder `options` object as well.
|
||||
|
||||
If you want to have a layer _ignored_ in the DNA uniqueness check, you can set `bypassDNA: true` in the `options` object. This has the effect of making sure the rest of the traits are unique while not considering the `Background` Layers as traits, for example. The layers _are_ included in the final image.
|
||||
|
||||
To use a different metadata attribute name you can add the `displayName: "Awesome Eye Color"` to the `options` object. All options are optional and can be addes on the same layer if you want to.
|
||||
|
||||
Here is an example on how you can play around with both filter fields:
|
||||
|
||||
```js
|
||||
const layerConfigurations = [
|
||||
{
|
||||
growEditionSizeTo: 5,
|
||||
layersOrder: [
|
||||
{ name: "Background" , {
|
||||
options: {
|
||||
bypassDNA: false;
|
||||
}
|
||||
}},
|
||||
{ name: "Eyeball" },
|
||||
{
|
||||
name: "Eye color",
|
||||
options: {
|
||||
blend: MODE.destinationIn,
|
||||
opacity: 0.2,
|
||||
displayName: "Awesome Eye Color",
|
||||
},
|
||||
},
|
||||
{ name: "Iris" },
|
||||
{ name: "Shine" },
|
||||
{ name: "Bottom lid", options: { blend: MODE.overlay, opacity: 0.7 } },
|
||||
{ name: "Top lid" },
|
||||
],
|
||||
},
|
||||
];
|
||||
```
|
||||
|
||||
Here is a list of the different blending modes that you can optionally use.
|
||||
|
||||
```js
|
||||
const MODE = {
|
||||
sourceOver: "source-over",
|
||||
sourceIn: "source-in",
|
||||
sourceOut: "source-out",
|
||||
sourceAtop: "source-out",
|
||||
destinationOver: "destination-over",
|
||||
destinationIn: "destination-in",
|
||||
destinationOut: "destination-out",
|
||||
destinationAtop: "destination-atop",
|
||||
lighter: "lighter",
|
||||
copy: "copy",
|
||||
xor: "xor",
|
||||
multiply: "multiply",
|
||||
screen: "screen",
|
||||
overlay: "overlay",
|
||||
darken: "darken",
|
||||
lighten: "lighten",
|
||||
colorDodge: "color-dodge",
|
||||
colorBurn: "color-burn",
|
||||
hardLight: "hard-light",
|
||||
softLight: "soft-light",
|
||||
difference: "difference",
|
||||
exclusion: "exclusion",
|
||||
hue: "hue",
|
||||
saturation: "saturation",
|
||||
color: "color",
|
||||
luminosity: "luminosity",
|
||||
};
|
||||
```
|
||||
|
||||
When you are ready, run the following command and your outputted art will be in the `build/images` directory and the json in the `build/json` directory:
|
||||
|
||||
```sh
|
||||
npm run build
|
||||
```
|
||||
|
||||
or
|
||||
|
||||
```sh
|
||||
node index.js
|
||||
```
|
||||
|
||||
The program will output all the images in the `build/images` directory along with the metadata files in the `build/json` directory. Each collection will have a `_metadata.json` file that consists of all the metadata in the collection inside the `build/json` directory. The `build/json` folder also will contain all the single json files that represent each image file. The single json file of a image will look something like this:
|
||||
|
||||
```json
|
||||
{
|
||||
"dna": "d956cdf4e460508b5ff90c21974124f68d6edc34",
|
||||
"name": "#1",
|
||||
"description": "This is the description of your NFT project",
|
||||
"image": "https://hashlips/nft/1.png",
|
||||
"edition": 1,
|
||||
"date": 1731990799975,
|
||||
"attributes": [
|
||||
{ "trait_type": "Background", "value": "Black" },
|
||||
{ "trait_type": "Eyeball", "value": "Red" },
|
||||
{ "trait_type": "Eye color", "value": "Yellow" },
|
||||
{ "trait_type": "Iris", "value": "Small" },
|
||||
{ "trait_type": "Shine", "value": "Shapes" },
|
||||
{ "trait_type": "Bottom lid", "value": "Low" },
|
||||
{ "trait_type": "Top lid", "value": "Middle" }
|
||||
],
|
||||
"compiler": "HashLips Art Engine"
|
||||
}
|
||||
```
|
||||
|
||||
You can also add extra metadata to each metadata file by adding your extra items, (key: value) pairs to the `extraMetadata` object variable in the `config.js` file.
|
||||
|
||||
```js
|
||||
const extraMetadata = {
|
||||
creator: "Daniel Eugene Botha",
|
||||
};
|
||||
```
|
||||
|
||||
If you don't need extra metadata, simply leave the object empty. It is empty by default.
|
||||
|
||||
```js
|
||||
const extraMetadata = {};
|
||||
```
|
||||
|
||||
That's it, you're done.
|
||||
|
||||
## Utils
|
||||
|
||||
### Updating baseUri for IPFS and description
|
||||
|
||||
You might possibly want to update the baseUri and description after you have ran your collection. To update the baseUri and description simply run:
|
||||
|
||||
```sh
|
||||
npm run update_info
|
||||
```
|
||||
|
||||
### Generate a preview image
|
||||
|
||||
Create a preview image collage of your collection, run:
|
||||
|
||||
```sh
|
||||
npm run preview
|
||||
```
|
||||
|
||||
### Generate pixelated images from collection
|
||||
|
||||
In order to convert images into pixelated images you would need a list of images that you want to convert. So run the generator first.
|
||||
|
||||
Then simply run this command:
|
||||
|
||||
```sh
|
||||
npm run pixelate
|
||||
```
|
||||
|
||||
All your images will be outputted in the `/build/pixel_images` directory.
|
||||
If you want to change the ratio of the pixelation then you can update the ratio property on the `pixelFormat` object in the `src/config.js` file. The lower the number on the left, the more pixelated the image will be.
|
||||
|
||||
```js
|
||||
const pixelFormat = {
|
||||
ratio: 5 / 128,
|
||||
};
|
||||
```
|
||||
|
||||
### Generate GIF images from collection
|
||||
|
||||
In order to export gifs based on the layers created, you just need to set the export on the `gif` object in the `src/config.js` file to `true`. You can also play around with the `repeat`, `quality` and the `delay` of the exported gif.
|
||||
|
||||
Setting the `repeat: -1` will produce a one time render and `repeat: 0` will loop forever.
|
||||
|
||||
```js
|
||||
const gif = {
|
||||
export: true,
|
||||
repeat: 0,
|
||||
quality: 100,
|
||||
delay: 500,
|
||||
};
|
||||
```
|
||||
|
||||
### Printing rarity data (Experimental feature)
|
||||
|
||||
To see the percentages of each attribute across your collection, run:
|
||||
|
||||
```sh
|
||||
npm run rarity
|
||||
```
|
||||
|
||||
The output will look something like this:
|
||||
|
||||
```sh
|
||||
Trait type: Top lid
|
||||
{
|
||||
trait: 'High',
|
||||
chance: '30',
|
||||
occurrence: '3 in 20 editions (15.00 %)'
|
||||
}
|
||||
{
|
||||
trait: 'Low',
|
||||
chance: '20',
|
||||
occurrence: '3 in 20 editions (15.00 %)'
|
||||
}
|
||||
{
|
||||
trait: 'Middle',
|
||||
chance: '50',
|
||||
occurrence: '14 in 20 editions (70.00 %)'
|
||||
}
|
||||
```
|
||||
|
||||
Hope you create some awesome artworks with this code 👄
|
After Width: | Height: | Size: 431 KiB |
|
@ -0,0 +1,32 @@
|
|||
const MODE = {
|
||||
sourceOver: "source-over",
|
||||
sourceIn: "source-in",
|
||||
sourceOut: "source-out",
|
||||
sourceAtop: "source-out",
|
||||
destinationOver: "destination-over",
|
||||
destinationIn: "destination-in",
|
||||
destinationOut: "destination-out",
|
||||
destinationAtop: "destination-atop",
|
||||
lighter: "lighter",
|
||||
copy: "copy",
|
||||
xor: "xor",
|
||||
multiply: "multiply",
|
||||
screen: "screen",
|
||||
overlay: "overlay",
|
||||
darken: "darken",
|
||||
lighten: "lighten",
|
||||
colorDodge: "color-dodge",
|
||||
colorBurn: "color-burn",
|
||||
hardLight: "hard-light",
|
||||
softLight: "soft-light",
|
||||
difference: "difference",
|
||||
exclusion: "exclusion",
|
||||
hue: "hue",
|
||||
saturation: "saturation",
|
||||
color: "color",
|
||||
luminosity: "luminosity",
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
MODE,
|
||||
};
|
|
@ -0,0 +1,8 @@
|
|||
const NETWORK = {
|
||||
eth: "eth",
|
||||
sol: "sol",
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
NETWORK,
|
||||
};
|
|
@ -0,0 +1,7 @@
|
|||
const basePath = process.cwd();
|
||||
const { startCreating, buildSetup } = require(`${basePath}/src/main.js`);
|
||||
|
||||
(() => {
|
||||
buildSetup();
|
||||
startCreating();
|
||||
})();
|
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 1.5 KiB |
After Width: | Height: | Size: 17 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 18 KiB |
After Width: | Height: | Size: 3.2 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 6.9 KiB |
After Width: | Height: | Size: 7.0 KiB |
After Width: | Height: | Size: 6.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 9.6 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 4.5 KiB |
After Width: | Height: | Size: 5.5 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 4.8 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 13 KiB |
After Width: | Height: | Size: 11 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 3.4 KiB |
After Width: | Height: | Size: 4.9 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 5.6 KiB |
After Width: | Height: | Size: 5.4 KiB |
After Width: | Height: | Size: 2.9 KiB |
After Width: | Height: | Size: 4.4 KiB |
After Width: | Height: | Size: 6.0 KiB |
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 9.9 KiB |
After Width: | Height: | Size: 18 KiB |
|
@ -0,0 +1,38 @@
|
|||
const GifEncoder = require("gif-encoder-2");
|
||||
const { writeFile } = require("fs");
|
||||
|
||||
class HashLipsGiffer {
|
||||
constructor(_canvas, _ctx, _fileName, _repeat, _quality, _delay) {
|
||||
this.canvas = _canvas;
|
||||
this.ctx = _ctx;
|
||||
this.fileName = _fileName;
|
||||
this.repeat = _repeat;
|
||||
this.quality = _quality;
|
||||
this.delay = _delay;
|
||||
this.initGifEncoder();
|
||||
}
|
||||
|
||||
initGifEncoder = () => {
|
||||
this.gifEncoder = new GifEncoder(this.canvas.width, this.canvas.height);
|
||||
this.gifEncoder.setQuality(this.quality);
|
||||
this.gifEncoder.setRepeat(this.repeat);
|
||||
this.gifEncoder.setDelay(this.delay);
|
||||
};
|
||||
|
||||
start = () => {
|
||||
this.gifEncoder.start();
|
||||
};
|
||||
|
||||
add = () => {
|
||||
this.gifEncoder.addFrame(this.ctx);
|
||||
};
|
||||
|
||||
stop = () => {
|
||||
this.gifEncoder.finish();
|
||||
const buffer = this.gifEncoder.out.getData();
|
||||
writeFile(this.fileName, buffer, (error) => {});
|
||||
console.log(`Created gif at ${this.fileName}`);
|
||||
};
|
||||
}
|
||||
|
||||
module.exports = HashLipsGiffer;
|
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "hashlips_art_engine",
|
||||
"version": "1.1.1",
|
||||
"description": "HashLips Art Engine is a tool used to create multiple different instances of artworks based on provided layers.",
|
||||
"main": "index.js",
|
||||
"bin": "index.js",
|
||||
"pkg": {
|
||||
"assets": [
|
||||
"layers/**/*",
|
||||
"node_modules/**/*",
|
||||
"src/**/*"
|
||||
]
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node index.js",
|
||||
"generate": "node index.js",
|
||||
"rarity": "node utils/rarity.js",
|
||||
"preview": "node utils/preview.js",
|
||||
"pixelate": "node utils/pixelate.js",
|
||||
"update_info": "node utils/update_info.js",
|
||||
"preview_gif": "node utils/preview_gif.js",
|
||||
"generate_metadata": "node utils/generate_metadata.js"
|
||||
},
|
||||
"author": "Daniel Eugene Botha (HashLips)",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"canvas": "^2.8.0",
|
||||
"gif-encoder-2": "^1.0.5",
|
||||
"sha1": "^1.1.1"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,128 @@
|
|||
const basePath = process.cwd();
|
||||
const { MODE } = require(`${basePath}/constants/blend_mode.js`);
|
||||
const { NETWORK } = require(`${basePath}/constants/network.js`);
|
||||
|
||||
const network = NETWORK.eth;
|
||||
|
||||
// General metadata for Ethereum
|
||||
const namePrefix = "Your Collection";
|
||||
const description = "Remember to replace this description";
|
||||
const baseUri = "ipfs://NewUriToReplace";
|
||||
|
||||
const solanaMetadata = {
|
||||
symbol: "YC",
|
||||
seller_fee_basis_points: 1000, // Define how much % you want from secondary market sales 1000 = 10%
|
||||
external_url: "https://www.youtube.com/c/hashlipsnft",
|
||||
creators: [
|
||||
{
|
||||
address: "7fXNuer5sbZtaTEPhtJ5g5gNtuyRoKkvxdjEjEnPN4mC",
|
||||
share: 100,
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
// If you have selected Solana then the collection starts from 0 automatically
|
||||
//order layer and the amount of nft you want to produce
|
||||
const layerConfigurations = [
|
||||
{
|
||||
growEditionSizeTo: 1,
|
||||
layersOrder: [
|
||||
{ name: "Background" },
|
||||
{ name: "LeftEar" },
|
||||
{ name: "RightEar" },
|
||||
{ name: "Body" },
|
||||
{ name: "Skull" },
|
||||
{ name: "RightHeadMarks" },
|
||||
{ name: "Eyebrows" },
|
||||
{ name: "Nose" },
|
||||
{ name: "LeftFacialMarks" },
|
||||
{ name: "Mouth" },
|
||||
{ name: "Eyes" },
|
||||
|
||||
],
|
||||
},
|
||||
];
|
||||
|
||||
const shuffleLayerConfigurations = false;
|
||||
|
||||
const debugLogs = false;
|
||||
|
||||
const format = {
|
||||
width: 512,
|
||||
height: 512,
|
||||
smoothing: false,
|
||||
};
|
||||
|
||||
const gif = {
|
||||
export: false,
|
||||
repeat: 0,
|
||||
quality: 100,
|
||||
delay: 500,
|
||||
};
|
||||
|
||||
const text = {
|
||||
only: false,
|
||||
color: "#ffffff",
|
||||
size: 20,
|
||||
xGap: 40,
|
||||
yGap: 40,
|
||||
align: "left",
|
||||
baseline: "top",
|
||||
weight: "regular",
|
||||
family: "Courier",
|
||||
spacer: " => ",
|
||||
};
|
||||
|
||||
const pixelFormat = {
|
||||
ratio: 2 / 128,
|
||||
};
|
||||
|
||||
const background = {
|
||||
generate: true,
|
||||
brightness: "80%",
|
||||
static: false,
|
||||
default: "#000000",
|
||||
};
|
||||
|
||||
const extraMetadata = {};
|
||||
|
||||
const rarityDelimiter = "#";
|
||||
|
||||
const uniqueDnaTorrance = 10000;
|
||||
|
||||
const preview = {
|
||||
thumbPerRow: 5,
|
||||
thumbWidth: 50,
|
||||
imageRatio: format.height / format.width,
|
||||
imageName: "preview.png",
|
||||
};
|
||||
|
||||
const preview_gif = {
|
||||
numberOfImages: 5,
|
||||
order: "ASC", // ASC, DESC, MIXED
|
||||
repeat: 0,
|
||||
quality: 100,
|
||||
delay: 500,
|
||||
imageName: "preview.gif",
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
format,
|
||||
baseUri,
|
||||
description,
|
||||
background,
|
||||
uniqueDnaTorrance,
|
||||
layerConfigurations,
|
||||
rarityDelimiter,
|
||||
preview,
|
||||
shuffleLayerConfigurations,
|
||||
debugLogs,
|
||||
extraMetadata,
|
||||
pixelFormat,
|
||||
text,
|
||||
namePrefix,
|
||||
network,
|
||||
solanaMetadata,
|
||||
gif,
|
||||
preview_gif,
|
||||
};
|
|
@ -0,0 +1,425 @@
|
|||
const basePath = process.cwd();
|
||||
const { NETWORK } = require(`${basePath}/constants/network.js`);
|
||||
const fs = require("fs");
|
||||
const sha1 = require(`${basePath}/node_modules/sha1`);
|
||||
const { createCanvas, loadImage } = require(`${basePath}/node_modules/canvas`);
|
||||
const buildDir = `${basePath}/build`;
|
||||
const layersDir = `${basePath}/layers`;
|
||||
const {
|
||||
format,
|
||||
baseUri,
|
||||
description,
|
||||
background,
|
||||
uniqueDnaTorrance,
|
||||
layerConfigurations,
|
||||
rarityDelimiter,
|
||||
shuffleLayerConfigurations,
|
||||
debugLogs,
|
||||
extraMetadata,
|
||||
text,
|
||||
namePrefix,
|
||||
network,
|
||||
solanaMetadata,
|
||||
gif,
|
||||
} = require(`${basePath}/src/config.js`);
|
||||
const canvas = createCanvas(format.width, format.height);
|
||||
const ctx = canvas.getContext("2d");
|
||||
ctx.imageSmoothingEnabled = format.smoothing;
|
||||
var metadataList = [];
|
||||
var attributesList = [];
|
||||
var dnaList = new Set();
|
||||
const DNA_DELIMITER = "-";
|
||||
const HashlipsGiffer = require(`${basePath}/modules/HashlipsGiffer.js`);
|
||||
|
||||
let hashlipsGiffer = null;
|
||||
|
||||
const buildSetup = () => {
|
||||
if (fs.existsSync(buildDir)) {
|
||||
fs.rmdirSync(buildDir, { recursive: true });
|
||||
}
|
||||
fs.mkdirSync(buildDir);
|
||||
fs.mkdirSync(`${buildDir}/json`);
|
||||
fs.mkdirSync(`${buildDir}/images`);
|
||||
if (gif.export) {
|
||||
fs.mkdirSync(`${buildDir}/gifs`);
|
||||
}
|
||||
};
|
||||
|
||||
const getRarityWeight = (_str) => {
|
||||
let nameWithoutExtension = _str.slice(0, -4);
|
||||
var nameWithoutWeight = Number(
|
||||
nameWithoutExtension.split(rarityDelimiter).pop()
|
||||
);
|
||||
if (isNaN(nameWithoutWeight)) {
|
||||
nameWithoutWeight = 1;
|
||||
}
|
||||
return nameWithoutWeight;
|
||||
};
|
||||
|
||||
const cleanDna = (_str) => {
|
||||
const withoutOptions = removeQueryStrings(_str);
|
||||
var dna = Number(withoutOptions.split(":").shift());
|
||||
return dna;
|
||||
};
|
||||
|
||||
const cleanName = (_str) => {
|
||||
let nameWithoutExtension = _str.slice(0, -4);
|
||||
var nameWithoutWeight = nameWithoutExtension.split(rarityDelimiter).shift();
|
||||
return nameWithoutWeight;
|
||||
};
|
||||
|
||||
const getElements = (path) => {
|
||||
return fs
|
||||
.readdirSync(path)
|
||||
.filter((item) => !/(^|\/)\.[^\/\.]/g.test(item))
|
||||
.map((i, index) => {
|
||||
return {
|
||||
id: index,
|
||||
name: cleanName(i),
|
||||
filename: i,
|
||||
path: `${path}${i}`,
|
||||
weight: getRarityWeight(i),
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
const layersSetup = (layersOrder) => {
|
||||
const layers = layersOrder.map((layerObj, index) => ({
|
||||
id: index,
|
||||
elements: getElements(`${layersDir}/${layerObj.name}/`),
|
||||
name:
|
||||
layerObj.options?.["displayName"] != undefined
|
||||
? layerObj.options?.["displayName"]
|
||||
: layerObj.name,
|
||||
blend:
|
||||
layerObj.options?.["blend"] != undefined
|
||||
? layerObj.options?.["blend"]
|
||||
: "source-over",
|
||||
opacity:
|
||||
layerObj.options?.["opacity"] != undefined
|
||||
? layerObj.options?.["opacity"]
|
||||
: 1,
|
||||
bypassDNA:
|
||||
layerObj.options?.["bypassDNA"] !== undefined
|
||||
? layerObj.options?.["bypassDNA"]
|
||||
: false,
|
||||
}));
|
||||
return layers;
|
||||
};
|
||||
|
||||
const saveImage = (_editionCount) => {
|
||||
fs.writeFileSync(
|
||||
`${buildDir}/images/${_editionCount}.png`,
|
||||
canvas.toBuffer("image/png")
|
||||
);
|
||||
};
|
||||
|
||||
const genColor = () => {
|
||||
let hue = Math.floor(Math.random() * 360);
|
||||
let pastel = `hsl(${hue}, 100%, ${background.brightness})`;
|
||||
return pastel;
|
||||
};
|
||||
|
||||
const drawBackground = () => {
|
||||
ctx.fillStyle = background.static ? background.default : genColor();
|
||||
ctx.fillRect(0, 0, format.width, format.height);
|
||||
};
|
||||
|
||||
const addMetadata = (_dna, _edition) => {
|
||||
let dateTime = Date.now();
|
||||
let tempMetadata = {
|
||||
name: `${namePrefix} #${_edition}`,
|
||||
description: description,
|
||||
image: `${baseUri}/${_edition}.png`,
|
||||
dna: sha1(_dna),
|
||||
edition: _edition,
|
||||
date: dateTime,
|
||||
...extraMetadata,
|
||||
attributes: attributesList,
|
||||
compiler: "HashLips Art Engine",
|
||||
};
|
||||
if (network == NETWORK.sol) {
|
||||
tempMetadata = {
|
||||
//Added metadata for solana
|
||||
name: tempMetadata.name,
|
||||
symbol: solanaMetadata.symbol,
|
||||
description: tempMetadata.description,
|
||||
//Added metadata for solana
|
||||
seller_fee_basis_points: solanaMetadata.seller_fee_basis_points,
|
||||
image: `image.png`,
|
||||
//Added metadata for solana
|
||||
external_url: solanaMetadata.external_url,
|
||||
edition: _edition,
|
||||
...extraMetadata,
|
||||
attributes: tempMetadata.attributes,
|
||||
properties: {
|
||||
files: [
|
||||
{
|
||||
uri: "image.png",
|
||||
type: "image/png",
|
||||
},
|
||||
],
|
||||
category: "image",
|
||||
creators: solanaMetadata.creators,
|
||||
},
|
||||
};
|
||||
}
|
||||
metadataList.push(tempMetadata);
|
||||
attributesList = [];
|
||||
};
|
||||
|
||||
const addAttributes = (_element) => {
|
||||
let selectedElement = _element.layer.selectedElement;
|
||||
attributesList.push({
|
||||
trait_type: _element.layer.name,
|
||||
value: selectedElement.name,
|
||||
});
|
||||
};
|
||||
|
||||
const loadLayerImg = async (_layer) => {
|
||||
return new Promise(async (resolve) => {
|
||||
const image = await loadImage(`${_layer.selectedElement.path}`);
|
||||
resolve({ layer: _layer, loadedImage: image });
|
||||
});
|
||||
};
|
||||
|
||||
const addText = (_sig, x, y, size) => {
|
||||
ctx.fillStyle = text.color;
|
||||
ctx.font = `${text.weight} ${size}pt ${text.family}`;
|
||||
ctx.textBaseline = text.baseline;
|
||||
ctx.textAlign = text.align;
|
||||
ctx.fillText(_sig, x, y);
|
||||
};
|
||||
|
||||
const drawElement = (_renderObject, _index, _layersLen) => {
|
||||
ctx.globalAlpha = _renderObject.layer.opacity;
|
||||
ctx.globalCompositeOperation = _renderObject.layer.blend;
|
||||
text.only
|
||||
? addText(
|
||||
`${_renderObject.layer.name}${text.spacer}${_renderObject.layer.selectedElement.name}`,
|
||||
text.xGap,
|
||||
text.yGap * (_index + 1),
|
||||
text.size
|
||||
)
|
||||
: ctx.drawImage(
|
||||
_renderObject.loadedImage,
|
||||
0,
|
||||
0,
|
||||
format.width,
|
||||
format.height
|
||||
);
|
||||
|
||||
addAttributes(_renderObject);
|
||||
};
|
||||
|
||||
const constructLayerToDna = (_dna = "", _layers = []) => {
|
||||
let mappedDnaToLayers = _layers.map((layer, index) => {
|
||||
let selectedElement = layer.elements.find(
|
||||
(e) => e.id == cleanDna(_dna.split(DNA_DELIMITER)[index])
|
||||
);
|
||||
return {
|
||||
name: layer.name,
|
||||
blend: layer.blend,
|
||||
opacity: layer.opacity,
|
||||
selectedElement: selectedElement,
|
||||
};
|
||||
});
|
||||
return mappedDnaToLayers;
|
||||
};
|
||||
|
||||
/**
|
||||
* In some cases a DNA string may contain optional query parameters for options
|
||||
* such as bypassing the DNA isUnique check, this function filters out those
|
||||
* items without modifying the stored DNA.
|
||||
*
|
||||
* @param {String} _dna New DNA string
|
||||
* @returns new DNA string with any items that should be filtered, removed.
|
||||
*/
|
||||
const filterDNAOptions = (_dna) => {
|
||||
const dnaItems = _dna.split(DNA_DELIMITER);
|
||||
const filteredDNA = dnaItems.filter((element) => {
|
||||
const query = /(\?.*$)/;
|
||||
const querystring = query.exec(element);
|
||||
if (!querystring) {
|
||||
return true;
|
||||
}
|
||||
const options = querystring[1].split("&").reduce((r, setting) => {
|
||||
const keyPairs = setting.split("=");
|
||||
return { ...r, [keyPairs[0]]: keyPairs[1] };
|
||||
}, []);
|
||||
|
||||
return options.bypassDNA;
|
||||
});
|
||||
|
||||
return filteredDNA.join(DNA_DELIMITER);
|
||||
};
|
||||
|
||||
/**
|
||||
* Cleaning function for DNA strings. When DNA strings include an option, it
|
||||
* is added to the filename with a ?setting=value query string. It needs to be
|
||||
* removed to properly access the file name before Drawing.
|
||||
*
|
||||
* @param {String} _dna The entire newDNA string
|
||||
* @returns Cleaned DNA string without querystring parameters.
|
||||
*/
|
||||
const removeQueryStrings = (_dna) => {
|
||||
const query = /(\?.*$)/;
|
||||
return _dna.replace(query, "");
|
||||
};
|
||||
|
||||
const isDnaUnique = (_DnaList = new Set(), _dna = "") => {
|
||||
const _filteredDNA = filterDNAOptions(_dna);
|
||||
return !_DnaList.has(_filteredDNA);
|
||||
};
|
||||
|
||||
const createDna = (_layers) => {
|
||||
let randNum = [];
|
||||
_layers.forEach((layer) => {
|
||||
var totalWeight = 0;
|
||||
layer.elements.forEach((element) => {
|
||||
totalWeight += element.weight;
|
||||
});
|
||||
// number between 0 - totalWeight
|
||||
let random = Math.floor(Math.random() * totalWeight);
|
||||
for (var i = 0; i < layer.elements.length; i++) {
|
||||
// subtract the current weight from the random weight until we reach a sub zero value.
|
||||
random -= layer.elements[i].weight;
|
||||
if (random < 0) {
|
||||
return randNum.push(
|
||||
`${layer.elements[i].id}:${layer.elements[i].filename}${
|
||||
layer.bypassDNA ? "?bypassDNA=true" : ""
|
||||
}`
|
||||
);
|
||||
}
|
||||
}
|
||||
});
|
||||
return randNum.join(DNA_DELIMITER);
|
||||
};
|
||||
|
||||
const writeMetaData = (_data) => {
|
||||
fs.writeFileSync(`${buildDir}/json/_metadata.json`, _data);
|
||||
};
|
||||
|
||||
const saveMetaDataSingleFile = (_editionCount) => {
|
||||
let metadata = metadataList.find((meta) => meta.edition == _editionCount);
|
||||
debugLogs
|
||||
? console.log(
|
||||
`Writing metadata for ${_editionCount}: ${JSON.stringify(metadata)}`
|
||||
)
|
||||
: null;
|
||||
fs.writeFileSync(
|
||||
`${buildDir}/json/${_editionCount}.json`,
|
||||
JSON.stringify(metadata, null, 2)
|
||||
);
|
||||
};
|
||||
|
||||
function shuffle(array) {
|
||||
let currentIndex = array.length,
|
||||
randomIndex;
|
||||
while (currentIndex != 0) {
|
||||
randomIndex = Math.floor(Math.random() * currentIndex);
|
||||
currentIndex--;
|
||||
[array[currentIndex], array[randomIndex]] = [
|
||||
array[randomIndex],
|
||||
array[currentIndex],
|
||||
];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
const startCreating = async () => {
|
||||
let layerConfigIndex = 0;
|
||||
let editionCount = 1;
|
||||
let failedCount = 0;
|
||||
let abstractedIndexes = [];
|
||||
for (
|
||||
let i = network == NETWORK.sol ? 0 : 1;
|
||||
i <= layerConfigurations[layerConfigurations.length - 1].growEditionSizeTo;
|
||||
i++
|
||||
) {
|
||||
abstractedIndexes.push(i);
|
||||
}
|
||||
if (shuffleLayerConfigurations) {
|
||||
abstractedIndexes = shuffle(abstractedIndexes);
|
||||
}
|
||||
debugLogs
|
||||
? console.log("Editions left to create: ", abstractedIndexes)
|
||||
: null;
|
||||
while (layerConfigIndex < layerConfigurations.length) {
|
||||
const layers = layersSetup(
|
||||
layerConfigurations[layerConfigIndex].layersOrder
|
||||
);
|
||||
while (
|
||||
editionCount <= layerConfigurations[layerConfigIndex].growEditionSizeTo
|
||||
) {
|
||||
let newDna = createDna(layers);
|
||||
if (isDnaUnique(dnaList, newDna)) {
|
||||
let results = constructLayerToDna(newDna, layers);
|
||||
let loadedElements = [];
|
||||
|
||||
results.forEach((layer) => {
|
||||
loadedElements.push(loadLayerImg(layer));
|
||||
});
|
||||
|
||||
await Promise.all(loadedElements).then((renderObjectArray) => {
|
||||
debugLogs ? console.log("Clearing canvas") : null;
|
||||
ctx.clearRect(0, 0, format.width, format.height);
|
||||
if (gif.export) {
|
||||
hashlipsGiffer = new HashlipsGiffer(
|
||||
canvas,
|
||||
ctx,
|
||||
`${buildDir}/gifs/${abstractedIndexes[0]}.gif`,
|
||||
gif.repeat,
|
||||
gif.quality,
|
||||
gif.delay
|
||||
);
|
||||
hashlipsGiffer.start();
|
||||
}
|
||||
if (background.generate) {
|
||||
drawBackground();
|
||||
}
|
||||
renderObjectArray.forEach((renderObject, index) => {
|
||||
drawElement(
|
||||
renderObject,
|
||||
index,
|
||||
layerConfigurations[layerConfigIndex].layersOrder.length
|
||||
);
|
||||
if (gif.export) {
|
||||
hashlipsGiffer.add();
|
||||
}
|
||||
});
|
||||
if (gif.export) {
|
||||
hashlipsGiffer.stop();
|
||||
}
|
||||
debugLogs
|
||||
? console.log("Editions left to create: ", abstractedIndexes)
|
||||
: null;
|
||||
saveImage(abstractedIndexes[0]);
|
||||
addMetadata(newDna, abstractedIndexes[0]);
|
||||
saveMetaDataSingleFile(abstractedIndexes[0]);
|
||||
console.log(
|
||||
`Created edition: ${abstractedIndexes[0]}, with DNA: ${sha1(
|
||||
newDna
|
||||
)}`
|
||||
);
|
||||
});
|
||||
dnaList.add(filterDNAOptions(newDna));
|
||||
editionCount++;
|
||||
abstractedIndexes.shift();
|
||||
} else {
|
||||
console.log("DNA exists!");
|
||||
failedCount++;
|
||||
if (failedCount >= uniqueDnaTorrance) {
|
||||
console.log(
|
||||
`You need more layers or elements to grow your edition to ${layerConfigurations[layerConfigIndex].growEditionSizeTo} artworks!`
|
||||
);
|
||||
process.exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
layerConfigIndex++;
|
||||
}
|
||||
writeMetaData(JSON.stringify(metadataList, null, 2));
|
||||
};
|
||||
|
||||
module.exports = { startCreating, buildSetup, getElements };
|
|
@ -0,0 +1,177 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { createCanvas, loadImage } = require("canvas");
|
||||
const basePath = process.cwd();
|
||||
const buildDir = `${basePath}/build/json`;
|
||||
const inputDir = `${basePath}/build/images`;
|
||||
const {
|
||||
format,
|
||||
namePrefix,
|
||||
description,
|
||||
baseUri,
|
||||
} = require(`${basePath}/src/config.js`);
|
||||
const console = require("console");
|
||||
const canvas = createCanvas(format.width, format.height);
|
||||
const ctx = canvas.getContext("2d");
|
||||
const metadataList = [];
|
||||
|
||||
const buildSetup = () => {
|
||||
if (fs.existsSync(buildDir)) {
|
||||
fs.rmdirSync(buildDir, { recursive: true });
|
||||
}
|
||||
fs.mkdirSync(buildDir);
|
||||
};
|
||||
|
||||
const getImages = (_dir) => {
|
||||
try {
|
||||
return fs
|
||||
.readdirSync(_dir)
|
||||
.filter((item) => {
|
||||
let extension = path.extname(`${_dir}${item}`);
|
||||
if (extension == ".png" || extension == ".jpg") {
|
||||
return item;
|
||||
}
|
||||
})
|
||||
.map((i) => {
|
||||
return {
|
||||
filename: i,
|
||||
path: `${_dir}/${i}`,
|
||||
};
|
||||
});
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const loadImgData = async (_imgObject) => {
|
||||
return new Promise(async (resolve) => {
|
||||
const image = await loadImage(`${_imgObject.path}`);
|
||||
resolve({ imgObject: _imgObject, loadedImage: image });
|
||||
});
|
||||
};
|
||||
|
||||
const draw = (_imgObject) => {
|
||||
let w = canvas.width;
|
||||
let h = canvas.height;
|
||||
ctx.drawImage(_imgObject.loadedImage, 0, 0, w, h);
|
||||
};
|
||||
|
||||
const addRarity = () => {
|
||||
let w = canvas.width;
|
||||
let h = canvas.height;
|
||||
let i = -4;
|
||||
let count = 0;
|
||||
let imgdata = ctx.getImageData(0, 0, w, h);
|
||||
let rgb = imgdata.data;
|
||||
let newRgb = { r: 0, g: 0, b: 0 };
|
||||
const tolerance = 15;
|
||||
const rareColorBase = "NOT a Hot Dog";
|
||||
const rareColor = [
|
||||
{ name: "Hot Dog", rgb: { r: 192, g: 158, b: 131 } },
|
||||
{ name: "Hot Dog", rgb: { r: 128, g: 134, b: 90 } },
|
||||
{ name: "Hot Dog", rgb: { r: 113, g: 65, b: 179 } },
|
||||
{ name: "Hot Dog", rgb: { r: 162, g: 108, b: 67 } },
|
||||
];
|
||||
|
||||
while ((i += 10 * 4) < rgb.length) {
|
||||
++count;
|
||||
newRgb.r += rgb[i];
|
||||
newRgb.g += rgb[i + 1];
|
||||
newRgb.b += rgb[i + 2];
|
||||
}
|
||||
|
||||
newRgb.r = ~~(newRgb.r / count);
|
||||
newRgb.g = ~~(newRgb.g / count);
|
||||
newRgb.b = ~~(newRgb.b / count);
|
||||
|
||||
let rarity = rareColorBase;
|
||||
|
||||
rareColor.forEach((color) => {
|
||||
if (isNeighborColor(newRgb, color.rgb, tolerance)) {
|
||||
rarity = color.name;
|
||||
}
|
||||
});
|
||||
|
||||
console.log(newRgb);
|
||||
console.log(rarity);
|
||||
|
||||
return [
|
||||
{
|
||||
trait_type: "average color",
|
||||
value: `rgb(${newRgb.r},${newRgb.g},${newRgb.b})`,
|
||||
},
|
||||
{
|
||||
trait_type: "What is this?",
|
||||
value: rarity,
|
||||
},
|
||||
{
|
||||
trait_type: "date",
|
||||
value: randomIntFromInterval(1500, 1900),
|
||||
},
|
||||
];
|
||||
};
|
||||
|
||||
randomIntFromInterval = (min, max) => {
|
||||
return Math.floor(Math.random() * (max - min + 1) + min);
|
||||
};
|
||||
|
||||
isNeighborColor = (color1, color2, tolerance) => {
|
||||
return (
|
||||
Math.abs(color1.r - color2.r) <= tolerance &&
|
||||
Math.abs(color1.g - color2.g) <= tolerance &&
|
||||
Math.abs(color1.b - color2.b) <= tolerance
|
||||
);
|
||||
};
|
||||
|
||||
const saveMetadata = (_loadedImageObject) => {
|
||||
let shortName = _loadedImageObject.imgObject.filename.replace(
|
||||
/\.[^/.]+$/,
|
||||
""
|
||||
);
|
||||
|
||||
let tempAttributes = [];
|
||||
tempAttributes.push(addRarity());
|
||||
|
||||
let tempMetadata = {
|
||||
name: `${namePrefix} #${shortName}`,
|
||||
description: description,
|
||||
image: `${baseUri}/${shortName}.png`,
|
||||
edition: Number(shortName),
|
||||
attributes: tempAttributes,
|
||||
compiler: "HashLips Art Engine",
|
||||
};
|
||||
fs.writeFileSync(
|
||||
`${buildDir}/${shortName}.json`,
|
||||
JSON.stringify(tempMetadata, null, 2)
|
||||
);
|
||||
metadataList.push(tempMetadata);
|
||||
};
|
||||
|
||||
const writeMetaData = (_data) => {
|
||||
fs.writeFileSync(`${buildDir}/_metadata.json`, _data);
|
||||
};
|
||||
|
||||
const startCreating = async () => {
|
||||
const images = getImages(inputDir);
|
||||
if (images == null) {
|
||||
console.log("Please generate collection first.");
|
||||
return;
|
||||
}
|
||||
let loadedImageObjects = [];
|
||||
images.forEach((imgObject) => {
|
||||
loadedImageObjects.push(loadImgData(imgObject));
|
||||
});
|
||||
await Promise.all(loadedImageObjects).then((loadedImageObjectArray) => {
|
||||
loadedImageObjectArray.forEach((loadedImageObject) => {
|
||||
draw(loadedImageObject);
|
||||
saveMetadata(loadedImageObject);
|
||||
console.log(
|
||||
`Created metadata for image: ${loadedImageObject.imgObject.filename}`
|
||||
);
|
||||
});
|
||||
});
|
||||
writeMetaData(JSON.stringify(metadataList, null, 2));
|
||||
};
|
||||
|
||||
buildSetup();
|
||||
startCreating();
|
|
@ -0,0 +1,83 @@
|
|||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
const { createCanvas, loadImage } = require("canvas");
|
||||
const basePath = process.cwd();
|
||||
const buildDir = `${basePath}/build/pixel_images`;
|
||||
const inputDir = `${basePath}/build/images`;
|
||||
const { format, pixelFormat } = require(`${basePath}/src/config.js`);
|
||||
const console = require("console");
|
||||
const canvas = createCanvas(format.width, format.height);
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
const buildSetup = () => {
|
||||
if (fs.existsSync(buildDir)) {
|
||||
fs.rmdirSync(buildDir, { recursive: true });
|
||||
}
|
||||
fs.mkdirSync(buildDir);
|
||||
};
|
||||
|
||||
const getImages = (_dir) => {
|
||||
try {
|
||||
return fs
|
||||
.readdirSync(_dir)
|
||||
.filter((item) => {
|
||||
let extension = path.extname(`${_dir}${item}`);
|
||||
if (extension == ".png" || extension == ".jpg") {
|
||||
return item;
|
||||
}
|
||||
})
|
||||
.map((i) => {
|
||||
return {
|
||||
filename: i,
|
||||
path: `${_dir}/${i}`,
|
||||
};
|
||||
});
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const loadImgData = async (_imgObject) => {
|
||||
return new Promise(async (resolve) => {
|
||||
const image = await loadImage(`${_imgObject.path}`);
|
||||
resolve({ imgObject: _imgObject, loadedImage: image });
|
||||
});
|
||||
};
|
||||
|
||||
const draw = (_imgObject) => {
|
||||
let size = pixelFormat.ratio;
|
||||
let w = canvas.width * size;
|
||||
let h = canvas.height * size;
|
||||
ctx.imageSmoothingEnabled = false;
|
||||
ctx.drawImage(_imgObject.loadedImage, 0, 0, w, h);
|
||||
ctx.drawImage(canvas, 0, 0, w, h, 0, 0, canvas.width, canvas.height);
|
||||
};
|
||||
|
||||
const saveImage = (_loadedImageObject) => {
|
||||
fs.writeFileSync(
|
||||
`${buildDir}/${_loadedImageObject.imgObject.filename}`,
|
||||
canvas.toBuffer("image/png")
|
||||
);
|
||||
};
|
||||
|
||||
const startCreating = async () => {
|
||||
const images = getImages(inputDir);
|
||||
if (images == null) {
|
||||
console.log("Please generate collection first.");
|
||||
return;
|
||||
}
|
||||
let loadedImageObjects = [];
|
||||
images.forEach((imgObject) => {
|
||||
loadedImageObjects.push(loadImgData(imgObject));
|
||||
});
|
||||
await Promise.all(loadedImageObjects).then((loadedImageObjectArray) => {
|
||||
loadedImageObjectArray.forEach((loadedImageObject) => {
|
||||
draw(loadedImageObject);
|
||||
saveImage(loadedImageObject);
|
||||
console.log(`Pixelated image: ${loadedImageObject.imgObject.filename}`);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
buildSetup();
|
||||
startCreating();
|
|
@ -0,0 +1,51 @@
|
|||
const basePath = process.cwd();
|
||||
const fs = require("fs");
|
||||
const { createCanvas, loadImage } = require("canvas");
|
||||
const buildDir = `${basePath}/build`;
|
||||
|
||||
const { preview } = require(`${basePath}/src/config.js`);
|
||||
|
||||
// read json data
|
||||
const rawdata = fs.readFileSync(`${basePath}/build/json/_metadata.json`);
|
||||
const metadataList = JSON.parse(rawdata);
|
||||
|
||||
const saveProjectPreviewImage = async (_data) => {
|
||||
// Extract from preview config
|
||||
const { thumbWidth, thumbPerRow, imageRatio, imageName } = preview;
|
||||
// Calculate height on the fly
|
||||
const thumbHeight = thumbWidth * imageRatio;
|
||||
// Prepare canvas
|
||||
const previewCanvasWidth = thumbWidth * thumbPerRow;
|
||||
const previewCanvasHeight =
|
||||
thumbHeight * Math.ceil(_data.length / thumbPerRow);
|
||||
// Shout from the mountain tops
|
||||
console.log(
|
||||
`Preparing a ${previewCanvasWidth}x${previewCanvasHeight} project preview with ${_data.length} thumbnails.`
|
||||
);
|
||||
|
||||
// Initiate the canvas now that we have calculated everything
|
||||
const previewPath = `${buildDir}/${imageName}`;
|
||||
const previewCanvas = createCanvas(previewCanvasWidth, previewCanvasHeight);
|
||||
const previewCtx = previewCanvas.getContext("2d");
|
||||
|
||||
// Iterate all NFTs and insert thumbnail into preview image
|
||||
// Don't want to rely on "edition" for assuming index
|
||||
for (let index = 0; index < _data.length; index++) {
|
||||
const nft = _data[index];
|
||||
await loadImage(`${buildDir}/images/${nft.edition}.png`).then((image) => {
|
||||
previewCtx.drawImage(
|
||||
image,
|
||||
thumbWidth * (index % thumbPerRow),
|
||||
thumbHeight * Math.trunc(index / thumbPerRow),
|
||||
thumbWidth,
|
||||
thumbHeight
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
// Write Project Preview to file
|
||||
fs.writeFileSync(previewPath, previewCanvas.toBuffer("image/png"));
|
||||
console.log(`Project preview image located at: ${previewPath}`);
|
||||
};
|
||||
|
||||
saveProjectPreviewImage(metadataList);
|
|
@ -0,0 +1,91 @@
|
|||
const basePath = process.cwd();
|
||||
const fs = require("fs");
|
||||
const { createCanvas, loadImage } = require("canvas");
|
||||
const buildDir = `${basePath}/build`;
|
||||
const imageDir = `${buildDir}/images`;
|
||||
const { format, preview_gif } = require(`${basePath}/src/config.js`);
|
||||
const canvas = createCanvas(format.width, format.height);
|
||||
const ctx = canvas.getContext("2d");
|
||||
|
||||
const HashlipsGiffer = require(`${basePath}/modules/HashlipsGiffer.js`);
|
||||
let hashlipsGiffer = null;
|
||||
|
||||
const loadImg = async (_img) => {
|
||||
return new Promise(async (resolve) => {
|
||||
const loadedImage = await loadImage(`${_img}`);
|
||||
resolve({ loadedImage: loadedImage });
|
||||
});
|
||||
};
|
||||
|
||||
// read image paths
|
||||
const imageList = [];
|
||||
const rawdata = fs.readdirSync(imageDir).forEach((file) => {
|
||||
imageList.push(loadImg(`${imageDir}/${file}`));
|
||||
});
|
||||
|
||||
const saveProjectPreviewGIF = async (_data) => {
|
||||
// Extract from preview config
|
||||
const { numberOfImages, order, repeat, quality, delay, imageName } =
|
||||
preview_gif;
|
||||
// Extract from format config
|
||||
const { width, height } = format;
|
||||
// Prepare canvas
|
||||
const previewCanvasWidth = width;
|
||||
const previewCanvasHeight = height;
|
||||
|
||||
if (_data.length < numberOfImages) {
|
||||
console.log(
|
||||
`You do not have enough images to create a gif with ${numberOfImages} images.`
|
||||
);
|
||||
} else {
|
||||
// Shout from the mountain tops
|
||||
console.log(
|
||||
`Preparing a ${previewCanvasWidth}x${previewCanvasHeight} project preview with ${_data.length} images.`
|
||||
);
|
||||
const previewPath = `${buildDir}/${imageName}`;
|
||||
|
||||
ctx.clearRect(0, 0, width, height);
|
||||
|
||||
hashlipsGiffer = new HashlipsGiffer(
|
||||
canvas,
|
||||
ctx,
|
||||
`${previewPath}`,
|
||||
repeat,
|
||||
quality,
|
||||
delay
|
||||
);
|
||||
hashlipsGiffer.start();
|
||||
|
||||
await Promise.all(_data).then((renderObjectArray) => {
|
||||
// Determin the order of the Images before creating the gif
|
||||
if (order == "ASC") {
|
||||
// Do nothing
|
||||
} else if (order == "DESC") {
|
||||
renderObjectArray.reverse();
|
||||
} else if (order == "MIXED") {
|
||||
renderObjectArray = renderObjectArray.sort(() => Math.random() - 0.5);
|
||||
}
|
||||
|
||||
// Reduce the size of the array of Images to the desired amount
|
||||
if (parseInt(numberOfImages) > 0) {
|
||||
renderObjectArray = renderObjectArray.slice(0, numberOfImages);
|
||||
}
|
||||
|
||||
renderObjectArray.forEach((renderObject, index) => {
|
||||
ctx.globalAlpha = 1;
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
ctx.drawImage(
|
||||
renderObject.loadedImage,
|
||||
0,
|
||||
0,
|
||||
previewCanvasWidth,
|
||||
previewCanvasHeight
|
||||
);
|
||||
hashlipsGiffer.add();
|
||||
});
|
||||
});
|
||||
hashlipsGiffer.stop();
|
||||
}
|
||||
};
|
||||
|
||||
saveProjectPreviewGIF(imageList);
|
|
@ -0,0 +1,82 @@
|
|||
const basePath = process.cwd();
|
||||
const fs = require("fs");
|
||||
const layersDir = `${basePath}/layers`;
|
||||
|
||||
const { layerConfigurations } = require(`${basePath}/src/config.js`);
|
||||
|
||||
const { getElements } = require("../src/main.js");
|
||||
|
||||
// read json data
|
||||
let rawdata = fs.readFileSync(`${basePath}/build/json/_metadata.json`);
|
||||
let data = JSON.parse(rawdata);
|
||||
let editionSize = data.length;
|
||||
|
||||
let rarityData = [];
|
||||
|
||||
// intialize layers to chart
|
||||
layerConfigurations.forEach((config) => {
|
||||
let layers = config.layersOrder;
|
||||
|
||||
layers.forEach((layer) => {
|
||||
// get elements for each layer
|
||||
let elementsForLayer = [];
|
||||
let elements = getElements(`${layersDir}/${layer.name}/`);
|
||||
elements.forEach((element) => {
|
||||
// just get name and weight for each element
|
||||
let rarityDataElement = {
|
||||
trait: element.name,
|
||||
weight: element.weight.toFixed(0),
|
||||
occurrence: 0, // initialize at 0
|
||||
};
|
||||
elementsForLayer.push(rarityDataElement);
|
||||
});
|
||||
let layerName =
|
||||
layer.options?.["displayName"] != undefined
|
||||
? layer.options?.["displayName"]
|
||||
: layer.name;
|
||||
// don't include duplicate layers
|
||||
if (!rarityData.includes(layer.name)) {
|
||||
// add elements for each layer to chart
|
||||
rarityData[layerName] = elementsForLayer;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// fill up rarity chart with occurrences from metadata
|
||||
data.forEach((element) => {
|
||||
let attributes = element.attributes;
|
||||
attributes.forEach((attribute) => {
|
||||
let traitType = attribute.trait_type;
|
||||
let value = attribute.value;
|
||||
|
||||
let rarityDataTraits = rarityData[traitType];
|
||||
rarityDataTraits.forEach((rarityDataTrait) => {
|
||||
if (rarityDataTrait.trait == value) {
|
||||
// keep track of occurrences
|
||||
rarityDataTrait.occurrence++;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// convert occurrences to occurence string
|
||||
for (var layer in rarityData) {
|
||||
for (var attribute in rarityData[layer]) {
|
||||
// get chance
|
||||
let chance =
|
||||
((rarityData[layer][attribute].occurrence / editionSize) * 100).toFixed(2);
|
||||
|
||||
// show two decimal places in percent
|
||||
rarityData[layer][attribute].occurrence =
|
||||
`${rarityData[layer][attribute].occurrence} in ${editionSize} editions (${chance} %)`;
|
||||
}
|
||||
}
|
||||
|
||||
// print out rarity data
|
||||
for (var layer in rarityData) {
|
||||
console.log(`Trait type: ${layer}`);
|
||||
for (var trait in rarityData[layer]) {
|
||||
console.log(rarityData[layer][trait]);
|
||||
}
|
||||
console.log();
|
||||
}
|
|
@ -0,0 +1,50 @@
|
|||
const basePath = process.cwd();
|
||||
const { NETWORK } = require(`${basePath}/constants/network.js`);
|
||||
const fs = require("fs");
|
||||
|
||||
const {
|
||||
baseUri,
|
||||
description,
|
||||
namePrefix,
|
||||
network,
|
||||
solanaMetadata,
|
||||
} = require(`${basePath}/src/config.js`);
|
||||
|
||||
// read json data
|
||||
let rawdata = fs.readFileSync(`${basePath}/build/json/_metadata.json`);
|
||||
let data = JSON.parse(rawdata);
|
||||
|
||||
data.forEach((item) => {
|
||||
if (network == NETWORK.sol) {
|
||||
item.name = `${namePrefix} #${item.edition}`;
|
||||
item.description = description;
|
||||
item.creators = solanaMetadata.creators;
|
||||
} else {
|
||||
item.name = `${namePrefix} #${item.edition}`;
|
||||
item.description = description;
|
||||
item.image = `${baseUri}/${item.edition}.png`;
|
||||
}
|
||||
fs.writeFileSync(
|
||||
`${basePath}/build/json/${item.edition}.json`,
|
||||
JSON.stringify(item, null, 2)
|
||||
);
|
||||
});
|
||||
|
||||
fs.writeFileSync(
|
||||
`${basePath}/build/json/_metadata.json`,
|
||||
JSON.stringify(data, null, 2)
|
||||
);
|
||||
|
||||
if (network == NETWORK.sol) {
|
||||
console.log(`Updated description for images to ===> ${description}`);
|
||||
console.log(`Updated name prefix for images to ===> ${namePrefix}`);
|
||||
console.log(
|
||||
`Updated creators for images to ===> ${JSON.stringify(
|
||||
solanaMetadata.creators
|
||||
)}`
|
||||
);
|
||||
} else {
|
||||
console.log(`Updated baseUri for images to ===> ${baseUri}`);
|
||||
console.log(`Updated description for images to ===> ${description}`);
|
||||
console.log(`Updated name prefix for images to ===> ${namePrefix}`);
|
||||
}
|
|
@ -0,0 +1,435 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
"@mapbox/node-pre-gyp@^1.0.0":
|
||||
"integrity" "sha512-qK1ECws8UxuPqOA8F5LFD90vyVU33W7N3hGfgsOVfrJaRVc8McC3JClTDHpeSbL9CBrOHly/4GsNPAvIgNZE+g=="
|
||||
"resolved" "https://registry.npmjs.org/@mapbox/node-pre-gyp/-/node-pre-gyp-1.0.6.tgz"
|
||||
"version" "1.0.6"
|
||||
dependencies:
|
||||
"detect-libc" "^1.0.3"
|
||||
"https-proxy-agent" "^5.0.0"
|
||||
"make-dir" "^3.1.0"
|
||||
"node-fetch" "^2.6.5"
|
||||
"nopt" "^5.0.0"
|
||||
"npmlog" "^5.0.1"
|
||||
"rimraf" "^3.0.2"
|
||||
"semver" "^7.3.5"
|
||||
"tar" "^6.1.11"
|
||||
|
||||
"abbrev@1":
|
||||
"integrity" "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q=="
|
||||
"resolved" "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz"
|
||||
"version" "1.1.1"
|
||||
|
||||
"agent-base@6":
|
||||
"integrity" "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ=="
|
||||
"resolved" "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz"
|
||||
"version" "6.0.2"
|
||||
dependencies:
|
||||
"debug" "4"
|
||||
|
||||
"ansi-regex@^3.0.0":
|
||||
"integrity" "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg="
|
||||
"resolved" "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz"
|
||||
"version" "3.0.0"
|
||||
|
||||
"aproba@^1.0.3 || ^2.0.0":
|
||||
"integrity" "sha512-lYe4Gx7QT+MKGbDsA+Z+he/Wtef0BiwDOlK/XkBrdfsh9J/jPPXbX0tE9x9cl27Tmu5gg3QUbUrQYa/y+KOHPQ=="
|
||||
"resolved" "https://registry.npmjs.org/aproba/-/aproba-2.0.0.tgz"
|
||||
"version" "2.0.0"
|
||||
|
||||
"are-we-there-yet@^2.0.0":
|
||||
"integrity" "sha512-Ci/qENmwHnsYo9xKIcUJN5LeDKdJ6R1Z1j9V/J5wyq8nh/mYPEpIKJbBZXtZjG04HiK7zV/p6Vs9952MrMeUIw=="
|
||||
"resolved" "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-2.0.0.tgz"
|
||||
"version" "2.0.0"
|
||||
dependencies:
|
||||
"delegates" "^1.0.0"
|
||||
"readable-stream" "^3.6.0"
|
||||
|
||||
"balanced-match@^1.0.0":
|
||||
"integrity" "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
"resolved" "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz"
|
||||
"version" "1.0.2"
|
||||
|
||||
"brace-expansion@^1.1.7":
|
||||
"integrity" "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA=="
|
||||
"resolved" "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz"
|
||||
"version" "1.1.11"
|
||||
dependencies:
|
||||
"balanced-match" "^1.0.0"
|
||||
"concat-map" "0.0.1"
|
||||
|
||||
"canvas@^2.8.0":
|
||||
"integrity" "sha512-gLTi17X8WY9Cf5GZ2Yns8T5lfBOcGgFehDFb+JQwDqdOoBOcECS9ZWMEAqMSVcMYwXD659J8NyzjRY/2aE+C2Q=="
|
||||
"resolved" "https://registry.npmjs.org/canvas/-/canvas-2.8.0.tgz"
|
||||
"version" "2.8.0"
|
||||
dependencies:
|
||||
"@mapbox/node-pre-gyp" "^1.0.0"
|
||||
"nan" "^2.14.0"
|
||||
"simple-get" "^3.0.3"
|
||||
|
||||
"charenc@>= 0.0.1":
|
||||
"integrity" "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc="
|
||||
"resolved" "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz"
|
||||
"version" "0.0.2"
|
||||
|
||||
"chownr@^2.0.0":
|
||||
"integrity" "sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ=="
|
||||
"resolved" "https://registry.npmjs.org/chownr/-/chownr-2.0.0.tgz"
|
||||
"version" "2.0.0"
|
||||
|
||||
"color-support@^1.1.2":
|
||||
"integrity" "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg=="
|
||||
"resolved" "https://registry.npmjs.org/color-support/-/color-support-1.1.3.tgz"
|
||||
"version" "1.1.3"
|
||||
|
||||
"concat-map@0.0.1":
|
||||
"integrity" "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
|
||||
"resolved" "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz"
|
||||
"version" "0.0.1"
|
||||
|
||||
"console-control-strings@^1.0.0", "console-control-strings@^1.1.0":
|
||||
"integrity" "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4="
|
||||
"resolved" "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz"
|
||||
"version" "1.1.0"
|
||||
|
||||
"crypt@>= 0.0.1":
|
||||
"integrity" "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs="
|
||||
"resolved" "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz"
|
||||
"version" "0.0.2"
|
||||
|
||||
"debug@4":
|
||||
"integrity" "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw=="
|
||||
"resolved" "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz"
|
||||
"version" "4.3.2"
|
||||
dependencies:
|
||||
"ms" "2.1.2"
|
||||
|
||||
"decompress-response@^4.2.0":
|
||||
"integrity" "sha512-jOSne2qbyE+/r8G1VU+G/82LBs2Fs4LAsTiLSHOCOMZQl2OKZ6i8i4IyHemTe+/yIXOtTcRQMzPcgyhoFlqPkw=="
|
||||
"resolved" "https://registry.npmjs.org/decompress-response/-/decompress-response-4.2.1.tgz"
|
||||
"version" "4.2.1"
|
||||
dependencies:
|
||||
"mimic-response" "^2.0.0"
|
||||
|
||||
"delegates@^1.0.0":
|
||||
"integrity" "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o="
|
||||
"resolved" "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz"
|
||||
"version" "1.0.0"
|
||||
|
||||
"detect-libc@^1.0.3":
|
||||
"integrity" "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
|
||||
"resolved" "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz"
|
||||
"version" "1.0.3"
|
||||
|
||||
"fs-minipass@^2.0.0":
|
||||
"integrity" "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg=="
|
||||
"resolved" "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz"
|
||||
"version" "2.1.0"
|
||||
dependencies:
|
||||
"minipass" "^3.0.0"
|
||||
|
||||
"fs.realpath@^1.0.0":
|
||||
"integrity" "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
|
||||
"resolved" "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz"
|
||||
"version" "1.0.0"
|
||||
|
||||
"gauge@^3.0.0":
|
||||
"integrity" "sha512-6STz6KdQgxO4S/ko+AbjlFGGdGcknluoqU+79GOFCDqqyYj5OanQf9AjxwN0jCidtT+ziPMmPSt9E4hfQ0CwIQ=="
|
||||
"resolved" "https://registry.npmjs.org/gauge/-/gauge-3.0.1.tgz"
|
||||
"version" "3.0.1"
|
||||
dependencies:
|
||||
"aproba" "^1.0.3 || ^2.0.0"
|
||||
"color-support" "^1.1.2"
|
||||
"console-control-strings" "^1.0.0"
|
||||
"has-unicode" "^2.0.1"
|
||||
"object-assign" "^4.1.1"
|
||||
"signal-exit" "^3.0.0"
|
||||
"string-width" "^1.0.1 || ^2.0.0"
|
||||
"strip-ansi" "^3.0.1 || ^4.0.0"
|
||||
"wide-align" "^1.1.2"
|
||||
|
||||
"gif-encoder-2@^1.0.5":
|
||||
"integrity" "sha512-fsRAKbZuUoZ7FYGjpFElmflTkKwsn/CzAmL/xDl4558aTAgysIDCUF6AXWO8dmai/ApfZACbPVAM+vPezJXlFg=="
|
||||
"resolved" "https://registry.npmjs.org/gif-encoder-2/-/gif-encoder-2-1.0.5.tgz"
|
||||
"version" "1.0.5"
|
||||
|
||||
"glob@^7.1.3":
|
||||
"integrity" "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q=="
|
||||
"resolved" "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz"
|
||||
"version" "7.2.0"
|
||||
dependencies:
|
||||
"fs.realpath" "^1.0.0"
|
||||
"inflight" "^1.0.4"
|
||||
"inherits" "2"
|
||||
"minimatch" "^3.0.4"
|
||||
"once" "^1.3.0"
|
||||
"path-is-absolute" "^1.0.0"
|
||||
|
||||
"has-unicode@^2.0.1":
|
||||
"integrity" "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk="
|
||||
"resolved" "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz"
|
||||
"version" "2.0.1"
|
||||
|
||||
"https-proxy-agent@^5.0.0":
|
||||
"integrity" "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA=="
|
||||
"resolved" "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz"
|
||||
"version" "5.0.0"
|
||||
dependencies:
|
||||
"agent-base" "6"
|
||||
"debug" "4"
|
||||
|
||||
"inflight@^1.0.4":
|
||||
"integrity" "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk="
|
||||
"resolved" "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz"
|
||||
"version" "1.0.6"
|
||||
dependencies:
|
||||
"once" "^1.3.0"
|
||||
"wrappy" "1"
|
||||
|
||||
"inherits@^2.0.3", "inherits@2":
|
||||
"integrity" "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
|
||||
"resolved" "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz"
|
||||
"version" "2.0.4"
|
||||
|
||||
"is-fullwidth-code-point@^2.0.0":
|
||||
"integrity" "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8="
|
||||
"resolved" "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz"
|
||||
"version" "2.0.0"
|
||||
|
||||
"lru-cache@^6.0.0":
|
||||
"integrity" "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA=="
|
||||
"resolved" "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz"
|
||||
"version" "6.0.0"
|
||||
dependencies:
|
||||
"yallist" "^4.0.0"
|
||||
|
||||
"make-dir@^3.1.0":
|
||||
"integrity" "sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw=="
|
||||
"resolved" "https://registry.npmjs.org/make-dir/-/make-dir-3.1.0.tgz"
|
||||
"version" "3.1.0"
|
||||
dependencies:
|
||||
"semver" "^6.0.0"
|
||||
|
||||
"mimic-response@^2.0.0":
|
||||
"integrity" "sha512-wXqjST+SLt7R009ySCglWBCFpjUygmCIfD790/kVbiGmUgfYGuB14PiTd5DwVxSV4NcYHjzMkoj5LjQZwTQLEA=="
|
||||
"resolved" "https://registry.npmjs.org/mimic-response/-/mimic-response-2.1.0.tgz"
|
||||
"version" "2.1.0"
|
||||
|
||||
"minimatch@^3.0.4":
|
||||
"integrity" "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA=="
|
||||
"resolved" "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz"
|
||||
"version" "3.0.4"
|
||||
dependencies:
|
||||
"brace-expansion" "^1.1.7"
|
||||
|
||||
"minipass@^3.0.0":
|
||||
"integrity" "sha512-+8NzxD82XQoNKNrl1d/FSi+X8wAEWR+sbYAfIvub4Nz0d22plFG72CEVVaufV8PNf4qSslFTD8VMOxNVhHCjTw=="
|
||||
"resolved" "https://registry.npmjs.org/minipass/-/minipass-3.1.5.tgz"
|
||||
"version" "3.1.5"
|
||||
dependencies:
|
||||
"yallist" "^4.0.0"
|
||||
|
||||
"minizlib@^2.1.1":
|
||||
"integrity" "sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg=="
|
||||
"resolved" "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz"
|
||||
"version" "2.1.2"
|
||||
dependencies:
|
||||
"minipass" "^3.0.0"
|
||||
"yallist" "^4.0.0"
|
||||
|
||||
"mkdirp@^1.0.3":
|
||||
"integrity" "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw=="
|
||||
"resolved" "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz"
|
||||
"version" "1.0.4"
|
||||
|
||||
"ms@2.1.2":
|
||||
"integrity" "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
|
||||
"resolved" "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz"
|
||||
"version" "2.1.2"
|
||||
|
||||
"nan@^2.14.0":
|
||||
"integrity" "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
|
||||
"resolved" "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz"
|
||||
"version" "2.15.0"
|
||||
|
||||
"node-fetch@^2.6.5":
|
||||
"integrity" "sha512-Z8/6vRlTUChSdIgMa51jxQ4lrw/Jy5SOW10ObaA47/RElsAN2c5Pn8bTgFGWn/ibwzXTE8qwr1Yzx28vsecXEA=="
|
||||
"resolved" "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.6.tgz"
|
||||
"version" "2.6.6"
|
||||
dependencies:
|
||||
"whatwg-url" "^5.0.0"
|
||||
|
||||
"nopt@^5.0.0":
|
||||
"integrity" "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ=="
|
||||
"resolved" "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz"
|
||||
"version" "5.0.0"
|
||||
dependencies:
|
||||
"abbrev" "1"
|
||||
|
||||
"npmlog@^5.0.1":
|
||||
"integrity" "sha512-AqZtDUWOMKs1G/8lwylVjrdYgqA4d9nu8hc+0gzRxlDb1I10+FHBGMXs6aiQHFdCUUlqH99MUMuLfzWDNDtfxw=="
|
||||
"resolved" "https://registry.npmjs.org/npmlog/-/npmlog-5.0.1.tgz"
|
||||
"version" "5.0.1"
|
||||
dependencies:
|
||||
"are-we-there-yet" "^2.0.0"
|
||||
"console-control-strings" "^1.1.0"
|
||||
"gauge" "^3.0.0"
|
||||
"set-blocking" "^2.0.0"
|
||||
|
||||
"object-assign@^4.1.1":
|
||||
"integrity" "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
|
||||
"resolved" "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz"
|
||||
"version" "4.1.1"
|
||||
|
||||
"once@^1.3.0", "once@^1.3.1":
|
||||
"integrity" "sha1-WDsap3WWHUsROsF9nFC6753Xa9E="
|
||||
"resolved" "https://registry.npmjs.org/once/-/once-1.4.0.tgz"
|
||||
"version" "1.4.0"
|
||||
dependencies:
|
||||
"wrappy" "1"
|
||||
|
||||
"path-is-absolute@^1.0.0":
|
||||
"integrity" "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
|
||||
"resolved" "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz"
|
||||
"version" "1.0.1"
|
||||
|
||||
"readable-stream@^3.6.0":
|
||||
"integrity" "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA=="
|
||||
"resolved" "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz"
|
||||
"version" "3.6.0"
|
||||
dependencies:
|
||||
"inherits" "^2.0.3"
|
||||
"string_decoder" "^1.1.1"
|
||||
"util-deprecate" "^1.0.1"
|
||||
|
||||
"rimraf@^3.0.2":
|
||||
"integrity" "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA=="
|
||||
"resolved" "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz"
|
||||
"version" "3.0.2"
|
||||
dependencies:
|
||||
"glob" "^7.1.3"
|
||||
|
||||
"safe-buffer@~5.2.0":
|
||||
"integrity" "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
|
||||
"resolved" "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"
|
||||
"version" "5.2.1"
|
||||
|
||||
"semver@^6.0.0":
|
||||
"integrity" "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw=="
|
||||
"resolved" "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz"
|
||||
"version" "6.3.0"
|
||||
|
||||
"semver@^7.3.5":
|
||||
"integrity" "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ=="
|
||||
"resolved" "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz"
|
||||
"version" "7.3.5"
|
||||
dependencies:
|
||||
"lru-cache" "^6.0.0"
|
||||
|
||||
"set-blocking@^2.0.0":
|
||||
"integrity" "sha1-BF+XgtARrppoA93TgrJDkrPYkPc="
|
||||
"resolved" "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz"
|
||||
"version" "2.0.0"
|
||||
|
||||
"sha1@^1.1.1":
|
||||
"integrity" "sha1-rdqnqTFo85PxnrKxUJFhjicA+Eg="
|
||||
"resolved" "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz"
|
||||
"version" "1.1.1"
|
||||
dependencies:
|
||||
"charenc" ">= 0.0.1"
|
||||
"crypt" ">= 0.0.1"
|
||||
|
||||
"signal-exit@^3.0.0":
|
||||
"integrity" "sha512-KWcOiKeQj6ZyXx7zq4YxSMgHRlod4czeBQZrPb8OKcohcqAXShm7E20kEMle9WBt26hFcAf0qLOcp5zmY7kOqQ=="
|
||||
"resolved" "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.5.tgz"
|
||||
"version" "3.0.5"
|
||||
|
||||
"simple-concat@^1.0.0":
|
||||
"integrity" "sha512-cSFtAPtRhljv69IK0hTVZQ+OfE9nePi/rtJmw5UjHeVyVroEqJXP1sFztKUy1qU+xvz3u/sfYJLa947b7nAN2Q=="
|
||||
"resolved" "https://registry.npmjs.org/simple-concat/-/simple-concat-1.0.1.tgz"
|
||||
"version" "1.0.1"
|
||||
|
||||
"simple-get@^3.0.3":
|
||||
"integrity" "sha512-bCR6cP+aTdScaQCnQKbPKtJOKDp/hj9EDLJo3Nw4y1QksqaovlW/bnptB6/c1e+qmNIDHRK+oXFDdEqBT8WzUA=="
|
||||
"resolved" "https://registry.npmjs.org/simple-get/-/simple-get-3.1.0.tgz"
|
||||
"version" "3.1.0"
|
||||
dependencies:
|
||||
"decompress-response" "^4.2.0"
|
||||
"once" "^1.3.1"
|
||||
"simple-concat" "^1.0.0"
|
||||
|
||||
"string_decoder@^1.1.1":
|
||||
"integrity" "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA=="
|
||||
"resolved" "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz"
|
||||
"version" "1.3.0"
|
||||
dependencies:
|
||||
"safe-buffer" "~5.2.0"
|
||||
|
||||
"string-width@^1.0.1 || ^2.0.0", "string-width@^1.0.2 || 2 || 3 || 4":
|
||||
"integrity" "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw=="
|
||||
"resolved" "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz"
|
||||
"version" "2.1.1"
|
||||
dependencies:
|
||||
"is-fullwidth-code-point" "^2.0.0"
|
||||
"strip-ansi" "^4.0.0"
|
||||
|
||||
"strip-ansi@^3.0.1 || ^4.0.0", "strip-ansi@^4.0.0":
|
||||
"integrity" "sha1-qEeQIusaw2iocTibY1JixQXuNo8="
|
||||
"resolved" "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz"
|
||||
"version" "4.0.0"
|
||||
dependencies:
|
||||
"ansi-regex" "^3.0.0"
|
||||
|
||||
"tar@^6.1.11":
|
||||
"integrity" "sha512-an/KZQzQUkZCkuoAA64hM92X0Urb6VpRhAFllDzz44U2mcD5scmT3zBc4VgVpkugF580+DQn8eAFSyoQt0tznA=="
|
||||
"resolved" "https://registry.npmjs.org/tar/-/tar-6.1.11.tgz"
|
||||
"version" "6.1.11"
|
||||
dependencies:
|
||||
"chownr" "^2.0.0"
|
||||
"fs-minipass" "^2.0.0"
|
||||
"minipass" "^3.0.0"
|
||||
"minizlib" "^2.1.1"
|
||||
"mkdirp" "^1.0.3"
|
||||
"yallist" "^4.0.0"
|
||||
|
||||
"tr46@~0.0.3":
|
||||
"integrity" "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
|
||||
"resolved" "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz"
|
||||
"version" "0.0.3"
|
||||
|
||||
"util-deprecate@^1.0.1":
|
||||
"integrity" "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8="
|
||||
"resolved" "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
|
||||
"version" "1.0.2"
|
||||
|
||||
"webidl-conversions@^3.0.0":
|
||||
"integrity" "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
|
||||
"resolved" "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz"
|
||||
"version" "3.0.1"
|
||||
|
||||
"whatwg-url@^5.0.0":
|
||||
"integrity" "sha1-lmRU6HZUYuN2RNNib2dCzotwll0="
|
||||
"resolved" "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz"
|
||||
"version" "5.0.0"
|
||||
dependencies:
|
||||
"tr46" "~0.0.3"
|
||||
"webidl-conversions" "^3.0.0"
|
||||
|
||||
"wide-align@^1.1.2":
|
||||
"integrity" "sha512-eDMORYaPNZ4sQIuuYPDHdQvf4gyCF9rEEV/yPxGfwPkRodwEgiMUUXTx/dex+Me0wxx53S+NgUHaP7y3MGlDmg=="
|
||||
"resolved" "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz"
|
||||
"version" "1.1.5"
|
||||
dependencies:
|
||||
"string-width" "^1.0.2 || 2 || 3 || 4"
|
||||
|
||||
"wrappy@1":
|
||||
"integrity" "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
|
||||
"resolved" "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
|
||||
"version" "1.0.2"
|
||||
|
||||
"yallist@^4.0.0":
|
||||
"integrity" "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A=="
|
||||
"resolved" "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz"
|
||||
"version" "4.0.0"
|