@ivuorinen/config-checker 1.1.0 → 1.1.2

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.
Files changed (2) hide show
  1. package/README.md +91 -10
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -6,7 +6,7 @@ Check for existence of common configuration files in usually used locations.
6
6
 
7
7
  ## Installation
8
8
 
9
- Install `this package` as a _`dependencies`_:
9
+ Install `this package` as a _`dependency`_:
10
10
 
11
11
  ```sh
12
12
  # npm
@@ -18,20 +18,100 @@ yarn add @ivuorinen/config-checker
18
18
 
19
19
  ## Usage
20
20
 
21
- ```js
22
- const configChecker = require('@ivuorinen/config-checker')
21
+ This package is intended to be used in lifecycle events of other packages.
22
+
23
+ Configuration packages located in this repository use this tool to check for existence of configuration files, and if they exist, they will not create new ones.
24
+
25
+ ### Real world example
23
26
 
24
- // Check for existance of configuration files.
25
- // Module name for Eslint would be 'eslint' for example.
26
- const configFiles = configChecker('module-name')
27
+ For commitlint-config you can find the usage in the [commitlint-config postinstall.js][commitlint-postinstall-link] file.
27
28
 
28
- if (configFiles.length > 0) {
29
- console.log('Found configuration files', configFiles)
30
- } else {
31
- console.log('No configuration files found')
29
+ Here's a snippet from the file:
30
+
31
+ ```js
32
+ const process = require('process')
33
+ const checkConfig = require('@ivuorinen/config-checker')
34
+ const foundConfig = checkConfig('commitlint')
35
+
36
+ if (foundConfig.length > 0) {
37
+ console.log('commitlint-config: Found existing commitlint config file, skipping creation.')
38
+ console.log('commitlint-config: If you want to create a new config file, please remove the existing one.')
39
+ console.log(`commitlint-config: Found config files at: ${foundConfig.join(', ')}`)
40
+ process.exit(0)
32
41
  }
33
42
  ```
34
43
 
44
+ ### Locations scanned
45
+
46
+ | Searched configuration files |
47
+ | ----------------------------------- |
48
+ | `[module name]` |
49
+ | `[module name]`rc |
50
+ | `[module name]`rc.json |
51
+ | `[module name]`rc.yaml |
52
+ | `[module name]`rc.yml |
53
+ | `[module name]`rc.js |
54
+ | `[module name]`rc.ts |
55
+ | `[module name]`rc.mjs |
56
+ | `[module name]`rc.cjs |
57
+ | `[module name]`.jsonc |
58
+ | `[module name]`.yaml |
59
+ | `[module name]`.json |
60
+ | `[module name]`.config.js |
61
+ | `[module name]`.config.ts |
62
+ | `[module name]`.config.mjs |
63
+ | `[module name]`.config.cjs |
64
+ | .`[module name]` |
65
+ | .`[module name]`rc |
66
+ | .`[module name]`rc.json |
67
+ | .`[module name]`rc.yaml |
68
+ | .`[module name]`rc.yml |
69
+ | .`[module name]`rc.js |
70
+ | .`[module name]`rc.ts |
71
+ | .`[module name]`rc.mjs |
72
+ | .`[module name]`rc.cjs |
73
+ | .`[module name]`.jsonc |
74
+ | .`[module name]`.yaml |
75
+ | .`[module name]`.json |
76
+ | .`[module name]`.config.js |
77
+ | .`[module name]`.config.ts |
78
+ | .`[module name]`.config.mjs |
79
+ | .`[module name]`.config.cjs |
80
+ | .config/`[module name]` |
81
+ | .config/`[module name]`rc |
82
+ | .config/`[module name]`rc.json |
83
+ | .config/`[module name]`rc.yaml |
84
+ | .config/`[module name]`rc.yml |
85
+ | .config/`[module name]`rc.js |
86
+ | .config/`[module name]`rc.ts |
87
+ | .config/`[module name]`rc.mjs |
88
+ | .config/`[module name]`rc.cjs |
89
+ | .config/`[module name]`.jsonc |
90
+ | .config/`[module name]`.yaml |
91
+ | .config/`[module name]`.json |
92
+ | .config/`[module name]`.config.js |
93
+ | .config/`[module name]`.config.ts |
94
+ | .config/`[module name]`.config.mjs |
95
+ | .config/`[module name]`.config.cjs |
96
+ | .config/.`[module name]` |
97
+ | .config/.`[module name]`rc |
98
+ | .config/.`[module name]`rc.json |
99
+ | .config/.`[module name]`rc.yaml |
100
+ | .config/.`[module name]`rc.yml |
101
+ | .config/.`[module name]`rc.js |
102
+ | .config/.`[module name]`rc.ts |
103
+ | .config/.`[module name]`rc.mjs |
104
+ | .config/.`[module name]`rc.cjs |
105
+ | .config/.`[module name]`.jsonc |
106
+ | .config/.`[module name]`.yaml |
107
+ | .config/.`[module name]`.json |
108
+ | .config/.`[module name]`.config.js |
109
+ | .config/.`[module name]`.config.ts |
110
+ | .config/.`[module name]`.config.mjs |
111
+ | .config/.`[module name]`.config.cjs |
112
+
113
+ This list has been generated using `npm run generate-table`.
114
+
35
115
  ## Contributing
36
116
 
37
117
  If you are interested in helping contribute, please take a look at our [contribution guidelines][contributing-link] and open an [issue][issue-link] or [pull request][pull-request-link].
@@ -54,3 +134,4 @@ This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md
54
134
  [pull-request-link]: https://github.com/ivuorinen/base-configs/pulls
55
135
  [style-badge]: https://img.shields.io/badge/code_style-ivuorinen%E2%80%99s-663399.svg?labelColor=292a44&style=flat-square
56
136
  [style-link]: https://github.com/ivuorinen/base-configs
137
+ [commitlint-postinstall-link]: https://github.com/ivuorinen/base-configs/blob/main/packages/commitlint-config/scripts/postinstall.js
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ivuorinen/config-checker",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "Checks the commonly used configuration locations for configuration files",
5
5
  "keywords": [
6
6
  "check-config",
@@ -34,10 +34,10 @@
34
34
  },
35
35
  "scripts": {
36
36
  "test": "node ./__tests__/config-checker.test.js",
37
- "files": "node ./helpers/files.js"
37
+ "generate-table": "node ./helpers/generate-md-table.js"
38
38
  },
39
39
  "bugs": {
40
40
  "url": "https://github.com/ivuorinen/base-configs/issues"
41
41
  },
42
- "gitHead": "56362dad967f93f6b3840f784fe7d53b654a860c"
42
+ "gitHead": "007b29019ebc5f13a231d96c17710f52b1760368"
43
43
  }