Browse Source

Merge pull request #14821 from abpframework/git-prettier-hook

Git prettier hook
pull/14957/head
Muhammed Altuğ 4 years ago
committed by GitHub
parent
commit
a65b9422a6
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      npm/ng-packs/.prettierignore
  2. 10
      npm/ng-packs/README.md
  3. 31
      npm/ng-packs/package.json
  4. 2
      npm/ng-packs/pre-commit

6
npm/ng-packs/.prettierignore

@ -2,3 +2,9 @@
/dist
/coverage
/.angular
/.vscode
/node_modules
/scripts
/tools
/source-code-requirements

10
npm/ng-packs/README.md

@ -22,4 +22,12 @@ The `dev-app` project is the same as the Angular UI template project. `dev-app`
For more information, see the [docs.abp.io](https://docs.abp.io)
If would you like contribute, see the [contribution guideline](./CONTRIBUTING.md).
### Git Hooks
There is a pre-defined git hook for Angular project. This hook is `pre-commit`. The hook run prettier for staged files. If you want to use this hook. (This steps tested for linux and Mac os)
- Go to `npm/ng-packs`
- Run `chmod +x ./pre-commit` in terminal
- Run `git config core.hooksPath npm/ng-packs` in terminal
and now, when you create a git commit, git hook execute prettier for staged files.

31
npm/ng-packs/package.json

@ -10,6 +10,7 @@
"build:all": "nx run-many --target=build --all --exclude=dev-app,schematics --prod && yarn build:schematics",
"test": "ng test --detect-open-handles=true --run-in-band=true --watch-all=true",
"test:all": "nx run-many --target=test --all",
"lint-staged": "lint-staged",
"lint": "nx workspace-lint && ng lint",
"lint:all": "nx run-many --target=lint --all",
"e2e": "ng e2e",
@ -40,6 +41,17 @@
},
"private": true,
"devDependencies": {
"@abp/ng.account": "~6.0.1",
"@abp/ng.account.core": "~6.0.1",
"@abp/ng.core": "~6.0.1",
"@abp/ng.feature-management": "~6.0.1",
"@abp/ng.identity": "~6.0.1",
"@abp/ng.permission-management": "~6.0.1",
"@abp/ng.schematics": "~6.0.1",
"@abp/ng.setting-management": "~6.0.1",
"@abp/ng.tenant-management": "~6.0.1",
"@abp/ng.theme.basic": "~6.0.1",
"@abp/ng.theme.shared": "~6.0.1",
"@abp/utils": "~6.0.1",
"@angular-devkit/build-angular": "14.2.1",
"@angular-devkit/build-ng-packagr": "^0.1002.0",
@ -59,17 +71,6 @@
"@angular/platform-browser": "14.2.1",
"@angular/platform-browser-dynamic": "14.2.1",
"@angular/router": "14.2.1",
"@abp/ng.account": "~6.0.1",
"@abp/ng.account.core": "~6.0.1",
"@abp/ng.core": "~6.0.1",
"@abp/ng.feature-management": "~6.0.1",
"@abp/ng.identity": "~6.0.1",
"@abp/ng.permission-management": "~6.0.1",
"@abp/ng.schematics": "~6.0.1",
"@abp/ng.setting-management": "~6.0.1",
"@abp/ng.tenant-management": "~6.0.1",
"@abp/ng.theme.basic": "~6.0.1",
"@abp/ng.theme.shared": "~6.0.1",
"@fortawesome/fontawesome-free": "^5.15.4",
"@ng-bootstrap/ng-bootstrap": "~13.0.0",
"@ngneat/spectator": "^10.0.0",
@ -105,6 +106,7 @@
"just-clone": "^3.2.1",
"just-compare": "^1.4.0",
"lerna": "^4.0.0",
"lint-staged": "^13.0.3",
"ng-packagr": "14.2.1",
"ng-zorro-antd": "^14.0.0",
"nx": "14.7.5",
@ -125,5 +127,10 @@
"typescript": "4.7.4",
"zone.js": "0.11.4"
},
"dependencies": {}
"dependencies": {},
"lint-staged": {
"**/*.{js,jsx,ts,tsx}":[
"npx prettier --write --config .prettierrc "
]
}
}

2
npm/ng-packs/pre-commit

@ -0,0 +1,2 @@
#!/usr/bin/env sh
cd npm/ng-packs && npm run lint-staged
Loading…
Cancel
Save