Skip to content

Commit

Permalink
chore(esbuild): ensure that output dirs are empty before we run esbui…
Browse files Browse the repository at this point in the history
…ld (#5219)

This adds a call to the fs-extra `emptyDir` before we run the whole
esbuild-based bundle and build step for the `compiler/` and `mock-doc/`
dirs to ensure that there's nothing hanging around from previous builds.
  • Loading branch information
alicewriteswrongs authored Jan 2, 2024
1 parent 59ecd9e commit d4f790f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/esbuild/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export async function buildCompiler(opts: BuildOptions) {
const compilerFileName = 'stencil.js';
const compilerDtsName = compilerFileName.replace('.js', '.d.ts');

// clear out rollup stuff and ensure directory exists
await fs.emptyDir(opts.output.compilerDir);

// create public d.ts
let dts = await fs.readFile(join(inputDir, 'public.d.ts'), 'utf8');
dts = dts.replace('@stencil/core/internal', '../internal/index');
Expand Down
3 changes: 3 additions & 0 deletions scripts/esbuild/mock-doc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ export async function buildMockDoc(opts: BuildOptions) {
const srcDir = join(opts.srcDir, 'mock-doc');
const outputDir = opts.output.mockDocDir;

// clear out rollup stuff and ensure directory exists
await fs.emptyDir(outputDir);

// bundle d.ts
await bundleMockDocDts(opts, inputDir, outputDir);

Expand Down

0 comments on commit d4f790f

Please sign in to comment.