Skip to content

Commit

Permalink
feat(ref: no-ref): add setup hooks, remove karma (#1340)
Browse files Browse the repository at this point in the history
* feat(ref: no-ref): add setup hooks, remove carma

* feat(ref: no-ref): remove environment

* feat(ref: no-ref): fix warnings in console

* feat(ref: no-ref): remove cypress from lib folder

* feat(ref: no-ref): add text to readme
  • Loading branch information
andriikamaldinov1 authored Mar 29, 2024
1 parent 779babe commit ec15f30
Show file tree
Hide file tree
Showing 31 changed files with 1,836 additions and 863 deletions.
6 changes: 0 additions & 6 deletions .github/.hooks/commit-msg/check-commit-msg.sh

This file was deleted.

6 changes: 6 additions & 0 deletions .github/hooks/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

set -e

commit_msg=$(cat .git/COMMIT_EDITMSG)
echo "$commit_msg" | npx commitlint
2 changes: 1 addition & 1 deletion .github/.hooks/pre-commit/quality.sh → .github/hooks/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin
#!/bin/bash

set -e

Expand Down
39 changes: 39 additions & 0 deletions .github/scripts/setup_hooks.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/bin/bash

# Define the directory containing sample hooks
SAMPLE_HOOKS_DIR=".github/hooks"

# Define the target directory for Git hooks
GIT_HOOKS_DIR=".git/hooks"

# Function to copy or replace hooks
copy_or_replace_hooks() {
for hook in "$SAMPLE_HOOKS_DIR"/*; do
hook_name=$(basename "$hook")
target_hook="$GIT_HOOKS_DIR/$hook_name"
if [ -f "$target_hook" ]; then
echo "Replacing existing hook: $hook_name"
else
echo "Copying new hook: $hook_name"
fi
cp "$hook" "$target_hook"
chmod ug+x "$target_hook" # Ensure executable permission is set
done
}

# Main function
main() {
# Check if .git/hooks directory exists
if [ ! -d "$GIT_HOOKS_DIR" ]; then
echo "Error: .git/hooks directory not found. Are you in a Git repository?"
exit 1
fi

# Copy or replace hooks
copy_or_replace_hooks

echo "Git hooks setup complete."
}

# Run the main function
main
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,10 @@ Then, just define masks in inputs.

Text [documentation](https://github.com/JsDaddy/ngx-mask/blob/develop/USAGE.md)

## Setup hooks
```bash
$ npm run init:hooks
```

## Contributing
We would love some contributions! Check out this [document](https://github.com/JsDaddy/ngx-mask/blob/develop/CONTRIBUTING.md) to get started.
61 changes: 16 additions & 45 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"outputPath": "dist/ngx-mask",
"index": "src/index.html",
"browser": "src/main.ts",
"tsConfig": "src/tsconfig.app.json",
"tsConfig": "tsconfig.app.json",
"assets": ["src/assets", "src/favicon.ico"],
"styles": [
"node_modules/highlight.js/styles/github.css",
Expand All @@ -36,31 +36,18 @@
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
"maximumWarning": "2mb",
"maximumError": "2mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "5kb",
"maximumError": "7kb"
}
],
"optimization": true,
"sourceMap": false,
"namedChunks": false,
"extractLicenses": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
"maximumWarning": "15kb",
"maximumError": "15kb"
}
],
"outputHashing": "all"
},
"development": {
"define": {
"VERSION": "'v0.0.1'"
},
"optimization": false,
"extractLicenses": false,
"sourceMap": true
Expand All @@ -79,26 +66,21 @@
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"buildTarget": "ngx-mask:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:web-test-runner",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"codeCoverage": true,
"sourceMap": true,
"scripts": [],
"styles": [
"node_modules/bootstrap/dist/css/bootstrap-grid.css",
"src/styles.scss"
"tsConfig": "tsconfig.spec.json",
"inlineStyleLanguage": "scss",
"assets": [
"src/favicon.ico",
"src/assets"
],
"polyfills": [
"zone.js",
"zone.js/testing"
],
"assets": ["src/assets", "src/favicon.ico"]
"styles": ["src/styles.scss"],
"scripts": []
}
},
"lint": {
Expand Down Expand Up @@ -128,17 +110,6 @@
}
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "projects/ngx-mask-lib/src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "projects/ngx-mask-lib/tsconfig.spec.json",
"karmaConfig": "projects/ngx-mask-lib/karma.conf.js",
"codeCoverage": true,
"sourceMap": true
}
},
"lint": {
"builder": "@angular-eslint/builder:lint",
"options": {
Expand Down
Loading

0 comments on commit ec15f30

Please sign in to comment.