Skip to content
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

refactor: share fedimint types from @fedimint/types package #277

Merged
merged 3 commits into from
Nov 27, 2023

Conversation

okjodom
Copy link
Collaborator

@okjodom okjodom commented Nov 10, 2023

Adds a dedicated types package for developing fedimint experiences

Closes #201

@okjodom okjodom marked this pull request as ready for review November 13, 2023 15:33
Copy link
Collaborator

@wbobeirne wbobeirne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First time run of the nix mprocs builds failed:

@fedimint/utils:build: src/format.tsx(1,23): error TS2307: Cannot find module '@fedimint/types' or its corresponding type decl
arations.
@fedimint/utils:build: 
@fedimint/utils:build: Error: error occured in dts build
@fedimint/utils:build:     at Worker.<anonymous> (/Users/willo/code/fedimint-ui/node_modules/tsup/dist/index.js:2067:22)
@fedimint/utils:build:     at Worker.emit (node:events:514:28)
@fedimint/utils:build:     at MessagePort.<anonymous> (node:internal/worker:243:53)
@fedimint/utils:build:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:741:20)
@fedimint/utils:build:     at exports.emitMessage (node:internal/per_context/messageport:23:28)
@fedimint/utils:build: DTS Build error
@fedimint/utils:build: Error: Failed to compile. Check the logs above.
@fedimint/utils:build:     at error (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:198:30)
@fedimint/utils:build:     at throwPluginError (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:21718:
12)
@fedimint/utils:build:     at Object.error (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:22672:20)
@fedimint/utils:build:     at Object.error (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:21895:42)
@fedimint/utils:build:     at Object.transform (/Users/willo/code/fedimint-ui/node_modules/tsup/dist/rollup.js:8400:20)
@fedimint/utils:build:     at /Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:22879:40
@fedimint/utils:build: error Command failed with exit code 1.
@fedimint/utils:build: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@fedimint/utils:build: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@fedimint/utils:build: error Command failed with exit code 1.
@fedimint/utils:build: ERROR: command finished with error: command (/Users/willo/code/fedimint-ui/packages/utils) yarn run bui
ld exited (1)
command (/Users/willo/code/fedimint-ui/packages/utils) yarn run build exited (1)

 Tasks:    0 successful, 5 total
Cached:    0 cached, 5 total
  Time:    8.495s 

 ERROR  run failed: command  exited (1)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Likely a dependency chain misconfiguration.

turbo.json Outdated Show resolved Hide resolved
@okjodom
Copy link
Collaborator Author

okjodom commented Nov 15, 2023

Likely a dependency chain misconfigured

is this the case with yarn && yarn mprocs ? Install then build is how I was able to get @fedimint/types to be recognized by @fedimint/utils. Not sure if there is a misconfig anywhere else

@okjodom okjodom changed the title share fedimint types from @fedimint/types package refactor: share fedimint types from @fedimint/types package Nov 20, 2023
Copy link
Collaborator

@wbobeirne wbobeirne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you able to actually run the projects? I'm still getting build errors:

@fedimint/utils:dev: src/format.tsx(1,23): error TS7016: Could not find a declaration file for module '@fedimint/types'. '/Use
rs/willo/code/fedimint-ui/packages/types/dist/index.js' implicitly has an 'any' type.
@fedimint/utils:dev:   Try `npm i --save-dev @types/fedimint__types` if it exists or add a new declaration (.d.ts) file contai
ning `declare module '@fedimint/types';`
@fedimint/utils:dev: 
@fedimint/utils:dev: Error: error occured in dts build
@fedimint/utils:dev:     at Worker.<anonymous> (/Users/willo/code/fedimint-ui/node_modules/tsup/dist/index.js:2067:22)
@fedimint/utils:dev:     at Worker.emit (node:events:514:28)
@fedimint/utils:dev:     at MessagePort.<anonymous> (node:internal/worker:243:53)
@fedimint/utils:dev:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:741:20)
@fedimint/utils:dev:     at exports.emitMessage (node:internal/per_context/messageport:23:28)
@fedimint/utils:dev: DTS Build failed
@fedimint/utils:dev: Error: Failed to compile. Check the logs above.
@fedimint/utils:dev:     at error (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:198:30)
@fedimint/utils:dev:     at throwPluginError (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:21718:12
)
@fedimint/utils:dev:     at Object.error (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:22672:20)
@fedimint/utils:dev:     at Object.error (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:21895:42)
@fedimint/utils:dev:     at Object.transform (/Users/willo/code/fedimint-ui/node_modules/tsup/dist/rollup.js:8400:20)
@fedimint/utils:dev:     at /Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:22879:40
@fedimint/utils:build: src/format.tsx(1,23): error TS7016: Could not find a declaration file for module '@fedimint/types'. '/U
sers/willo/code/fedimint-ui/packages/types/dist/index.js' implicitly has an 'any' type.
@fedimint/utils:build:   Try `npm i --save-dev @types/fedimint__types` if it exists or add a new declaration (.d.ts) file cont
aining `declare module '@fedimint/types';`

