canvacord
Advanced tools
Comparing version 5.4.10 to 6.0.0-beta.0
{ | ||
"name": "canvacord", | ||
"version": "5.4.10", | ||
"description": "Powerful image manipulation package for beginners.", | ||
"main": "index.js", | ||
"types": "./typings/index.d.ts", | ||
"bin": "./bin/canvacord.js", | ||
"description": "Generate images on-the-fly with the help of wide range of templates.", | ||
"version": "6.0.0-beta.0", | ||
"main": "./dist/index.js", | ||
"exports": { | ||
"require": { | ||
"default": "./dist/index.js", | ||
"types": "./dist/index.d.ts" | ||
}, | ||
"import": { | ||
"default": "./dist/index.mjs", | ||
"types": "./dist/index.d.mts" | ||
} | ||
}, | ||
"files": [ | ||
"bin", | ||
"scripts", | ||
"libs", | ||
"plugins", | ||
"src", | ||
"index.js", | ||
"typings" | ||
"dist" | ||
], | ||
"dependencies": { | ||
"@napi-rs/canvas": "^0.1.41", | ||
"@napi-rs/image": "^1.7.0", | ||
"@resvg/resvg-js": "^2.6.0", | ||
"@skyra/gifenc": "^1.0.1", | ||
"file-type": "16.5.4", | ||
"satori": "^0.10.9", | ||
"tailwind-merge": "^1.14.0" | ||
}, | ||
"scripts": { | ||
"docs": "docgen --source src --custom docs/index.yml --output docs/docs.json", | ||
"docs:test": "docgen --source src --custom docs/index.yml", | ||
"test": "cd test && node .", | ||
"types": "tsc", | ||
"postinstall": "node scripts/postinstall.mjs" | ||
"format": "prettier --write \"./src/**/*.{js,ts,jsx,tsx}\"", | ||
"build": "tsup", | ||
"test": "tsx ./test/index.ts", | ||
"test:jsx": "tsx ./test/jsxTest.tsx", | ||
"bench": "cd ./benchmark && node jsx-renderer.mjs" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/neplextech/Canvacord.git" | ||
"url": "git+https://github.com/neplextech/canvacord.git" | ||
}, | ||
"keywords": [ | ||
"canvacord", | ||
"canvas", | ||
"canavcord", | ||
"image", | ||
"api", | ||
"manipulation", | ||
"easy", | ||
"simple", | ||
"fast", | ||
"api", | ||
"rank", | ||
"card", | ||
"rankcard", | ||
"welcomer", | ||
"leaver", | ||
"spotify", | ||
"memegen" | ||
"nodejs", | ||
"typescript" | ||
], | ||
"author": "neplextech", | ||
"license": "GPL-3.0", | ||
"author": "twlite", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/neplextech/canvacord/issues" | ||
}, | ||
"homepage": "https://canvacord.js.org", | ||
"dependencies": { | ||
"@napi-rs/canvas": "^0.1.29", | ||
"@skyra/gifenc": "^1.0.0", | ||
"chalk": "^5.0.1", | ||
"moment": "^2.29.4", | ||
"moment-duration-format": "^2.3.2", | ||
"node-fetch": "2.6.7" | ||
}, | ||
"homepage": "https://github.com/neplextech/canvacord#readme", | ||
"packageManager": "yarn@3.6.0", | ||
"devDependencies": { | ||
"@discordjs/docgen": "^0.11.1", | ||
"@types/node": "^16.4.7", | ||
"typescript": "^4.7.4" | ||
}, | ||
"packageManager": "yarn@3.6.0" | ||
} | ||
"@types/node": "^20.3.1", | ||
"@types/react": "^18.2.12", | ||
"benny": "^3.7.1", | ||
"prettier": "^2.8.8", | ||
"tailwindcss": "^3.3.3", | ||
"tsup": "^7.2.0", | ||
"tsx": "^3.12.7", | ||
"typescript": "^5.1.3" | ||
} | ||
} |
112
README.md
[![SWUbanner](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner2-direct.svg)](https://vshymanskyy.github.io/StandWithUkraine) | ||
# Canvacord | ||
Powerful image manipulation tool to manipulate images easily. | ||
# Installation | ||
Easily generate images on-the-fly with node.js using wide range of templates. | ||
```sh | ||
$ npm i canvacord | ||
``` | ||
> **Warning** | ||
> | ||
> You are looking at the next version of canvacord, which is under development. Go to the [legacy branch](https://github.com/neplextech/canvacord/tree/legacy) to view legacy codebase. | ||
[![NPM](https://nodei.co/npm/canvacord.png)](https://nodei.co/npm/canvacord/) | ||
## Features | ||
# Features | ||
- Super simple and easy to use 😎 | ||
- Faster than canvacord v4 🚀 | ||
- More than **50 methods**...? Yay! 🎉 | ||
- Built on top of **[@napi-rs/canvas](https://npm.im/@napi-rs/canvas)** 🔥 | ||
- Object oriented 💻 | ||
- Beginner friendly 🤓 | ||
- Supports emojis 😀 | ||
- image generation _(wip)_ | ||
- image manipulation _(wip)_ | ||
- image templates _(wip)_ | ||
- image filters _(wip)_ | ||
- complex layouts _(wip)_ | ||
# Documentation | ||
**[https://canvacord.js.org](https://canvacord.js.org)** | ||
## Example | ||
**[Join our Discord server](https://neplextech.com/discord)** | ||
### Image Generation | ||
# Examples | ||
## Rank Card | ||
<!-- prettier-ignore --> | ||
```ts | ||
import { canvacord } from 'canvacord'; | ||
import fs from 'node:fs'; | ||
```js | ||
const canvacord = require("canvacord"); | ||
const img = "https://cdn.discordapp.com/embed/avatars/0.png"; | ||
// triggered gif | ||
const triggered = await canvacord.triggered(image); | ||
triggered.pipe(fs.createWriteStream('triggered.gif')); | ||
const userData = getDataSomehow(); | ||
// filters | ||
const filtered = await canvacord | ||
.filters(512, 512) | ||
.drawImage(image) | ||
.hueRotate(90) | ||
.invert(2) | ||
.sepia(1) | ||
.opacity(0.5) | ||
.saturate(2) | ||
.encode(); | ||
const rank = new canvacord.Rank() | ||
.setAvatar(img) | ||
.setCurrentXP(userData.xp) | ||
.setRequiredXP(userData.requiredXP) | ||
.setStatus("dnd") | ||
.setProgressBar("#FFFFFF", "COLOR") | ||
.setUsername("Snowflake") | ||
.setDiscriminator("0007"); | ||
// alternative syntax | ||
const filtered = await canvacord(image, 512, 512) | ||
.hueRotate(90) | ||
.invert(2) | ||
.sepia(1) | ||
.opacity(0.5) | ||
.saturate(2) | ||
.encode(); | ||
rank.build() | ||
.then(data => { | ||
const attachment = new Discord.MessageAttachment(data, "RankCard.png"); | ||
message.channel.send(attachment); | ||
}); | ||
fs.writeFileSync('filtered.png', filtered); | ||
``` | ||
### Preview | ||
![RankCard](https://raw.githubusercontent.com/neplextech/canvacord/main/test/images/RankCard.png) | ||
## XP Card Preview | ||
## Rank Card Variants | ||
![RankCard](https://raw.githubusercontent.com/neplextech/canvacord/main/test/Gamer.png) | ||
![RankCard](https://raw.githubusercontent.com/neplextech/canvacord/main/test/Nerd.png) | ||
![RankCard](https://raw.githubusercontent.com/neplextech/canvacord/main/test/Player.png) | ||
## Other Examples | ||
```js | ||
const Discord = require("discord.js"); | ||
const client = new Discord.Client(); | ||
const canvacord = require("canvacord"); | ||
client.on("ready", () => { | ||
console.log("I'm online!"); | ||
}); | ||
client.on("message", async (message) => { | ||
if (message.author.bot) return; | ||
if (message.content === "!triggered") { | ||
let avatar = message.author.displayAvatarURL({ dynamic: false, format: 'png' }); | ||
let image = await canvacord.Canvas.trigger(avatar); | ||
let attachment = new Discord.MessageAttachment(image, "triggered.gif"); | ||
return message.channel.send(attachment); | ||
} | ||
}); | ||
client.login("Your_Bot_Token_here"); | ||
``` | ||
# Note | ||
> ⚠ | In order to use `Canvacord#Welcomer`/`Canvacord#Leaver`/`Canvacord#CaptchaGen`, you may need to install packages like **[discord-canvas](https://npmjs.com/package/discord-canvas)** & **[captcha-canvas](https://npmjs.com/package/captcha-canvas)**. | ||
![xp-card](https://raw.githubusercontent.com/neplextech/canvacord/main/test/jsx/test2.svg) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 2 instances in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Install scripts
Supply chain riskInstall scripts are run when the package is installed. The majority of malware in npm is hidden in install scripts.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances in 1 package
856581
5398
0
7
8
7
3
1
58
13
7
+ Added@napi-rs/image@^1.7.0
+ Added@resvg/resvg-js@^2.6.0
+ Addedfile-type@16.5.4
+ Addedsatori@^0.10.9
+ Addedtailwind-merge@^1.14.0
+ Added@emnapi/core@1.3.1(transitive)
+ Added@emnapi/runtime@1.3.1(transitive)
+ Added@emnapi/wasi-threads@1.0.1(transitive)
+ Added@napi-rs/image@1.9.2(transitive)
+ Added@napi-rs/image-android-arm64@1.9.2(transitive)
+ Added@napi-rs/image-darwin-arm64@1.9.2(transitive)
+ Added@napi-rs/image-darwin-x64@1.9.2(transitive)
+ Added@napi-rs/image-freebsd-x64@1.9.2(transitive)
+ Added@napi-rs/image-linux-arm-gnueabihf@1.9.2(transitive)
+ Added@napi-rs/image-linux-arm64-gnu@1.9.2(transitive)
+ Added@napi-rs/image-linux-arm64-musl@1.9.2(transitive)
+ Added@napi-rs/image-linux-x64-gnu@1.9.2(transitive)
+ Added@napi-rs/image-linux-x64-musl@1.9.2(transitive)
+ Added@napi-rs/image-wasm32-wasi@1.9.2(transitive)
+ Added@napi-rs/image-win32-ia32-msvc@1.9.2(transitive)
+ Added@napi-rs/image-win32-x64-msvc@1.9.2(transitive)
+ Added@napi-rs/wasm-runtime@0.2.5(transitive)
+ Added@resvg/resvg-js@2.6.2(transitive)
+ Added@resvg/resvg-js-android-arm-eabi@2.6.2(transitive)
+ Added@resvg/resvg-js-android-arm64@2.6.2(transitive)
+ Added@resvg/resvg-js-darwin-arm64@2.6.2(transitive)
+ Added@resvg/resvg-js-darwin-x64@2.6.2(transitive)
+ Added@resvg/resvg-js-linux-arm-gnueabihf@2.6.2(transitive)
+ Added@resvg/resvg-js-linux-arm64-gnu@2.6.2(transitive)
+ Added@resvg/resvg-js-linux-arm64-musl@2.6.2(transitive)
+ Added@resvg/resvg-js-linux-x64-gnu@2.6.2(transitive)
+ Added@resvg/resvg-js-linux-x64-musl@2.6.2(transitive)
+ Added@resvg/resvg-js-win32-arm64-msvc@2.6.2(transitive)
+ Added@resvg/resvg-js-win32-ia32-msvc@2.6.2(transitive)
+ Added@resvg/resvg-js-win32-x64-msvc@2.6.2(transitive)
+ Added@shuding/opentype.js@1.4.0-beta.0(transitive)
+ Added@tokenizer/token@0.3.0(transitive)
+ Added@tybys/wasm-util@0.9.0(transitive)
+ Addedbase64-js@0.0.8(transitive)
+ Addedcamelize@1.0.1(transitive)
+ Addedcolor-name@1.1.4(transitive)
+ Addedcss-background-parser@0.1.0(transitive)
+ Addedcss-box-shadow@1.0.0-3(transitive)
+ Addedcss-color-keywords@1.0.0(transitive)
+ Addedcss-to-react-native@3.2.0(transitive)
+ Addedemoji-regex@10.4.0(transitive)
+ Addedescape-html@1.0.3(transitive)
+ Addedfflate@0.7.4(transitive)
+ Addedfile-type@16.5.4(transitive)
+ Addedhex-rgb@4.3.0(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedinherits@2.0.4(transitive)
+ Addedlinebreak@1.1.0(transitive)
+ Addedpako@0.2.9(transitive)
+ Addedparse-css-color@0.2.1(transitive)
+ Addedpeek-readable@4.1.0(transitive)
+ Addedpostcss-value-parser@4.2.0(transitive)
+ Addedreadable-stream@3.6.2(transitive)
+ Addedreadable-web-to-node-stream@3.0.2(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedsatori@0.10.14(transitive)
+ Addedstring.prototype.codepointat@0.2.1(transitive)
+ Addedstring_decoder@1.3.0(transitive)
+ Addedstrtok3@6.3.0(transitive)
+ Addedtailwind-merge@1.14.0(transitive)
+ Addedtiny-inflate@1.0.3(transitive)
+ Addedtoken-types@4.2.1(transitive)
+ Addedunicode-trie@2.0.0(transitive)
+ Addedutil-deprecate@1.0.2(transitive)
+ Addedyoga-wasm-web@0.3.3(transitive)
- Removedchalk@^5.0.1
- Removedmoment@^2.29.4
- Removedmoment-duration-format@^2.3.2
- Removednode-fetch@2.6.7
- Removedchalk@5.3.0(transitive)
- Removedmoment@2.30.1(transitive)
- Removedmoment-duration-format@2.3.2(transitive)
- Removednode-fetch@2.6.7(transitive)
- Removedtr46@0.0.3(transitive)
- Removedwebidl-conversions@3.0.1(transitive)
- Removedwhatwg-url@5.0.0(transitive)
Updated@napi-rs/canvas@^0.1.41
Updated@skyra/gifenc@^1.0.1