-
Notifications
You must be signed in to change notification settings - Fork 180
feat: modernize sdk/qrcode build pipeline #872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
transphorm
merged 15 commits into
dev
from
codex/implement-advanced-tsup-and-post-build-processing
Aug 11, 2025
Merged
Changes from 13 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
5f3a975
Modernize qrcode build
transphorm d1978d2
chore(qrcode): add lint helpers
transphorm 2182177
Merge branch 'dev' into codex/implement-advanced-tsup-and-post-build-…
transphorm ee4c976
fix sdk qrcode
transphorm 1b5e80a
add new qrcode ci
transphorm 32f4bcb
fix formatting
transphorm 2b15338
qrcode fixes
transphorm 656a2b2
Merge branch 'dev' into codex/implement-advanced-tsup-and-post-build-…
transphorm ba41650
fixes
transphorm 3b7f872
fixes rd2
transphorm 6485168
enable corepack
transphorm cf277bc
enable corepack
transphorm 1491fc8
build caching
transphorm 0a29fe3
update caching
transphorm dfcea82
cr feedback
transphorm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,269 @@ | ||
| name: QRCode SDK CI | ||
|
|
||
| env: | ||
| # Build environment versions | ||
| NODE_VERSION: 22 | ||
| # Cache versioning - increment these to bust caches when needed | ||
| GH_CACHE_VERSION: v1 # Global cache version | ||
| GH_YARN_CACHE_VERSION: v1 # Yarn-specific cache version | ||
| GH_SDK_CACHE_VERSION: v1 # SDK build cache version | ||
|
|
||
| on: | ||
| pull_request: | ||
| paths: | ||
| - "sdk/qrcode/**" | ||
| - "common/**" | ||
| - ".github/workflows/qrcode-sdk-ci.yml" | ||
| - ".github/actions/**" | ||
| push: | ||
| branches: [main, develop] | ||
| paths: | ||
| - "sdk/qrcode/**" | ||
| - "common/**" | ||
|
|
||
| jobs: | ||
| # Build dependencies once and cache for other jobs | ||
| build: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Use Node.js ${{ env.NODE_VERSION }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'yarn' | ||
|
|
||
| - name: Enable Corepack | ||
| run: corepack enable | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| id: yarn-cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| sdk/qrcode/node_modules | ||
| common/node_modules | ||
| key: ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ hashFiles('yarn.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn- | ||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Build dependencies | ||
| shell: bash | ||
| run: | | ||
| yarn workspace @selfxyz/common build | ||
| yarn workspace @selfxyz/qrcode build | ||
| - name: Cache build artifacts | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| path: | | ||
| common/dist | ||
| sdk/qrcode/dist | ||
| node_modules | ||
| sdk/qrcode/node_modules | ||
| common/node_modules | ||
| key: qrcode-sdk-build-${{ github.sha }} | ||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # Quality checks job | ||
| quality-checks: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Use Node.js ${{ env.NODE_VERSION }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'yarn' | ||
|
|
||
| - name: Enable Corepack | ||
| run: corepack enable | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| id: yarn-cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| sdk/qrcode/node_modules | ||
| common/node_modules | ||
| key: ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ hashFiles('yarn.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn- | ||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Restore build artifacts | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: | | ||
| common/dist | ||
| sdk/qrcode/dist | ||
| node_modules | ||
| sdk/qrcode/node_modules | ||
| common/node_modules | ||
| key: qrcode-sdk-build-${{ github.sha }} | ||
| fail-on-cache-miss: true | ||
|
|
||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| - name: Run linter | ||
| run: yarn workspace @selfxyz/qrcode lint:imports:check | ||
|
|
||
| - name: Check Prettier formatting | ||
| run: yarn workspace @selfxyz/qrcode lint | ||
|
|
||
| - name: Type checking | ||
| run: yarn workspace @selfxyz/qrcode types | ||
|
|
||
| - name: Log cache status | ||
| run: | | ||
| echo "Cache hit results:" | ||
| echo "- Yarn cache hit: ${{ steps.yarn-cache.outputs.cache-hit }}" | ||
| # Build verification job | ||
| build-verification: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Use Node.js ${{ env.NODE_VERSION }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'yarn' | ||
|
|
||
| - name: Enable Corepack | ||
| run: corepack enable | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| id: yarn-cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| sdk/qrcode/node_modules | ||
| common/node_modules | ||
| key: ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ hashFiles('yarn.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn- | ||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Restore build artifacts | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: | | ||
| common/dist | ||
| sdk/qrcode/dist | ||
| node_modules | ||
| sdk/qrcode/node_modules | ||
| common/node_modules | ||
| key: qrcode-sdk-build-${{ github.sha }} | ||
| fail-on-cache-miss: true | ||
|
|
||
| - name: Verify build output | ||
| run: | | ||
| echo "Checking build output structure..." | ||
| ls -la sdk/qrcode/dist/ | ||
| echo "Checking ESM build..." | ||
| ls -la sdk/qrcode/dist/esm/ | ||
| echo "Checking CJS build..." | ||
| ls -la sdk/qrcode/dist/cjs/ | ||
| echo "Checking type definitions..." | ||
| if ! find sdk/qrcode/dist/esm -maxdepth 1 -name '*.d.ts' | grep -q .; then | ||
| echo "No .d.ts files found in dist/esm"; exit 1; | ||
| fi | ||
| find sdk/qrcode/dist/esm -maxdepth 1 -name '*.d.ts' -ls | ||
| - name: Test package exports | ||
| run: | | ||
| echo "Testing package exports..." | ||
| node -e " | ||
| const pkg = require('./sdk/qrcode/package.json'); | ||
| console.log('Package exports:', JSON.stringify(pkg.exports, null, 2)); | ||
| " | ||
| - name: Verify bundle size | ||
| run: yarn workspace @selfxyz/qrcode size-limit | ||
|
|
||
| - name: Log cache status | ||
| run: | | ||
| echo "Cache hit results:" | ||
| echo "- Yarn cache hit: ${{ steps.yarn-cache.outputs.cache-hit }}" | ||
| # Integration test job | ||
| integration-test: | ||
| runs-on: ubuntu-latest | ||
| needs: build | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Use Node.js ${{ env.NODE_VERSION }} | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: ${{ env.NODE_VERSION }} | ||
| cache: 'yarn' | ||
|
|
||
| - name: Enable Corepack | ||
| run: corepack enable | ||
|
|
||
| - name: Cache Yarn dependencies | ||
| id: yarn-cache | ||
| uses: actions/cache@v4 | ||
| with: | ||
| path: | | ||
| .yarn/cache | ||
| node_modules | ||
| sdk/qrcode/node_modules | ||
| common/node_modules | ||
| key: ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn-${{ hashFiles('yarn.lock') }} | ||
| restore-keys: | | ||
| ${{ runner.os }}-node${{ env.NODE_VERSION }}-yarn- | ||
| - name: Install Dependencies | ||
| uses: ./.github/actions/yarn-install | ||
|
|
||
| - name: Restore build artifacts | ||
| uses: actions/cache/restore@v4 | ||
| with: | ||
| path: | | ||
| common/dist | ||
| sdk/qrcode/dist | ||
| node_modules | ||
| sdk/qrcode/node_modules | ||
| common/node_modules | ||
| key: qrcode-sdk-build-${{ github.sha }} | ||
| fail-on-cache-miss: true | ||
|
|
||
| - name: Run tests | ||
| run: yarn workspace @selfxyz/qrcode test | ||
|
|
||
| - name: Test package import | ||
| run: | | ||
| echo "Testing package import..." | ||
| node -e " | ||
| try { | ||
| const { SelfQRcode, SelfQRcodeWrapper, countries } = require('./sdk/qrcode/dist/cjs/index.cjs'); | ||
| console.log('✅ Package import successful'); | ||
| console.log('Exported components:', Object.keys({ SelfQRcode, SelfQRcodeWrapper, countries })); | ||
| } catch (error) { | ||
| console.error('❌ Package import failed:', error.message); | ||
| process.exit(1); | ||
| } | ||
| " | ||
| - name: Log cache status | ||
| run: | | ||
| echo "Cache hit results:" | ||
| echo "- Yarn cache hit: ${{ steps.yarn-cache.outputs.cache-hit }}" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -86,9 +86,11 @@ const SuccessScreen: React.FC = () => { | |
| if (isFocused && !countdownStarted && selfApp?.deeplinkCallback) { | ||
| if (selfApp?.deeplinkCallback) { | ||
| try { | ||
| new URL(selfApp.deeplinkCallback); | ||
| setCountdown(5); | ||
| setCountdownStarted(true); | ||
| const url = new URL(selfApp.deeplinkCallback); | ||
| if (url) { | ||
| setCountdown(5); | ||
| setCountdownStarted(true); | ||
| } | ||
|
Comment on lines
+89
to
+93
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Validate protocol and avoid redundant if (url); store validated URL for use on redirect.
Apply: - const url = new URL(selfApp.deeplinkCallback);
- if (url) {
- setCountdown(5);
- setCountdownStarted(true);
- }
+ const url = new URL(selfApp.deeplinkCallback);
+ const allowedProtocols = new Set(['https:', 'http:', 'self:']); // adjust as needed
+ if (allowedProtocols.has(url.protocol)) {
+ setCountdown(5);
+ setCountdownStarted(true);
+ setValidatedDeeplink(url.toString());
+ } else {
+ console.warn('Unsupported deep link protocol:', url.protocol);
+ }Also update outside this hunk:
const [validatedDeeplink, setValidatedDeeplink] = useState<string | null>(null);
if (validatedDeeplink) {
Linking.openURL(validatedDeeplink).catch(err => { /* ... */ });
}
deeplinkCallback={validatedDeeplink?.replace(/^https?:\/\//, '')}🤖 Prompt for AI Agents |
||
| } catch (error) { | ||
| console.warn( | ||
| 'Invalid deep link URL provided:', | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.