diff --git a/.devcontainer/react/devcontainer.json b/.devcontainer/react/devcontainer.json index d384cec91269..a403239429b6 100644 --- a/.devcontainer/react/devcontainer.json +++ b/.devcontainer/react/devcontainer.json @@ -4,14 +4,20 @@ "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {} }, - "onCreateCommand": "curl -s install.aztec.network | NON_INTERACTIVE=1 BIN_PATH=/usr/local/bin bash -s && echo 'y' | npx create-aztec-app -t app -n react -s && cd react && yarn", - "postAttachCommand": "(nohup /usr/local/bin/aztec sandbox &) && cd react", + "onCreateCommand": "cp -R /root/workspace /root/scripts && rm -rf /root/workspace/* && sh /root/scripts/onCreateCommand.sh app react", + "postAttachCommand": "sh /root/scripts/postAttachCommand.sh app react", "customizations": { "vscode": { "settings": {}, "extensions": ["noir-lang.vscode-noir"] } }, - "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/react,target=/root/workspace,type=bind", - "workspaceFolder": "/root/workspace" + "hostRequirements": { + "cpus": 8, + "memory": "8gb", + "storage": "32gb" + }, + "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/scripts,target=/root/workspace,type=bind", + "workspaceFolder": "/root/workspace", + "forwardPorts": [8080] } diff --git a/.devcontainer/scripts/onCreateCommand.sh b/.devcontainer/scripts/onCreateCommand.sh new file mode 100755 index 000000000000..e6c4f3cd7270 --- /dev/null +++ b/.devcontainer/scripts/onCreateCommand.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +TYPE=$1 +NAME=$2 + +curl -s install.aztec.network | NON_INTERACTIVE=1 BIN_PATH=/usr/local/bin bash -s +docker compose -f $HOME/.aztec/docker-compose.yml pull + +if ! grep -q "PXE_URL" ~/.bashrc; then + echo "export PXE_URL=https://\$CODESPACE_NAME-8080.preview.\$GITHUB_CODESPACES_PORT_FORWARDING_DOMAIN" >> ~/.bashrc +fi + +echo 'y' | npx create-aztec-app -t $TYPE -n $NAME -s +mv react/* . +rm -rf react + +yarn + +npx -y playwright install --with-deps +yarn prep diff --git a/.devcontainer/scripts/postAttachCommand.sh b/.devcontainer/scripts/postAttachCommand.sh new file mode 100755 index 000000000000..1f822385d0db --- /dev/null +++ b/.devcontainer/scripts/postAttachCommand.sh @@ -0,0 +1,65 @@ +#!/usr/bin/env bash +TYPE=$1 +NAME=$2 + +# apt install gh +# gh codespace ports visibility 8080:public -c $CODESPACE_NAME + +# (nohup /usr/local/bin/aztec sandbox &) + +r=$(tput sgr0) # Reset color +bold=$(tput bold) # Bold text +g=$(tput setaf 46) # Light Green +b=$(tput setaf 21) # Bright Blue +p=$(tput setaf 13) # Magenta +y=$(tput setaf 226) # Bright Yellow +c=$(tput setaf 51) # Cyan +o=$(tput setaf 208) # Orange + +# Function to print colored text +print_colored() { + case $2 in + green) + color=$g + ;; + blue) + color=$b + ;; + magenta) + color=$p + ;; + yellow) + color=$y + ;; + cyan) + color=$c + ;; + orange) + color=$o + ;; + *) + color=$r + ;; + esac + echo "${color}$1${r}" +} + +echo +echo "${bold}${c} █████╗ ███████╗████████╗███████╗ ██████╗${r}" +echo "${bold}${o}██╔══██╗╚══███╔╝╚══██╔══╝██╔════╝██╔════╝${r}" +echo "${bold}${g}███████║ ███╔╝ ██║ █████╗ ██║${r}" +echo "${bold}${b}██╔══██║ ███╔╝ ██║ ██╔══╝ ██║${r}" +echo "${bold}${p}██║ ██║███████╗ ██║ ███████╗╚██████╗${r}" +echo "${bold}${y}╚═╝ ╚═╝╚══════╝ ╚═╝ ╚══════╝ ╚═════╝${r}" +echo +print_colored "${bold}Sandbox Codespace" "cyan" +print_colored "${bold}Your codespace is ready with your chosen box! 🎉" "cyan" +echo +print_colored "All the packages are already installed, and you can now run yarn dev or any other package.json script." "magenta" +print_colored "You can also use this codespace for its running sandbox, by connecting your local environment to it." "magenta" +echo +print_colored "To do so, set the PXE_URL to this codespace's sandbox URL:" "magenta" +print_colored "${PXE_URL}" "green" +print_colored "ex. PXE_URL=\"${PXE_URL}\" yarn dev" +echo +print_colored "${bold}Enjoy your sandbox! 🏖️" "orange" diff --git a/.devcontainer/token/devcontainer.json b/.devcontainer/token/devcontainer.json index 974938edbd0f..ebb1cef6f527 100644 --- a/.devcontainer/token/devcontainer.json +++ b/.devcontainer/token/devcontainer.json @@ -4,15 +4,27 @@ "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {} }, - "onCreateCommand": "curl -s install.aztec.network | NON_INTERACTIVE=1 BIN_PATH=/usr/local/bin bash -s && echo 'y' | npx create-aztec-app -t contract -n token_contract -s && cd token_contract && yarn", - "postCreateCommand": "cd boxes && yarn && npx create-aztec-app -t contract -n token_contract -s", - "postAttachCommand": "(nohup /usr/local/bin/aztec sandbox &) && cd token_contract", + "onCreateCommand": ".devcontainer/scripts/onCreateCommand.sh contract token_contract", + "postAttachCommand": ".devcontainer/scripts/postAttachCommand.sh contract token_contract", "customizations": { "vscode": { "settings": {}, "extensions": ["noir-lang.vscode-noir"] } }, - "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/token,target=/root/workspace,type=bind", - "workspaceFolder": "/root/workspace" + "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/token_contract,target=/root/workspace,type=bind", + "workspaceFolder": "/root/workspace", + "hostRequirements": { + "cpus": 8, + "memory": "8gb", + "storage": "32gb" + }, + "mounts": [ + { + "source": "${localWorkspaceFolder}/.devcontainer/scripts", + "target": "/root/workspace/.devcontainer/scripts", + "type": "bind" + } + ], + "forwardPorts": [8080] } diff --git a/.devcontainer/vanilla/devcontainer.json b/.devcontainer/vanilla/devcontainer.json index a293161a54f5..340a8a417031 100644 --- a/.devcontainer/vanilla/devcontainer.json +++ b/.devcontainer/vanilla/devcontainer.json @@ -1,11 +1,11 @@ { - "name": "Vanilla JS/TS", + "name": "Vanilla Typescript App", "image": "node:lts-bookworm", "features": { "ghcr.io/devcontainers/features/docker-in-docker:2": {} }, - "onCreateCommand": "curl -s install.aztec.network | NON_INTERACTIVE=1 BIN_PATH=/usr/local/bin bash -s && echo 'y' | npx create-aztec-app -t app -n vanilla -s && cd vanilla && yarn", - "postAttachCommand": "(nohup /usr/local/bin/aztec sandbox &) && cd vanilla", + "onCreateCommand": ".devcontainer/scripts/onCreateCommand.sh app vanilla", + "postAttachCommand": ".devcontainer/scripts/postAttachCommand.sh app vanilla", "customizations": { "vscode": { "settings": {}, @@ -13,5 +13,18 @@ } }, "workspaceMount": "source=${localWorkspaceFolder}/.devcontainer/vanilla,target=/root/workspace,type=bind", - "workspaceFolder": "/root/workspace" + "workspaceFolder": "/root/workspace", + "hostRequirements": { + "cpus": 8, + "memory": "8gb", + "storage": "32gb" + }, + "mounts": [ + { + "source": "${localWorkspaceFolder}/.devcontainer/scripts", + "target": "/root/workspace/.devcontainer/scripts", + "type": "bind" + } + ], + "forwardPorts": [8080] } diff --git a/.vscode/settings.json b/.vscode/settings.json index fad277ad08c3..ea41bbe2bc22 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -166,6 +166,5 @@ "**/l1-contracts/lib/**": true, "**/barretenberg/cpp/build*/**": true }, - "workbench.editor.enablePreviewFromQuickOpen": true, - "cmake.sourceDirectory": "/Users/zpedro/Documents/GitHub/aztec-packages/barretenberg/cpp" + "cmake.sourceDirectory": "/mnt/user-data/adam/aztec-packages/barretenberg/cpp" } diff --git a/boxes/bin.js b/boxes/bin.js index 3de6d5ecbd9e..5757ebff0ccb 100755 --- a/boxes/bin.js +++ b/boxes/bin.js @@ -107,7 +107,6 @@ if (optsKeys.length % 2) { } program.action(async (options) => { - console.log(options) const { projectType, projectName, skipSandbox } = options; // SETUP: Initialize global variables await init(options); @@ -116,8 +115,8 @@ program.action(async (options) => { if (skipSandbox) return; // STEP 2: Install the Sandbox - await sandboxInstallOrUpdate({ skipQuestion: sandbox }); + await sandboxInstallOrUpdate({ skipQuestion: skipSandbox }); // STEP 3: Running the Sandbox - await sandboxRun({ skipQuestion: sandbox }); + await sandboxRun({ skipQuestion: skipSandbox }); }); program.parse(); diff --git a/boxes/boxes/react/.yarnrc.yml b/boxes/boxes/react/.yarnrc.yml new file mode 100644 index 000000000000..3186f3f0795a --- /dev/null +++ b/boxes/boxes/react/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/boxes/boxes/vanilla/.yarnrc.yml b/boxes/boxes/vanilla/.yarnrc.yml new file mode 100644 index 000000000000..3186f3f0795a --- /dev/null +++ b/boxes/boxes/vanilla/.yarnrc.yml @@ -0,0 +1 @@ +nodeLinker: node-modules diff --git a/boxes/package.json b/boxes/package.json index 78525b35c9fc..bff118dbe5be 100644 --- a/boxes/package.json +++ b/boxes/package.json @@ -1,7 +1,7 @@ { "name": "create-aztec-app", "packageManager": "yarn@4.1.0", - "version": "0.3.15", + "version": "0.3.16", "type": "module", "scripts": { "compile": "yarn workspaces foreach -A -v run compile",