@ivuorinen/config-checker 1.1.12 → 2.1.1
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/LICENSE.md +15 -3
- package/README.md +13 -13
- package/lib/config-checker.js +13 -13
- package/lib/configuration-paths.js +10 -10
- package/package.json +16 -6
package/LICENSE.md
CHANGED
|
@@ -2,8 +2,20 @@ MIT License
|
|
|
2
2
|
|
|
3
3
|
Copyright (c) 2023 Ismo Vuorinen
|
|
4
4
|
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
6
11
|
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
8
14
|
|
|
9
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -29,22 +29,22 @@ For commitlint-config you can find the usage in the [commitlint-config postinsta
|
|
|
29
29
|
Here's a snippet from the file:
|
|
30
30
|
|
|
31
31
|
```js
|
|
32
|
-
const process = require(
|
|
33
|
-
const checkConfig = require(
|
|
34
|
-
const foundConfig = checkConfig(
|
|
32
|
+
const process = require("process");
|
|
33
|
+
const checkConfig = require("@ivuorinen/config-checker");
|
|
34
|
+
const foundConfig = checkConfig("commitlint");
|
|
35
35
|
|
|
36
36
|
if (foundConfig.length > 0) {
|
|
37
|
-
console.log(
|
|
38
|
-
console.log(
|
|
39
|
-
console.log(`commitlint-config: Found config files at: ${foundConfig.join(
|
|
40
|
-
process.exit(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);
|
|
41
41
|
}
|
|
42
42
|
```
|
|
43
43
|
|
|
44
44
|
### Locations scanned
|
|
45
45
|
|
|
46
46
|
| Searched configuration files |
|
|
47
|
-
|
|
47
|
+
| ----------------------------------- |
|
|
48
48
|
| `[module name]` |
|
|
49
49
|
| `[module name]`rc |
|
|
50
50
|
| `[module name]`rc.json |
|
|
@@ -126,12 +126,12 @@ This project is licensed under the MIT License - see the [LICENSE.md][license-li
|
|
|
126
126
|
|
|
127
127
|
[changelog-link]: ./CHANGELOG.md
|
|
128
128
|
[contributing-link]: https://github.com/ivuorinen/.github/blob/main/CONTRIBUTING.md
|
|
129
|
-
[issue-link]: https://github.com/ivuorinen/
|
|
130
|
-
[license-badge]: https://img.shields.io/github/license/ivuorinen/
|
|
129
|
+
[issue-link]: https://github.com/ivuorinen/config-checker/issues
|
|
130
|
+
[license-badge]: https://img.shields.io/github/license/ivuorinen/config-checker?style=flat-square&labelColor=292a44&color=663399
|
|
131
131
|
[license-link]: ./LICENSE.md
|
|
132
132
|
[npm-badge]: https://img.shields.io/npm/v/@ivuorinen/config-checker?style=flat-square&labelColor=292a44&color=663399
|
|
133
133
|
[npm-link]: https://www.npmjs.com/package/@ivuorinen/config-checker
|
|
134
|
-
[pull-request-link]: https://github.com/ivuorinen/
|
|
134
|
+
[pull-request-link]: https://github.com/ivuorinen/config-checker/pulls
|
|
135
135
|
[style-badge]: https://img.shields.io/badge/code_style-ivuorinen%E2%80%99s-663399.svg?labelColor=292a44&style=flat-square
|
|
136
|
-
[style-link]: https://github.com/ivuorinen/
|
|
137
|
-
[commitlint-postinstall-link]: https://github.com/ivuorinen/base-configs
|
|
136
|
+
[style-link]: https://github.com/ivuorinen/config-checker
|
|
137
|
+
[commitlint-postinstall-link]: https://github.com/ivuorinen/base-configs-commitlint/scripts/postinstall.js
|
package/lib/config-checker.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/* eslint no-console: "off", n/no-process-exit: "off" -- CLI app that gives users feedback */
|
|
2
2
|
|
|
3
|
-
const fs = require(
|
|
4
|
-
const path = require(
|
|
3
|
+
const fs = require("node:fs");
|
|
4
|
+
const path = require("node:path");
|
|
5
5
|
// noinspection NpmUsedModulesInstalled
|
|
6
|
-
const process = require(
|
|
7
|
-
const configurationPaths = require(
|
|
6
|
+
const process = require("node:process");
|
|
7
|
+
const configurationPaths = require("./configuration-paths");
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Checks for the existence of a configuration file.
|
|
@@ -12,21 +12,21 @@ const configurationPaths = require('./configuration-paths')
|
|
|
12
12
|
* @param {string} pathPrefix The prefix to add to the path.
|
|
13
13
|
* @returns {string[]} - The paths to the configuration files.
|
|
14
14
|
*/
|
|
15
|
-
const configChecker = (moduleName, pathPrefix =
|
|
16
|
-
let searchPath = process.env.INIT_CWD
|
|
15
|
+
const configChecker = (moduleName, pathPrefix = "") => {
|
|
16
|
+
let searchPath = process.env.INIT_CWD;
|
|
17
17
|
if (pathPrefix.length > 0) {
|
|
18
|
-
searchPath = pathPrefix
|
|
18
|
+
searchPath = pathPrefix;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
const allFiles = configurationPaths(moduleName)
|
|
21
|
+
const allFiles = configurationPaths(moduleName);
|
|
22
22
|
|
|
23
23
|
if (process.env.DEBUG) {
|
|
24
|
-
const filesWithPath = allFiles.map(file => path.join(searchPath, file))
|
|
25
|
-
console.log(filesWithPath)
|
|
24
|
+
const filesWithPath = allFiles.map((file) => path.join(searchPath, file));
|
|
25
|
+
console.log(filesWithPath);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
// Look for config files in defined search path, and return found.
|
|
29
|
-
return allFiles.filter(file => fs.existsSync(path.join(searchPath, file)))
|
|
30
|
-
}
|
|
29
|
+
return allFiles.filter((file) => fs.existsSync(path.join(searchPath, file)));
|
|
30
|
+
};
|
|
31
31
|
|
|
32
|
-
module.exports = configChecker
|
|
32
|
+
module.exports = configChecker;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
const path = require(
|
|
1
|
+
const path = require("node:path");
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Returns an array of configuration paths.
|
|
5
5
|
* @param {string} moduleName The name of the module to check for.
|
|
6
6
|
* @returns {string[]} - The paths to the configuration files.
|
|
7
7
|
*/
|
|
8
|
-
const configurationPaths = moduleName => {
|
|
8
|
+
const configurationPaths = (moduleName) => {
|
|
9
9
|
const filesPlain = [
|
|
10
10
|
moduleName,
|
|
11
11
|
`${moduleName}rc`,
|
|
@@ -22,14 +22,14 @@ const configurationPaths = moduleName => {
|
|
|
22
22
|
`${moduleName}.config.js`,
|
|
23
23
|
`${moduleName}.config.ts`,
|
|
24
24
|
`${moduleName}.config.mjs`,
|
|
25
|
-
`${moduleName}.config.cjs
|
|
26
|
-
]
|
|
25
|
+
`${moduleName}.config.cjs`,
|
|
26
|
+
];
|
|
27
27
|
|
|
28
|
-
const filesDot = filesPlain.map(file => `.${file}`)
|
|
29
|
-
const bothFiles = filesPlain.concat(filesDot)
|
|
30
|
-
const filesInConfig = bothFiles.map(file => path.join(
|
|
28
|
+
const filesDot = filesPlain.map((file) => `.${file}`);
|
|
29
|
+
const bothFiles = filesPlain.concat(filesDot);
|
|
30
|
+
const filesInConfig = bothFiles.map((file) => path.join(".config", file));
|
|
31
31
|
|
|
32
|
-
return bothFiles.concat(filesInConfig)
|
|
33
|
-
}
|
|
32
|
+
return bothFiles.concat(filesInConfig);
|
|
33
|
+
};
|
|
34
34
|
|
|
35
|
-
module.exports = configurationPaths
|
|
35
|
+
module.exports = configurationPaths;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ivuorinen/config-checker",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"description": "Checks the commonly used configuration locations for configuration files",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"check-config",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"name": "Ismo Vuorinen",
|
|
16
16
|
"url": "https://github.com/ivuorinen"
|
|
17
17
|
},
|
|
18
|
-
"homepage": "https://github.com/ivuorinen/
|
|
18
|
+
"homepage": "https://github.com/ivuorinen/config-checker#readme",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"main": "lib/config-checker.js",
|
|
21
21
|
"directories": {
|
|
@@ -30,14 +30,24 @@
|
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "git+https://github.com/ivuorinen/
|
|
33
|
+
"url": "git+https://github.com/ivuorinen/config-checker.git"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"test": "node ./__tests__/config-checker.test.js",
|
|
37
|
-
"generate-table": "node ./helpers/generate-md-table.js"
|
|
37
|
+
"generate-table": "node ./helpers/generate-md-table.js",
|
|
38
|
+
"semantic-release": "semantic-release"
|
|
38
39
|
},
|
|
39
40
|
"bugs": {
|
|
40
|
-
"url": "https://github.com/ivuorinen/
|
|
41
|
+
"url": "https://github.com/ivuorinen/config-checker/issues"
|
|
41
42
|
},
|
|
42
|
-
"
|
|
43
|
+
"packageManager": "yarn@4.12.0",
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
46
|
+
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
47
|
+
"@semantic-release/git": "^10.0.1",
|
|
48
|
+
"@semantic-release/github": "^12.0.2",
|
|
49
|
+
"@semantic-release/npm": "^13.1.2",
|
|
50
|
+
"@semantic-release/release-notes-generator": "^14.1.0",
|
|
51
|
+
"semantic-release": "^25.0.2"
|
|
52
|
+
}
|
|
43
53
|
}
|