Run command(s) only for codespace prebuilds #173831
-
Select Topic AreaQuestion BodyIn my |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
. The easiest way is to check for a special environment variable called CODESPACE_PREBUILD. It's only set to true when a Codespace is being prebuilt, not when someone starts it up on their local machine or just creates a new one. So, in your onCreateCommand or updateContentCommand script, you can just use a simple if statement that checks for that variable. That lets you run all your super-slow setup stuff, like compiling huge projects or grabbing massive files, just once for the prebuilds. Everyone else gets a lightning-fast start without having to sit through all the heavy lifting. Easy peasy. |
Beta Was this translation helpful? Give feedback.
. The easiest way is to check for a special environment variable called CODESPACE_PREBUILD. It's only set to true when a Codespace is being prebuilt, not when someone starts it up on their local machine or just creates a new one. So, in your onCreateCommand or updateContentCommand script, you can just use a simple if statement that checks for that variable. That lets you run all your super-slow setup stuff, like compiling huge projects or grabbing massive files, just once for the prebuilds. Everyone else gets a lightning-fast start without having to sit through all the heavy lifting. Easy peasy.