[replace] [m]: create main file to replace content
This commit is contained in:
parent
84d341a91f
commit
814f091131
21
packages/create-portal-app/helpers/replace.js
Normal file
21
packages/create-portal-app/helpers/replace.js
Normal file
@ -0,0 +1,21 @@
|
||||
const fs = require('fs');
|
||||
const path = require("path");
|
||||
const {parserPath } = require('./copy')
|
||||
function _replacePackage(projectName){
|
||||
const appPath = parserPath(projectName)
|
||||
const packagePath = `${appPath}/package.json`
|
||||
const data = JSON.parse(fs.readFileSync(packagePath, 'utf8'))
|
||||
data.name = projectName
|
||||
delete data.homepage
|
||||
|
||||
fs.writeFileSync(packagePath, JSON.stringify(data, null, 2))
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
function replaceContent(projectName){
|
||||
_replacePackage(projectName)
|
||||
}
|
||||
|
||||
module.exports = replaceContent
|
||||
Loading…
x
Reference in New Issue
Block a user