( workingDir: string, args: BuildInputs, logger: Logger )
| 23 | const buildOutputs = z.void(); |
| 24 | |
| 25 | export async function buildAdapter( |
| 26 | workingDir: string, |
| 27 | args: BuildInputs, |
| 28 | logger: Logger |
| 29 | ): Promise<z.infer<typeof buildOutputs>> { |
| 30 | const location = resolveToAbsolutePath(path.resolve(workingDir, args.location ?? '')); |
| 31 | assert(existsSync(location), 'Argument `location` is not a valid directory or file'); |
| 32 | |
| 33 | const directory = lstatSync(location).isDirectory() ? location : path.dirname(location); |
| 34 | |
| 35 | await buildTsManifest(location, logger.info.bind(logger)); |
| 36 | |
| 37 | // Check that this is a SubQuery project |
| 38 | const projectSearch = path.resolve( |
| 39 | directory, |
| 40 | `./{project*.{yaml,yml},subquery-multichain.yaml${directory !== location ? `,${path.basename(location)}` : ''}}` |
| 41 | ); |
| 42 | const manifests = await glob(projectSearch, {windowsPathsNoEscape: true}); |
| 43 | if (!manifests.length) { |
| 44 | throw new Error( |
| 45 | 'This is not a SubQuery project, please make sure you run this in the root of your project directory.' |
| 46 | ); |
| 47 | } |
| 48 | |
| 49 | const buildEntries = getBuildEntries(directory, logger); |
| 50 | const outputDir = path.resolve(directory, args.output); |
| 51 | |
| 52 | await runBundle(buildEntries, directory, outputDir, false, true, logger); |
| 53 | } |
| 54 | |
| 55 | export default class Build extends Command { |
| 56 | static description = 'Build this SubQuery project code into a bundle'; |
no test coverage detected