@p8ec/shared 2.2.5 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -4,7 +4,13 @@ Shared TypeScript/JavaScript libraries for P(8) products.
4
4
 
5
5
  ## Shared Configuration
6
6
 
7
- Shared configuration for P(8) projects.
7
+ Shared (**and very opinionated**) configuration for P(8) projects.
8
+
9
+ **Contents:**
10
+ - ESLint configuration
11
+ - Prettier configuration
12
+ - Commitlint configuration
13
+ - Lefthook configuration
8
14
 
9
15
  ### Usage
10
16
 
@@ -23,20 +29,31 @@ p8-cli init
23
29
  This command will create the following files in your project and remove corresponding configuration entries
24
30
  from `package.json`:
25
31
 
26
- #### **`.eslintrc.js`**
32
+ #### **`.eslintrc.cjs`**
27
33
 
28
34
  ```javascript
35
+ /* eslint-disable */
29
36
  module.exports = require('@p8ec/shared').eslintConfigRecommended;
30
37
  ```
31
38
 
32
- #### **`.prettierrc.js`**
39
+ #### **`.prettierrc.cjs`**
33
40
 
34
41
  ```javascript
42
+ /* eslint-disable */
35
43
  module.exports = require('@p8ec/shared').prettierConfigRecommended;
36
44
  ```
37
45
 
46
+ #### **`.commitlintrc.cjs`**
47
+
48
+ ```javascript
49
+ /* eslint-disable */
50
+ module.exports = { extends: ["@commitlint/config-conventional"] };
51
+ ```
52
+
38
53
  ## P(8) CLI Tool
39
54
 
55
+ A command-line interface (CLI) tool for P(8) projects to simplify common tasks.
56
+
40
57
  ### Syntax
41
58
 
42
59
  ```shell
@@ -46,6 +63,8 @@ p8-cli [command] [options]
46
63
  ### Commands
47
64
 
48
65
  - `init` - Initialize P(8) shared configuration in your project. Options: `cleanup` - remove configuration entries from `package.json`
66
+ - Example: `p8-cli init --cleanup` - initializes the shared configuration and removes corresponding entries from `package.json`.
49
67
  - `dirn` - Get the directory name. Options: `0` - current directory (default), `1` - parent directory, `2` - 2 levels up
50
68
  directory, etc.
69
+ - Example: `p8-cli dirn 1` - shows the parent directory name.
51
70
 
@@ -1,6 +1,19 @@
1
- # Refer for explanation to following link:
1
+ # Refer for explanation to the following link:
2
2
  # https://github.com/evilmartians/lefthook/blob/master/docs/configuration.md
3
3
 
4
+ ### Pre-commit hook ###
5
+ # 1. Block commits to main, master, and release branches
6
+ pre-commit:
7
+ commands:
8
+ git:
9
+ run: |
10
+ if [[ $(git rev-parse --abbrev-ref HEAD) =~ ^(main|master|release)$ ]]; then
11
+ echo "Direct commits to main, master, and release branches are not allowed."
12
+ exit 1
13
+ fi
14
+
15
+ ### Commit message hook ###
16
+ # 1. Allow only commit messages that follow a conventional commit format
4
17
  commit-msg:
5
18
  commands:
6
19
  commitlint:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@p8ec/shared",
3
- "version": "2.2.5",
3
+ "version": "2.3.0",
4
4
  "description": "P(8) Global Shared Library for Javascript",
5
5
  "repository": {
6
6
  "type": "git",