Skip to content

Commit

Permalink
Fixed type error (2.0.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
flameface committed Mar 21, 2024
1 parent 51824a3 commit 8b59766
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 28 deletions.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ const fs = require('fs')
Minimal({
avatar: "https://cdn.discordapp.com/avatars/786504767358238720/f65e8322c0c290e7fc1d9ad20322256b.webp",
name: "FLAMEFACE",
type: "WELCOME"
type: "WELCOME",
message: "YOUR ARE 100TH MEMBER"
}).then(x => {
fs.writeFileSync("greetify.png", x)
})
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"deploy": "npm publish",
"deploy:beta": "npm publish --tag beta",
"test:m": "cd tests && node index.mjs",
"test:c": "cd tests && node --watch index.js"
"test:c": "cd tests && node index.js"
},
"keywords": [
"welcome-card",
Expand Down Expand Up @@ -51,4 +51,4 @@
"@napi-rs/canvas": "^0.1.51",
"cropify": "latest"
}
}
}
22 changes: 11 additions & 11 deletions src/themes/minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { cropImage } from "cropify"
import { registerFont } from "../functions/registerFont";
import { minimalType } from "../typings/types";

registerFont("PlusJakartaSans-Bold.ttf", "pjs-bold")
registerFont("PlusJakartaSans-ExtraBold.ttf", "pjs-ebold")
registerFont("PlusJakartaSans-ExtraLight.ttf", "pjs-elight")
registerFont("PlusJakartaSans-Light.ttf", "pjs-light")
registerFont("PlusJakartaSans-Medium.ttf", "pjs-medium")
registerFont("PlusJakartaSans-Regular.ttf", "pjs-regular")
registerFont("PlusJakartaSans-SemiBold.ttf", "pjs-sbold")
registerFont("PlusJakartaSans-Bold.ttf", "bold")
registerFont("PlusJakartaSans-ExtraBold.ttf", "extrabold")
registerFont("PlusJakartaSans-ExtraLight.ttf", "extralight")
registerFont("PlusJakartaSans-Light.ttf", "light")
registerFont("PlusJakartaSans-Medium.ttf", "medium")
registerFont("PlusJakartaSans-Regular.ttf", "regular")
registerFont("PlusJakartaSans-SemiBold.ttf", "semibold")

const Minimal = async (option: minimalType) => {
if (!option.backgroundImage) {
Expand Down Expand Up @@ -45,7 +45,7 @@ const Minimal = async (option: minimalType) => {
imagePath: option.backgroundImage,
borderRadius: 100,
cropCenter: true,
width: 1280,
width: 1280,
height: 720
})

Expand All @@ -63,17 +63,17 @@ const Minimal = async (option: minimalType) => {
ctx.drawImage(await loadImage(avatar), 505, 56)

ctx.fillStyle = option.nameColor
ctx.font = "100px pjs-ebold"
ctx.font = "100px extrabold"
ctx.textAlign = 'center';
ctx.fillText(option.name.toUpperCase(), centerX, 440)

ctx.fillStyle = option.typeColor
ctx.font = "65px pjs-bold"
ctx.font = "65px bold"
ctx.textAlign = 'center';
ctx.fillText(option.type.toUpperCase(), centerX, 530)

ctx.fillStyle = option.messageColor
ctx.font = "40px pjs-light"
ctx.font = "40px light"
ctx.textAlign = 'center';
ctx.fillText(option.message.toUpperCase(), centerX, 655)

Expand Down
20 changes: 10 additions & 10 deletions src/themes/panorama.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ import { cropImage } from "cropify"
import { registerFont } from "../functions/registerFont";
import { panoramaType } from "../typings/types";

registerFont("PlusJakartaSans-Bold.ttf", "pjs-bold")
registerFont("PlusJakartaSans-ExtraBold.ttf", "pjs-ebold")
registerFont("PlusJakartaSans-ExtraLight.ttf", "pjs-elight")
registerFont("PlusJakartaSans-Light.ttf", "pjs-light")
registerFont("PlusJakartaSans-Medium.ttf", "pjs-medium")
registerFont("PlusJakartaSans-Regular.ttf", "pjs-regular")
registerFont("PlusJakartaSans-SemiBold.ttf", "pjs-sbold")
registerFont("PlusJakartaSans-Bold.ttf", "bold")
registerFont("PlusJakartaSans-ExtraBold.ttf", "extrabold")
registerFont("PlusJakartaSans-ExtraLight.ttf", "extralight")
registerFont("PlusJakartaSans-Light.ttf", "light")
registerFont("PlusJakartaSans-Medium.ttf", "medium")
registerFont("PlusJakartaSans-Regular.ttf", "regular")
registerFont("PlusJakartaSans-SemiBold.ttf", "semibold")

const Panorama = async (option: panoramaType) => {
if (!option.backgroundImage) {
Expand Down Expand Up @@ -57,14 +57,14 @@ const Panorama = async (option: panoramaType) => {
ctx.drawImage(await loadImage(avatar), 90, 60)

ctx.fillStyle = option.nameColor
ctx.font = "80px pjs-ebold"
ctx.font = "80px extrabold"
ctx.fillText(option.name.toUpperCase(), 420, centerY + 75)

ctx.fillStyle = option.typeColor
ctx.font = "65px pjs-light"
ctx.font = "65px light"
ctx.fillText(option.type.toUpperCase(), 420, centerY - 25)

return canvas.toBuffer("image/png")
}

export { Panorama }
export { Panorama }
Binary file modified tests/greetify.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ const { Minimal } = require("../dist/index");
const fs = require('fs')

Minimal({

avatar: "https://cdn.discordapp.com/avatars/786504767358238720/f65e8322c0c290e7fc1d9ad20322256b.webp",
name: "FLAMEFACE",
type: "WELCOME",
message: "YOUR ARE 100TH MEMBER"
}).then(x => {
fs.writeFileSync("greetify.png", x)
})
11 changes: 11 additions & 0 deletions tests/index.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Minimal } from "../dist/index.mjs";
import fs from 'fs'

Minimal({
avatar: "https://cdn.discordapp.com/avatars/786504767358238720/f65e8322c0c290e7fc1d9ad20322256b.webp",
name: "FLAMEFACE",
type: "WELCOME",
message: "YOUR ARE 100TH MEMBER"
}).then(x => {
fs.writeFileSync("greetify.png", x)
})
5 changes: 3 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
"compilerOptions": {
"target": "ES2016",
"module": "CommonJS",
"target": "ESNext",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"strict": true,
"outDir": "dist",
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export default defineConfig({
dts: true,
shims: true,
skipNodeModulesBundle: true,
clean: ['./src/index.ts']
clean: true
});

0 comments on commit 8b59766

Please sign in to comment.