@jayfong/x-server 2.21.7 → 2.21.9
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/lib/_cjs/cli/env_util.js +4 -1
- package/lib/_cjs/services/sms.js +24 -8
- package/lib/cli/env_util.d.ts +1 -0
- package/lib/cli/env_util.js +5 -2
- package/lib/services/sms.js +24 -8
- package/package.json +2 -2
package/lib/_cjs/cli/env_util.js
CHANGED
|
@@ -148,7 +148,7 @@ class EnvUtil {
|
|
|
148
148
|
${env.comment.split(/[\r\n]+/g).map(line => `* ${line.trim()}`).join('\n*\n')}
|
|
149
149
|
*/
|
|
150
150
|
` : ''}
|
|
151
|
-
${env.key}: ${
|
|
151
|
+
${env.key}: ${EnvUtil.getTypesFromValue(env.value)};
|
|
152
152
|
`).join('\n')}
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -160,6 +160,9 @@ class EnvUtil {
|
|
|
160
160
|
const types = EnvUtil.makeTypes(envs);
|
|
161
161
|
await _fsExtra.default.outputFile(outFile, types);
|
|
162
162
|
}
|
|
163
|
+
static getTypesFromValue(value) {
|
|
164
|
+
return Array.isArray(value) ? `Array<${value[0] ? EnvUtil.getTypesFromValue(value[0]) : 'any'}>` : (0, _vtils.isPlainObject)(value) ? Object.keys(value).length ? `Record<any, ${EnvUtil.getTypesFromValue(value[Object.keys(value)[0]])}>` : `Record<any, any>` : typeof value;
|
|
165
|
+
}
|
|
163
166
|
}
|
|
164
167
|
exports.EnvUtil = EnvUtil;
|
|
165
168
|
EnvUtil.NEWLINE = '\n';
|