@andre1502/react-utilities 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +340 -0
- package/dist/Config/Config.d.ts +28 -0
- package/dist/Config/Config.js +200 -0
- package/dist/Config/Config.js.map +1 -0
- package/dist/Config/GoogleAuth.d.ts +15 -0
- package/dist/Config/GoogleAuth.js +71 -0
- package/dist/Config/GoogleAuth.js.map +1 -0
- package/dist/Config/Locales.d.ts +18 -0
- package/dist/Config/Locales.js +62 -0
- package/dist/Config/Locales.js.map +1 -0
- package/dist/Config/Output.d.ts +10 -0
- package/dist/Config/Output.js +28 -0
- package/dist/Config/Output.js.map +1 -0
- package/dist/Config/Sitemap.d.ts +13 -0
- package/dist/Config/Sitemap.js +73 -0
- package/dist/Config/Sitemap.js.map +1 -0
- package/dist/Format/NumberFormat.d.ts +6 -0
- package/dist/Format/NumberFormat.js +77 -0
- package/dist/Format/NumberFormat.js.map +1 -0
- package/dist/Format/NumberParser.d.ts +9 -0
- package/dist/Format/NumberParser.js +51 -0
- package/dist/Format/NumberParser.js.map +1 -0
- package/dist/React-BaJ1KfGF.js +87 -0
- package/dist/React-BaJ1KfGF.js.map +1 -0
- package/dist/React-qUl0CBmE.js +109 -0
- package/dist/React-qUl0CBmE.js.map +1 -0
- package/dist/ReactNative-CqUrY2ZJ.js +3856 -0
- package/dist/ReactNative-CqUrY2ZJ.js.map +1 -0
- package/dist/ReactNative-mNnws-b5.js +3834 -0
- package/dist/ReactNative-mNnws-b5.js.map +1 -0
- package/dist/Sentry/Build.d.ts +9 -0
- package/dist/Sentry/Build.js +88 -0
- package/dist/Sentry/Build.js.map +1 -0
- package/dist/Sentry/React.d.ts +18 -0
- package/dist/Sentry/React.js +104 -0
- package/dist/Sentry/React.js.map +1 -0
- package/dist/Sentry/ReactNative.d.ts +18 -0
- package/dist/Sentry/ReactNative.js +114 -0
- package/dist/Sentry/ReactNative.js.map +1 -0
- package/dist/Sentry/Utils.d.ts +2 -0
- package/dist/Sentry/Utils.js +24 -0
- package/dist/Sentry/Utils.js.map +1 -0
- package/dist/Utils/Files.d.ts +7 -0
- package/dist/Utils/Files.js +52 -0
- package/dist/Utils/Files.js.map +1 -0
- package/dist/Utils-Cq948gfa.js +20 -0
- package/dist/Utils-Cq948gfa.js.map +1 -0
- package/dist/Utils-Dilye04y.js +22 -0
- package/dist/Utils-Dilye04y.js.map +1 -0
- package/dist/config-cli.cjs +471 -0
- package/dist/config-cli.cjs.map +1 -0
- package/dist/config-cli.d.ts +34 -0
- package/dist/config-cli.js +220 -0
- package/dist/config-cli.js.map +1 -0
- package/dist/config-cli.mjs +443 -0
- package/dist/config-cli.mjs.map +1 -0
- package/dist/enums/CurrencySymbolEnum.d.ts +5 -0
- package/dist/enums/CurrencySymbolEnum.js +13 -0
- package/dist/enums/CurrencySymbolEnum.js.map +1 -0
- package/dist/format.cjs +122 -0
- package/dist/format.cjs.map +1 -0
- package/dist/format.d.ts +3 -0
- package/dist/format.js +55 -0
- package/dist/format.js.map +1 -0
- package/dist/format.mjs +117 -0
- package/dist/format.mjs.map +1 -0
- package/dist/index-cli.cjs +24 -0
- package/dist/index-cli.cjs.map +1 -0
- package/dist/index-cli.d.ts +2 -0
- package/dist/index-cli.js +28 -0
- package/dist/index-cli.js.map +1 -0
- package/dist/index-cli.mjs +12 -0
- package/dist/index-cli.mjs.map +1 -0
- package/dist/index-fmt.cjs +16 -0
- package/dist/index-fmt.cjs.map +1 -0
- package/dist/index-fmt.d.ts +1 -0
- package/dist/index-fmt.js +17 -0
- package/dist/index-fmt.js.map +1 -0
- package/dist/index-fmt.mjs +3 -0
- package/dist/index-fmt.mjs.map +1 -0
- package/dist/index-rn.cjs +21 -0
- package/dist/index-rn.cjs.map +1 -0
- package/dist/index-rn.d.ts +2 -0
- package/dist/index-rn.js +28 -0
- package/dist/index-rn.js.map +1 -0
- package/dist/index-rn.mjs +6 -0
- package/dist/index-rn.mjs.map +1 -0
- package/dist/index.cjs +21 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +28 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +6 -0
- package/dist/index.mjs.map +1 -0
- package/dist/interfaces/Config/ConfigOptions.d.ts +8 -0
- package/dist/interfaces/Config/ConfigOptions.js +6 -0
- package/dist/interfaces/Config/ConfigOptions.js.map +1 -0
- package/dist/interfaces/Config/OutputMap.d.ts +3 -0
- package/dist/interfaces/Config/OutputMap.js +6 -0
- package/dist/interfaces/Config/OutputMap.js.map +1 -0
- package/dist/interfaces/Config/OutputOptions.d.ts +7 -0
- package/dist/interfaces/Config/OutputOptions.js +6 -0
- package/dist/interfaces/Config/OutputOptions.js.map +1 -0
- package/dist/interfaces/Config/SitemapMap.d.ts +5 -0
- package/dist/interfaces/Config/SitemapMap.js +6 -0
- package/dist/interfaces/Config/SitemapMap.js.map +1 -0
- package/dist/interfaces/Config/StringMap.d.ts +3 -0
- package/dist/interfaces/Config/StringMap.js +6 -0
- package/dist/interfaces/Config/StringMap.js.map +1 -0
- package/dist/interfaces/Format/FormatOptions.d.ts +14 -0
- package/dist/interfaces/Format/FormatOptions.js +6 -0
- package/dist/interfaces/Format/FormatOptions.js.map +1 -0
- package/dist/interfaces/Sentry/InitOptions.d.ts +20 -0
- package/dist/interfaces/Sentry/InitOptions.js +6 -0
- package/dist/interfaces/Sentry/InitOptions.js.map +1 -0
- package/dist/interfaces/Sentry/InitOptionsRN.d.ts +4 -0
- package/dist/interfaces/Sentry/InitOptionsRN.js +6 -0
- package/dist/interfaces/Sentry/InitOptionsRN.js.map +1 -0
- package/dist/interfaces/Sentry/SourceMapOptions.d.ts +7 -0
- package/dist/interfaces/Sentry/SourceMapOptions.js +6 -0
- package/dist/interfaces/Sentry/SourceMapOptions.js.map +1 -0
- package/dist/sentry-cli.cjs +119 -0
- package/dist/sentry-cli.cjs.map +1 -0
- package/dist/sentry-cli.d.ts +9 -0
- package/dist/sentry-cli.js +50 -0
- package/dist/sentry-cli.js.map +1 -0
- package/dist/sentry-cli.mjs +98 -0
- package/dist/sentry-cli.mjs.map +1 -0
- package/dist/sentry-rn.cjs +11 -0
- package/dist/sentry-rn.cjs.map +1 -0
- package/dist/sentry-rn.d.ts +2 -0
- package/dist/sentry-rn.js +28 -0
- package/dist/sentry-rn.js.map +1 -0
- package/dist/sentry-rn.mjs +4 -0
- package/dist/sentry-rn.mjs.map +1 -0
- package/dist/sentry.cjs +11 -0
- package/dist/sentry.cjs.map +1 -0
- package/dist/sentry.d.ts +2 -0
- package/dist/sentry.js +28 -0
- package/dist/sentry.js.map +1 -0
- package/dist/sentry.mjs +4 -0
- package/dist/sentry.mjs.map +1 -0
- package/dist/types/Config/OptionType.d.ts +2 -0
- package/dist/types/Config/OptionType.js +6 -0
- package/dist/types/Config/OptionType.js.map +1 -0
- package/dist/types/Format/OptionType.d.ts +3 -0
- package/dist/types/Format/OptionType.js +6 -0
- package/dist/types/Format/OptionType.js.map +1 -0
- package/dist/types/Sentry/OptionType.d.ts +1 -0
- package/dist/types/Sentry/OptionType.js +6 -0
- package/dist/types/Sentry/OptionType.js.map +1 -0
- package/package.json +139 -0
- package/src/Config/Config.ts +258 -0
- package/src/Config/GoogleAuth.ts +54 -0
- package/src/Config/Locales.ts +72 -0
- package/src/Config/Output.ts +29 -0
- package/src/Config/Sitemap.ts +67 -0
- package/src/Format/NumberFormat.ts +96 -0
- package/src/Format/NumberParser.ts +42 -0
- package/src/Sentry/Build.ts +67 -0
- package/src/Sentry/React.ts +127 -0
- package/src/Sentry/ReactNative.ts +133 -0
- package/src/Sentry/Utils.ts +26 -0
- package/src/Utils/Files.ts +51 -0
- package/src/config-cli.ts +152 -0
- package/src/enums/CurrencySymbolEnum.ts +5 -0
- package/src/format.ts +39 -0
- package/src/index-cli.ts +2 -0
- package/src/index-fmt.ts +1 -0
- package/src/index-rn.ts +2 -0
- package/src/index.ts +2 -0
- package/src/interfaces/Config/ConfigOptions.ts +9 -0
- package/src/interfaces/Config/OutputMap.ts +3 -0
- package/src/interfaces/Config/OutputOptions.ts +8 -0
- package/src/interfaces/Config/SitemapMap.ts +5 -0
- package/src/interfaces/Config/StringMap.ts +3 -0
- package/src/interfaces/Format/FormatOptions.ts +19 -0
- package/src/interfaces/Sentry/InitOptions.ts +23 -0
- package/src/interfaces/Sentry/InitOptionsRN.ts +5 -0
- package/src/interfaces/Sentry/SourceMapOptions.ts +7 -0
- package/src/sentry-cli.ts +16 -0
- package/src/sentry-rn.ts +2 -0
- package/src/sentry.ts +2 -0
- package/src/types/Config/OptionType.ts +2 -0
- package/src/types/Format/OptionType.ts +15 -0
- package/src/types/Sentry/OptionType.ts +1 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Utils-Cq948gfa.js","sources":["../src/Sentry/Utils.ts"],"sourcesContent":[null],"names":["recordSentryHttp","Sentry","config","request","response","withScope","scope","setContext"],"mappings":"AAAMA,MAAAA,gBAAgB,GAAGA,CACvBC,MAAW,EACXC,MAAY,EACZC,OAAa,EACbC,QAAc,KACZ;AACF,EAAA,IAAIF,MAAM,EAAE;AACVD,IAAAA,MAAM,CAACI,SAAS,CAAEC,KAAU,IAAI;AAC9BA,MAAAA,KAAK,CAACC,UAAU,CAAC,QAAQ,EAAEL,MAAM,CAAC,CAAA;AACpC,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,IAAIC,OAAO,EAAE;AACXF,IAAAA,MAAM,CAACI,SAAS,CAAEC,KAAU,IAAI;AAC9BA,MAAAA,KAAK,CAACC,UAAU,CAAC,SAAS,EAAEJ,OAAO,CAAC,CAAA;AACtC,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,IAAIC,QAAQ,EAAE;AACZH,IAAAA,MAAM,CAACI,SAAS,CAAEC,KAAU,IAAI;AAC9BA,MAAAA,KAAK,CAACC,UAAU,CAAC,UAAU,EAAEH,QAAQ,CAAC,CAAA;AACxC,KAAC,CAAC,CAAA;AACJ,GAAA;AACF;;;;"}
|
@@ -0,0 +1,22 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
const recordSentryHttp = (Sentry, config, request, response) => {
|
4
|
+
if (config) {
|
5
|
+
Sentry.withScope(scope => {
|
6
|
+
scope.setContext('config', config);
|
7
|
+
});
|
8
|
+
}
|
9
|
+
if (request) {
|
10
|
+
Sentry.withScope(scope => {
|
11
|
+
scope.setContext('request', request);
|
12
|
+
});
|
13
|
+
}
|
14
|
+
if (response) {
|
15
|
+
Sentry.withScope(scope => {
|
16
|
+
scope.setContext('response', response);
|
17
|
+
});
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
exports.recordSentryHttp = recordSentryHttp;
|
22
|
+
//# sourceMappingURL=Utils-Dilye04y.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"Utils-Dilye04y.js","sources":["../src/Sentry/Utils.ts"],"sourcesContent":[null],"names":["recordSentryHttp","Sentry","config","request","response","withScope","scope","setContext"],"mappings":";;AAAMA,MAAAA,gBAAgB,GAAGA,CACvBC,MAAW,EACXC,MAAY,EACZC,OAAa,EACbC,QAAc,KACZ;AACF,EAAA,IAAIF,MAAM,EAAE;AACVD,IAAAA,MAAM,CAACI,SAAS,CAAEC,KAAU,IAAI;AAC9BA,MAAAA,KAAK,CAACC,UAAU,CAAC,QAAQ,EAAEL,MAAM,CAAC,CAAA;AACpC,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,IAAIC,OAAO,EAAE;AACXF,IAAAA,MAAM,CAACI,SAAS,CAAEC,KAAU,IAAI;AAC9BA,MAAAA,KAAK,CAACC,UAAU,CAAC,SAAS,EAAEJ,OAAO,CAAC,CAAA;AACtC,KAAC,CAAC,CAAA;AACJ,GAAA;AAEA,EAAA,IAAIC,QAAQ,EAAE;AACZH,IAAAA,MAAM,CAACI,SAAS,CAAEC,KAAU,IAAI;AAC9BA,MAAAA,KAAK,CAACC,UAAU,CAAC,UAAU,EAAEH,QAAQ,CAAC,CAAA;AACxC,KAAC,CAAC,CAAA;AACJ,GAAA;AACF;;;;"}
|
@@ -0,0 +1,471 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var lodash = require('lodash');
|
4
|
+
var fs = require('fs');
|
5
|
+
var googleAuthLibrary = require('google-auth-library');
|
6
|
+
var googleapis = require('googleapis');
|
7
|
+
var path = require('path');
|
8
|
+
var process = require('process');
|
9
|
+
var sitemap = require('sitemap');
|
10
|
+
var stream = require('stream');
|
11
|
+
|
12
|
+
function _interopNamespaceDefault(e) {
|
13
|
+
var n = Object.create(null);
|
14
|
+
if (e) {
|
15
|
+
Object.keys(e).forEach(function (k) {
|
16
|
+
if (k !== 'default') {
|
17
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
18
|
+
Object.defineProperty(n, k, d.get ? d : {
|
19
|
+
enumerable: true,
|
20
|
+
get: function () { return e[k]; }
|
21
|
+
});
|
22
|
+
}
|
23
|
+
});
|
24
|
+
}
|
25
|
+
n.default = e;
|
26
|
+
return Object.freeze(n);
|
27
|
+
}
|
28
|
+
|
29
|
+
var lodash__namespace = /*#__PURE__*/_interopNamespaceDefault(lodash);
|
30
|
+
var path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
|
31
|
+
var process__namespace = /*#__PURE__*/_interopNamespaceDefault(process);
|
32
|
+
|
33
|
+
/**
|
34
|
+
* Write content into target file
|
35
|
+
*
|
36
|
+
* @param {string} content
|
37
|
+
* @param {OutputOptions} options
|
38
|
+
* @return {void}
|
39
|
+
*/
|
40
|
+
const outputToFile = (content, options) => {
|
41
|
+
let filename = options.filename;
|
42
|
+
if (options.isFilenameLowercase) {
|
43
|
+
filename = filename.toLowerCase();
|
44
|
+
}
|
45
|
+
const filePath = `${options.folder}/${filename}`;
|
46
|
+
fs.writeFile(filePath, content, 'utf8', function (err) {
|
47
|
+
if (err) {
|
48
|
+
throw err;
|
49
|
+
}
|
50
|
+
console.log(filePath, content);
|
51
|
+
});
|
52
|
+
};
|
53
|
+
|
54
|
+
/**
|
55
|
+
* Process config data
|
56
|
+
*
|
57
|
+
* @param {any[][]} rows
|
58
|
+
* @return {OutputMap}
|
59
|
+
*/
|
60
|
+
const processConfig = rows => {
|
61
|
+
let versionConfig = {};
|
62
|
+
let params = rows[0].map(key => {
|
63
|
+
return key;
|
64
|
+
});
|
65
|
+
rows.forEach((row, index) => {
|
66
|
+
if (index === 0) {
|
67
|
+
return;
|
68
|
+
}
|
69
|
+
versionConfig = processRow(row, params, versionConfig);
|
70
|
+
});
|
71
|
+
return versionConfig;
|
72
|
+
};
|
73
|
+
/**
|
74
|
+
* Process config item
|
75
|
+
*
|
76
|
+
* @param {string[]} data
|
77
|
+
* @param {string[]} params
|
78
|
+
* @param {OutputMap} versionConfig
|
79
|
+
* @return {OutputMap}
|
80
|
+
*/
|
81
|
+
const processRow = (data, params, versionConfig) => {
|
82
|
+
const versionName = data[0];
|
83
|
+
versionConfig[versionName] = {};
|
84
|
+
params.forEach((paramsName, index) => {
|
85
|
+
if (index === 0 || data[index] === undefined || data[index] === '') {
|
86
|
+
return;
|
87
|
+
}
|
88
|
+
versionConfig[versionName][paramsName] = paramsTypeHandler(data[index]);
|
89
|
+
});
|
90
|
+
return versionConfig;
|
91
|
+
};
|
92
|
+
/**
|
93
|
+
* Check is JSON value
|
94
|
+
*
|
95
|
+
* @param {string} str
|
96
|
+
* @return {boolean}
|
97
|
+
*/
|
98
|
+
const isJsonString = str => {
|
99
|
+
try {
|
100
|
+
JSON.parse(str);
|
101
|
+
} catch (e) {
|
102
|
+
return false;
|
103
|
+
}
|
104
|
+
return true;
|
105
|
+
};
|
106
|
+
/**
|
107
|
+
* Handling config value type
|
108
|
+
*
|
109
|
+
* @param {string} params
|
110
|
+
* @return {any}
|
111
|
+
*/
|
112
|
+
const paramsTypeHandler = params => {
|
113
|
+
const booleanText = ['TRUE', 'FALSE'];
|
114
|
+
if (booleanText.includes(params.toUpperCase())) {
|
115
|
+
return params === 'TRUE';
|
116
|
+
}
|
117
|
+
if (isJsonString(params)) {
|
118
|
+
return JSON.parse(params);
|
119
|
+
}
|
120
|
+
return params;
|
121
|
+
};
|
122
|
+
/**
|
123
|
+
* Export config data into js file
|
124
|
+
*
|
125
|
+
* @param {OutputMap} data
|
126
|
+
* @param {OutputOptions} options
|
127
|
+
* @return {void}
|
128
|
+
*/
|
129
|
+
const exportConfig = (data, options) => {
|
130
|
+
const config = {
|
131
|
+
params: data
|
132
|
+
};
|
133
|
+
const content = `module.exports = ${JSON.stringify(config, null, 2)}`;
|
134
|
+
outputToFile(content, options);
|
135
|
+
};
|
136
|
+
/**
|
137
|
+
* Handling env map value
|
138
|
+
*
|
139
|
+
* @param {string} env
|
140
|
+
* @return {string}
|
141
|
+
*/
|
142
|
+
const envMap = env => {
|
143
|
+
let result;
|
144
|
+
switch (env) {
|
145
|
+
case 'dev':
|
146
|
+
case 'develop':
|
147
|
+
case 'development':
|
148
|
+
result = 'dev';
|
149
|
+
break;
|
150
|
+
case 'stg':
|
151
|
+
case 'stag':
|
152
|
+
case 'staging':
|
153
|
+
result = 'staging';
|
154
|
+
break;
|
155
|
+
case 'prd':
|
156
|
+
case 'prod':
|
157
|
+
case 'production':
|
158
|
+
result = 'production';
|
159
|
+
break;
|
160
|
+
default:
|
161
|
+
throw new Error(`env ${env} not supported.`);
|
162
|
+
}
|
163
|
+
return result;
|
164
|
+
};
|
165
|
+
/**
|
166
|
+
* Mapping content to exportAs value
|
167
|
+
*
|
168
|
+
* @param {string} key
|
169
|
+
* @param {any} value
|
170
|
+
* @param {string} exportAs
|
171
|
+
* @return {string}
|
172
|
+
*/
|
173
|
+
const contentMap = (key, value, exportAs) => {
|
174
|
+
let content = '';
|
175
|
+
switch (exportAs) {
|
176
|
+
case 'ts':
|
177
|
+
if (lodash__namespace.isNull(value)) {
|
178
|
+
content += `export const ${key}: string | null = ${value};\n`;
|
179
|
+
} else if (typeof value === 'boolean') {
|
180
|
+
content += `export const ${key}: boolean = ${value};\n`;
|
181
|
+
} else {
|
182
|
+
content += `export const ${key} = '${value}';\n`;
|
183
|
+
}
|
184
|
+
break;
|
185
|
+
case 'js':
|
186
|
+
content += `export const ${key} = "${value}";\n`;
|
187
|
+
break;
|
188
|
+
case 'env':
|
189
|
+
content += `${key} = "${value}"\n`;
|
190
|
+
break;
|
191
|
+
default:
|
192
|
+
throw new Error(`exportAs ${exportAs} not supported.`);
|
193
|
+
}
|
194
|
+
return content;
|
195
|
+
};
|
196
|
+
/**
|
197
|
+
* Transform config
|
198
|
+
*
|
199
|
+
* @param {OutputMap} data
|
200
|
+
* @param {string} env
|
201
|
+
* @param {string} configKeyPrefix
|
202
|
+
* @param {OutputOptions} options
|
203
|
+
* @return {void}
|
204
|
+
*/
|
205
|
+
const transformConfig = (data, env, configKeyPrefix, options) => {
|
206
|
+
const envKey = configKeyPrefix ? `${configKeyPrefix}ENV` : 'ENV';
|
207
|
+
let content = contentMap(envKey, envMap(env), options.exportAs);
|
208
|
+
Object.keys(data).forEach(key => {
|
209
|
+
const newConfigKey = configKeyPrefix ? `${configKeyPrefix}${key}` : key;
|
210
|
+
if (key === 'BASE_PROJECT') {
|
211
|
+
const extensionFile = [`.${data[key]}.js`, `.${data[key]}.jsx`, `.${data[key]}.ts`, `.${data[key]}.tsx`, `.${data[key]}.css`, `.${data[key]}.json`, `.${data[key]}.scss`];
|
212
|
+
content += contentMap(newConfigKey, extensionFile.join(','), options.exportAs);
|
213
|
+
return;
|
214
|
+
}
|
215
|
+
if (key === 'SITEMAP') {
|
216
|
+
content += contentMap(newConfigKey, JSON.stringify(data[key]), options.exportAs);
|
217
|
+
return;
|
218
|
+
}
|
219
|
+
if (Array.isArray(data[key])) {
|
220
|
+
content += contentMap(newConfigKey, data[key].join(','), options.exportAs);
|
221
|
+
return;
|
222
|
+
}
|
223
|
+
if (typeof data[key] === 'object') {
|
224
|
+
if (data[key].hasOwnProperty(env)) {
|
225
|
+
content += contentMap(newConfigKey, data[key][env], options.exportAs);
|
226
|
+
} else {
|
227
|
+
content += contentMap(newConfigKey, JSON.stringify(data[key]), options.exportAs);
|
228
|
+
}
|
229
|
+
return;
|
230
|
+
}
|
231
|
+
content += contentMap(newConfigKey, data[key], options.exportAs);
|
232
|
+
});
|
233
|
+
outputToFile(content, options);
|
234
|
+
};
|
235
|
+
|
236
|
+
const SCOPES = ['https://www.googleapis.com/auth/spreadsheets.readonly'];
|
237
|
+
const GOOGLE_APPLICATION_CREDENTIALS_PATH = path__namespace.join(process__namespace.cwd(), '/google_application_credentials.json');
|
238
|
+
/**
|
239
|
+
* Authenticate using google console service account.
|
240
|
+
* @return {GoogleAuth<JSONClient>}
|
241
|
+
*/
|
242
|
+
const authorizeServiceAccount = () => {
|
243
|
+
const isExist = fs.existsSync(GOOGLE_APPLICATION_CREDENTIALS_PATH);
|
244
|
+
const options = {
|
245
|
+
scopes: SCOPES
|
246
|
+
};
|
247
|
+
if (isExist) {
|
248
|
+
options.keyFile = GOOGLE_APPLICATION_CREDENTIALS_PATH;
|
249
|
+
}
|
250
|
+
return new googleAuthLibrary.GoogleAuth(options);
|
251
|
+
};
|
252
|
+
/**
|
253
|
+
* @param {GoogleAuth<JSONClient>} auth The authenticated Google OAuth client.
|
254
|
+
* @param {string} spreadsheetId
|
255
|
+
* @param {string} spreadsheetTab
|
256
|
+
* @return {Promise<any[][] | null | undefined>}
|
257
|
+
*/
|
258
|
+
const fetchGoogleSheet = async (auth, spreadsheetId, spreadsheetTab) => {
|
259
|
+
const sheets = googleapis.google.sheets({
|
260
|
+
version: 'v4',
|
261
|
+
auth
|
262
|
+
});
|
263
|
+
const res = await sheets.spreadsheets.values.get({
|
264
|
+
spreadsheetId: spreadsheetId,
|
265
|
+
range: spreadsheetTab,
|
266
|
+
majorDimension: 'COLUMNS'
|
267
|
+
});
|
268
|
+
return res.data.values;
|
269
|
+
};
|
270
|
+
|
271
|
+
/**
|
272
|
+
* Process locales data
|
273
|
+
*
|
274
|
+
* @param {any[][]} rows
|
275
|
+
* @return {OutputMap}
|
276
|
+
*/
|
277
|
+
const processLocales = rows => {
|
278
|
+
let keys = rows[0].map(key => {
|
279
|
+
return key;
|
280
|
+
});
|
281
|
+
let data = {};
|
282
|
+
rows.forEach((lang, index) => {
|
283
|
+
if (index === 0) {
|
284
|
+
return;
|
285
|
+
}
|
286
|
+
let langData = {};
|
287
|
+
lang.forEach((data, dIndex) => {
|
288
|
+
if (dIndex === 0) {
|
289
|
+
return;
|
290
|
+
}
|
291
|
+
langData[keys[dIndex]] = data;
|
292
|
+
});
|
293
|
+
data[lang[0]] = langData;
|
294
|
+
});
|
295
|
+
return data;
|
296
|
+
};
|
297
|
+
/**
|
298
|
+
* Export locales data to file
|
299
|
+
*
|
300
|
+
* @param {OutputMap} data
|
301
|
+
* @param {OutputOptions} options
|
302
|
+
* @return {void}
|
303
|
+
*/
|
304
|
+
const exportLocales = (data, options) => {
|
305
|
+
Object.keys(data).forEach(key => {
|
306
|
+
options.filename = `${key}.${options.exportAs.toLowerCase()}`;
|
307
|
+
let content = '';
|
308
|
+
switch (options.exportAs) {
|
309
|
+
case 'ts':
|
310
|
+
content = 'export default ' + JSON.stringify(data[key], null, 2);
|
311
|
+
break;
|
312
|
+
case 'json':
|
313
|
+
content = JSON.stringify(data[key], null, 2);
|
314
|
+
break;
|
315
|
+
default:
|
316
|
+
throw new Error(`exportAs ${options.exportAs} not supported.`);
|
317
|
+
}
|
318
|
+
if (!content) {
|
319
|
+
throw new Error(`empty content, please check remote value.`);
|
320
|
+
}
|
321
|
+
outputToFile(content, options);
|
322
|
+
});
|
323
|
+
};
|
324
|
+
|
325
|
+
/**
|
326
|
+
* Generate Sitemap Robots
|
327
|
+
*
|
328
|
+
* @param {string} hostname
|
329
|
+
* @param {OutputOptions} options
|
330
|
+
* @return {void}
|
331
|
+
*/
|
332
|
+
const generateRobots = (hostname, options) => {
|
333
|
+
let content = ['# https://www.robotstxt.org/robotstxt.html', `Sitemap: ${hostname}/${options.filename}`, 'User-agent: *', 'Disallow:'];
|
334
|
+
options.filename = 'robots.txt';
|
335
|
+
outputToFile(content.join('\r\n'), options);
|
336
|
+
};
|
337
|
+
/**
|
338
|
+
* Transform Sitemap
|
339
|
+
*
|
340
|
+
* @param {string} hostname
|
341
|
+
* @param {SitemapMap[]} urls
|
342
|
+
* @param {boolean} includeRobots
|
343
|
+
* @param {OutputOptions} options
|
344
|
+
* @return {Promise<void>}
|
345
|
+
*/
|
346
|
+
const transformSitemap = async (hostname, urls, includeRobots, options) => {
|
347
|
+
const stream$1 = new sitemap.SitemapStream({
|
348
|
+
hostname: hostname,
|
349
|
+
lastmodDateOnly: false,
|
350
|
+
xmlns: {
|
351
|
+
news: false,
|
352
|
+
xhtml: false,
|
353
|
+
image: false,
|
354
|
+
video: false,
|
355
|
+
custom: ['xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"', 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd"']
|
356
|
+
}
|
357
|
+
});
|
358
|
+
const content = await sitemap.streamToPromise(stream.Readable.from(urls).pipe(stream$1)).then(data => data.toString());
|
359
|
+
outputToFile(content, options);
|
360
|
+
if (includeRobots) {
|
361
|
+
generateRobots(hostname, options);
|
362
|
+
}
|
363
|
+
};
|
364
|
+
|
365
|
+
/**
|
366
|
+
* Private function to fetch locales
|
367
|
+
*
|
368
|
+
* @param {GoogleAuth<JSONClient>} auth
|
369
|
+
* @param {ConfigOption} options
|
370
|
+
* @return {Promise<void>}
|
371
|
+
*/
|
372
|
+
const innerFetchLocales = async (auth, options) => {
|
373
|
+
// console.log('auth', auth);
|
374
|
+
const values = await fetchGoogleSheet(auth, options.spreadsheetId, options.spreadsheetTab);
|
375
|
+
if (!values || values.length === 0) {
|
376
|
+
console.log('No data found.');
|
377
|
+
return;
|
378
|
+
}
|
379
|
+
// console.log('values,', values);
|
380
|
+
const data = processLocales(values);
|
381
|
+
exportLocales(data, options.output);
|
382
|
+
};
|
383
|
+
/**
|
384
|
+
* Private function to fetch config
|
385
|
+
*
|
386
|
+
* @param {GoogleAuth<JSONClient>} auth
|
387
|
+
* @param {ConfigOption} options
|
388
|
+
* @return {Promise<void>}
|
389
|
+
*/
|
390
|
+
const innerFetchConfig = async (auth, options) => {
|
391
|
+
// console.log('auth', auth);
|
392
|
+
const values = await fetchGoogleSheet(auth, options.spreadsheetId, options.spreadsheetTab);
|
393
|
+
if (!values || values.length === 0) {
|
394
|
+
console.log('No data found.');
|
395
|
+
return;
|
396
|
+
}
|
397
|
+
// console.log('values,', values);
|
398
|
+
const data = processConfig(values);
|
399
|
+
exportConfig(data, options.output);
|
400
|
+
};
|
401
|
+
/**
|
402
|
+
* Fetch locales
|
403
|
+
*
|
404
|
+
* @param {ConfigOptions} options
|
405
|
+
* @return {void}
|
406
|
+
*/
|
407
|
+
const fetchLocales = options => {
|
408
|
+
try {
|
409
|
+
const auth = authorizeServiceAccount();
|
410
|
+
innerFetchLocales(auth, options);
|
411
|
+
} catch (error) {
|
412
|
+
console.error(error);
|
413
|
+
}
|
414
|
+
};
|
415
|
+
/**
|
416
|
+
* Fetch config
|
417
|
+
*
|
418
|
+
* @param {ConfigOptions} options
|
419
|
+
* @return {void}
|
420
|
+
*/
|
421
|
+
const fetchConfig = options => {
|
422
|
+
try {
|
423
|
+
const auth = authorizeServiceAccount();
|
424
|
+
innerFetchConfig(auth, options);
|
425
|
+
} catch (error) {
|
426
|
+
console.error(error);
|
427
|
+
}
|
428
|
+
};
|
429
|
+
/**
|
430
|
+
* Fetch all format from array options
|
431
|
+
*
|
432
|
+
* @param {ConfigOptions[]} options
|
433
|
+
* @return {void}
|
434
|
+
*/
|
435
|
+
const fetchAll = options => {
|
436
|
+
try {
|
437
|
+
const auth = authorizeServiceAccount();
|
438
|
+
options.forEach(option => {
|
439
|
+
if (option.formatAs === 'locales') {
|
440
|
+
innerFetchLocales(auth, option);
|
441
|
+
} else if (option.formatAs === 'config') {
|
442
|
+
innerFetchConfig(auth, option);
|
443
|
+
}
|
444
|
+
});
|
445
|
+
} catch (error) {
|
446
|
+
console.error(error);
|
447
|
+
}
|
448
|
+
};
|
449
|
+
/**
|
450
|
+
* Fetch raw value
|
451
|
+
*
|
452
|
+
* @param {ConfigOptions} options
|
453
|
+
* @return {Promise<any[][] | null | undefined>}
|
454
|
+
*/
|
455
|
+
const fetchRawValue = async options => {
|
456
|
+
try {
|
457
|
+
const auth = authorizeServiceAccount();
|
458
|
+
return await fetchGoogleSheet(auth, options.spreadsheetId, options.spreadsheetTab);
|
459
|
+
} catch (error) {
|
460
|
+
console.error(error);
|
461
|
+
}
|
462
|
+
return null;
|
463
|
+
};
|
464
|
+
|
465
|
+
exports.fetchAll = fetchAll;
|
466
|
+
exports.fetchConfig = fetchConfig;
|
467
|
+
exports.fetchLocales = fetchLocales;
|
468
|
+
exports.fetchRawValue = fetchRawValue;
|
469
|
+
exports.transformConfig = transformConfig;
|
470
|
+
exports.transformSitemap = transformSitemap;
|
471
|
+
//# sourceMappingURL=config-cli.cjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"config-cli.cjs","sources":["../src/Config/Output.ts","../src/Config/Config.ts","../src/Config/GoogleAuth.ts","../src/Config/Locales.ts","../src/Config/Sitemap.ts","../src/config-cli.ts"],"sourcesContent":[null,null,null,null,null,null],"names":["outputToFile","content","options","filename","isFilenameLowercase","toLowerCase","filePath","folder","writeFile","err","console","log","processConfig","rows","versionConfig","params","map","key","forEach","row","index","processRow","data","versionName","paramsName","undefined","paramsTypeHandler","isJsonString","str","JSON","parse","e","booleanText","includes","toUpperCase","exportConfig","config","stringify","envMap","env","result","Error","contentMap","value","exportAs","lodash","isNull","transformConfig","configKeyPrefix","envKey","Object","keys","newConfigKey","extensionFile","join","Array","isArray","hasOwnProperty","SCOPES","GOOGLE_APPLICATION_CREDENTIALS_PATH","path","process","cwd","authorizeServiceAccount","isExist","existsSync","scopes","keyFile","GoogleAuth","fetchGoogleSheet","auth","spreadsheetId","spreadsheetTab","sheets","google","version","res","spreadsheets","values","get","range","majorDimension","processLocales","lang","langData","dIndex","exportLocales","generateRobots","hostname","transformSitemap","urls","includeRobots","stream","SitemapStream","lastmodDateOnly","xmlns","news","xhtml","image","video","custom","streamToPromise","Readable","from","pipe","then","toString","innerFetchLocales","length","output","innerFetchConfig","fetchLocales","error","fetchConfig","fetchAll","option","formatAs","fetchRawValue"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;AAMG;AACH,MAAMA,YAAY,GAAGA,CAACC,OAAe,EAAEC,OAAsB,KAAU;AACrE,EAAA,IAAIC,QAAQ,GAAGD,OAAO,CAACC,QAAQ,CAAA;EAE/B,IAAID,OAAO,CAACE,mBAAmB,EAAE;AAC/BD,IAAAA,QAAQ,GAAGA,QAAQ,CAACE,WAAW,EAAE,CAAA;AACnC,GAAA;EAEA,MAAMC,QAAQ,GAAG,CAAGJ,EAAAA,OAAO,CAACK,MAAM,CAAA,CAAA,EAAIJ,QAAQ,CAAE,CAAA,CAAA;EAEhDK,YAAS,CAACF,QAAQ,EAAEL,OAAO,EAAE,MAAM,EAAE,UAAUQ,GAAG,EAAA;AAChD,IAAA,IAAIA,GAAG,EAAE;AACP,MAAA,MAAMA,GAAG,CAAA;AACX,KAAA;AAEAC,IAAAA,OAAO,CAACC,GAAG,CAACL,QAAQ,EAAEL,OAAO,CAAC,CAAA;AAChC,GAAC,CAAC,CAAA;AACJ,CAAC;;ACrBD;;;;;AAKG;AACH,MAAMW,aAAa,GAAIC,IAAa,IAAe;EACjD,IAAIC,aAAa,GAAc,EAAE,CAAA;EAEjC,IAAIC,MAAM,GAAGF,IAAI,CAAC,CAAC,CAAC,CAACG,GAAG,CAAEC,GAAG,IAAI;AAC/B,IAAA,OAAOA,GAAG,CAAA;AACZ,GAAC,CAAC,CAAA;AAEFJ,EAAAA,IAAI,CAACK,OAAO,CAAC,CAACC,GAAa,EAAEC,KAAa,KAAI;IAC5C,IAAIA,KAAK,KAAK,CAAC,EAAE;AACf,MAAA,OAAA;AACF,KAAA;IAEAN,aAAa,GAAGO,UAAU,CAACF,GA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ACUK,MAAAA,aAAa,GAAG,MAC3BnH,OAAsB,IACiB;EACvC,IAAI;AACF,IAAA,MAAMoE,IAAI,GAAGP,uBAAuB,EAAE,CAAA;AAEtC,IAAA,OAAO,MAAMM,gBAAgB,CAC3BC,IAAI,EACJpE,OAAO,CAACqE,aAAa,EACrBrE,OAAO,CAACsE,cAAc,CACvB,CAAA;GACF,CAAC,OAAOwC,KAAK,EAAE;AACdtG,IAAAA,OAAO,CAACsG,KAAK,CAACA,KAAK,CAAC,CAAA;AACtB,GAAA;AAEA,EAAA,OAAO,IAAI,CAAA;AACb;;;;;;;;;"}
|
@@ -0,0 +1,34 @@
|
|
1
|
+
import { ConfigOptions } from './interfaces/Config/ConfigOptions';
|
2
|
+
export { transformConfig } from './Config/Config';
|
3
|
+
export { transformSitemap } from './Config/Sitemap';
|
4
|
+
export * from './interfaces/Config/ConfigOptions';
|
5
|
+
export * from './interfaces/Config/OutputOptions';
|
6
|
+
export type { ExportAs, FormatAs } from './types/Config/OptionType';
|
7
|
+
/**
|
8
|
+
* Fetch locales
|
9
|
+
*
|
10
|
+
* @param {ConfigOptions} options
|
11
|
+
* @return {void}
|
12
|
+
*/
|
13
|
+
export declare const fetchLocales: (options: ConfigOptions) => void;
|
14
|
+
/**
|
15
|
+
* Fetch config
|
16
|
+
*
|
17
|
+
* @param {ConfigOptions} options
|
18
|
+
* @return {void}
|
19
|
+
*/
|
20
|
+
export declare const fetchConfig: (options: ConfigOptions) => void;
|
21
|
+
/**
|
22
|
+
* Fetch all format from array options
|
23
|
+
*
|
24
|
+
* @param {ConfigOptions[]} options
|
25
|
+
* @return {void}
|
26
|
+
*/
|
27
|
+
export declare const fetchAll: (options: ConfigOptions[]) => void;
|
28
|
+
/**
|
29
|
+
* Fetch raw value
|
30
|
+
*
|
31
|
+
* @param {ConfigOptions} options
|
32
|
+
* @return {Promise<any[][] | null | undefined>}
|
33
|
+
*/
|
34
|
+
export declare const fetchRawValue: (options: ConfigOptions) => Promise<any[][] | null | undefined>;
|