Skip to content

fix: pack includes dist + ads-react build order#41

Merged
brenonovelli merged 2 commits into
mainfrom
fix/publish-pack-and-build
Jun 13, 2026
Merged

fix: pack includes dist + ads-react build order#41
brenonovelli merged 2 commits into
mainfrom
fix/publish-pack-and-build

Conversation

@brenonovelli

Copy link
Copy Markdown
Collaborator

Root causes

Bug 1 — ads-core pack-and-publish-ca failed

dist/ is in .gitignore. Without a files field or .npmignore, pnpm pack honors .gitignore and excludes dist/. The tarball sent to CodeArtifact had no built output.

Fix: add files: ["dist", "src", "README.md", "CHANGELOG.md"] to both packages.

Bug 2 — ads-react node-command failed in 13s

DK runs nodeCommands from contextPath (packages/react). When tsup runs with dts: true, TypeScript tries to resolve @vtex/ads-core types from packages/core/dist/esm/index.d.ts — but dist/ doesn't exist because ads-core hasn't been built yet in this isolated context.

Fix: add "prebuild": "pnpm --filter @vtex/ads-core run build" to ads-react scripts. npm/pnpm lifecycle hooks run prebuild automatically before build, so ads-core is built first.

Bonus fix

@swc/core was in dependencies instead of devDependencies. It's a TypeScript compiler used only at build time — it was being installed unnecessarily by consumers of @vtex/ads-core.

Changes

  • packages/core/package.json: add files, move @swc/core to devDeps
  • packages/react/package.json: add files, add prebuild script

Test plan

  • Merge this PR
  • Push tag v0.5.2 (delete and re-create, or use v0.5.3 if preferred)
  • Confirm DK triggers both pipelines → both node-command steps pass
  • Confirm both pack-and-publish-ca steps pass
  • Confirm @vtex/ads-core@0.5.2 and @vtex/ads-react@0.5.2 published to npm

🤖 Generated with Claude Code

brenonovelli and others added 2 commits June 12, 2026 23:35
… fix ads-react build order

Without a `files` field and no `.npmignore`, pnpm pack honors `.gitignore` which
excludes `dist/` — the tarball sent to CodeArtifact was missing the built output.

For ads-react: DK runs nodeCommands from contextPath (packages/react), so
ads-core dist doesn't exist yet when tsup tries to generate .d.ts. A `prebuild`
lifecycle script builds ads-core first.

- Add `files: ["dist", "src", ...]` to both packages so pnpm pack includes dist
- Add `prebuild` to ads-react that builds ads-core before tsup runs
- Move @swc/core from dependencies to devDependencies (it's a build tool, not runtime)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@sonar-workflows

Copy link
Copy Markdown

Failed Quality Gate failed

  • 69 New Issues (is greater than 0)
  • 0.00% Coverage on New Code (is less than 80.00%)
  • 0.00% Security Hotspots Reviewed on New Code (is less than 100.00%)

Project ID: ads-js

View in SonarQube

@brenonovelli brenonovelli merged commit 9027d6b into main Jun 13, 2026
6 of 7 checks passed
@brenonovelli brenonovelli deleted the fix/publish-pack-and-build branch June 13, 2026 02:45
@brenonovelli brenonovelli mentioned this pull request Jun 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant