Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add git hook + task for prettier #45

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ node_modules/:
.PHONY: ensure
ensure: node_modules/

.PHONY: setup-git-hooks
setup-git-hooks:
cp bin/pre-push-git-hook .git/hooks/pre-push

.PHONY: test
test: ensure
npx vitest --run
Expand Down
11 changes: 11 additions & 0 deletions bin/pre-push-git-hook
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0

# Prettify all selected files
echo "$FILES" | xargs ./node_modules/.bin/prettier --ignore-unknown --write

# Add back the modified/prettified files to staging
echo "$FILES" | xargs git add

exit 0
8 changes: 7 additions & 1 deletion src/Node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ type Options = {
id?: Node["id"];
/** When true the server will omit this node's output. Default: false */
hide?: boolean;
};
};







export class Node<Args = Object> {
/** The id of the node. Default: random id */
Expand Down
Loading