@webiny/global-config 6.6.0-alpha.2 → 6.6.0-alpha.4
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/index.d.ts +6 -0
- package/index.js +11 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
export interface GlobalConfig {
|
|
2
|
+
/**
|
|
3
|
+
* Returns the whole config, creating it with defaults if it is missing or
|
|
4
|
+
* has no `id`. `isEnabled()` in @webiny/telemetry already calls it this way;
|
|
5
|
+
* the overload was just missing from these types.
|
|
6
|
+
*/
|
|
7
|
+
get(): Record<string, any>;
|
|
2
8
|
get(key: string): any;
|
|
3
9
|
set(key: string, value: any): void;
|
|
4
10
|
}
|
package/index.js
CHANGED
|
@@ -32,6 +32,17 @@ export const globalConfig = {
|
|
|
32
32
|
writeJsonFileSync(GLOBAL_CONFIG_PATH, this.__globalConfig);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
// Backfill `newUser` on configs that predate it, or that were written by something
|
|
36
|
+
// that didn't set it. Absent is not the same as `false`: the only thing that writes
|
|
37
|
+
// `false` is the first successful deploy, so a missing key means that never happened
|
|
38
|
+
// and the user is still new. Reading it as `Boolean(undefined)` reported every one of
|
|
39
|
+
// them as returning. Persisted so the state stops being ambiguous, and so every reader
|
|
40
|
+
// agrees without repeating this rule.
|
|
41
|
+
if (!("newUser" in this.__globalConfig)) {
|
|
42
|
+
this.__globalConfig.newUser = isCI ? false : true;
|
|
43
|
+
writeJsonFileSync(GLOBAL_CONFIG_PATH, this.__globalConfig);
|
|
44
|
+
}
|
|
45
|
+
|
|
35
46
|
return key ? this.__globalConfig[key] : this.__globalConfig;
|
|
36
47
|
},
|
|
37
48
|
set(key, value) {
|