@beauraines/node-helpers 3.0.0 → 4.0.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/CHANGELOG.md +9 -1
- package/package.json +1 -1
- package/src/config.js +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
### [4.0.1](https://github.com/beauraines/node-helpers/compare/v4.0.0...v4.0.1) (2023-07-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* **config:** creating config will not overwrite exisitng configuratio file ([#52](https://github.com/beauraines/node-helpers/issues/52)) ([bad664c](https://github.com/beauraines/node-helpers/commit/bad664c6bf59c5de7404f5b9113951c2fc107c99))
|
|
11
|
+
|
|
12
|
+
## [4.0.0](https://github.com/beauraines/node-helpers/compare/v2.7.1...v4.0.0) (2023-07-02)
|
|
6
13
|
|
|
7
14
|
|
|
8
15
|
### ⚠ BREAKING CHANGES
|
|
@@ -23,6 +30,7 @@ Updates unit test to run async
|
|
|
23
30
|
|
|
24
31
|
* **deps:** bump azure-devops-node-api from 12.0.0 to 12.1.0 ([#37](https://github.com/beauraines/node-helpers/issues/37)) ([b71396d](https://github.com/beauraines/node-helpers/commit/b71396d28d089a1f8919ad53363a4759f61b1e52))
|
|
25
32
|
* **deps:** bump node-fetch from 2.6.11 to 2.6.12 ([786f458](https://github.com/beauraines/node-helpers/commit/786f458fbf0c03fd9462ab67db558c5646afb62e))
|
|
33
|
+
* **deps:** bump xml2js and @azure/core-http ([#46](https://github.com/beauraines/node-helpers/issues/46)) ([83b0c60](https://github.com/beauraines/node-helpers/commit/83b0c6077e70120a7e24519f7a03740578236969))
|
|
26
34
|
* increment version number ([c42e3ae](https://github.com/beauraines/node-helpers/commit/c42e3aebf1373b8820b18ced1b88617bbfe69da6))
|
|
27
35
|
|
|
28
36
|
|
package/package.json
CHANGED
package/src/config.js
CHANGED
|
@@ -63,14 +63,22 @@ const validateConfig = async (configFile, configProps) => {
|
|
|
63
63
|
* @param {string} configFile file name for the JSON config file, from the users home directory
|
|
64
64
|
* @param {Array} configProps an array of properties that defines a valid config file
|
|
65
65
|
*
|
|
66
|
+
* @returns {string} Fully qualified path to configuration file
|
|
67
|
+
*
|
|
68
|
+
* @throws {error} if the file already exists
|
|
69
|
+
*
|
|
66
70
|
*/
|
|
67
71
|
const createConfig = async (configFile,configProps) => {
|
|
68
72
|
configFile = path.join(homedir(),configFile)
|
|
73
|
+
if ( await fileExists(configFile) ) {
|
|
74
|
+
throw Error('File already exists. Will not overwrite')
|
|
75
|
+
}
|
|
69
76
|
let config = {}
|
|
70
77
|
for (const key of configProps) {
|
|
71
78
|
config[key] = ''
|
|
72
79
|
}
|
|
73
|
-
fs.writeFileSync(configFile,JSON.stringify(config))
|
|
80
|
+
fs.writeFileSync(configFile,JSON.stringify(config, null, 2))
|
|
81
|
+
return configFile
|
|
74
82
|
}
|
|
75
83
|
|
|
76
84
|
module.exports = {
|