From 39900022db9fb05e11d2e394f778c772d4067a85 Mon Sep 17 00:00:00 2001 From: MikeWallaceDev Date: Mon, 18 Jul 2022 14:31:13 -0400 Subject: [PATCH 1/4] fix: improved development environment installation moved and renamed /Makefile.toml to githooks.toml added install script for Linux --- Makefile.toml | 35 ------------- frontend/Makefile.toml | 1 + .../scripts/install_dev_env/install_linux.sh | 50 +++++++++++++++++++ frontend/scripts/makefile/githooks.toml | 39 +++++++++++++++ 4 files changed, 90 insertions(+), 35 deletions(-) delete mode 100644 Makefile.toml create mode 100755 frontend/scripts/install_dev_env/install_linux.sh create mode 100644 frontend/scripts/makefile/githooks.toml diff --git a/Makefile.toml b/Makefile.toml deleted file mode 100644 index 2e75c10277..0000000000 --- a/Makefile.toml +++ /dev/null @@ -1,35 +0,0 @@ -[tasks.install-commitlint.mac] -script = [ - """ - brew install npm - yarn install - yarn husky install - """, -] -script_runner = "@shell" - -[tasks.install-commitlint.windows] -script = [ - """ - echo "WIP" - """, -] -script_runner = "@duckscript" - -[tasks.install-commitlint.linux] -script = [ - """ - if command -v apt &> /dev/null - then - echo "Installing node.js and yarn (sudo apt install nodejs yarn)" - sudo apt install nodejs yarn - else - echo "Installing node.js and yarn (sudo pacman -S nodejs yarn)" - sudo pacman -S nodejs yarn - fi - - yarn install - yarn husky install - """, -] -script_runner = "@shell" diff --git a/frontend/Makefile.toml b/frontend/Makefile.toml index 337b9efd76..7449bfeef3 100644 --- a/frontend/Makefile.toml +++ b/frontend/Makefile.toml @@ -8,6 +8,7 @@ extend = [ { path = "scripts/makefile/env.toml" }, { path = "scripts/makefile/flutter.toml" }, { path = "scripts/makefile/tool.toml" }, + { path = "scripts/makefile/githooks.toml" }, ] [config] diff --git a/frontend/scripts/install_dev_env/install_linux.sh b/frontend/scripts/install_dev_env/install_linux.sh new file mode 100755 index 0000000000..1d8e7f810d --- /dev/null +++ b/frontend/scripts/install_dev_env/install_linux.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +BLUE="\e[34m" +GREEN="\e[32m" +ENDCOLOR="\e[0m" + + +# Install rust on Linux +read -p 'Do you want to install Rust? [y/N] ' installrust + + +if [ ${installrust^^} == "Y" ]; then + echo -e "${BLUE}AppFlowy : Installing Rust.${ENDCOLOR}" + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh + source $HOME/.cargo/env + rustup toolchain install stable + rustup default stable +else + echo -e "${BLUE}AppFlowy : Skipping Rust installation.${ENDCOLOR}" +fi + +# Enable the flutter stable channel +echo -e "${BLUE}AppFlowy : Checking Flutter installation.${ENDCOLOR}" +flutter channel stable + +# Enable linux desktop +flutter config --enable-linux-desktop + +# Fix any problems reported by flutter doctor +flutter doctor + +# Add the githooks directory to your git configuration +echo -e "${BLUE}AppFlowy : Setting up githooks.${ENDCOLOR}" +git config core.hooksPath .githooks + +# Change to the frontend directory +cd frontend + +# Install cargo make +echo -e "${BLUE}AppFlowy : Installing cargo-make.${ENDCOLOR}" +cargo install --force cargo-make + +# Install duckscript +echo -e "${BLUE}AppFlowy : Installing duckscript.${ENDCOLOR}" +cargo install --force duckscript_cli + +# Install CommitLint +echo -e "${BLUE}AppFlowy : Installing CommitLint.${ENDCOLOR}" +npm install @commitlint/cli @commitlint/config-conventional --save-dev + diff --git a/frontend/scripts/makefile/githooks.toml b/frontend/scripts/makefile/githooks.toml new file mode 100644 index 0000000000..f6b066ec49 --- /dev/null +++ b/frontend/scripts/makefile/githooks.toml @@ -0,0 +1,39 @@ +[tasks.install-commitlint.mac] +script = [ + """ + brew install npm + npm install @commitlint/cli @commitlint/config-conventional --save-dev + + git config core.hooksPath .githooks + """, +] +script_runner = "@shell" + +[tasks.install-commitlint.windows] +script = [ + """ + echo "WIP" + + git config core.hooksPath .githooks + """, +] +script_runner = "@duckscript" + +[tasks.install-commitlint.linux] +script = [ + """ + if command -v apt &> /dev/null + then + echo "Installing node.js (sudo apt install nodejs)" + sudo apt install nodejs + else + echo "Installing node.js (sudo pacman -S nodejs)" + sudo pacman -S nodejs + fi + + npm install @commitlint/cli @commitlint/config-conventional --save-dev + + git config core.hooksPath .githooks + """, +] +script_runner = "@shell" From 1cb8dbcfa4b8faf8009d29182b5b02bcb77f6ad0 Mon Sep 17 00:00:00 2001 From: MikeWallaceDev Date: Mon, 18 Jul 2022 15:24:25 -0400 Subject: [PATCH 2/4] fix: improved installation on MacOs added MacOs install script Removed Makefile, since we now use a bash script. This removes the dependency on make. Removed Brewfile, since we now use a bash script --- frontend/Brewfile | 2 - frontend/Makefile | 14 ----- .../scripts/install_dev_env/install_linux.sh | 10 +++- .../scripts/install_dev_env/install_macos.sh | 56 +++++++++++++++++++ 4 files changed, 64 insertions(+), 18 deletions(-) delete mode 100644 frontend/Brewfile delete mode 100644 frontend/Makefile create mode 100755 frontend/scripts/install_dev_env/install_macos.sh diff --git a/frontend/Brewfile b/frontend/Brewfile deleted file mode 100644 index 470312025d..0000000000 --- a/frontend/Brewfile +++ /dev/null @@ -1,2 +0,0 @@ -brew 'sqlite3' -brew 'rustup-init' diff --git a/frontend/Makefile b/frontend/Makefile deleted file mode 100644 index c393bec0e0..0000000000 --- a/frontend/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -.PHONY: flowy_dev_install flowy_clean - -flowy_dev_install: - brew bundle - rustup-init -y --default-toolchain=stable - cargo install --force cargo-make - cargo install --force duckscript_cli - cargo make flowy_dev - - -flowy_clean: - sh ./scripts/clean.sh - - diff --git a/frontend/scripts/install_dev_env/install_linux.sh b/frontend/scripts/install_dev_env/install_linux.sh index 1d8e7f810d..0446655c02 100755 --- a/frontend/scripts/install_dev_env/install_linux.sh +++ b/frontend/scripts/install_dev_env/install_linux.sh @@ -1,13 +1,16 @@ #!/bin/bash BLUE="\e[34m" -GREEN="\e[32m" +RED="\e[31m" ENDCOLOR="\e[0m" +# Note: This script does not install applications which are installed by the package manager. There are too many package managers out there. # Install rust on Linux -read -p 'Do you want to install Rust? [y/N] ' installrust +echo -e "${BLUE}AppFlowy : The Rust programming language is required to compile AppFlowy.${ENDCOLOR}" +echo -e "${BLUE}AppFlowy : We can install it now if you don't already have it on your system.${ENDCOLOR}" +read -p "${BLUE}AppFlowy : Do you want to install Rust? [y/N]${ENDCOLOR} " installrust if [ ${installrust^^} == "Y" ]; then echo -e "${BLUE}AppFlowy : Installing Rust.${ENDCOLOR}" @@ -48,3 +51,6 @@ cargo install --force duckscript_cli echo -e "${BLUE}AppFlowy : Installing CommitLint.${ENDCOLOR}" npm install @commitlint/cli @commitlint/config-conventional --save-dev +# Check prerequisites +echo -e "${BLUE}AppFlowy : Checking prerequisites.${ENDCOLOR}" +cargo make flowy_dev diff --git a/frontend/scripts/install_dev_env/install_macos.sh b/frontend/scripts/install_dev_env/install_macos.sh new file mode 100755 index 0000000000..a4f325094e --- /dev/null +++ b/frontend/scripts/install_dev_env/install_macos.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +BLUE="\e[34m" +RED="\e[31m" +ENDCOLOR="\e[0m" + +# Install rust on Linux +echo -e "${BLUE}AppFlowy : The Rust programming language is required to compile AppFlowy.${ENDCOLOR}" +echo -e "${BLUE}AppFlowy : We can install it now if you don't already have it on your system.${ENDCOLOR}" + +read -p "${BLUE}AppFlowy : Do you want to install Rust? [y/N]${ENDCOLOR} " installrust + +if [ ${installrust^^} == "Y" ]; then + echo -e "${BLUE}AppFlowy : Installing Rust.${ENDCOLOR}" + brew 'rustup-init' + rustup-init -y --default-toolchain=stable +else + echo -e "${BLUE}AppFlowy : Skipping Rust installation.${ENDCOLOR}" +fi + +# Install sqllite +echo -e "${BLUE}AppFlowy : Installing SqlLite3.${ENDCOLOR}" +brew 'sqlite3' + +# Enable the flutter stable channel +echo -e "${BLUE}AppFlowy : Checking Flutter installation.${ENDCOLOR}" +flutter channel stable + +# Enable linux desktop +flutter config --enable-linux-desktop + +# Fix any problems reported by flutter doctor +flutter doctor + +# Add the githooks directory to your git configuration +echo -e "${BLUE}AppFlowy : Setting up githooks.${ENDCOLOR}" +git config core.hooksPath .githooks + +# Change to the frontend directory +cd frontend + +# Install cargo make +echo -e "${BLUE}AppFlowy : Installing cargo-make.${ENDCOLOR}" +cargo install --force cargo-make + +# Install duckscript +echo -e "${BLUE}AppFlowy : Installing duckscript.${ENDCOLOR}" +cargo install --force duckscript_cli + +# Install CommitLint +echo -e "${BLUE}AppFlowy : Installing CommitLint.${ENDCOLOR}" +npm install @commitlint/cli @commitlint/config-conventional --save-dev + +# Check prerequisites +echo -e "${BLUE}AppFlowy : Checking prerequisites.${ENDCOLOR}" +cargo make flowy_dev From f30f2485c68655df7fcc1b7c93826d1d12df5d1e Mon Sep 17 00:00:00 2001 From: MikeWallaceDev Date: Mon, 18 Jul 2022 20:08:13 -0400 Subject: [PATCH 3/4] fix: fixed colors when asking to install Rust --- frontend/scripts/install_dev_env/install_linux.sh | 5 +++-- frontend/scripts/install_dev_env/install_macos.sh | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/scripts/install_dev_env/install_linux.sh b/frontend/scripts/install_dev_env/install_linux.sh index 0446655c02..405c8b85c5 100755 --- a/frontend/scripts/install_dev_env/install_linux.sh +++ b/frontend/scripts/install_dev_env/install_linux.sh @@ -1,16 +1,17 @@ #!/bin/bash BLUE="\e[34m" +GREEN="\e[32m" RED="\e[31m" ENDCOLOR="\e[0m" # Note: This script does not install applications which are installed by the package manager. There are too many package managers out there. -# Install rust on Linux +# Install Rust echo -e "${BLUE}AppFlowy : The Rust programming language is required to compile AppFlowy.${ENDCOLOR}" echo -e "${BLUE}AppFlowy : We can install it now if you don't already have it on your system.${ENDCOLOR}" -read -p "${BLUE}AppFlowy : Do you want to install Rust? [y/N]${ENDCOLOR} " installrust +read -p "$(echo -e $GREEN"AppFlowy : Do you want to install Rust? [y/N]"$ENDCOLOR) " installrust if [ ${installrust^^} == "Y" ]; then echo -e "${BLUE}AppFlowy : Installing Rust.${ENDCOLOR}" diff --git a/frontend/scripts/install_dev_env/install_macos.sh b/frontend/scripts/install_dev_env/install_macos.sh index a4f325094e..8fc25f9227 100755 --- a/frontend/scripts/install_dev_env/install_macos.sh +++ b/frontend/scripts/install_dev_env/install_macos.sh @@ -1,14 +1,15 @@ #!/bin/bash BLUE="\e[34m" +GREEN="\e[32m" RED="\e[31m" ENDCOLOR="\e[0m" -# Install rust on Linux +# Install Rust echo -e "${BLUE}AppFlowy : The Rust programming language is required to compile AppFlowy.${ENDCOLOR}" echo -e "${BLUE}AppFlowy : We can install it now if you don't already have it on your system.${ENDCOLOR}" -read -p "${BLUE}AppFlowy : Do you want to install Rust? [y/N]${ENDCOLOR} " installrust +read -p "$(echo -e $GREEN"AppFlowy : Do you want to install Rust? [y/N]"$ENDCOLOR) " installrust if [ ${installrust^^} == "Y" ]; then echo -e "${BLUE}AppFlowy : Installing Rust.${ENDCOLOR}" From 6d9c4619e49d5e1abb6a841c35c84afa0d41bbc0 Mon Sep 17 00:00:00 2001 From: MikeWallaceDev Date: Mon, 18 Jul 2022 21:44:11 -0400 Subject: [PATCH 4/4] fix: fixed flutter config variable for mac --- frontend/scripts/install_dev_env/install_macos.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/scripts/install_dev_env/install_macos.sh b/frontend/scripts/install_dev_env/install_macos.sh index 8fc25f9227..36c8f062f4 100755 --- a/frontend/scripts/install_dev_env/install_macos.sh +++ b/frontend/scripts/install_dev_env/install_macos.sh @@ -28,7 +28,7 @@ echo -e "${BLUE}AppFlowy : Checking Flutter installation.${ENDCOLOR}" flutter channel stable # Enable linux desktop -flutter config --enable-linux-desktop +flutter config --enable-macos-desktop # Fix any problems reported by flutter doctor flutter doctor