Skip to content

fix: load dotenv inside figma-sync main to avoid top-level await - #2016

Open
raskara-LD wants to merge 2 commits into
mainfrom
raskara/fix/sync-icons-failures
Open

fix: load dotenv inside figma-sync main to avoid top-level await#2016
raskara-LD wants to merge 2 commits into
mainfrom
raskara/fix/sync-icons-failures

Conversation

@raskara-LD

@raskara-LD raskara-LD commented Aug 24, 2026

Copy link
Copy Markdown

Summary

  • tsx compiles packages/icons/scripts/figma-sync.ts as CommonJS (the icons package has no "type": "module"), which cannot emit top-level await.
  • After refactor: fix oxlint findings instead of suppressing them #1976, optional dotenv loading used await import('dotenv') at module scope, so @launchpad-ui/icons:sync failed in CI with Top-level await is currently not supported with the "cjs" output format.
  • Load dotenv inside an async helper awaited from main() instead of using top-level await.

Screenshots (if appropriate):

N/A

Testing approaches

DRY_RUN=1 pnpm nx run @launchpad-ui/icons:sync shows Missing FIGMA_ACCESS_TOKEN and did not fail during compile time anymore.


Note

Overview
Fixes @launchpad-ui/icons:sync failing under tsx when optional dotenv loading used top-level await, which CommonJS output cannot emit for this package.

Optional .env loading is moved into loadOptionalDotenv(), awaited from main() before reading FIGMA_ACCESS_TOKEN, DRY_RUN, and FORCE_SYNC. Token validation and process.exit(1) run after dotenv so local env files still apply.

Adds an empty changeset stub (.changeset/some-nights-film.md).

Reviewed by Cursor Bugbot for commit 6c5433e. Bugbot is set up for automated code reviews on this repo. Configure here.

@raskara-LD
raskara-LD requested review from a team as code owners August 24, 2026 22:08
@changeset-bot

changeset-bot Bot commented Aug 24, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6c5433e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 0 packages

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 24, 2026

Copy link
Copy Markdown
yarn add https://pkg.pr.new/@launchpad-ui/components@2016.tgz
yarn add https://pkg.pr.new/@launchpad-ui/icons@2016.tgz
yarn add https://pkg.pr.new/@launchpad-ui/tokens@2016.tgz

commit: 6c5433e

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