(projectPath: string, project: ProjectSpecBase)
| 208 | } |
| 209 | |
| 210 | export async function preparePackage(projectPath: string, project: ProjectSpecBase): Promise<void> { |
| 211 | //load and write package.json |
| 212 | const packageData = await fs.promises.readFile(`${projectPath}/package.json`); |
| 213 | const currentPackage = JSON.parse(packageData.toString()); |
| 214 | currentPackage.name = project.name; |
| 215 | currentPackage.description = project.description ?? currentPackage.description; |
| 216 | currentPackage.author = project.author; |
| 217 | //add build and develop scripts |
| 218 | currentPackage.scripts = { |
| 219 | ...currentPackage.scripts, |
| 220 | build: 'subql codegen && subql build', |
| 221 | 'build:develop': 'NODE_ENV=develop subql codegen && NODE_ENV=develop subql build', |
| 222 | }; |
| 223 | //add dotenv package for env file support |
| 224 | currentPackage.devDependencies = { |
| 225 | ...currentPackage.devDependencies, |
| 226 | dotenv: 'latest', |
| 227 | }; |
| 228 | const newPackage = JSON.stringify(currentPackage, null, 2); |
| 229 | await fs.promises.writeFile(`${projectPath}/package.json`, newPackage, 'utf8'); |
| 230 | } |
| 231 | |
| 232 | export async function prepareManifest(projectPath: string, project: ProjectSpecBase): Promise<void> { |
| 233 | //load and write manifest(project.ts/project.yaml) |
no outgoing calls
no test coverage detected