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

bug: Project structure is a mess #901

Open
cyberluke opened this issue Jan 8, 2025 · 9 comments
Open

bug: Project structure is a mess #901

cyberluke opened this issue Jan 8, 2025 · 9 comments

Comments

@cyberluke
Copy link

Where do you have dev guidelines?

Because of two level nested structure, I cannot import specific package:

"@logto/js": "git+https://github.com/logto-io/js.git#a0f91a3acf84c34eac6fa5b89348896a8ea2bfe4:packages/js",
"@logto/client": "git+https://github.com/logto-io/js.git#a0f91a3acf84c34eac6fa5b89348896a8ea2bfe4:packages/client",
"@logto/node": "git+https://github.com/logto-io/js.git#a0f91a3acf84c34eac6fa5b89348896a8ea2bfe4:packages/node",
"@logto/express": "git+https://github.com/logto-io/js.git#a0f91a3acf84c34eac6fa5b89348896a8ea2bfe4:packages/express",

Only @logto/express": "git+https://github.com/logto-io/js.git#a0f91a3acf84c34eac6fa5b89348896a8ea2bfe4:packages works

How do you test it in some 3rd party integration package when developing?

@cyberluke cyberluke added the bug Something isn't working label Jan 8, 2025
@charIeszhao
Copy link
Member

Hi, can you let us know what you are trying to do?

I don't quite get the "two level nested structure". The whole JS SDK repo is a "PNPM monorepo".
Refer to docs for more info: https://pnpm.io/workspaces

@charIeszhao
Copy link
Member

charIeszhao commented Jan 8, 2025

If you want examples of integrating with 3rd party frameworks / libraries. You can check our sample projects.

For example:
https://github.com/logto-io/js/tree/master/packages/react-sample

All sample links can be found here:
https://github.com/logto-io/js/tree/master?tab=readme-ov-file#samples

@charIeszhao charIeszhao removed the bug Something isn't working label Jan 8, 2025
@cyberluke
Copy link
Author

    "@logto/js": "git+https://github.com/logto-io/js.git#a0f91a3acf84c34eac6fa5b89348896a8ea2bfe4:packages/js",
    "@logto/client": "git+https://github.com/logto-io/js.git#a0f91a3acf84c34eac6fa5b89348896a8ea2bfe4:packages/client",
    "@logto/node": "git+https://github.com/logto-io/js.git#a0f91a3acf84c34eac6fa5b89348896a8ea2bfe4:packages/node",
    "@logto/express": "git+https://github.com/logto-io/js.git#a0f91a3acf84c34eac6fa5b89348896a8ea2bfe4:packages/express",

I tried to reference it in my dev app package.json like this

pnpm can resolve subdirectory, but not nested subdirectories (packages is ok, but packages/js not)

I want to use your master branch with new features.

@cyberluke
Copy link
Author

cyberluke commented Jan 8, 2025

in your sample you reference it as workspace:

"dependencies": {
    "@logto/express": "workspace:^",
    "cookie-parser": "^1.4.6",
    "express": "^4.20.0",
    "express-session": "^1.17.3"
  }

but my workspace is different, actually I use bun not pnpm in my dev app

@cyberluke
Copy link
Author

bun supports also workspaces: https://bun.sh/docs/install/workspaces

maybe I'm doing something wrong, I'm new to workspaces

(I tried cloning repo locally and reference it using file:/ but because you use workspace ref, it fails as well)

thank you

@cyberluke
Copy link
Author

even I create bun-workspace.yml and reference your packages:

packages:
  - '/home/runner/workspace/logto/js/packages/js'
  - '/home/runner/workspace/logto/js/packages/client'
  - '/home/runner/workspace/logto/js/packages/node'
  - '/home/runner/workspace/logto/js/packages/express'

it fails with:

Workspace dependency "@logto/js" not found

Searched in "./logto/js/packages/client/^"

because you reference it using workspace:^

DeepSeek advices to rewrite your packages.json to not use ^ syntax

@cyberluke
Copy link
Author

cyberluke commented Jan 8, 2025

replacing workspace:^ with file:../js solved that, but it seems it is not possible to use your repo when testing/developing locally and integrating in 3rd party dev app by default

@charIeszhao
Copy link
Member

OK, I see what you want to do. But our repo is not initially designed for users who want to use our master code. Since the master code may not be stable at times and may even include breaking changes sometimes, it's really not recommended to directly use it.

Is there any specific reason you want to use master code instead of published versions? We don't actually have any unpublished features at the moment, I believe. And you can always contact us if there's a feature in master code you want to use but not published yet.

Finally, if you still want to keep using our master code, the easiest way I can think of is to clone/fork the monorepo, and making your own testing/developing app as a subpackage in it. Then you can use pnpm and the workspace protocol, too. Is this an option for you to ditch bun and use pnpm instead?

@cyberluke
Copy link
Author

cyberluke commented Jan 22, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants