@achs/env 3.1.0 → 3.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/arguments.d.ts +25 -0
- package/arguments.d.ts.map +1 -0
- package/{src/arguments.ts → arguments.js} +8 -32
- package/arguments.js.map +1 -0
- package/commands/env.command.d.ts +8 -0
- package/commands/env.command.d.ts.map +1 -0
- package/commands/env.command.js +85 -0
- package/commands/env.command.js.map +1 -0
- package/commands/export.command.d.ts +8 -0
- package/commands/export.command.d.ts.map +1 -0
- package/commands/export.command.js +54 -0
- package/commands/export.command.js.map +1 -0
- package/{src/commands/index.ts → commands/index.d.ts} +1 -0
- package/commands/index.d.ts.map +1 -0
- package/commands/index.js +14 -0
- package/commands/index.js.map +1 -0
- package/commands/pull.command.d.ts +7 -0
- package/commands/pull.command.d.ts.map +1 -0
- package/commands/pull.command.js +39 -0
- package/commands/pull.command.js.map +1 -0
- package/commands/push.command.d.ts +7 -0
- package/commands/push.command.d.ts.map +1 -0
- package/commands/push.command.js +38 -0
- package/commands/push.command.js.map +1 -0
- package/commands/schema.command.d.ts +4 -0
- package/commands/schema.command.d.ts.map +1 -0
- package/commands/schema.command.js +18 -0
- package/commands/schema.command.js.map +1 -0
- package/exec.d.ts +3 -0
- package/exec.d.ts.map +1 -0
- package/exec.js +142 -0
- package/exec.js.map +1 -0
- package/{src/index.ts → index.d.ts} +1 -0
- package/index.d.ts.map +1 -0
- package/index.js +20 -0
- package/index.js.map +1 -0
- package/{src/interfaces/index.ts → interfaces/index.d.ts} +1 -0
- package/interfaces/index.d.ts.map +1 -0
- package/interfaces/index.js +18 -0
- package/interfaces/index.js.map +1 -0
- package/interfaces/loader.interface.d.ts +21 -0
- package/interfaces/loader.interface.d.ts.map +1 -0
- package/interfaces/loader.interface.js +3 -0
- package/interfaces/loader.interface.js.map +1 -0
- package/main.d.ts +3 -0
- package/main.d.ts.map +1 -0
- package/main.js +6 -0
- package/main.js.map +1 -0
- package/package.json +1 -1
- package/providers/app-settings.provider.d.ts +8 -0
- package/providers/app-settings.provider.d.ts.map +1 -0
- package/providers/app-settings.provider.js +50 -0
- package/providers/app-settings.provider.js.map +1 -0
- package/providers/azure-key-vault.provider.d.ts +20 -0
- package/providers/azure-key-vault.provider.d.ts.map +1 -0
- package/providers/azure-key-vault.provider.js +143 -0
- package/providers/azure-key-vault.provider.js.map +1 -0
- package/providers/index.d.ts +7 -0
- package/providers/index.d.ts.map +1 -0
- package/providers/index.js +30 -0
- package/providers/index.js.map +1 -0
- package/providers/local.provider.d.ts +8 -0
- package/providers/local.provider.d.ts.map +1 -0
- package/providers/local.provider.js +31 -0
- package/providers/local.provider.js.map +1 -0
- package/providers/package-json.provider.d.ts +8 -0
- package/providers/package-json.provider.d.ts.map +1 -0
- package/providers/package-json.provider.js +29 -0
- package/providers/package-json.provider.js.map +1 -0
- package/tsconfig.build.tsbuildinfo +1 -0
- package/utils/command.util.d.ts +13 -0
- package/utils/command.util.d.ts.map +1 -0
- package/utils/command.util.js +134 -0
- package/utils/command.util.js.map +1 -0
- package/{src/utils/index.ts → utils/index.d.ts} +1 -0
- package/utils/index.d.ts.map +1 -0
- package/utils/index.js +23 -0
- package/utils/index.js.map +1 -0
- package/utils/interpolate.util.d.ts +4 -0
- package/utils/interpolate.util.d.ts.map +1 -0
- package/utils/interpolate.util.js +33 -0
- package/utils/interpolate.util.js.map +1 -0
- package/utils/json.util.d.ts +5 -0
- package/utils/json.util.d.ts.map +1 -0
- package/utils/json.util.js +48 -0
- package/utils/json.util.js.map +1 -0
- package/utils/logger.d.ts +3 -0
- package/utils/logger.d.ts.map +1 -0
- package/{src/utils/logger.ts → utils/logger.js} +6 -6
- package/utils/logger.js.map +1 -0
- package/utils/normalize.util.d.ts +3 -0
- package/utils/normalize.util.d.ts.map +1 -0
- package/utils/normalize.util.js +61 -0
- package/utils/normalize.util.js.map +1 -0
- package/utils/schema.util.d.ts +11 -0
- package/utils/schema.util.d.ts.map +1 -0
- package/utils/schema.util.js +100 -0
- package/utils/schema.util.js.map +1 -0
- package/.eslintignore +0 -3
- package/.eslintrc.json +0 -329
- package/.vscode/extensions.json +0 -18
- package/.vscode/launch.json +0 -30
- package/.vscode/settings.json +0 -29
- package/jest.config.json +0 -28
- package/src/commands/env.command.ts +0 -139
- package/src/commands/export.command.ts +0 -88
- package/src/commands/pull.command.ts +0 -52
- package/src/commands/push.command.ts +0 -48
- package/src/commands/schema.command.ts +0 -31
- package/src/exec.ts +0 -221
- package/src/interfaces/loader.interface.ts +0 -66
- package/src/main.ts +0 -6
- package/src/providers/app-settings.provider.ts +0 -67
- package/src/providers/azure-key-vault.provider.ts +0 -277
- package/src/providers/index.ts +0 -29
- package/src/providers/local.provider.ts +0 -44
- package/src/providers/package-json.provider.ts +0 -39
- package/src/utils/command.util.ts +0 -223
- package/src/utils/interpolate.util.ts +0 -65
- package/src/utils/json.util.ts +0 -116
- package/src/utils/normalize.util.ts +0 -142
- package/src/utils/schema.util.ts +0 -191
- package/tests/env/appsettings.json +0 -32
- package/tests/env/dev.env.json +0 -12
- package/tests/env/dev.local.env.json +0 -9
- package/tests/env/env.schema.json +0 -225
- package/tests/env/keys.json +0 -7
- package/tests/env/settings/schema.json +0 -239
- package/tests/env/settings/settings.json +0 -22
- package/tests/env.int.test.ts +0 -42
- package/tests/exec.ts +0 -19
- package/tests/export.int.test.ts +0 -9
- package/tests/pull-push.int.test.ts +0 -15
- package/tests/run.js +0 -32
- package/tests/schema.int.test.ts +0 -9
- package/tests/setup.ts +0 -13
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -37
|
@@ -1,225 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"package-json": {
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"ENV": {
|
|
6
|
-
"type": [
|
|
7
|
-
"string"
|
|
8
|
-
],
|
|
9
|
-
"nullable": true
|
|
10
|
-
},
|
|
11
|
-
"VERSION": {
|
|
12
|
-
"type": [
|
|
13
|
-
"string"
|
|
14
|
-
],
|
|
15
|
-
"nullable": true
|
|
16
|
-
},
|
|
17
|
-
"PROJECT": {
|
|
18
|
-
"type": [
|
|
19
|
-
"string"
|
|
20
|
-
],
|
|
21
|
-
"nullable": true
|
|
22
|
-
},
|
|
23
|
-
"NAME": {
|
|
24
|
-
"type": [
|
|
25
|
-
"string"
|
|
26
|
-
],
|
|
27
|
-
"nullable": true
|
|
28
|
-
},
|
|
29
|
-
"TITLE": {
|
|
30
|
-
"type": [
|
|
31
|
-
"string"
|
|
32
|
-
],
|
|
33
|
-
"nullable": true
|
|
34
|
-
},
|
|
35
|
-
"DESCRIPTION": {
|
|
36
|
-
"type": [
|
|
37
|
-
"string"
|
|
38
|
-
],
|
|
39
|
-
"nullable": true
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"app-settings": {
|
|
44
|
-
"type": "object",
|
|
45
|
-
"properties": {
|
|
46
|
-
"VAR1": {
|
|
47
|
-
"type": [
|
|
48
|
-
"string"
|
|
49
|
-
],
|
|
50
|
-
"nullable": true
|
|
51
|
-
},
|
|
52
|
-
"C1": {
|
|
53
|
-
"type": [
|
|
54
|
-
"string"
|
|
55
|
-
],
|
|
56
|
-
"nullable": true
|
|
57
|
-
},
|
|
58
|
-
"C2": {
|
|
59
|
-
"type": [
|
|
60
|
-
"string"
|
|
61
|
-
],
|
|
62
|
-
"nullable": true
|
|
63
|
-
},
|
|
64
|
-
"C3": {
|
|
65
|
-
"type": [
|
|
66
|
-
"integer"
|
|
67
|
-
],
|
|
68
|
-
"nullable": true
|
|
69
|
-
},
|
|
70
|
-
"GROUP1": {
|
|
71
|
-
"type": [
|
|
72
|
-
"object"
|
|
73
|
-
],
|
|
74
|
-
"properties": {
|
|
75
|
-
"VAR1": {
|
|
76
|
-
"type": [
|
|
77
|
-
"null"
|
|
78
|
-
],
|
|
79
|
-
"nullable": true
|
|
80
|
-
},
|
|
81
|
-
"VAR2": {
|
|
82
|
-
"type": [
|
|
83
|
-
"string"
|
|
84
|
-
],
|
|
85
|
-
"nullable": true
|
|
86
|
-
},
|
|
87
|
-
"VAR3": {
|
|
88
|
-
"type": [
|
|
89
|
-
"boolean"
|
|
90
|
-
],
|
|
91
|
-
"nullable": true
|
|
92
|
-
},
|
|
93
|
-
"GROUP2": {
|
|
94
|
-
"type": [
|
|
95
|
-
"object"
|
|
96
|
-
],
|
|
97
|
-
"properties": {
|
|
98
|
-
"VAR1": {
|
|
99
|
-
"type": [
|
|
100
|
-
"string"
|
|
101
|
-
],
|
|
102
|
-
"nullable": true
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"nullable": true
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"nullable": true
|
|
109
|
-
},
|
|
110
|
-
"C4": {
|
|
111
|
-
"type": [
|
|
112
|
-
"string"
|
|
113
|
-
],
|
|
114
|
-
"format": "utc-millisec",
|
|
115
|
-
"nullable": true
|
|
116
|
-
},
|
|
117
|
-
"NODE_ENV": {
|
|
118
|
-
"type": [
|
|
119
|
-
"string"
|
|
120
|
-
],
|
|
121
|
-
"nullable": true
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"azure-key-vault": {
|
|
126
|
-
"type": "object",
|
|
127
|
-
"properties": {
|
|
128
|
-
"VAR1": {
|
|
129
|
-
"type": [
|
|
130
|
-
"boolean"
|
|
131
|
-
],
|
|
132
|
-
"nullable": true
|
|
133
|
-
},
|
|
134
|
-
"VAR2": {
|
|
135
|
-
"type": [
|
|
136
|
-
"boolean"
|
|
137
|
-
],
|
|
138
|
-
"nullable": true
|
|
139
|
-
},
|
|
140
|
-
"VAR3": {
|
|
141
|
-
"type": [
|
|
142
|
-
"integer"
|
|
143
|
-
],
|
|
144
|
-
"nullable": true
|
|
145
|
-
},
|
|
146
|
-
"VAR4": {
|
|
147
|
-
"type": [
|
|
148
|
-
"string"
|
|
149
|
-
],
|
|
150
|
-
"nullable": true
|
|
151
|
-
},
|
|
152
|
-
"ARR1": {
|
|
153
|
-
"type": [
|
|
154
|
-
"array"
|
|
155
|
-
],
|
|
156
|
-
"nullable": true
|
|
157
|
-
},
|
|
158
|
-
"GROUP2": {
|
|
159
|
-
"type": [
|
|
160
|
-
"object"
|
|
161
|
-
],
|
|
162
|
-
"properties": {
|
|
163
|
-
"VAR1": {
|
|
164
|
-
"type": [
|
|
165
|
-
"string"
|
|
166
|
-
],
|
|
167
|
-
"nullable": true
|
|
168
|
-
},
|
|
169
|
-
"VAR2": {
|
|
170
|
-
"type": [
|
|
171
|
-
"string"
|
|
172
|
-
],
|
|
173
|
-
"nullable": true
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
"nullable": true
|
|
177
|
-
},
|
|
178
|
-
"$SECRET": {
|
|
179
|
-
"type": [
|
|
180
|
-
"string"
|
|
181
|
-
],
|
|
182
|
-
"nullable": true
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
"local": {
|
|
187
|
-
"type": "object",
|
|
188
|
-
"properties": {
|
|
189
|
-
"VAR4": {
|
|
190
|
-
"type": [
|
|
191
|
-
"string"
|
|
192
|
-
],
|
|
193
|
-
"nullable": true
|
|
194
|
-
},
|
|
195
|
-
"GROUP1": {
|
|
196
|
-
"type": [
|
|
197
|
-
"object"
|
|
198
|
-
],
|
|
199
|
-
"properties": {
|
|
200
|
-
"VAR1": {
|
|
201
|
-
"type": [
|
|
202
|
-
"null"
|
|
203
|
-
],
|
|
204
|
-
"nullable": true
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
"nullable": true
|
|
208
|
-
},
|
|
209
|
-
"GROUP2": {
|
|
210
|
-
"type": [
|
|
211
|
-
"object"
|
|
212
|
-
],
|
|
213
|
-
"properties": {
|
|
214
|
-
"VAR2": {
|
|
215
|
-
"type": [
|
|
216
|
-
"string"
|
|
217
|
-
],
|
|
218
|
-
"nullable": true
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
"nullable": true
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
}
|
package/tests/env/keys.json
DELETED
|
@@ -1,239 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"package-json": {
|
|
3
|
-
"type": "object",
|
|
4
|
-
"properties": {
|
|
5
|
-
"ENV": {
|
|
6
|
-
"type": [
|
|
7
|
-
"string"
|
|
8
|
-
],
|
|
9
|
-
"nullable": true
|
|
10
|
-
},
|
|
11
|
-
"VERSION": {
|
|
12
|
-
"type": [
|
|
13
|
-
"string"
|
|
14
|
-
],
|
|
15
|
-
"nullable": true
|
|
16
|
-
},
|
|
17
|
-
"PROJECT": {
|
|
18
|
-
"type": [
|
|
19
|
-
"string"
|
|
20
|
-
],
|
|
21
|
-
"nullable": true
|
|
22
|
-
},
|
|
23
|
-
"NAME": {
|
|
24
|
-
"type": [
|
|
25
|
-
"string"
|
|
26
|
-
],
|
|
27
|
-
"nullable": true
|
|
28
|
-
},
|
|
29
|
-
"TITLE": {
|
|
30
|
-
"type": [
|
|
31
|
-
"string"
|
|
32
|
-
],
|
|
33
|
-
"nullable": true
|
|
34
|
-
},
|
|
35
|
-
"DESCRIPTION": {
|
|
36
|
-
"type": [
|
|
37
|
-
"string"
|
|
38
|
-
],
|
|
39
|
-
"nullable": true
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
},
|
|
43
|
-
"app-settings": {
|
|
44
|
-
"type": "object",
|
|
45
|
-
"properties": {
|
|
46
|
-
"VAR1": {
|
|
47
|
-
"type": [
|
|
48
|
-
"string"
|
|
49
|
-
],
|
|
50
|
-
"nullable": true
|
|
51
|
-
},
|
|
52
|
-
"C1": {
|
|
53
|
-
"type": [
|
|
54
|
-
"string"
|
|
55
|
-
],
|
|
56
|
-
"nullable": true
|
|
57
|
-
},
|
|
58
|
-
"C2": {
|
|
59
|
-
"type": [
|
|
60
|
-
"string"
|
|
61
|
-
],
|
|
62
|
-
"nullable": true
|
|
63
|
-
},
|
|
64
|
-
"C3": {
|
|
65
|
-
"type": [
|
|
66
|
-
"integer"
|
|
67
|
-
],
|
|
68
|
-
"nullable": true
|
|
69
|
-
},
|
|
70
|
-
"GROUP1": {
|
|
71
|
-
"type": [
|
|
72
|
-
"object"
|
|
73
|
-
],
|
|
74
|
-
"properties": {
|
|
75
|
-
"VAR1": {
|
|
76
|
-
"type": [
|
|
77
|
-
"null"
|
|
78
|
-
],
|
|
79
|
-
"nullable": true
|
|
80
|
-
},
|
|
81
|
-
"VAR2": {
|
|
82
|
-
"type": [
|
|
83
|
-
"string"
|
|
84
|
-
],
|
|
85
|
-
"nullable": true
|
|
86
|
-
},
|
|
87
|
-
"VAR3": {
|
|
88
|
-
"type": [
|
|
89
|
-
"boolean"
|
|
90
|
-
],
|
|
91
|
-
"nullable": true
|
|
92
|
-
},
|
|
93
|
-
"GROUP2": {
|
|
94
|
-
"type": [
|
|
95
|
-
"object"
|
|
96
|
-
],
|
|
97
|
-
"properties": {
|
|
98
|
-
"VAR1": {
|
|
99
|
-
"type": [
|
|
100
|
-
"string"
|
|
101
|
-
],
|
|
102
|
-
"nullable": true
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
"nullable": true
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"nullable": true
|
|
109
|
-
},
|
|
110
|
-
"C4": {
|
|
111
|
-
"type": [
|
|
112
|
-
"string"
|
|
113
|
-
],
|
|
114
|
-
"format": "utc-millisec",
|
|
115
|
-
"nullable": true
|
|
116
|
-
},
|
|
117
|
-
"NODE_ENV": {
|
|
118
|
-
"type": [
|
|
119
|
-
"string"
|
|
120
|
-
],
|
|
121
|
-
"nullable": true
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
"azure-key-vault": {
|
|
126
|
-
"type": "object",
|
|
127
|
-
"properties": {
|
|
128
|
-
"VAR1": {
|
|
129
|
-
"type": [
|
|
130
|
-
"boolean"
|
|
131
|
-
],
|
|
132
|
-
"nullable": true
|
|
133
|
-
},
|
|
134
|
-
"VAR2": {
|
|
135
|
-
"type": [
|
|
136
|
-
"boolean"
|
|
137
|
-
],
|
|
138
|
-
"nullable": true
|
|
139
|
-
},
|
|
140
|
-
"VAR3": {
|
|
141
|
-
"type": [
|
|
142
|
-
"integer"
|
|
143
|
-
],
|
|
144
|
-
"nullable": true
|
|
145
|
-
},
|
|
146
|
-
"VAR4": {
|
|
147
|
-
"type": [
|
|
148
|
-
"string"
|
|
149
|
-
],
|
|
150
|
-
"nullable": true
|
|
151
|
-
},
|
|
152
|
-
"ARR1": {
|
|
153
|
-
"type": [
|
|
154
|
-
"array"
|
|
155
|
-
],
|
|
156
|
-
"nullable": true
|
|
157
|
-
},
|
|
158
|
-
"GROUP2": {
|
|
159
|
-
"type": [
|
|
160
|
-
"object"
|
|
161
|
-
],
|
|
162
|
-
"properties": {
|
|
163
|
-
"VAR1": {
|
|
164
|
-
"type": [
|
|
165
|
-
"string"
|
|
166
|
-
],
|
|
167
|
-
"nullable": true
|
|
168
|
-
},
|
|
169
|
-
"VAR2": {
|
|
170
|
-
"type": [
|
|
171
|
-
"string"
|
|
172
|
-
],
|
|
173
|
-
"nullable": true
|
|
174
|
-
}
|
|
175
|
-
},
|
|
176
|
-
"nullable": true
|
|
177
|
-
},
|
|
178
|
-
"$SECRET": {
|
|
179
|
-
"type": [
|
|
180
|
-
"string"
|
|
181
|
-
],
|
|
182
|
-
"nullable": true
|
|
183
|
-
},
|
|
184
|
-
"GROUP1": {
|
|
185
|
-
"type": [
|
|
186
|
-
"object"
|
|
187
|
-
],
|
|
188
|
-
"properties": {
|
|
189
|
-
"VAR1": {
|
|
190
|
-
"type": [
|
|
191
|
-
"null"
|
|
192
|
-
],
|
|
193
|
-
"nullable": true
|
|
194
|
-
}
|
|
195
|
-
},
|
|
196
|
-
"nullable": true
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
"local": {
|
|
201
|
-
"type": "object",
|
|
202
|
-
"properties": {
|
|
203
|
-
"VAR4": {
|
|
204
|
-
"type": [
|
|
205
|
-
"string"
|
|
206
|
-
],
|
|
207
|
-
"nullable": true
|
|
208
|
-
},
|
|
209
|
-
"GROUP1": {
|
|
210
|
-
"type": [
|
|
211
|
-
"object"
|
|
212
|
-
],
|
|
213
|
-
"properties": {
|
|
214
|
-
"VAR1": {
|
|
215
|
-
"type": [
|
|
216
|
-
"null"
|
|
217
|
-
],
|
|
218
|
-
"nullable": true
|
|
219
|
-
}
|
|
220
|
-
},
|
|
221
|
-
"nullable": true
|
|
222
|
-
},
|
|
223
|
-
"GROUP2": {
|
|
224
|
-
"type": [
|
|
225
|
-
"object"
|
|
226
|
-
],
|
|
227
|
-
"properties": {
|
|
228
|
-
"VAR2": {
|
|
229
|
-
"type": [
|
|
230
|
-
"string"
|
|
231
|
-
],
|
|
232
|
-
"nullable": true
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
"nullable": true
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"logMaskValuesOfKeys": ["SECRET"],
|
|
3
|
-
"providers": [
|
|
4
|
-
{
|
|
5
|
-
"path": "package-json"
|
|
6
|
-
},
|
|
7
|
-
{
|
|
8
|
-
"path": "app-settings"
|
|
9
|
-
},
|
|
10
|
-
{
|
|
11
|
-
"path": "azure-key-vault",
|
|
12
|
-
"config": {
|
|
13
|
-
"dev": {
|
|
14
|
-
"vaultUrl": "https://azure.vault.net"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
{
|
|
19
|
-
"path": "local"
|
|
20
|
-
}
|
|
21
|
-
]
|
|
22
|
-
}
|
package/tests/env.int.test.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { execEnv, execDebugEnv } from './exec';
|
|
2
|
-
|
|
3
|
-
const subcmd = ': node tests/run.js';
|
|
4
|
-
|
|
5
|
-
describe('env command', () => {
|
|
6
|
-
test('show helps', () => {
|
|
7
|
-
const response = execEnv('--help');
|
|
8
|
-
|
|
9
|
-
expect(response).toMatch(/usage: env/i);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
test('load env into run.js', () => {
|
|
13
|
-
const response = execEnv('-e dev', '--m debug', subcmd);
|
|
14
|
-
|
|
15
|
-
expect(response).not.toMatch(/error/i);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
test('load env without modes into run.js', () => {
|
|
19
|
-
const response = execEnv('-e dev', ': node tests/run.js');
|
|
20
|
-
|
|
21
|
-
expect(response).not.toMatch(/error/i);
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
test('load env with two modes into run.js', () => {
|
|
25
|
-
const response = execEnv('-e dev', '--m debug build', subcmd);
|
|
26
|
-
|
|
27
|
-
expect(response).not.toMatch(/error/i);
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
test('load env with options after subcmd', () => {
|
|
31
|
-
const response = execEnv('-e dev', subcmd, ': -m debug');
|
|
32
|
-
|
|
33
|
-
expect(response).not.toMatch(/error/i);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
test('logger must not show SECRET variable value', () => {
|
|
37
|
-
const response = execDebugEnv('-e dev', subcmd);
|
|
38
|
-
|
|
39
|
-
expect(response).not.toMatch(/error/i);
|
|
40
|
-
expect(response).not.toMatch(/any secret/i);
|
|
41
|
-
});
|
|
42
|
-
});
|
package/tests/exec.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { execSync } from 'child_process';
|
|
2
|
-
|
|
3
|
-
const CMD = 'node dist/main.js';
|
|
4
|
-
|
|
5
|
-
const BASE_ARGS = ['--root tests/env', '--mock'];
|
|
6
|
-
|
|
7
|
-
export const execEnv = (...args: string[]): string | undefined => {
|
|
8
|
-
return execSync(
|
|
9
|
-
`${CMD} ${[...BASE_ARGS, '--log error', ...args].join(' ')}`
|
|
10
|
-
)?.toString();
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
export const execDebugEnv = (...args: string[]): string | undefined => {
|
|
14
|
-
return execSync(
|
|
15
|
-
`${CMD} ${[...BASE_ARGS, '--log debug', ...args].join(' ')}`
|
|
16
|
-
)?.toString();
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { execSync as exec } from 'child_process';
|
package/tests/export.int.test.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { execEnv } from './exec';
|
|
2
|
-
|
|
3
|
-
describe('pull & push commands', () => {
|
|
4
|
-
test('pull', () => {
|
|
5
|
-
const response = execEnv('pull', '-e dev');
|
|
6
|
-
|
|
7
|
-
expect(response).not.toMatch(/error/i);
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
test('push', () => {
|
|
11
|
-
const response = execEnv('push', '-e dev');
|
|
12
|
-
|
|
13
|
-
expect(response).not.toMatch(/error/i);
|
|
14
|
-
});
|
|
15
|
-
});
|
package/tests/run.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
function validateEnv(...vars) {
|
|
2
|
-
for(const key of vars) {
|
|
3
|
-
if(!process.env[key])
|
|
4
|
-
{
|
|
5
|
-
throw new Error(`${key} dont loaded`);
|
|
6
|
-
}
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
validateEnv(
|
|
11
|
-
'NODE_ENV',
|
|
12
|
-
'ENV',
|
|
13
|
-
'VERSION',
|
|
14
|
-
'PROJECT',
|
|
15
|
-
'NAME',
|
|
16
|
-
'TITLE',
|
|
17
|
-
'DESCRIPTION',
|
|
18
|
-
'VAR1',
|
|
19
|
-
'C1',
|
|
20
|
-
'C2',
|
|
21
|
-
'C3',
|
|
22
|
-
'C4',
|
|
23
|
-
'GROUP1__VAR2',
|
|
24
|
-
'GROUP1__VAR3',
|
|
25
|
-
'GROUP1__GROUP2__VAR1',
|
|
26
|
-
'VAR2',
|
|
27
|
-
'VAR3',
|
|
28
|
-
'VAR4',
|
|
29
|
-
'ARR1',
|
|
30
|
-
'GROUP2__VAR1',
|
|
31
|
-
'GROUP2__VAR2'
|
|
32
|
-
);
|
package/tests/schema.int.test.ts
DELETED
package/tests/setup.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { exec, execEnv } from './exec';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Builds app and regenerates schema.
|
|
5
|
-
*/
|
|
6
|
-
function setup(): void {
|
|
7
|
-
// builds application
|
|
8
|
-
exec('npm run build');
|
|
9
|
-
// generates schema from environment variables
|
|
10
|
-
execEnv('schema', '-e dev', '-m debug');
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default setup;
|
package/tsconfig.build.json
DELETED
package/tsconfig.json
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"baseUrl": "src",
|
|
4
|
-
"outDir": "dist",
|
|
5
|
-
|
|
6
|
-
"target": "es2018",
|
|
7
|
-
"module": "commonjs",
|
|
8
|
-
"moduleResolution": "node",
|
|
9
|
-
"resolveJsonModule": true,
|
|
10
|
-
|
|
11
|
-
"allowJs": false,
|
|
12
|
-
"checkJs": false,
|
|
13
|
-
|
|
14
|
-
"experimentalDecorators": true,
|
|
15
|
-
"emitDecoratorMetadata": true,
|
|
16
|
-
|
|
17
|
-
"incremental": true,
|
|
18
|
-
"sourceMap": true,
|
|
19
|
-
"declaration": true,
|
|
20
|
-
"declarationMap": true,
|
|
21
|
-
"removeComments": true,
|
|
22
|
-
|
|
23
|
-
"isolatedModules": true,
|
|
24
|
-
"esModuleInterop": true,
|
|
25
|
-
"importHelpers": false,
|
|
26
|
-
"skipLibCheck": false,
|
|
27
|
-
"downlevelIteration": false,
|
|
28
|
-
|
|
29
|
-
"strict": true,
|
|
30
|
-
"strictPropertyInitialization": false,
|
|
31
|
-
"noFallthroughCasesInSwitch": false,
|
|
32
|
-
"noUnusedLocals": false,
|
|
33
|
-
"noUnusedParameters": false,
|
|
34
|
-
"exactOptionalPropertyTypes": false
|
|
35
|
-
},
|
|
36
|
-
"include": ["src/**/*", "tests/**/*", "**/*.spec.ts", "**/*.test.ts"]
|
|
37
|
-
}
|