Skip to content

Commit

Permalink
Merge pull request #1927 from vishal423/pretty-quick-to-lint-staged
Browse files Browse the repository at this point in the history
chore: Replace pretty-quick with lint-staged
  • Loading branch information
vishal423 authored Nov 21, 2023
2 parents f0095a4 + 44d5550 commit 6f148ce
Show file tree
Hide file tree
Showing 10 changed files with 1,096 additions and 301 deletions.
66 changes: 33 additions & 33 deletions .github/workflows/copyright-update.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
name: Copyright Update
on:
schedule:
- cron: '0 0 31 12 *' # Repeats December 31st every year
schedule:
- cron: '0 0 31 12 *' # Repeats December 31st every year

permissions:
contents: read
contents: read

jobs:
build:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
name: copyright update
if: github.repository == 'jhipster/generator-jhipster-svelte'
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
# Checkout
- uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
# Update the copyright headers
- name: Find and Replace
run: |
CURRENT_YEAR=$(date +'%Y')
NEW_YEAR=$(($CURRENT_YEAR + 1))
grep -rlZE "Copyright ([0-9]+)-$CURRENT_YEAR" . | xargs -0 sed -i -E "s/Copyright ([0-9]+)-$CURRENT_YEAR/Copyright \1-$NEW_YEAR/g"
# Create PR
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Update copyright headers'
title: 'Update Copyright Headers'
body: 'This is an automated pull request to update the copyright headers'
branch: 'copyright-date-update'
author: 'jhipster-bot <[email protected]>'
build:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
name: copyright update
if: github.repository == 'jhipster/generator-jhipster-svelte'
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
# Checkout
- uses: actions/checkout@v3
with:
ref: main
fetch-depth: 0
# Update the copyright headers
- name: Find and Replace
run: |
CURRENT_YEAR=$(date +'%Y')
NEW_YEAR=$(($CURRENT_YEAR + 1))
grep -rlZE "Copyright ([0-9]+)-$CURRENT_YEAR" . | xargs -0 sed -i -E "s/Copyright ([0-9]+)-$CURRENT_YEAR/Copyright \1-$NEW_YEAR/g"
# Create PR
- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'Update copyright headers'
title: 'Update Copyright Headers'
body: 'This is an automated pull request to update the copyright headers'
branch: 'copyright-date-update'
author: 'jhipster-bot <[email protected]>'
4 changes: 1 addition & 3 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install pretty-quick --staged

npm run lint
npx --no-install lint-staged
3 changes: 3 additions & 0 deletions .lintstagedrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"src/*": ["npm run lint", "npm run format", "npm run check"]
}
2 changes: 1 addition & 1 deletion generators/client/templates/svelte/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"prettier": "2.8.8",
"prettier-plugin-svelte": "2.10.1",
"prettier-plugin-organize-imports": "3.2.2",
"pretty-quick": "3.1.3",
"lint-staged": "14.0.1",
"rimraf": "5.0.5",
"svelte": "4.2.3",
"tailwindcss": "3.3.4",
Expand Down
1 change: 1 addition & 0 deletions generators/common/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const commonFiles = {
{
condition: generator => !generator.skipCommitHook,
templates: [
'.lintstagedrc.json',
{
file: 'pre-commit',
renameTo: () => '.husky/pre-commit',
Expand Down
7 changes: 7 additions & 0 deletions generators/common/templates/.lintstagedrc.json.ejs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"src/*": [
"npm run lint",
"npm run format",
"npm run check"
]
}
2 changes: 1 addition & 1 deletion generators/common/templates/pre-commit.ejs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no-install pretty-quick --staged
npx --no-install lint-staged
2 changes: 1 addition & 1 deletion generators/server/templates/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"devDependencies": {
"husky": "8.0.3",
"pretty-quick": "3.1.3",
"lint-staged": "14.0.1",
"prettier": "2.8.7",
"prettier-plugin-java": "2.1.0",
"prettier-plugin-packagejson": "2.4.3"
Expand Down
Loading

0 comments on commit 6f148ce

Please sign in to comment.