UNPKG

@25sprout/react-starter

Version:

25sprout web starter with React

27 lines (20 loc) 582 B
import fs from 'fs/promises'; async function processPkg(projectPath, options) { const projectName = options.name || 'react-starter'; try { const pkg = await fs.readFile(`${projectPath}/package.json`, { encoding: 'utf8' }); const oldPkg = JSON.parse(pkg); const newPkg = { ...oldPkg, name: projectName, version: '0.1.0', '25sprout': { version: oldPkg.version }, }; await fs.writeFile(`${projectPath}/package.json`, JSON.stringify(newPkg, null, '\t'), { encoding: 'utf8', }); } catch (error) { console.log(error); } } export default processPkg;