A subsequent run gets me:

@fedimint/ui:build: src/Login.tsx(12,32): error TS7016: Could not find a declaration file for module '@fedimint/utils'. '/User
s/willo/code/fedimint-ui/packages/utils/dist/index.js' implicitly has an 'any' type.
@fedimint/ui:build:   Try `npm i --save-dev @types/fedimint__utils` if it exists or add a new declaration (.d.ts) file contain
ing `declare module '@fedimint/utils';`
@fedimint/ui:build: 
@fedimint/ui:build: Error: error occured in dts build
@fedimint/ui:build:     at Worker.<anonymous> (/Users/willo/code/fedimint-ui/node_modules/tsup/dist/index.js:2067:22)
@fedimint/ui:build:     at Worker.emit (node:events:514:28)
@fedimint/ui:build:     at MessagePort.<anonymous> (node:internal/worker:243:53)
@fedimint/ui:build:     at [nodejs.internal.kHybridDispatch] (node:internal/event_target:741:20)
@fedimint/ui:build:     at exports.emitMessage (node:internal/per_context/messageport:23:28)
@fedimint/ui:build: DTS Build error
@fedimint/ui:build: Error: Failed to compile. Check the logs above.
@fedimint/ui:build:     at error (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:198:30)
@fedimint/ui:build:     at throwPluginError (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:21718:12)
@fedimint/ui:build:     at Object.error (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:22672:20)
@fedimint/ui:build:     at Object.error (/Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:21895:42)
@fedimint/ui:build:     at Object.transform (/Users/willo/code/fedimint-ui/node_modules/tsup/dist/rollup.js:8400:20)
@fedimint/ui:build:     at /Users/willo/code/fedimint-ui/node_modules/rollup/dist/shared/rollup.js:22879:40
@fedimint/ui:build: error Command failed with exit code 1.
@fedimint/ui:build: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
@fedimint/ui:build: ERROR: command finished with error: command (/Users/willo/code/fedimint-ui/packages/ui) yarn run build exi
ted (1)

So I think after repeated builds, your dist folders get built out, but it seems it's still a bit of a race condition. I recommend deleting all the dist / build folders before running to replicate.

EDIT: FWIW I'm running just gate or yarn nix-gateway to replicate this, since it runs everything.

@Kodylow
Copy link
Member

Kodylow commented Nov 20, 2023

Yeah i can't build this branch locally, same errors

@okjodom
Copy link
Collaborator Author

okjodom commented Nov 20, 2023

ack. marking draft and debugging

@okjodom okjodom marked this pull request as draft November 20, 2023 18:49
@okjodom okjodom marked this pull request as ready for review November 22, 2023 01:03
@okjodom okjodom requested review from a team as code owners November 22, 2023 01:03
@okjodom
Copy link
Collaborator Author

okjodom commented Nov 22, 2023

@Kodylow, @wbobeirne , turns out parallelism in dev:gateway-ui and dev:guardian-ui is what was causing me pain, and I didn't detect it cause I was testing with turbo build --force to invalidate cache.

cleaning dist and build dirs helped me reproduce what y'all were seeing earlier

Copy link
Collaborator

@wbobeirne wbobeirne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mprocs dev and yarn build now work out of the box, thanks!

@wbobeirne wbobeirne merged commit 8a5ca87 into fedimint:master Nov 27, 2023
1 check passed
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.

Add a package for sharing types between apps
3 participants