@ivuorinen/config-checker 1.1.13 → 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/README.md +1 -3
- package/lib/config-checker.js +13 -13
- package/lib/configuration-paths.js +10 -10
- package/package.json +13 -2
package/README.md
CHANGED
|
@@ -35,9 +35,7 @@ const foundConfig = checkConfig("commitlint");
|
|
|
35
35
|
|
|
36
36
|
if (foundConfig.length > 0) {
|
|
37
37
|
console.log("commitlint-config: Found existing commitlint config file, skipping creation.");
|
|
38
|
-
console.log(
|
|
39
|
-
"commitlint-config: If you want to create a new config file, please remove the existing one.",
|
|
40
|
-
);
|
|
38
|
+
console.log("commitlint-config: If you want to create a new config file, please remove the existing one.");
|
|
41
39
|
console.log(`commitlint-config: Found config files at: ${foundConfig.join(", ")}`);
|
|
42
40
|
process.exit(0);
|
|
43
41
|
}
|
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",
|
|
@@ -34,9 +34,20 @@
|
|
|
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
41
|
"url": "https://github.com/ivuorinen/config-checker/issues"
|
|
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"
|
|
41
52
|
}
|
|
42
53
|
}
|