irctc-connect
Version:
⚠️ DEPRECATED: This package has been renamed to `railkit`. It still works for now but will not receive updates. Please migrate to `railkit` as soon as possible.
65 lines (58 loc) • 1.91 kB
JavaScript
/**
* postinstall.js
*
* Displayed once when `irctc-connect` is installed/updated.
* The package still works for backward compatibility, but it has
* been renamed to `railkit`. This notice guides users to migrate
* without breaking their existing code.
*/
const OLD_PKG = "irctc-connect";
const NEW_PKG = "railkit";
const DOCS_URL = "https://railkit.rajivdubey.dev";
const REPO_URL = "https://github.com/RAJIV81205/RailKit";
const BORDER = "=".repeat(72);
const LINE = "-".repeat(72);
const YELLOW = "\x1b[33m";
const CYAN = "\x1b[36m";
const BOLD = "\x1b[1m";
const RESET = "\x1b[0m";
const lines = [
"",
BORDER,
`${BOLD}${YELLOW} ⚠ DEPRECATION NOTICE${RESET}`,
BORDER,
` The npm package ${BOLD}"${OLD_PKG}"${RESET} has been renamed to ${BOLD}${CYAN}"${NEW_PKG}"${RESET}.`,
"",
` This package will continue to work for now, but it will not`,
` receive new features, bug fixes, or security updates.`,
"",
LINE,
`${BOLD} Migration steps:${RESET}`,
"",
` 1. Uninstall the old package:`,
` ${CYAN}npm uninstall ${OLD_PKG}${RESET}`,
"",
` 2. Install the new package:`,
` ${CYAN}npm install ${NEW_PKG}${RESET}`,
"",
` 3. Update your imports in every file that uses it:`,
` ${CYAN}- import { ... } from "${OLD_PKG}";${RESET}`,
` ${CYAN}+ import { ... } from "${NEW_PKG}";${RESET}`,
"",
LINE,
`${BOLD} Resources:${RESET}`,
` Documentation : ${CYAN}${DOCS_URL}${RESET}`,
` Repository : ${CYAN}${REPO_URL}${RESET}`,
BORDER,
"",
];
// Avoid duplicate output if both preinstall and postinstall fire.
const output = lines.join("\n");
if (process.stdout.isTTY) {
process.stdout.write(output);
} else {
// Strip ANSI codes for non-TTY environments (CI logs, etc.)
// eslint-disable-next-line no-control-regex
process.stdout.write(output.replace(/\x1b\[[0-9;]*m/g, ""));
}