| 1 | #!/usr/bin/env bash |
| 2 | # This is used in a task in .vscode/tasks.json |
| 3 | # Start developing with: |
| 4 | # - Run Task -> Install Dependencies |
| 5 | # - Debug -> Extension |
| 6 | set -e |
| 7 | |
| 8 | # Check if node version matches .nvmrc |
| 9 | if [ -f .nvmrc ]; then |
| 10 | required_node_version=$(cat .nvmrc) |
| 11 | current_node_version=$(node -v) |
| 12 | |
| 13 | # Remove 'v' prefix from versions for comparison |
| 14 | required_version=${required_node_version#v} |
| 15 | current_version=${current_node_version#v} |
| 16 | |
| 17 | if [ "$required_version" != "$current_version" ]; then |
| 18 | echo "⚠️ Warning: Your Node.js version ($current_node_version) does not match the required version ($required_node_version)" |
| 19 | echo "Please consider switching to the correct version using: nvm use" |
| 20 | |
| 21 | if [ -t 0 ]; then |
| 22 | read -p "Press Enter to continue with installation anyway..." |
| 23 | else |
| 24 | echo "Continuing with installation anyway..." |
| 25 | fi |
| 26 | echo |
| 27 | fi |
| 28 | fi |
| 29 | |
| 30 | echo "Installing root-level dependencies..." |
| 31 | npm install |
| 32 | |
| 33 | echo "Building packages (fetch, openai-adapters, config-yaml)..." |
| 34 | node ./scripts/build-packages.js |
| 35 | |
| 36 | echo "Installing Core extension dependencies..." |
| 37 | pushd core |
| 38 | ## This flag is set because we pull down Chromium at runtime |
| 39 | export PUPPETEER_SKIP_DOWNLOAD='true' |
| 40 | npm install |
| 41 | npm link |
| 42 | popd |
| 43 | |
| 44 | echo "Installing GUI extension dependencies..." |
| 45 | pushd gui |
| 46 | npm install |
| 47 | npm link @continuedev/core |
| 48 | NODE_OPTIONS="--max-old-space-size=4096" npm run build |
| 49 | popd |
| 50 | |
| 51 | # VSCode Extension (will also package GUI) |
| 52 | echo "Installing VSCode extension dependencies..." |
| 53 | pushd extensions/vscode |
| 54 | # This does way too many things inline but is the common denominator between many of the scripts |
| 55 | npm install |
| 56 | npm link @continuedev/core |
| 57 | # npm run prepackage # not required since npm run package has prescript of prepackage |
| 58 | npm run package |
| 59 | popd |
| 60 | |
| 61 | echo "Installing binary dependencies..." |
| 62 | pushd binary |
| 63 | npm install |
| 64 | npm run build |
| 65 | popd |
| 66 | |
| 67 | echo "Installing docs dependencies..." |
| 68 | pushd docs |
| 69 | npm install |
| 70 | popd |