MCPcopy Create free account
hub / github.com/adobe/react-spectrum / loadBuild

Function loadBuild

perf/build.mjs:165–191  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

163}
164
165export async function loadBuild(name) {
166 let dir = buildPath(name);
167 let manifest;
168 try {
169 manifest = JSON.parse(await fs.readFile(path.join(dir, 'manifest.json'), 'utf8'));
170 } catch (error) {
171 if (error.code === 'ENOENT') {
172 throw new Error(
173 `No snapshot named ${name}. Create it with \`yarn perf build --name ${name}\`.`
174 );
175 }
176 throw error;
177 }
178 if (
179 manifest.schema !== 1 ||
180 !manifest.production ||
181 manifest.harnessHash !== (await harnessHash())
182 ) {
183 throw new Error(
184 `Snapshot ${name} uses a different harness or is not a verified production build. Rebuild both snapshots with the current harness.`
185 );
186 }
187 if (manifest.artifactHash !== (await artifactHash(dir))) {
188 throw new Error(`Snapshot ${name} has been modified since it was built.`);
189 }
190 return manifest;
191}

Callers 3

confirmFunction · 0.90
runFunction · 0.90
confirm.test.mjsFile · 0.90

Calls 4

buildPathFunction · 0.85
harnessHashFunction · 0.85
artifactHashFunction · 0.85
parseMethod · 0.45

Tested by

no test coverage detected