create-app-setup
Version:
A CLI tool to quickly set up frontend & backend projects with various frameworks.
25 lines (24 loc) • 977 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs_1 = __importDefault(require("fs"));
const path_1 = __importDefault(require("path"));
const gitignoreConfig = ({ path: sourcePath }) => {
// Define the destination path (.gitignore in the same directory)
const destinationPath = path_1.default.join(path_1.default.dirname(sourcePath), ".gitignore");
try {
// Check if the source file exists
if (!fs_1.default.existsSync(sourcePath)) {
console.error(`❌ Error: File not found at ${sourcePath}`);
return;
}
// Rename (move) the file to .gitignore
fs_1.default.renameSync(sourcePath, destinationPath);
}
catch (error) {
console.error("❌ Error renaming file:", error);
}
};
exports.default = gitignoreConfig;
;