UNPKG

@reliverse/rse-sdk

Version:

@reliverse/rse-sdk allows you to create new plugins for @reliverse/rse CLI, interact with reliverse.org, and even extend your own CLI functionality (you may also try @reliverse/dler-sdk for this case).

24 lines (23 loc) 937 B
import path from "@reliverse/pathkit"; import fs from "@reliverse/relifso"; import { relinka } from "@reliverse/relinka"; import { definePackageJSON, writePackageJSON } from "pkg-types"; export async function createPackageJSON(projectPath, projectName, isLib) { const packageJson = definePackageJSON({ name: projectName, version: "0.1.0", description: `${projectName} is built with \u2764\uFE0F by @rse`, type: "module", ...isLib ? {} : { private: true } }); const filename = "package.json"; const packageJsonPath = path.join(projectPath, filename); await writePackageJSON(packageJsonPath, packageJson); const content = await fs.readFile(packageJsonPath, "utf-8"); const formatted = JSON.stringify(JSON.parse(content), null, 2); await fs.writeFile(packageJsonPath, formatted, "utf-8"); relinka( "verbose", `Created ${filename} with ${isLib ? "library" : "application"} configuration` ); }