Skip to content

Commit 8379309

Browse files
committed
chore: add vscode recommendations; jira commit tagging
1 parent d890d31 commit 8379309

File tree

5 files changed

+46
-2
lines changed

5 files changed

+46
-2
lines changed

.husky/pre-commit

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
#!/usr/bin/env sh
22
. "$(dirname -- "$0")/_/husky.sh"
33

4-
yarn lint-staged
4+
yarn lint-staged --allow-empty
5+
6+
# If CI files are added/edited and the circleci cli is available, validate the config
7+
if [[ ! -z "$(command -v gh)" && ! -z "$(gh extension list | grep actionlint)" ]]; then
8+
gh actionlint
9+
fi

.husky/prepare-commit-msg

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/sh
2+
#
3+
# ABOUT: a git prepare-commit-msg hook for automatically postfixing
4+
# an ticket number to commit messages based on the branch name
5+
6+
# check if commit is merge commit or a commit ammend
7+
[[ $2 = "merge" || $2 = "commit" ]] && exit
8+
9+
# Regex: looks for CSS or JIRA followed by either a dash, underscore, or nothing and then a number; case insensitive
10+
ISSUE_KEY=`git rev-parse --abbrev-ref HEAD | sed -r 's/^.*[CSS|JIRA][-|_]{0,1}([0-9]+).*$/CSS-\1/I'`
11+
12+
# If the parse above returns the full branch name, default to the original message
13+
# Must quote variable and the command to compare strings in bash
14+
[[ "$ISSUE_KEY" == "$(git rev-parse --abbrev-ref HEAD)" ]] && exit
15+
16+
# issue key matched from branch prefix, postfix to commit message
17+
TEMP=`mktemp /tmp/commitmsg-XXXXX`
18+
(echo "$(cat $1) [$ISSUE_KEY]") > $TEMP
19+
cat $TEMP > $1

.vscode/extensions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"rajdeepchandra.spectrum-design-tokens-for-vscode",
4+
"gruntfuggly.todo-tree",
5+
"nrwl.angular-console",
6+
"esbenp.prettier-vscode",
7+
"vunguyentuan.vscode-postcss",
8+
"mariusschulz.yarn-lock-syntax"
9+
]
10+
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"mv:preview": "rimraf dist/preview && mv tools/preview/storybook-static dist/preview",
4545
"new": "nx run @spectrum-css/generator:new",
4646
"precommit": "lint-staged",
47-
"prepare": "husky install",
47+
"prepare": "sh ./tasks/prepare.sh",
4848
"prepare:site": "run-s clean:docs build:all",
4949
"prerelease": "yarn version:build",
5050
"release": "lerna publish",

tasks/prepare.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env sh
2+
3+
[ -n "$CI" ] && exit 0
4+
5+
husky install
6+
7+
# Install gh actionlint if user has the gh cli; skips with no errors if not
8+
if [[ ! -z "$(command -v gh)" && -z "$(gh extension list | grep actionlint)" ]]; then
9+
gh extension install cschleiden/gh-actionlint >> /dev/null 2>&1
10+
fi

0 commit comments

Comments
 (0)