MCPcopy Index your code
hub / github.com/subquery/subql / preparePackage

Function preparePackage

packages/cli/src/controller/init-controller.ts:210–230  ·  view source on GitHub ↗
(projectPath: string, project: ProjectSpecBase)

Source from the content-addressed store, hash-verified

208}
209
210export 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
232export async function prepareManifest(projectPath: string, project: ProjectSpecBase): Promise<void> {
233 //load and write manifest(project.ts/project.yaml)

Callers 3

migrateSubgraphAdapterFunction · 0.90
prepareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected