pixel-forge
Version:
A comprehensive generator for social media previews, favicons, and visual assets across all platforms
185 lines (184 loc) • 7.27 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComprehensiveSocialGenerator = void 0;
const opengraph_1 = require("./opengraph");
const instagram_1 = require("./instagram");
const messaging_1 = require("./messaging");
const platforms_1 = require("./platforms");
class ComprehensiveSocialGenerator {
constructor(sourceImage, config) {
this.config = config;
this.sourceImage = sourceImage;
}
/**
* Generate assets for all platforms
*/
async generate(options = {}) {
const { includeStandard = true, includeInstagram = true, includeMessaging = true, includePlatforms = true } = options;
// Generate standard social media formats (Facebook, Twitter, LinkedIn)
if (includeStandard) {
// OpenGraphGenerator uses config.socialPreview instead of options
await this.generateStandardSocial();
}
// Generate Instagram specific formats
if (includeInstagram) {
await this.generateInstagram(options);
}
// Generate messaging app formats
if (includeMessaging) {
await this.generateMessaging(options);
}
// Generate other platform formats
if (includePlatforms) {
await this.generatePlatforms(options);
}
}
/**
* Generate standard social media formats
*
* Note: OpenGraphGenerator doesn't use the options directly,
* it uses config.socialPreview instead
*/
async generateStandardSocial() {
const generator = new opengraph_1.OpenGraphGenerator(this.sourceImage, this.config);
await generator.generate();
}
/**
* Generate Instagram formats
*/
async generateInstagram(options) {
const generator = new instagram_1.InstagramGenerator(this.sourceImage, this.config);
await generator.generate({
title: options.title,
description: options.description,
template: options.template,
includeStories: options.platforms?.instagramStories !== false,
includeReels: options.platforms?.instagramReels !== false
});
}
/**
* Generate messaging app formats
*/
async generateMessaging(options) {
const generator = new messaging_1.MessagingGenerator(this.sourceImage, this.config);
await generator.generate({
title: options.title,
description: options.description,
template: options.template,
includeWhatsApp: options.platforms?.whatsapp !== false,
includeDiscord: options.platforms?.discord !== false,
includeTelegram: options.platforms?.telegram !== false,
includeSignal: options.platforms?.signal !== false,
includeSlack: options.platforms?.slack !== false,
includeiMessage: options.platforms?.imessage !== false,
includeAndroidRCS: options.platforms?.androidRCS !== false,
includeWeChat: options.platforms?.wechat === true
});
}
/**
* Generate other platform formats
*/
async generatePlatforms(options) {
const generator = new platforms_1.PlatformGenerator(this.sourceImage, this.config);
await generator.generate({
title: options.title,
description: options.description,
template: options.template,
includeTikTok: options.platforms?.tiktok !== false,
includeYouTube: options.platforms?.youtube !== false,
includePinterest: options.platforms?.pinterest !== false,
includeSnapchat: options.platforms?.snapchat !== false,
includeThreads: options.platforms?.threads !== false,
includeBluesky: options.platforms?.bluesky !== false,
includeMastodon: options.platforms?.mastodon !== false
});
}
/**
* Get comprehensive HTML meta tags
*/
getMetaTags() {
const standardGenerator = new opengraph_1.OpenGraphGenerator(this.sourceImage, this.config);
const instagramGenerator = new instagram_1.InstagramGenerator(this.sourceImage, this.config);
const messagingGenerator = new messaging_1.MessagingGenerator(this.sourceImage, this.config);
const platformGenerator = new platforms_1.PlatformGenerator(this.sourceImage, this.config);
return [
...standardGenerator.getMetaTags(),
...instagramGenerator.getMetaTags(),
...messagingGenerator.getMetaTags(),
...platformGenerator.getMetaTags()
];
}
/**
* Get comprehensive Next.js metadata configuration
*/
getNextMetadata() {
const standardGenerator = new opengraph_1.OpenGraphGenerator(this.sourceImage, this.config);
const instagramGenerator = new instagram_1.InstagramGenerator(this.sourceImage, this.config);
const messagingGenerator = new messaging_1.MessagingGenerator(this.sourceImage, this.config);
const platformGenerator = new platforms_1.PlatformGenerator(this.sourceImage, this.config);
const standardMeta = standardGenerator.getNextMetadata();
const instagramMeta = instagramGenerator.getNextMetadata();
const messagingMeta = messagingGenerator.getNextMetadata();
const platformMeta = platformGenerator.getNextMetadata();
return {
openGraph: {
...standardMeta.openGraph,
images: [
...standardMeta.openGraph?.images || [],
...instagramMeta.openGraph?.images || [],
...messagingMeta.openGraph?.images || [],
...platformMeta.openGraph?.images || []
]
},
twitter: {
...standardMeta.twitter,
...instagramMeta.twitter
},
other: {
...messagingMeta.other,
...platformMeta.other
}
};
}
/**
* Get generated file summary
*/
async getGeneratedFiles() {
// This would return a list of all generated files
// Implementation would scan the output directory
return [
// Standard social
'facebook.png',
'twitter.png',
'linkedin.png',
// Instagram
'instagram-square.png',
'instagram-portrait.png',
'instagram-landscape.png',
'instagram-stories.png',
'instagram-reels.png',
// Messaging
'messaging-standard.png',
'whatsapp-square.png',
'whatsapp-link.png',
'discord.png',
'telegram.png',
'signal.png',
'slack.png',
'imessage.png',
'android-rcs.png',
'wechat.png',
// Platforms
'tiktok.png',
'youtube-thumbnail.png',
'youtube-shorts.png',
'pinterest-pin.png',
'pinterest-square.png',
'snapchat.png',
'threads.png',
'bluesky.png',
'mastodon.png'
];
}
}
exports.ComprehensiveSocialGenerator = ComprehensiveSocialGenerator;