Build a Compass dist how?

I can build Compass from source and run it with npm install and npm start.
How do I create a dist that I can run without recompilation each time?
(Or is the typical dist doing some of this recompiling behind the scenes when it runs?)

Hey @Jack_Woehr! You can find this and more info about how to work with Compass monorepo locally in the contributing doc that is part of the source on GitHub.

Running Compass locally in dev mode and building it for distribution is not the same. The most basic way of building Compass locally is to run npm run package-compass from the root of the monorepo. There are additional parameters that can be passed through the environmental variables during the build that are documented in the “Building Compass Locally” section of the doc.

We don’t really see many people trying to build it locally and as developers who work on Compass day to day we don’t set up our working environments from scratch every day so you might run into some issues while following the instructions there so please feel free to try this command and tell us if everything works well for you and we can try to assist if it doesn’t (although I think if you are able to run the app locally already, it all should go smoothly)

1 Like

Hi @Sergey_Petushkov , thanks for your response. says, HADRON_SKIP_INSTALLER=true npm run test-package-compass but there’s no such script, did they possibly confuse test-packages-publish with package-compass?

I just tried package-compass but it errored out. I’m going to try with debugging now.

Thanks, @Sergey_Petushkov , I was able to build a release. The failure before was my mistake, each morning I have to remember to do nvm use 14.17.5 to build Compass :slight_smile:

One question … when I run packages/compass/dist/MongoDB\ Compass\ Dev-linux-x64/MongoDB\ Compass\ Dev it doesn’t find the connections I created using previous builds. Do various versions disregard previous versions’ settings?

Hey, where’s the fun in Open Source if you can’t build it yourself? :slight_smile:
Seriously, if I’m interested in a body of code I like to explore it. MongoDB is interesting … I’m coming up on 2 years with MongoDB now.

We are definitely not trying to stop people from doing that, just a warning that some issues might occur during that process, like some slight doc inconsistencies :smile:

And thanks for catching these inconsistencies in the docs by the way! This particular test-package-compass command was indeed removed awhile ago, but we forgot to remove it from the contributing section, you can safely substitute it for package-compass in this example

1 Like

Thanks again for your help, Sergey. As noted, I was able to build a release. I am curious though why the newly-build Compass doesn’t pick up favorites from my previous sessions.

Hmmm, if you built it with exactly the same configuration (i.e. no env vars were used to change app name), it should indeed be able to pick them up. I might need some time to try to reproduce on a linux machine as it doesn’t happen for me on macos.

In the meantime I think what you can check is if you have those connections stored on disk actually. When you run your locally built version of Compass, if you open devtools and run following code in the console


this should give you a full path to where the connections will be eventually stored. Can you check that this dir exists, and there is a Connections dir in it containing files of the previous connections that you expect to see?

1 Like

Thanks again, @Sergey_Petushkov … mystery solved. It created a new subdirectory /home/jwoehr/.config/MongoDB Compass Dev sibling to my other .config subdirectory /home/jwoehr/.config/MongoDB Compass Dev Local created by running Compass via npm start.

Hmm, interesting, a lot of the files built in compass/packages/compass/dist/MongoDB\ Compass\ Dev-linux-x64/ are built with a date of Jan 1, 1980:

$ ls -l compass/packages/compass/dist/MongoDB\ Compass\ Dev-linux-x64/
total 184572
-rw-r--r-- 1 jwoehr jwoehr    141930 Jan  1  1980  chrome_100_percent.pak
-rw-r--r-- 1 jwoehr jwoehr    208519 Jan  1  1980  chrome_200_percent.pak
-rwxr-xr-x 1 jwoehr jwoehr     50656 Jan  1  1980  chrome-sandbox
-rw-r--r-- 1 jwoehr jwoehr  10413488 Jan  1  1980  icudtl.dat
-rwxr-xr-x 1 jwoehr jwoehr    233960 Jan  1  1980
-rwxr-xr-x 1 jwoehr jwoehr  11158672 Jan  1  1980
-rwxr-xr-x 1 jwoehr jwoehr   7234040 Jan  1  1980
-rwxr-xr-x 1 jwoehr jwoehr   4168528 Jan  1  1980
-rwxr-xr-x 1 jwoehr jwoehr   4426328 Jan  1  1980
-rw-r--r-- 1 jwoehr jwoehr     41462 Mar  7 06:44  LICENSE
-rw-r--r-- 1 jwoehr jwoehr   5285976 Mar  7 06:44  LICENSES.chromium.html
drwxrwxr-x 2 jwoehr jwoehr      4096 Mar  7 06:44  locales
-rwxr-xr-x 1 jwoehr jwoehr 140273080 Jan  1  1980 'MongoDB Compass Dev'
drwxrwxr-x 3 jwoehr jwoehr      4096 Mar  7 06:44  resources
-rw-r--r-- 1 jwoehr jwoehr   5093175 Jan  1  1980  resources.pak
-rw-r--r-- 1 jwoehr jwoehr     48465 Jan  1  1980  snapshot_blob.bin
drwxrwxr-x 2 jwoehr jwoehr      4096 Mar  7 06:44  swiftshader
-rw-r--r-- 1 jwoehr jwoehr    165677 Jan  1  1980  v8_context_snapshot.bin
-rw-r--r-- 1 jwoehr jwoehr        11 Mar  7 06:44  version
-rw-r--r-- 1 jwoehr jwoehr       107 Jan  1  1980  vk_swiftshader_icd.json