autoft-qris
Version:
Package untuk generate QRIS dengan 2 tema (Biru & Hijau) dan cek payment status secara realtime dengan API OrderKuota
91 lines (81 loc) ⢠4.21 kB
JavaScript
import { readFileSync } from 'fs';
import { resolve, dirname } from 'path';
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
class DeprecationWarning {
static checkNodeVersion() {
const nodeVersion = process.version;
const currentVersion = nodeVersion.slice(1);
const targetVersion = '21.7.3';
if (currentVersion !== targetVersion) {
console.log('\n' + '='.repeat(60));
console.log('ā ļø NODE.JS VERSION WARNING!');
console.log('='.repeat(60));
console.log(`š“ Node.js ${nodeVersion} detected`);
console.log('ā Chalk package hanya support Node.js 21.7.3');
console.log('š Solusi:');
console.log(' ⢠Install Node.js 21.7.3 secara spesifik');
console.log(' ⢠Versi lain akan menyebabkan chalk error');
console.log(`š” Required Node.js version: ${targetVersion}`);
console.log('='.repeat(60) + '\n');
return false;
}
return true;
}
static async showUpdateNotification() {
try {
const chalk = await import('chalk');
const packageJsonPath = resolve(__dirname, '../package.json');
const packageData = JSON.parse(readFileSync(packageJsonPath, 'utf8'));
const currentVersion = packageData.version;
console.log('\n' + '='.repeat(60));
console.log(chalk.default.yellow.bold('š UPDATE TERSEDIA!'));
console.log('='.repeat(60));
console.log(chalk.default.cyan('š¦ Package: autoft-qris'));
console.log(chalk.default.green(`⨠Versi Terbaru: v${currentVersion}`));
console.log(chalk.default.blue('šØ Fitur Baru:'));
console.log(chalk.default.white(' ⢠2 Tema QRIS (Default & Meta Style)'));
console.log(chalk.default.white(' ⢠ESM & CommonJS Support'));
console.log(chalk.default.white(' ⢠Perbaikan performa'));
console.log(chalk.default.white(' ⢠API yang lebih bersih'));
console.log(chalk.default.yellow('\nš” Untuk update:'));
console.log(chalk.default.white(' npm update autoft-qris'));
console.log(chalk.default.gray('\nš Dokumentasi lengkap:'));
console.log(chalk.default.blue(' https://github.com/AutoFTbot/Qris-OrderKuota'));
console.log(chalk.default.magenta('\nšØāš» Original Author: AutoFTbot'));
console.log(chalk.default.green('š¤ Contributor: AlfiDev'));
console.log('='.repeat(60) + '\n');
} catch (error) {
console.log('\n' + '='.repeat(60));
console.log('š UPDATE TERSEDIA!');
console.log('='.repeat(60));
console.log('š¦ Package: autoft-qris');
console.log('⨠Versi Terbaru dengan fitur baru!');
console.log('šØ Fitur Baru:');
console.log(' ⢠2 Tema QRIS (Default & Meta Style)');
console.log(' ⢠ESM & CommonJS Support');
console.log(' ⢠Perbaikan performa');
console.log(' ⢠API yang lebih bersih');
console.log('\nš” Untuk update:');
console.log(' npm update autoft-qris');
console.log('\nš Dokumentasi lengkap:');
console.log(' https://github.com/AutoFTbot/Qris-OrderKuota');
console.log('\nšØāš» Original Author: AutoFTbot');
console.log('š¤ Contributor: AlfiDev');
console.log('='.repeat(60) + '\n');
}
}
static async checkAndShowWarning() {
try {
if (process.env.NODE_ENV === 'production') return;
if (!this.checkNodeVersion()) return;
await this.showUpdateNotification();
} catch (error) {
}
}
}
export function checkAndShowWarning() {
return DeprecationWarning.checkAndShowWarning();
}
export default DeprecationWarning;