-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1161 from assemblee-virtuelle/next
Release v0.6.0
- Loading branch information
Showing
479 changed files
with
36,731 additions
and
18,766 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#!/bin/bash | ||
|
||
# Catch cases where the work dir changed after a git command. | ||
# In that cases, run ./scripts/on-workdir-changed.sh | ||
|
||
|
||
function in_rebase { | ||
git_dir=$(git rev-parse --git-dir) | ||
# Check if git_dir/rebase-merge or /rebase_apply exist. | ||
# Then return the result | ||
return $([ -d "$git_dir/rebase-merge" ] || [ -d "$git_dir/rebase-apply" ]) | ||
} | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
cd "$ROOT_DIR" | ||
|
||
# If in rebase, this hook is called multiple times. | ||
# Skip here and wait for post-rewrite to have been called. | ||
if in_rebase; then | ||
exit 0 | ||
fi | ||
|
||
|
||
# Get first argument. If it is 1, this indicates, working dir files have changed. | ||
if [ "$1" = 1 ] ; then | ||
./scripts/on-workdir-changed.sh | ||
fi | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/bin/bash | ||
|
||
# Catch cases where the work dir changed after a git rebase. | ||
# In that cases, run ./scripts/on-workdir-changed.sh | ||
|
||
|
||
# If coming from a rewrite-rebase ($1 == rebase), run on-workdir-changed. | ||
if [ "$1" = "rebase" ] ; then | ||
# cd to root directory | ||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
cd "$ROOT_DIR" | ||
|
||
./scripts/on-workdir-changed.sh | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/bash | ||
|
||
# Skip pre-push checks if SKIP_PREPUSH_CHECKS is set. | ||
if [ "$SKIP_PREPUSH_CHECKS" = true ] || [ "$SKIP_PREPUSH_CHECKS" = 1 ] ; then | ||
echo "=== Skipping pre-push checks ===" | ||
exit 0 | ||
fi | ||
|
||
cd "$ROOT_DIR" | ||
|
||
./scripts/run-typecheck.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,10 @@ lerna-debug.log | |
/.idea | ||
/data | ||
*.swp | ||
.parcel-cache | ||
.classpath | ||
.project | ||
.settings | ||
# conflict | ||
*.orig | ||
.nx |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
*.cjs.js | ||
*.es.js | ||
**/dist/** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
# This script is called when a git command possibly modified files in the working dir. | ||
|
||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
cd "$ROOT_DIR" | ||
|
||
./scripts/run-yalc-publish.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/bin/bash | ||
|
||
# Script to run linter before commit. | ||
# This is called by `.git-hooks/pre-commit` | ||
|
||
|
||
echo "=== Running linter ===" | ||
|
||
cd $(git rev-parse --show-toplevel) | ||
|
||
FILES="$@" | ||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
|
||
MIDDLEWARE_FILES="$(echo "$FILES" | grep -E "src/middleware" | xargs -r realpath | sed 's/.*/"&"/')" | ||
FRONTEND_FILES="$(echo "$FILES" | grep -E "src/frontend" | xargs -r realpath | sed 's/.*/"&"/')" | ||
|
||
LINT_FILE_TYPES="js|jsx|ts|tsx" | ||
LINT_MIDDLEWARE_FILES=$(echo "$MIDDLEWARE_FILES" | grep -E "\.($LINT_FILE_TYPES)$") | ||
LINT_FRONTEND_FILES=$(echo "$FRONTEND_FILES" | grep -E "\.($LINT_FILE_TYPES)$") | ||
|
||
# Function to evaluate the linter results | ||
function evaluate_linter_results { | ||
if [ $? == 1 ]; then | ||
echo "⛔ The linter found some errors. Please fix them before committing." | ||
echo " You can skip pre-commit checks by setting \$SKIP_PRECOMMIT_CHECKS" | ||
exit 1 | ||
elif [ $? -ge 2 ]; then | ||
echo "⛔ Something went wrong running the linter. Have you run \`yarn\` yet?" | ||
echo " You can skip pre-commit checks by setting \$SKIP_PRECOMMIT_CHECKS" | ||
exit 1 | ||
fi | ||
} | ||
|
||
|
||
# Run linter on middleware and frontend files | ||
|
||
cd "$ROOT_DIR"/src/middleware | ||
yarn run lint-files $LINT_MIDDLEWARE_FILES | ||
evaluate_linter_results | ||
|
||
cd "$ROOT_DIR"/src/frontend | ||
yarn run lint-files $LINT_FRONTEND_FILES | ||
evaluate_linter_results | ||
|
||
|
||
echo "✅ Linter successful!" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#!/bin/bash | ||
|
||
# Script to run prettier on staged files before commit. | ||
# This is called by `.git-hooks/pre-commit` | ||
|
||
|
||
echo "=== Running prettier ===" | ||
|
||
FILES="$@" | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
|
||
MIDDLEWARE_FILES="$(echo "$FILES" | grep -E "src/middleware" | xargs -r realpath | sed 's/.*/"&"/')" | ||
FRONTEND_FILES="$(echo "$FILES" | grep -E "src/frontend" | xargs -r realpath | sed 's/.*/"&"/')" | ||
|
||
|
||
# Run prettier on all given files. | ||
cd "$ROOT_DIR"/src/middleware | ||
echo "$MIDDLEWARE_FILES" | xargs npx prettier --write --ignore-unknown | ||
cd "$ROOT_DIR"/src/frontend | ||
echo "$FRONTEND_FILES" | xargs npx prettier --write --ignore-unknown | ||
cd "$ROOT_DIR" | ||
|
||
if [ $? != 0 ]; then | ||
echo "⛔ Something went wrong running prettier. Have you run \`npm install\` yet?" | ||
echo " You can skip pre-commit checks by setting \$SKIP_PRECOMMIT_CHECKS" | ||
exit 1 | ||
fi | ||
|
||
echo "✅ Prettier done!" | ||
|
||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/bash | ||
|
||
# Script to typecheck frontend code. | ||
# Called by pre-push hook. | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
cd "$ROOT_DIR"/src/frontend | ||
|
||
echo "=== Running typecheck for frontend ===" | ||
|
||
yarn typecheck > /dev/null | ||
if [ $? -ne 0 ]; then | ||
echo "⛔ Typecheck failed! To see the errors, run \`yarn typecheck\` in the frontend directory." | ||
echo " You can skip pre-push checks by setting \$SKIP_PREPUSH_CHECKS=true" | ||
exit 1 | ||
fi | ||
echo "✅ Typecheck successful!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/bin/bash | ||
|
||
# Script to run yalc:publish. | ||
# Called by on-workdir-changed.sh | ||
|
||
|
||
if [ "$SKIP_YALC_PUBLISH" = true ] || [ "$SKIP_YALC_PUBLISH" = 1 ] ; then | ||
echo "=== Skipping yalc:publish ===" | ||
exit 0 | ||
fi | ||
|
||
|
||
echo === Running yalc:publish === | ||
|
||
ROOT_DIR=$(git rev-parse --show-toplevel) | ||
cd "$ROOT_DIR"/src/frontend | ||
|
||
# Run yalc:publish. If not available, just print an info message. | ||
yarn yalc:publish &> /dev/null || \ | ||
echo "⚠️ yarn or yalc is not installed. Skipping yalc:publish" | ||
|
||
exit 0 |
Oops, something went wrong.