Skip to content

Commit

Permalink
Update setup instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
Heliozoa committed Sep 23, 2024
1 parent 8d0d2d9 commit 1ce0685
Show file tree
Hide file tree
Showing 8 changed files with 781 additions and 437 deletions.
12 changes: 12 additions & 0 deletions bin/detect-dev-env-problems
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,18 @@ echo "$DOCKER_OUTPUT"

echo ""

echo "Checking if langs exists"
BASEDIR="$(dirname "${BASH_SOURCE[0]}")"
FOLDER_PATH="$BASEDIR/../services/tmc/"
if [ -n "$(find "$FOLDER_PATH" -maxdepth 1 -type f -name "tmc-langs-cli-*")" ]; then
echo "Found langs"
else
echo "Langs not found, please run bin/download-tmc-langs"
exit 255
fi

echo ""

DOMAIN="project-331.local"

ensure_program_in_path minikube
Expand Down
4 changes: 2 additions & 2 deletions bin/download-tmc-langs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ echo "$GENERATED" >> "$GENERATED_DOWNLOAD_TARGET"
# write guard annotation for CliOutput and RunResult
run_command sed -i '/^export type CliOutput/i \/** @see {isCliOutput} ts-auto-guard:type-guard *\/' "$GENERATED_DOWNLOAD_TARGET"
run_command sed -i '/^export interface RunResult/i \/** @see {isRunResult} ts-auto-guard:type-guard *\/' "$GENERATED_DOWNLOAD_TARGET"
run_command npx eslint --fix "$GENERATED_DOWNLOAD_TARGET"
run_command npx eslint@8 --fix "$GENERATED_DOWNLOAD_TARGET"

# generate guard
run_command npx ts-auto-guard --paths "$GENERATED_DOWNLOAD_TARGET" --project ./tsconfig.json
run_command sed -i '1s;^;/* eslint-disable @typescript-eslint/no-explicit-any */\n/* eslint-disable @typescript-eslint/explicit-module-boundary-types */\n\n;' "$GENERATED_GUARD"
run_command npx eslint --fix "$GENERATED_GUARD"
run_command npx eslint@8 --fix "$GENERATED_GUARD"

# this is done last so that if anything goes wrong earlier, we don't get a false "Already up to date!" message
echo "Downloading CLI"
Expand Down
30 changes: 15 additions & 15 deletions docs/Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,18 @@ brew install kubectx stern

# Running the development environment

## Installing secret-projects dependencies

In the root directory, run the command `nvm install` followed by `nvm use`. After that you should have Node 20. Then run `npm ci` in the root folder to install the dependencies and `./bin/npm-ci-all` which will install all the dependencies for the services. Then make sure that TMC-Langs is downloaded by running `bin/download-tmc-langs`. Otherwise the build won't succeed.

Once you've installed the node modules run the command `./bin/copy-and-check-shared-module` which will copy the contents of the shared module to each of the services.

Add the environment variables for the headless-lms by the following command

```shell
cp services/headless-lms/models/.env.example services/headless-lms/models/.env
```

## Starting minikube

**Before you do this the first time:** If you're running Linux, you can detect common problems with your setup by running `bin/detect-dev-env-problems` on the repo root. Once you see this script printing `Minikube is not running. Please start it with bin/minikube-start and run this again.`, you can proceed to the next step.
Expand Down Expand Up @@ -300,18 +312,6 @@ After that, you should be able to access the application by going to `http://pro

Take a look at `kubernetes/ingress.yml` to see how requests are routed to different services.

## Installing secret-projects dependencies

In the root directory, run the command `nvm use`. After that you should have node 16. Then run `npm ci` in the root folder to install the dependencies and `./bin/npm-ci-all` which will install all the dependencies for the services. Then make sure that TMC-Langs is downloaded by running `bin/download-tmc-langs`. Otherwise the build won't succeed.

Once you've installed the node modules run the command `./bin/copy-and-check-shared-module` which will copy the contents of the shared module to each of the services.

Add the environment variables for the headless-lms by the following command

```shell
cp services/headless-lms/models/.env.example services/headless-lms/models/.env
```

## Starting development the application

Before starting the application, make sure minikube is running.
Expand All @@ -324,11 +324,11 @@ For windows environment, you can use [windows terminal](https://aka.ms/terminal)

For macOS, you can use [Iterm2](https://iterm2.com/)

### Linux

**Verify that you've setup minikube corretly by running `bin/detect-dev-env-problems`.**

Afterwards, in the root of the repo, run: `bin/dev`. This script will start the development environment inside Minikube with Skaffold. The initial build will take a while but after that is done, everything should be relatively quick.
### Linux

In the root of the repo, run: `bin/dev`. This script will start the development environment inside Minikube with Skaffold. The initial build will take a while but after that is done, everything should be relatively quick.

### Windows

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"eslint:format-generated-docs": "eslint --cache --fix services/headless-lms/server/generated-docs/*.ts && prettier --write services/headless-lms/server/generated-docs/*.json",
"eslint:open:vscode": "eslint . --format json | jq '(.[] | select((.errorCount > 0) or (.warningCount > 0))).filePath' | xargs code",
"eslint:ci": "eslint .",
"prepare": "husky install",
"prepare": "husky",
"lint:css": "stylelint '**/*.tsx'",
"postinstall": "cd shared-module && npm ci && npm run sync-once"
},
Expand Down
Loading

0 comments on commit 1ce0685

Please sign in to comment.