Skip to content

Commit ad23ba4

Browse files
authored
feat: removed unit test questionaire and added "pre-push" command (#3)
1 parent 621a7f9 commit ad23ba4

File tree

8 files changed

+37
-31
lines changed

8 files changed

+37
-31
lines changed

README.md

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11

2-
# @ng-vim/devtools
3-
4-
1. Auto format your staged files before commiting using prettier configuration
5-
2. Run your unit test cases before pushing your code to server.
6-
3. Make sure your commit messages are per commitlint standard.
7-
8-
Above funtionality can be integrated in your angular workspace using single schematic command.
9-
This schematics will integrate git hooks using husky in your angular workspace.
2+
<p align="center">
3+
<img width="30%" height="30%" src="./logo.png">
4+
</p>
105

11-
<br/>
6+
# @ng-vim/devtools
7+
A schematic to integrate husky, prettier and commit-lint in your angular application
128

13-
<p align="center">
9+
<p align="left">
1410
<a href="https://www.npmjs.com/package/@ng-vim/devtools">
1511
<img src="https://img.shields.io/npm/v/@ng-vim/devtools/latest.svg" alt="NPM Version" />
1612
</a>
@@ -19,13 +15,34 @@ This schematics will integrate git hooks using husky in your angular workspace.
1915
</a>
2016
</p>
2117

18+
2219
## 🌟 Install
2320

2421
```sh
2522
$ ng add @ng-vim/devtools
2623
```
2724

28-
that's it.
25+
26+
Running above schematics in your angular application will integrate below functionality.
27+
1. Auto format your staged files before commiting using prettier configuration
28+
1. Make sure your commit messages are per commitlint standard.
29+
30+
<br/>
31+
32+
33+
After this whenever you will try to perform any git actions like `git commit` and `git push`, husky command will be executed for the respective commands.
34+
35+
## Troubleshoot
36+
If you are using Linux/Max operating system you need to give execution permission to `.husky` and `.git/hooks` folder.
37+
```sh
38+
chmod ug+x .husky/*
39+
chmod ug+x .git/hooks/*
40+
```
41+
42+
43+
## Husky Documentation
44+
https://typicode.github.io/husky
45+
2946

3047

3148
## License

logo.png

22.2 KB
Loading

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ng-vim/devtools",
3-
"version": "1.0.5",
3+
"version": "1.1.0",
44
"description": "A schematics to integrate husky with prettier and commitlint in your angular workspace",
55
"license": "MIT",
66
"schematics": "./collection.json",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
<% if(includeAngularCommands) %> npm run test-ci
4+
npm run pre-push

src/ng-add/index.ts

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ export default function (options: Options): Rule {
1616
addPackageJsonDependencies(),
1717
installDependencies(),
1818
addTemplateFiles(options),
19-
updatePackageCommands(options)
19+
updatePackageCommands()
2020
])(tree, _context);
2121
};
2222
}
2323

24-
function updatePackageCommands(options: Options): Rule {
24+
function updatePackageCommands(): Rule {
2525
return (tree: Tree, _context: SchematicContext) => {
2626
const packagePath: string = './package.json';
2727
const buffer = tree.read(packagePath);
@@ -32,15 +32,11 @@ function updatePackageCommands(options: Options): Rule {
3232

3333
const pkg: any = JSON.parse(buffer.toString());
3434

35-
pkg.scripts['format'] = 'pretty-quick --staged';
36-
pkg.scripts['pre-commit'] = 'npm run format';
35+
pkg.scripts['prettier'] = 'pretty-quick --staged';
36+
pkg.scripts['pre-commit'] = 'npm run prettier';
37+
pkg.scripts['pre-push'] = '';
3738
pkg.scripts['prepare'] = 'husky install';
3839

39-
if (options.includeAngularCommands) {
40-
pkg.scripts['test-ci'] =
41-
'ng test -- --no-watch --no-progress --browsers=ChromeHeadless';
42-
}
43-
4440
tree.overwrite(packagePath, JSON.stringify(pkg, null, 2));
4541
};
4642
}

src/ng-add/interfaces.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ export interface Workspace {
1010

1111
export interface Options {
1212
integrateCommitlint: boolean;
13-
includeAngularCommands: boolean;
1413
}

src/ng-add/schema.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
"title": "Ngx Builder ng-add schematic",
55
"type": "object",
66
"properties": {
7-
"includeAngularCommands": {
8-
"description": "commitlint integration",
9-
"type": "boolean",
10-
"default": false,
11-
"x-prompt": "Would you like to integrate angular unit test command ?"
12-
},
137
"skipConfirmation": {
148
"description": "Skip asking a confirmation prompt before installing and executing the package. Ensure package name is correct prior to using this option.",
159
"type": "boolean",

0 commit comments

Comments
 (0)