UNPKG

@expressots/cli

Version:

Expressots CLI - modern, fast, lightweight nodejs web framework (@cli)

18 lines (17 loc) 865 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.changePackageName = void 0; const node_fs_1 = __importDefault(require("node:fs")); const node_path_1 = __importDefault(require("node:path")); function changePackageName({ directory, name, }) { const absDirPath = node_path_1.default.resolve(directory); const packageJsonPath = node_path_1.default.join(absDirPath, "package.json"); const fileContents = node_fs_1.default.readFileSync(packageJsonPath, "utf-8"); const packageJson = JSON.parse(fileContents); packageJson.name = name; node_fs_1.default.writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2)); } exports.changePackageName = changePackageName;