UNPKG

flowbite-react

Version:

Official React components built for Flowbite and Tailwind CSS

1 lines 1.41 kB
{"version":3,"file":"get-package-json.cjs","sources":["../../../src/cli/utils/get-package-json.ts"],"sourcesContent":["import fs from \"fs/promises\";\nimport cjson from \"comment-json\";\nimport { packageJsonFile } from \"../consts\";\n\nexport interface PackageJson {\n name: string;\n version: string;\n dependencies: Record<string, string>;\n devDependencies: Record<string, string>;\n scripts: Record<string, string>;\n}\n/**\n * Reads and parses the package.json file.\n *\n * This function attempts to read the package.json file specified by `packageJsonFile`, parse its content as JSON,\n * and return the parsed object. If the file cannot be read or parsed, it logs an error message and exits the process.\n *\n * @returns {Promise<any>} A promise that resolves to the parsed package.json object.\n */\nexport async function getPackageJson(): Promise<PackageJson> {\n try {\n return cjson.parse(await fs.readFile(packageJsonFile, \"utf-8\")) as unknown as PackageJson;\n } catch {\n console.error(`Unable to find ${packageJsonFile}.`);\n process.exit(1);\n }\n}\n"],"names":["packageJsonFile"],"mappings":";;;;;;AAIO,eAAe,cAAc,GAAG;AACvC,EAAE,IAAI;AACN,IAAI,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,QAAQ,CAACA,sBAAe,EAAE,OAAO,CAAC,CAAC;AACnE,GAAG,CAAC,MAAM;AACV,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,eAAe,EAAEA,sBAAe,CAAC,CAAC,CAAC,CAAC;AACvD,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACnB;AACA;;;;"}