generated from metaplex-foundation/solana-project-template
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add lint precommit hook * update comments
- Loading branch information
Showing
7 changed files
with
106 additions
and
2 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,24 @@ | ||
#!/bin/sh | ||
|
||
set +e | ||
|
||
# Stash un-staged changes | ||
git stash -q --keep-index | ||
|
||
# Run pnpm commands | ||
echo "Linting..." | ||
pnpm lint | ||
LINT_EXIT_CODE=$? | ||
|
||
# Restore un-staged changes | ||
git stash pop -q | ||
|
||
# Check if tests or lint failed | ||
if [ $LINT_EXIT_CODE -ne 0 ]; then | ||
echo "Linting failed run 'pnpm lint:fix' to fix linting issues" | ||
exit 1 | ||
fi | ||
|
||
set -e | ||
|
||
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,14 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
# go to parent folder | ||
cd $(dirname $(dirname $(dirname $SCRIPT_DIR))) | ||
WORKING_DIR=$(pwd) | ||
|
||
# command-line input | ||
ARGS=$* | ||
|
||
# js client tests folder | ||
cd ${WORKING_DIR}/clients/js | ||
|
||
pnpm install && pnpm format:fix |
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 | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
# go to parent folder | ||
cd $(dirname $(dirname $(dirname $SCRIPT_DIR))) | ||
WORKING_DIR=$(pwd) | ||
|
||
# command-line input | ||
ARGS=$* | ||
|
||
# js client tests folder | ||
cd ${WORKING_DIR}/clients/js | ||
|
||
pnpm install && pnpm format |
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,19 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
OUTPUT="./programs/.bin" | ||
# go to parent folder | ||
cd $(dirname $(dirname $(dirname ${SCRIPT_DIR}))) | ||
|
||
rm -rf $OUTPUT | ||
|
||
if [ -z ${PROGRAMS+x} ]; then | ||
PROGRAMS="$(cat .github/.env | grep "PROGRAMS" | cut -d '=' -f 2)" | ||
fi | ||
|
||
PROGRAMS=$(echo ${PROGRAMS} | jq -c '.[]' | sed 's/"//g') | ||
WORKING_DIR=$(pwd) | ||
|
||
for p in ${PROGRAMS[@]}; do | ||
cargo fmt --all --manifest-path ./programs/${p}/Cargo.toml | ||
done |
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,19 @@ | ||
#!/bin/bash | ||
|
||
SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd) | ||
OUTPUT="./programs/.bin" | ||
# go to parent folder | ||
cd $(dirname $(dirname $(dirname ${SCRIPT_DIR}))) | ||
|
||
rm -rf $OUTPUT | ||
|
||
if [ -z ${PROGRAMS+x} ]; then | ||
PROGRAMS="$(cat .github/.env | grep "PROGRAMS" | cut -d '=' -f 2)" | ||
fi | ||
|
||
PROGRAMS=$(echo ${PROGRAMS} | jq -c '.[]' | sed 's/"//g') | ||
WORKING_DIR=$(pwd) | ||
|
||
for p in ${PROGRAMS[@]}; do | ||
cargo fmt --all --manifest-path ./programs/${p}/Cargo.toml -- --check | ||
done |
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 |
---|---|---|
|
@@ -13,13 +13,18 @@ | |
"validator": "CI=1 amman start --config ./configs/validator.cjs", | ||
"validator:debug": "amman start --config ./configs/validator.cjs", | ||
"validator:logs": "CI=1 amman logs", | ||
"validator:stop": "amman stop" | ||
"validator:stop": "amman stop", | ||
"lint:fix": "./configs/scripts/client/format-js.sh && ./configs/scripts/program/format.sh", | ||
"format:fix": "pnpm lint:fix", | ||
"lint": "./configs/scripts/client/lint-js.sh && ./configs/scripts/program/lint.sh", | ||
"prepare": "husky" | ||
}, | ||
"devDependencies": { | ||
"@metaplex-foundation/amman": "^0.12.1", | ||
"@metaplex-foundation/kinobi": "0.18.8-alpha.0", | ||
"@metaplex-foundation/shank-js": "^0.1.7", | ||
"husky": "^9.0.11", | ||
"typescript": "^4.9.4" | ||
}, | ||
"packageManager": "[email protected]" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.