@scaleway/configuration-loader 0.1.0-beta.6 → 1.0.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/CHANGELOG.md +12 -0
- package/dist/index.cjs +5 -5
- package/dist/yml-loader.js +3 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,18 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 1.0.0 (2023-02-21)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- prepare v1 release ([#454](https://github.com/scaleway/scaleway-sdk-js/issues/454)) ([57bc014](https://github.com/scaleway/scaleway-sdk-js/commit/57bc014556338ba9fa7eca2a2d4179f5ff8383be))
|
|
11
|
+
|
|
12
|
+
## 0.1.0-beta.7 (2023-01-27)
|
|
13
|
+
|
|
14
|
+
### Features
|
|
15
|
+
|
|
16
|
+
- update to Node18, remove cross-fetch, and run tests on node+jsdom ([#386](https://github.com/scaleway/scaleway-sdk-js/issues/386)) ([4e1fe02](https://github.com/scaleway/scaleway-sdk-js/commit/4e1fe02b54939d2d4008b9c53d56ea2553c796fb))
|
|
17
|
+
|
|
6
18
|
## 0.1.0-beta.6 (2023-01-03)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/dist/index.cjs
CHANGED
|
@@ -77,9 +77,9 @@ const DETECT_SECTION_REGEX = /^\s*([^]+):\s*$/;
|
|
|
77
77
|
const DETECT_ITEM_REGEX = /^\s*(.+?)\s*:\s*(.+?)\s*$/;
|
|
78
78
|
|
|
79
79
|
/**
|
|
80
|
-
* Converts
|
|
80
|
+
* Converts YAML to configuration map.
|
|
81
81
|
*
|
|
82
|
-
* @param input -
|
|
82
|
+
* @param input - YAML string
|
|
83
83
|
* @returns The configuration map
|
|
84
84
|
*
|
|
85
85
|
* @internal
|
|
@@ -100,7 +100,7 @@ const convertYamlToConfiguration = input => {
|
|
|
100
100
|
currentSection = undefined;
|
|
101
101
|
if (newSection[1] === 'profiles') {
|
|
102
102
|
foundProfilesKey = true;
|
|
103
|
-
} else if (foundProfilesKey
|
|
103
|
+
} else if (foundProfilesKey) {
|
|
104
104
|
[, currentSection] = newSection;
|
|
105
105
|
}
|
|
106
106
|
}
|
|
@@ -175,7 +175,7 @@ const loadProfileFromEnvironmentValues = () => ({
|
|
|
175
175
|
* @public
|
|
176
176
|
*/
|
|
177
177
|
const loadAllProfilesFromConfigurationFile = params => {
|
|
178
|
-
const filePath =
|
|
178
|
+
const filePath = params?.filepath ?? resolveConfigurationFilePath();
|
|
179
179
|
if (typeof filePath !== 'string' || filePath.length === 0) {
|
|
180
180
|
throw new Error('Could not find the path to the configuration file.');
|
|
181
181
|
}
|
|
@@ -200,7 +200,7 @@ const loadAllProfilesFromConfigurationFile = params => {
|
|
|
200
200
|
*/
|
|
201
201
|
const loadProfileFromConfigurationFile = params => {
|
|
202
202
|
const configs = loadAllProfilesFromConfigurationFile(params);
|
|
203
|
-
const profileName =
|
|
203
|
+
const profileName = params?.profileName ?? 'default';
|
|
204
204
|
const profileMap = configs[profileName];
|
|
205
205
|
if (typeof profileMap !== 'object') {
|
|
206
206
|
throw new Error(`Could not find the desired profile '${profileName}' in the configuration file.`);
|
package/dist/yml-loader.js
CHANGED
|
@@ -5,9 +5,9 @@ const DETECT_SECTION_REGEX = /^\s*([^]+):\s*$/;
|
|
|
5
5
|
const DETECT_ITEM_REGEX = /^\s*(.+?)\s*:\s*(.+?)\s*$/;
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
|
-
* Converts
|
|
8
|
+
* Converts YAML to configuration map.
|
|
9
9
|
*
|
|
10
|
-
* @param input -
|
|
10
|
+
* @param input - YAML string
|
|
11
11
|
* @returns The configuration map
|
|
12
12
|
*
|
|
13
13
|
* @internal
|
|
@@ -28,7 +28,7 @@ const convertYamlToConfiguration = input => {
|
|
|
28
28
|
currentSection = undefined;
|
|
29
29
|
if (newSection[1] === 'profiles') {
|
|
30
30
|
foundProfilesKey = true;
|
|
31
|
-
} else if (foundProfilesKey
|
|
31
|
+
} else if (foundProfilesKey) {
|
|
32
32
|
[, currentSection] = newSection;
|
|
33
33
|
}
|
|
34
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scaleway/configuration-loader",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"description": "Load configuration via file or environment for NodeJS.",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
},
|
|
20
20
|
"type": "module",
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@types/node": "^18.11.
|
|
22
|
+
"@types/node": "^18.11.18"
|
|
23
23
|
},
|
|
24
|
-
"gitHead": "
|
|
24
|
+
"gitHead": "53da2037e927cabe7f148ea2555a8ad590a6a375"
|
|
25
25
|
}
|