-
Notifications
You must be signed in to change notification settings - Fork 397
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
[Feature] Document the monorepo architecture, build process and dependencies #6418
Comments
Hi! Thanks for raising this issue about building OneKey in Ubuntu. Let me explain the build system and address your specific questions: The monorepo uses Yarn workspaces to manage multiple apps (desktop, extension, mobile, web) and shared packages. For building in Ubuntu, you'll need: # Install prerequisites
sudo apt-get install -y git curl build-essential python3 libusb-1.0-0-dev libudev-dev
# Setup Node.js 20+ and Yarn
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs
corepack enable && corepack prepare [email protected] --activate
# Build steps
git clone https://github.com/OneKeyHQ/app-monorepo.git
cd app-monorepo
yarn install
yarn workspace @onekeyhq/ext build:v3 # Chrome extension
yarn workspace @onekeyhq/desktop build # Desktop app About your specific questions:
Common issues:
The build process works offline after initial setup since all dependencies are managed through yarn.lock. Let me know if you run into any specific issues! |
Actually, we haven't tested whether it compiles successfully in Docker. If you run into issues there, you'll need to address them based on the specific errors you get. |
Thanks for a quick reply and sharing more context. I actually am already
able to successfully build in a container (reproducible build code at
x...ottok:onekey-app-monorepo:build-audit).
Exact steps how to build is visible in the OneKey CI scripts, so I mainly
read them to reproduce the steps. I was however not able to spot inline
comments or a README explaining why the build steps are what they are.
My question was more about understanding what the architecture is and *why*
it is so. It is much easier to contribute improvements if one grasps the
design decisions of the original authors.
|
Hi, thanks a lot for your submission! Here's the design background of our monorepo. Feel free to discuss any questions you might have at any time. We use a monorepo + workspaces because it lets us share critical crypto/blockchain code across platforms while keeping platform-specific stuff separate. This means:
The build system complexity comes from needing to support multiple platforms while ensuring consistent behavior for all developers. Each workspace can build independently, making it faster to test changes. |
I have been trying to reproduce the build of OneKey. My goal is to build the Chrome extension and the Electron app in a clean Debian/Ubuntu container. However, I find it challenging to understand the build process. Could you please create a BUILD.md that explains things such as:
There are many oddities that are hard to understand. Why for example do you need
rimraf
to delete files, why isn't a regularrm -rf
enough? Why is there a zip.js wrapper, why not callzip
directly? What is the purpose ofcross-env
?I have documented some things I've uncovered so far in x...ottok:onekey-app-monorepo:build-audit, but understanding the repository structure by purely reading the build files seems overly complex, so I was hoping maybe you can produce some documentation on the topic. Thanks!
The text was updated successfully, but these errors were encountered: