.nvmrc
The .nvmrc file in the root of the project specifies the node verison that is used. Update this file to the newest version of Node, which will automatically update the node version used by the GitHub action CI scripts found in the ./github directory.
With nmv installed run:
nvm install # installs the latest nvm on your machine if it's not present
nvm use # set it as the default node version You should see output like this:
Now using Node v20.20.0 (npm 10.8.2) ~/.local/share/nvm/v20.20.0/bin/node
The node version is the version specified in .nvmrc, make note of the corresponding npm verison, in this case 10.8.2.
- Updating
package.json
In the root package.json update the engine and volta with the node version you specified and the npm version from above:
"engines": {
"node": "20.20.0",
"npm": "10.8.2"
} "volta": {
"node": "20.20.0",
"npm": "10.8.2"
}- Readme Documentation
Update packages/desktop/README.md and packages/mobile/README.md and any other documentation with your new node version.
- Android Docker File
Open https://hub.docker.com/layers/library/node/20.20.0/ with your node verison. Copy and paste the "Index Digest" text strating with sha256:
Then edit pacakges/mobile/android-environment/Dockerfile
FROM node:20.20.0@sha256:65b74d0fb42134c49530a8c34e9f3e4a2fb8e1f99ac4a0eb4e6f314b426183a2- Change the
nodeversion to the new version - After the
@sign update the digest with the value copied above from the webpage
- If necessary, to support the new version, obtain new
classic-levelbinaries for each platofrm + architecture that are linked against the new nodejs version. This will be needed if there are brekaing changes to then-apithe "node API" used for npm modules with native code in your new nodejs release.classic-levelmight have to be recompiled by hand. Update:
packages/backend-bundle/deps/darwin/universal/classic-level/classic-level.node(NOTE that this is a "Mach-O FAT binary" containing executable code for macOS that can is capable of running on both ARM and Intel macs)packages/backend-bundle/deps/linux/x64/classic-level/classic_level.nodefor Intel based Linux machinespackages/backend-bundle/depswin32/x64/classic-level/classic_level.nodefor Intel based Windows machines. As of this writing Quiet doesn't support ARM based Windows PCs...packages/mobile/nodejs-assets/deps/android/arm64/classic-level/classic_level.nodeThis is the binary for Android devices with 64 bit ARM processors. It won't work on older 32 bit Android ARM processors, aka devices wiht thearmeabi-v7aABI which are still found in the wild. It won't work in android emulators that are running on Intel based hosts, but can run fine on emulators with a 64 bit ARM (such as newer Apple Silicon macs). In order to be submitted in the play store this binary needs to be 16-bit aligned, which happens automatically when you compile it with Android NDK versions 28 and higher.packages/mobile/nodejs-assets/deps/ios/universal/classic-level/classic_level.nodeThis is the iOS binary. It's also technically a Mach-O FAT binary, but currently only supports one architecture which is thearm64one for physical iPhones, but in theory there should be a binary (either seperately or as a FAT binary) supporting thearm64-simulatorarchitecture which will let you run Quiet in the iPhone simulator on Apple Silicon macs...cp -fthe newpackages/mobile/nodejs-assets/deps/ios/universal/classic-level/classic_level.nodefrom the last step topackages/mobile/ios/classic-level.framework/classic-level(overwrite the file here with the.nodefile from the last step but don't include the file extension...)
See packages/mobile/docs/building-classic-level-android.md for help on recompiling classic-level against the headers in nodejs mobile.
- Update the nodejs backend on iOS and Android, if necessary. This is different from the version of nodejs that react native uses. This version of nodejs is used to run custom nodejs modules on these platforms, it's what's used to run the
classic-levelbinary. This only should happen if you had to do the last step...
comming soon...
- Update
nodecommand line flags, if necessary
New versions of add/remove command line flags. If you need to make this change update:
- the various tests in
packages/backend/package.json packages/desktop/src/main/main.tsfor the Desktop electron app- If you had to update the mobile dependencies for
classic-levelin steps 5 and 6, then also update:- Update the args in
pacakges/mobile/android/app/src/main/java/com/quietmobile/Backend/BackendWorker.kt'sfunstartNodeProjectWithArguments packages/mobile/ios/NodeJsMobile/RNNodeJsMobile.m's-(void)callStartNodeProject:(NSString *)input. Note that on iOS this is defined in the variablenodeArguementstwice:
- Update the args in
NSString* dlopenoverridePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithFormat:@"%@/%@", NODEJS_PROJECT_RESOURCE_PATH, NODEJS_DLOPEN_OVERRIDE_FILENAME] ofType:@""];
// Check if the file to override dlopen lookup exists, for loading native modules from the Frameworks.
if(!dlopenoverridePath)
{
nodeArguments = [NSMutableArray arrayWithObjects:
@"node",
@"--experimental-global-customevent",
srcPath,
nil
];
[nodeArguments addObjectsFromArray:args];
} else {
nodeArguments = [NSMutableArray arrayWithObjects:
@"node",
@"--experimental-global-customevent",
@"-r",
dlopenoverridePath,
srcPath,
nil
];
[nodeArguments addObjectsFromArray:args];
- Update
electron
Migrate packages/desktop/package.json to an electron version that ships with the new node verison.
- You can see each major electron release's nodejs here
- Pay careful attention to breaking changes within electron releases. APIs can be removed which will make your project fail to build. But also, and more subtly, the behavior of a certain API may change causing Quiet to build and perhaps seem OK, but something is now behaving differently and/or incorrectly.
- Upgrade the
selenium-webdriverand theelectron-chromedrivermodules inpackages/e2e-tests/package.json.electron-chromedrivershould match the major version ofelectronthat you just migrated to in thedesktoppackage.
- Bootsrap
Run npm run bootstrap and fix whatever just got broken with the new node version.