@webiny/global-config 0.0.0-mt-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 ADDED
@@ -0,0 +1,254 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [5.18.1](https://github.com/webiny/webiny-js/compare/v5.18.1-beta.0...v5.18.1) (2021-11-25)
7
+
8
+ **Note:** Version bump only for package @webiny/global-config
9
+
10
+
11
+
12
+
13
+
14
+ ## [5.18.1-beta.0](https://github.com/webiny/webiny-js/compare/v5.18.0...v5.18.1-beta.0) (2021-11-25)
15
+
16
+ **Note:** Version bump only for package @webiny/global-config
17
+
18
+
19
+
20
+
21
+
22
+ # [5.18.0](https://github.com/webiny/webiny-js/compare/v5.18.0-beta.4...v5.18.0) (2021-11-24)
23
+
24
+ **Note:** Version bump only for package @webiny/global-config
25
+
26
+
27
+
28
+
29
+
30
+ # [5.18.0-beta.4](https://github.com/webiny/webiny-js/compare/v5.18.0-beta.3...v5.18.0-beta.4) (2021-11-23)
31
+
32
+ **Note:** Version bump only for package @webiny/global-config
33
+
34
+
35
+
36
+
37
+
38
+ # [5.18.0-beta.3](https://github.com/webiny/webiny-js/compare/v5.18.0-beta.2...v5.18.0-beta.3) (2021-11-22)
39
+
40
+ **Note:** Version bump only for package @webiny/global-config
41
+
42
+
43
+
44
+
45
+
46
+ # [5.18.0-beta.2](https://github.com/webiny/webiny-js/compare/v5.18.0-beta.1...v5.18.0-beta.2) (2021-11-21)
47
+
48
+ **Note:** Version bump only for package @webiny/global-config
49
+
50
+
51
+
52
+
53
+
54
+ # [5.18.0-beta.1](https://github.com/webiny/webiny-js/compare/v5.18.0-beta.0...v5.18.0-beta.1) (2021-11-19)
55
+
56
+ **Note:** Version bump only for package @webiny/global-config
57
+
58
+
59
+
60
+
61
+
62
+ # [5.18.0-beta.0](https://github.com/webiny/webiny-js/compare/v5.17.4...v5.18.0-beta.0) (2021-11-19)
63
+
64
+ **Note:** Version bump only for package @webiny/global-config
65
+
66
+
67
+
68
+
69
+
70
+ ## [5.17.4](https://github.com/webiny/webiny-js/compare/v5.17.4-beta.1...v5.17.4) (2021-11-19)
71
+
72
+ **Note:** Version bump only for package @webiny/global-config
73
+
74
+
75
+
76
+
77
+
78
+ ## [5.17.4-beta.1](https://github.com/webiny/webiny-js/compare/v5.17.4-beta.0...v5.17.4-beta.1) (2021-11-19)
79
+
80
+ **Note:** Version bump only for package @webiny/global-config
81
+
82
+
83
+
84
+
85
+
86
+ ## [5.17.4-beta.0](https://github.com/webiny/webiny-js/compare/v5.17.3...v5.17.4-beta.0) (2021-11-19)
87
+
88
+ **Note:** Version bump only for package @webiny/global-config
89
+
90
+
91
+
92
+
93
+
94
+ ## [5.17.3](https://github.com/webiny/webiny-js/compare/v5.17.3-beta.0...v5.17.3) (2021-11-15)
95
+
96
+ **Note:** Version bump only for package @webiny/global-config
97
+
98
+
99
+
100
+
101
+
102
+ ## [5.17.3-beta.0](https://github.com/webiny/webiny-js/compare/v5.17.2...v5.17.3-beta.0) (2021-11-12)
103
+
104
+ **Note:** Version bump only for package @webiny/global-config
105
+
106
+
107
+
108
+
109
+
110
+ ## [5.17.2](https://github.com/webiny/webiny-js/compare/v5.17.2-beta.0...v5.17.2) (2021-11-11)
111
+
112
+ **Note:** Version bump only for package @webiny/global-config
113
+
114
+
115
+
116
+
117
+
118
+ ## [5.17.2-beta.0](https://github.com/webiny/webiny-js/compare/v5.17.1...v5.17.2-beta.0) (2021-11-11)
119
+
120
+
121
+ ### Bug Fixes
122
+
123
+ * force same version on all packages ([9cbae8b](https://github.com/webiny/webiny-js/commit/9cbae8b050900546eb17932c23a609593211c1c8))
124
+
125
+
126
+
127
+
128
+
129
+ # [5.17.0](https://github.com/webiny/webiny-js/compare/v5.17.0-beta.2...v5.17.0) (2021-11-08)
130
+
131
+ **Note:** Version bump only for package @webiny/global-config
132
+
133
+
134
+
135
+
136
+
137
+ # [5.17.0-beta.2](https://github.com/webiny/webiny-js/compare/v5.17.0-beta.1...v5.17.0-beta.2) (2021-11-08)
138
+
139
+ **Note:** Version bump only for package @webiny/global-config
140
+
141
+
142
+
143
+
144
+
145
+ # [5.17.0-beta.1](https://github.com/webiny/webiny-js/compare/v5.16.0...v5.17.0-beta.1) (2021-11-08)
146
+
147
+ **Note:** Version bump only for package @webiny/global-config
148
+
149
+
150
+
151
+
152
+
153
+ # [5.16.0](https://github.com/webiny/webiny-js/compare/v5.16.0-beta.4...v5.16.0) (2021-10-21)
154
+
155
+ **Note:** Version bump only for package @webiny/global-config
156
+
157
+
158
+
159
+
160
+
161
+ # [5.16.0-beta.4](https://github.com/webiny/webiny-js/compare/v5.16.0-beta.3...v5.16.0-beta.4) (2021-10-20)
162
+
163
+ **Note:** Version bump only for package @webiny/global-config
164
+
165
+
166
+
167
+
168
+
169
+ # [5.16.0-beta.3](https://github.com/webiny/webiny-js/compare/v5.16.0-beta.2...v5.16.0-beta.3) (2021-10-20)
170
+
171
+ **Note:** Version bump only for package @webiny/global-config
172
+
173
+
174
+
175
+
176
+
177
+ # [5.16.0-beta.2](https://github.com/webiny/webiny-js/compare/v5.16.0-beta.1...v5.16.0-beta.2) (2021-10-20)
178
+
179
+ **Note:** Version bump only for package @webiny/global-config
180
+
181
+
182
+
183
+
184
+
185
+ # [5.16.0-beta.1](https://github.com/webiny/webiny-js/compare/v5.16.0-beta.0...v5.16.0-beta.1) (2021-10-19)
186
+
187
+ **Note:** Version bump only for package @webiny/global-config
188
+
189
+
190
+
191
+
192
+
193
+ # [5.16.0-beta.0](https://github.com/webiny/webiny-js/compare/v5.17.0-beta.0...v5.16.0-beta.0) (2021-10-19)
194
+
195
+ **Note:** Version bump only for package @webiny/global-config
196
+
197
+
198
+
199
+
200
+
201
+ # [5.17.0-beta.0](https://github.com/webiny/webiny-js/compare/v5.15.0...v5.17.0-beta.0) (2021-10-18)
202
+
203
+ **Note:** Version bump only for package @webiny/global-config
204
+
205
+
206
+
207
+
208
+
209
+ # [5.15.0](https://github.com/webiny/webiny-js/compare/v5.15.0-beta.3...v5.15.0) (2021-09-30)
210
+
211
+ **Note:** Version bump only for package @webiny/global-config
212
+
213
+
214
+
215
+
216
+
217
+ # [5.15.0-beta.3](https://github.com/webiny/webiny-js/compare/v5.15.0-beta.2...v5.15.0-beta.3) (2021-09-30)
218
+
219
+ **Note:** Version bump only for package @webiny/global-config
220
+
221
+
222
+
223
+
224
+
225
+ # [5.15.0-beta.2](https://github.com/webiny/webiny-js/compare/v5.15.0-beta.1...v5.15.0-beta.2) (2021-09-29)
226
+
227
+ **Note:** Version bump only for package @webiny/global-config
228
+
229
+
230
+
231
+
232
+
233
+ # [5.15.0-beta.1](https://github.com/webiny/webiny-js/compare/v5.15.0-beta.0...v5.15.0-beta.1) (2021-09-28)
234
+
235
+ **Note:** Version bump only for package @webiny/global-config
236
+
237
+
238
+
239
+
240
+
241
+ # [5.15.0-beta.0](https://github.com/webiny/webiny-js/compare/v5.14.0...v5.15.0-beta.0) (2021-09-16)
242
+
243
+
244
+ ### Bug Fixes
245
+
246
+ * remove extra get function ([6aa6533](https://github.com/webiny/webiny-js/commit/6aa65333927284a354f2f79274dba3fc2ffd212a))
247
+ * remove telemetry getter ([62630e8](https://github.com/webiny/webiny-js/commit/62630e87b20e5a408848ccb718e07409625e3bd2))
248
+ * update dependencies ([fe2a736](https://github.com/webiny/webiny-js/commit/fe2a73694c14d3694ecc2117619f6907fa6d156a))
249
+ * update dependencies ([37f2691](https://github.com/webiny/webiny-js/commit/37f2691f3cb615615a089d977f58a22a8bb21f50))
250
+
251
+
252
+ ### Features
253
+
254
+ * create webiny/global-config package ([efffba0](https://github.com/webiny/webiny-js/commit/efffba0ccaa89d6840e2170ba8aa69938967d282))
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) Webiny
4
+
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:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
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 ADDED
@@ -0,0 +1 @@
1
+ # @webiny/global-config
package/index.js ADDED
@@ -0,0 +1,33 @@
1
+ const os = require("os");
2
+ const path = require("path");
3
+ const { v4: uuidv4 } = require("uuid");
4
+ const readJson = require("load-json-file");
5
+ const writeJson = require("write-json-file");
6
+
7
+ const GLOBAL_CONFIG_PATH = path.join(os.homedir(), ".webiny", "config");
8
+
9
+ module.exports.globalConfig = {
10
+ __globalConfig: null,
11
+ get(key) {
12
+ try {
13
+ if (!this.__globalConfig) {
14
+ this.__globalConfig = readJson.sync(GLOBAL_CONFIG_PATH);
15
+ if (!this.__globalConfig.id) {
16
+ throw Error("Invalid Webiny config!");
17
+ }
18
+ }
19
+ } catch (e) {
20
+ // A new config file is written if it doesn't exist or is invalid.
21
+ this.__globalConfig = { id: uuidv4(), telemetry: true };
22
+ writeJson.sync(GLOBAL_CONFIG_PATH, this.__globalConfig);
23
+ }
24
+
25
+ return key ? this.__globalConfig[key] : this.__globalConfig;
26
+ },
27
+ set(key, value) {
28
+ const globalConfig = this.get();
29
+ globalConfig[key] = value;
30
+ writeJson.sync(GLOBAL_CONFIG_PATH, globalConfig);
31
+ return globalConfig;
32
+ }
33
+ };
package/package.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "name": "@webiny/global-config",
3
+ "version": "0.0.0-mt-1",
4
+ "main": "index.js",
5
+ "license": "MIT",
6
+ "dependencies": {
7
+ "load-json-file": "6.2.0",
8
+ "uuid": "8.3.2",
9
+ "write-json-file": "4.3.0"
10
+ },
11
+ "publishConfig": {
12
+ "access": "public",
13
+ "directory": "."
14
+ },
15
+ "gitHead": "37736d8456a6ecb342a6c3645060bd9a3f2d4bb0"
16
+ }