MCPcopy Index your code
hub / github.com/developit/microbundle / buildDirectory

Function buildDirectory

tools/build-fixture.js:43–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

41};
42
43export const buildDirectory = async fixtureDir => {
44 let fixturePath = resolve(FIXTURES_DIR, fixtureDir);
45 if (fixtureDir.endsWith('-with-cwd')) {
46 fixturePath = resolve(fixturePath, fixtureDir.replace('-with-cwd', ''));
47 }
48
49 const dist = resolve(`${fixturePath}/dist`);
50 // clean up
51 await rimraf(dist);
52 if (!fixturePath.endsWith('ts-custom-declaration')) {
53 await rimraf(resolve(`${fixturePath}/types`));
54 }
55 await rimraf(resolve(`${fixturePath}/.rts2_cache_cjs`));
56 await rimraf(resolve(`${fixturePath}/.rts2_cache_es`));
57 await rimraf(resolve(`${fixturePath}/.rts2_cache_umd`));
58
59 const script = await getBuildScript(fixturePath, DEFAULT_SCRIPT);
60
61 const prevDir = process.cwd();
62 process.chdir(resolve(fixturePath));
63
64 const parsedOpts = parseScript(script);
65 let { output } = await microbundle({
66 ...parsedOpts,
67 cwd: parsedOpts.cwd !== '.' ? parsedOpts.cwd : resolve(fixturePath),
68 });
69 output = output || '';
70
71 process.chdir(prevDir);
72
73 return output;
74};

Callers 2

index.test.jsFile · 0.90

Calls 2

getBuildScriptFunction · 0.85
microbundleFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…