UNPKG

next-tribune-blog

Version:

Automatic blog generator for Next.js from Tribune.sh blockchain articles

42 lines 1.8 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.NextTribuneBlogPlugin = void 0; const generator_1 = require("./generator"); // Fixed Tribune contract address on Abstract mainnet const TRIBUNE_CONTRACT_ADDRESS = '0xA951D889Dc4c157bad4Dca26BF5b86720D5b33FA'; // Fixed RPC URL for Abstract mainnet const ABSTRACT_MAINNET_RPC = 'https://abstract-mainnet.g.alchemy.com/v2/HNy2ntUiTXz3ZQpBJq1VKXbVlG11VKTN'; class NextTribuneBlogPlugin { constructor(options = {}) { this.options = { // Contract address is now fixed contractAddress: TRIBUNE_CONTRACT_ADDRESS, // RPC URL is now fixed rpcUrl: ABSTRACT_MAINNET_RPC, // User can configure these outputDir: options.outputDir || 'src/app/blog', walletAddress: options.walletAddress || '0x0', }; // Log warning if no wallet address is provided if (this.options.walletAddress === '0x0') { console.log('⚠️ No wallet address configured. Showing all articles from Tribune.'); console.log('💡 To show only your articles, set walletAddress in next.config.ts'); } } apply(nextConfig) { const originalWebpack = nextConfig.webpack; nextConfig.webpack = (config, options) => { if (options.isServer && !options.dev) { // Generate blog pages during build (0, generator_1.generateBlogPages)(this.options).catch(console.error); } if (originalWebpack) { return originalWebpack(config, options); } return config; }; return nextConfig; } } exports.NextTribuneBlogPlugin = NextTribuneBlogPlugin; //# sourceMappingURL=plugin.js.map