-
Notifications
You must be signed in to change notification settings - Fork 180
feat: modernize circuits build pipeline #876
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 6 commits into
dev
from
codex/add-circuits-build-configuration-and-scripts
Aug 11, 2025
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c17d874
Add tsup build for circuits
transphorm b5f8068
sort package.json
transphorm 22ecf49
cr feedback
transphorm fe9717f
circuits fixes
transphorm 320cd4f
Merge branch 'dev' into codex/add-circuits-build-configuration-and-sc…
transphorm b5540ab
fixes
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
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,44 @@ | ||
| import { writeFileSync, mkdirSync, readFileSync } from 'node:fs'; | ||
| import path from 'node:path'; | ||
| import { fileURLToPath } from 'node:url'; | ||
| import { shimConfigs } from './shimConfigs.js'; | ||
|
|
||
| const __dirname = path.dirname(fileURLToPath(import.meta.url)); | ||
| const DIST = path.resolve(__dirname, '..', 'dist'); | ||
|
|
||
| // Read package version | ||
| const packageJsonPath = path.resolve(__dirname, '..', 'package.json'); | ||
| const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8')); | ||
|
|
||
| writeFileSync(path.join(DIST, 'esm', 'package.json'), JSON.stringify({ type: 'module' }, null, 4)); | ||
| writeFileSync( | ||
| path.join(DIST, 'cjs', 'package.json'), | ||
| JSON.stringify({ type: 'commonjs' }, null, 4) | ||
| ); | ||
|
|
||
| // Create dist package.json for Metro | ||
| const distPackageJson = { | ||
| name: '@selfxyz/circuits', | ||
| version: packageJson.version, | ||
| type: 'module', | ||
| exports: { | ||
| '.': './esm/index.js', | ||
| }, | ||
| }; | ||
| writeFileSync(path.join(DIST, 'package.json'), JSON.stringify(distPackageJson, null, 4)); | ||
|
|
||
coderabbitai[bot] marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| function createShim(shimPath, targetPath) { | ||
| const shimDir = path.join(DIST, shimPath); | ||
| mkdirSync(shimDir, { recursive: true }); | ||
| const cjsTargetPath = targetPath.replace('/esm/', '/cjs/').replace('.js', '.cjs'); | ||
| writeFileSync( | ||
| path.join(shimDir, 'index.js'), | ||
| `// Shim file for @selfxyz/circuits/${shimPath}\nmodule.exports = require('${cjsTargetPath}');` | ||
| ); | ||
| writeFileSync( | ||
| path.join(shimDir, 'index.d.ts'), | ||
| `// Shim file for @selfxyz/circuits/${shimPath} types\nexport * from '${targetPath.replace('.js', '')}';` | ||
| ); | ||
| } | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| shimConfigs.forEach((config) => createShim(config.shimPath, config.targetPath)); | ||
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,2 @@ | ||
| // Shim configurations for @selfxyz/circuits | ||
| export const shimConfigs = []; |
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 @@ | ||
| export {}; | ||
transphorm marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
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,10 @@ | ||
| { | ||
| "extends": "./tsconfig.json", | ||
| "compilerOptions": { | ||
| "module": "CommonJS", | ||
| "moduleResolution": "Node", | ||
| "outDir": "./dist/cjs", | ||
| "declarationDir": "./dist/cjs", | ||
| "esModuleInterop": true | ||
| } | ||
| } |
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 |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import path from 'path'; | ||
| import { defineConfig } from 'tsup'; | ||
| import { fileURLToPath } from 'url'; | ||
|
|
||
| const __filename = fileURLToPath(import.meta.url); | ||
| const __dirname = path.dirname(__filename); | ||
|
|
||
| const entry = { | ||
| index: 'src/index.ts', | ||
| }; | ||
|
|
||
| export default defineConfig([ | ||
| { | ||
| tsconfig: './tsconfig.json', | ||
| entry, | ||
| format: ['esm'], | ||
| outDir: path.resolve(__dirname, 'dist/esm'), | ||
| dts: false, | ||
| splitting: false, | ||
| clean: true, | ||
| sourcemap: true, | ||
| target: 'es2020', | ||
| }, | ||
| { | ||
| tsconfig: './tsconfig.cjs.json', | ||
| entry, | ||
| format: ['cjs'], | ||
| outDir: path.resolve(__dirname, 'dist/cjs'), | ||
| dts: false, | ||
| splitting: false, | ||
| clean: false, | ||
| sourcemap: true, | ||
| target: 'es2020', | ||
| }, | ||
| ]); |
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.
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.