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

Function prepare

packages/cli/src/controller/init-controller.ts:178–208  ·  view source on GitHub ↗
(
  projectPath: string,
  project: ProjectSpecBase,
  isMultiChainProject = false
)

Source from the content-addressed store, hash-verified

176}
177
178export async function prepare(
179 projectPath: string,
180 project: ProjectSpecBase,
181 isMultiChainProject = false
182): Promise<void> {
183 try {
184 if (!isMultiChainProject) await prepareEnv(projectPath, project);
185 } catch (e) {
186 throw new Error('Failed to prepare read or write .env file while preparing the project');
187 }
188 try {
189 if (!isMultiChainProject) await prepareManifest(projectPath, project);
190 } catch (e) {
191 throw new Error('Failed to prepare read or write manifest while preparing the project');
192 }
193 try {
194 await preparePackage(projectPath, project);
195 } catch (e) {
196 throw new Error('Failed to prepare read or write package.json while preparing the project');
197 }
198 try {
199 await rimraf(`${projectPath}/.git`);
200 } catch (e) {
201 throw new Error('Failed to remove .git from template project');
202 }
203 try {
204 await prepareGitIgnore(projectPath);
205 } catch (e) {
206 throw new Error('Failed to prepare read or write .gitignore while preparing the project');
207 }
208}
209
210export async function preparePackage(projectPath: string, project: ProjectSpecBase): Promise<void> {
211 //load and write package.json

Callers 3

createTestProjectFunction · 0.90
initAdapterFunction · 0.90

Calls 4

prepareEnvFunction · 0.85
prepareManifestFunction · 0.85
preparePackageFunction · 0.85
prepareGitIgnoreFunction · 0.85

Tested by

no test coverage detected