@andre1502/react-utilities 0.9.0 → 0.9.1

Sign up to get free protection for your applications and to get access to all the features.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # react-utilities
2
2
 
3
+ [![npm version](https://badge.fury.io/js/@andre1502%2Freact-utilities.svg)](https://badge.fury.io/js/@andre1502%2Freact-utilities)
4
+
3
5
  Library to combine common functions
4
6
 
5
7
  ## Installation
@@ -50,9 +52,9 @@ fetchLocales(optionLocales);
50
52
  Config file only support export as js file, since you need to combine it with transform function.
51
53
 
52
54
  ```js
53
- const { fetchConfig } = require('@andre1502/@andre1502/react-utilities/cli');
55
+ const { fetchConfig } = require('@andre1502/react-utilities/cli');
54
56
  // OR
55
- const { fetchConfig } = require('@andre1502/@andre1502/react-utilities/config-cli');
57
+ const { fetchConfig } = require('@andre1502/react-utilities/config-cli');
56
58
 
57
59
  https://docs.google.com/spreadsheets/d/<google-sheet-id>/edit
58
60
  const optionConfig = {
@@ -61,8 +63,9 @@ const optionConfig = {
61
63
  formatAs: 'config',
62
64
  output: {
63
65
  folder: '.', // config folder location
64
- filename: 'versionConfig.js', // config filename
66
+ filename: 'versionConfig', // config filename
65
67
  isFilenameLowercase: false, // set if filename need to be lowercase
68
+ exportAs: 'json', // export config as 'ts' | 'json' | 'js'
66
69
  },
67
70
  };
68
71
 
@@ -116,8 +119,9 @@ const optionConfig = {
116
119
  formatAs: 'config',
117
120
  output: {
118
121
  folder: '.', // config folder location
119
- filename: 'versionConfig.js', // config filename
122
+ filename: 'versionConfig', // config filename
120
123
  isFilenameLowercase: false, // set if filename need to be lowercase
124
+ exportAs: 'json', // export locales as 'ts' | 'json' | 'js'
121
125
  },
122
126
  };
123
127
 
@@ -189,7 +193,9 @@ Add sentry file in root project with this code
189
193
  ```js
190
194
  const { releaseSentrySourceMap } = require('@andre1502/react-utilities/cli');
191
195
  // OR
192
- const { releaseSentrySourceMap } = require('@andre1502/react-utilities/sentry-cli');
196
+ const {
197
+ releaseSentrySourceMap,
198
+ } = require('@andre1502/react-utilities/sentry-cli');
193
199
 
194
200
  releaseSentrySourceMap({
195
201
  env: '',
@@ -92,7 +92,23 @@ var exportConfig = exports.exportConfig = function exportConfig(data, options) {
92
92
  var config = {
93
93
  params: data
94
94
  };
95
- var content = "module.exports = ".concat(JSON.stringify(config, null, 2));
95
+ var content = '';
96
+ switch (options.exportAs) {
97
+ case 'ts':
98
+ content = 'export default ' + JSON.stringify(config, null, 2);
99
+ options.filename = "".concat(options.filename, ".ts");
100
+ break;
101
+ case 'json':
102
+ content = JSON.stringify(config, null, 2);
103
+ options.filename = "".concat(options.filename, ".json");
104
+ break;
105
+ case 'js':
106
+ content = "module.exports = ".concat(JSON.stringify(config, null, 2));
107
+ options.filename = "".concat(options.filename, ".js");
108
+ break;
109
+ default:
110
+ throw new Error("exportAs ".concat(options.exportAs, " not supported."));
111
+ }
96
112
  (0, _Output.outputToFile)(content, options);
97
113
  };
98
114
 
@@ -1 +1 @@
1
- {"version":3,"file":"Config.js","names":["lodash","_interopRequireWildcard","require","_Output","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","o","Symbol","iterator","constructor","prototype","processConfig","exports","rows","versionConfig","params","map","key","forEach","row","index","processRow","data","versionName","paramsName","undefined","paramsTypeHandler","isJsonString","str","JSON","parse","booleanText","includes","toUpperCase","exportConfig","options","config","content","concat","stringify","outputToFile","envMap","env","result","Error","contentMap","value","exportAs","isNull","transformConfig","configKeyPrefix","envKey","keys","newConfigKey","extensionFile","join","Array","isArray"],"sources":["../../src/Config/Config.ts"],"sourcesContent":["import * as lodash from 'lodash';\nimport { OutputMap } from '../interfaces/Config/OutputMap';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\nimport { outputToFile } from './Output';\n\n/**\n * Process config data\n *\n * @param {any[][]} rows\n * @return {OutputMap}\n */\nconst processConfig = (rows: any[][]): OutputMap => {\n let versionConfig: OutputMap = {};\n\n let params = rows[0].map((key) => {\n return key;\n });\n\n rows.forEach((row: string[], index: number) => {\n if (index === 0) {\n return;\n }\n\n versionConfig = processRow(row, params, versionConfig);\n });\n\n return versionConfig;\n};\n\n/**\n * Process config item\n *\n * @param {string[]} data\n * @param {string[]} params\n * @param {OutputMap} versionConfig\n * @return {OutputMap}\n */\nconst processRow = (\n data: string[],\n params: string[],\n versionConfig: OutputMap,\n): OutputMap => {\n const versionName = data[0];\n versionConfig[versionName] = {};\n\n params.forEach((paramsName, index) => {\n if (index === 0 || data[index] === undefined || data[index] === '') {\n return;\n }\n\n versionConfig[versionName][paramsName] = paramsTypeHandler(data[index]);\n });\n\n return versionConfig;\n};\n\n/**\n * Check is JSON value\n *\n * @param {string} str\n * @return {boolean}\n */\nconst isJsonString = (str: string): boolean => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n\n return true;\n};\n\n/**\n * Handling config value type\n *\n * @param {string} params\n * @return {any}\n */\nconst paramsTypeHandler = (params: string): any => {\n const booleanText = ['TRUE', 'FALSE'];\n\n if (booleanText.includes(params.toUpperCase())) {\n return params === 'TRUE';\n }\n\n if (isJsonString(params)) {\n return JSON.parse(params);\n }\n\n return params;\n};\n\n/**\n * Export config data into js file\n *\n * @param {OutputMap} data\n * @param {OutputOptions} options\n * @return {void}\n */\nconst exportConfig = (data: OutputMap, options: OutputOptions): void => {\n const config = {\n params: data,\n };\n\n const content = `module.exports = ${JSON.stringify(config, null, 2)}`;\n\n outputToFile(content, options);\n};\n\n/**\n * Handling env map value\n *\n * @param {string} env\n * @return {string}\n */\nconst envMap = (env: string): string => {\n let result;\n\n switch (env) {\n case 'dev':\n case 'develop':\n case 'development':\n result = 'dev';\n break;\n case 'stg':\n case 'stag':\n case 'staging':\n result = 'staging';\n break;\n case 'prd':\n case 'prod':\n case 'production':\n result = 'production';\n break;\n default:\n throw new Error(`env ${env} not supported.`);\n }\n\n return result;\n};\n\n/**\n * Mapping content to exportAs value\n *\n * @param {string} key\n * @param {any} value\n * @param {string} exportAs\n * @return {string}\n */\nconst contentMap = (key: string, value: any, exportAs: string): string => {\n let content = '';\n\n switch (exportAs) {\n case 'ts':\n if (lodash.isNull(value)) {\n content += `export const ${key}: string | null = ${value};\\n`;\n } else if (typeof value === 'boolean') {\n content += `export const ${key}: boolean = ${value};\\n`;\n } else {\n content += `export const ${key} = '${value}';\\n`;\n }\n break;\n case 'js':\n content += `export const ${key} = \"${value}\";\\n`;\n break;\n case 'env':\n content += `${key} = \"${value}\"\\n`;\n break;\n default:\n throw new Error(`exportAs ${exportAs} not supported.`);\n }\n\n return content;\n};\n\n/**\n * Transform config\n *\n * @param {OutputMap} data\n * @param {string} env\n * @param {string} configKeyPrefix\n * @param {OutputOptions} options\n * @return {void}\n */\nconst transformConfig = (\n data: OutputMap,\n env: string,\n configKeyPrefix: string,\n options: OutputOptions,\n): void => {\n const envKey = configKeyPrefix ? `${configKeyPrefix}ENV` : 'ENV';\n\n let content = contentMap(envKey, envMap(env), options.exportAs!);\n\n Object.keys(data).forEach((key) => {\n const newConfigKey = configKeyPrefix ? `${configKeyPrefix}${key}` : key;\n\n if (key === 'BASE_PROJECT') {\n const extensionFile = [\n `.${data[key]}.js`,\n `.${data[key]}.jsx`,\n `.${data[key]}.ts`,\n `.${data[key]}.tsx`,\n `.${data[key]}.css`,\n `.${data[key]}.json`,\n `.${data[key]}.scss`,\n ];\n\n content += contentMap(\n newConfigKey,\n extensionFile.join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (key === 'SITEMAP') {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n\n return;\n }\n\n if (Array.isArray(data[key])) {\n content += contentMap(\n newConfigKey,\n data[key].join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (typeof data[key] === 'object') {\n if (data[key].hasOwnProperty(env)) {\n content += contentMap(newConfigKey, data[key][env], options.exportAs!);\n } else {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n }\n\n return;\n }\n\n content += contentMap(newConfigKey, data[key], options.exportAs!);\n });\n\n outputToFile(content, options);\n};\n\nexport { exportConfig, processConfig, transformConfig };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AAAwC,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAAA,CAAAN,CAAA,UAAAG,CAAA,CAAAI,GAAA,CAAAP,CAAA,OAAAQ,CAAA,KAAAC,SAAA,UAAAC,CAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,CAAA,IAAAd,CAAA,oBAAAc,CAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,CAAA,SAAAG,CAAA,GAAAP,CAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAb,CAAA,EAAAc,CAAA,UAAAG,CAAA,KAAAA,CAAA,CAAAV,GAAA,IAAAU,CAAA,CAAAC,GAAA,IAAAP,MAAA,CAAAC,cAAA,CAAAJ,CAAA,EAAAM,CAAA,EAAAG,CAAA,IAAAT,CAAA,CAAAM,CAAA,IAAAd,CAAA,CAAAc,CAAA,YAAAN,CAAA,cAAAR,CAAA,EAAAG,CAAA,IAAAA,CAAA,CAAAe,GAAA,CAAAlB,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AI,CAACL,GAAG,CAAC,CAAC,EACzBkB,OAAO,CAACY,QACV,CAAC;MAED;IACF;IAEA,IAAIS,KAAK,CAACC,OAAO,CAACnC,IAAI,CAACL,GAAG,CAAC,CAAC,EAAE;MAC5BoB,OAAO,IAAIQ,UAAU,CACnBQ,YAAY,EACZ/B,IAAI,CAACL,GAAG,CAAC,CAACsC,IAAI,CAAC,GAAG,CAAC,EACnBpB,OAAO,CAACY,QACV,CAAC;MAED;IACF;IAEA,IAAIvD,OAAA,CAAO8B,IAAI,CAACL,GAAG,CAAC,MAAK,QAAQ,EAAE;MACjC,IAAIK,IAAI,CAACL,GAAG,CAAC,CAACf,cAAc,CAACwC,GAAG,CAAC,EAAE;QACjCL,OAAO,IAAIQ,UAAU,CAACQ,YAAY,EAAE/B,IAAI,CAACL,GAAG,CAAC,CAACyB,GAAG,CAAC,EAAEP,OAAO,CAACY,QAAS,CAAC;MACxE,CAAC,MAAM;QACLV,OAAO,IAAIQ,UAAU,CACnBQ,YAAY,EACZxB,IAAI,CAACU,SAAS,CAACjB,IAAI,CAACL,GAAG,CAAC,CAAC,EACzBkB,OAAO,CAACY,QACV,CAAC;MACH;MAEA;IACF;IAEAV,OAAO,IAAIQ,UAAU,CAACQ,YAAY,EAAE/B,IAAI,CAACL,GAAG,CAAC,EAAEkB,OAAO,CAACY,QAAS,CAAC;EACnE,CAAC,CAAC;EAEF,IAAAP,oBAAY,EAACH,OAAO,EAAEF,OAAO,CAAC;AAChC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Config.js","names":["lodash","_interopRequireWildcard","require","_Output","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","_typeof","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","o","Symbol","iterator","constructor","prototype","processConfig","exports","rows","versionConfig","params","map","key","forEach","row","index","processRow","data","versionName","paramsName","undefined","paramsTypeHandler","isJsonString","str","JSON","parse","booleanText","includes","toUpperCase","exportConfig","options","config","content","exportAs","stringify","filename","concat","Error","outputToFile","envMap","env","result","contentMap","value","isNull","transformConfig","configKeyPrefix","envKey","keys","newConfigKey","extensionFile","join","Array","isArray"],"sources":["../../src/Config/Config.ts"],"sourcesContent":["import * as lodash from 'lodash';\nimport { OutputMap } from '../interfaces/Config/OutputMap';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\nimport { outputToFile } from './Output';\n\n/**\n * Process config data\n *\n * @param {any[][]} rows\n * @return {OutputMap}\n */\nconst processConfig = (rows: any[][]): OutputMap => {\n let versionConfig: OutputMap = {};\n\n let params = rows[0].map((key) => {\n return key;\n });\n\n rows.forEach((row: string[], index: number) => {\n if (index === 0) {\n return;\n }\n\n versionConfig = processRow(row, params, versionConfig);\n });\n\n return versionConfig;\n};\n\n/**\n * Process config item\n *\n * @param {string[]} data\n * @param {string[]} params\n * @param {OutputMap} versionConfig\n * @return {OutputMap}\n */\nconst processRow = (\n data: string[],\n params: string[],\n versionConfig: OutputMap,\n): OutputMap => {\n const versionName = data[0];\n versionConfig[versionName] = {};\n\n params.forEach((paramsName, index) => {\n if (index === 0 || data[index] === undefined || data[index] === '') {\n return;\n }\n\n versionConfig[versionName][paramsName] = paramsTypeHandler(data[index]);\n });\n\n return versionConfig;\n};\n\n/**\n * Check is JSON value\n *\n * @param {string} str\n * @return {boolean}\n */\nconst isJsonString = (str: string): boolean => {\n try {\n JSON.parse(str);\n } catch (e) {\n return false;\n }\n\n return true;\n};\n\n/**\n * Handling config value type\n *\n * @param {string} params\n * @return {any}\n */\nconst paramsTypeHandler = (params: string): any => {\n const booleanText = ['TRUE', 'FALSE'];\n\n if (booleanText.includes(params.toUpperCase())) {\n return params === 'TRUE';\n }\n\n if (isJsonString(params)) {\n return JSON.parse(params);\n }\n\n return params;\n};\n\n/**\n * Export config data into js file\n *\n * @param {OutputMap} data\n * @param {OutputOptions} options\n * @return {void}\n */\nconst exportConfig = (data: OutputMap, options: OutputOptions): void => {\n const config = {\n params: data,\n };\n\n let content = '';\n\n switch (options.exportAs) {\n case 'ts':\n content = 'export default ' + JSON.stringify(config, null, 2);\n options.filename = `${options.filename}.ts`;\n break;\n case 'json':\n content = JSON.stringify(config, null, 2);\n options.filename = `${options.filename}.json`;\n break;\n case 'js':\n content = `module.exports = ${JSON.stringify(config, null, 2)}`;\n options.filename = `${options.filename}.js`;\n break;\n default:\n throw new Error(`exportAs ${options.exportAs} not supported.`);\n }\n\n outputToFile(content, options);\n};\n\n/**\n * Handling env map value\n *\n * @param {string} env\n * @return {string}\n */\nconst envMap = (env: string): string => {\n let result;\n\n switch (env) {\n case 'dev':\n case 'develop':\n case 'development':\n result = 'dev';\n break;\n case 'stg':\n case 'stag':\n case 'staging':\n result = 'staging';\n break;\n case 'prd':\n case 'prod':\n case 'production':\n result = 'production';\n break;\n default:\n throw new Error(`env ${env} not supported.`);\n }\n\n return result;\n};\n\n/**\n * Mapping content to exportAs value\n *\n * @param {string} key\n * @param {any} value\n * @param {string} exportAs\n * @return {string}\n */\nconst contentMap = (key: string, value: any, exportAs: string): string => {\n let content = '';\n\n switch (exportAs) {\n case 'ts':\n if (lodash.isNull(value)) {\n content += `export const ${key}: string | null = ${value};\\n`;\n } else if (typeof value === 'boolean') {\n content += `export const ${key}: boolean = ${value};\\n`;\n } else {\n content += `export const ${key} = '${value}';\\n`;\n }\n break;\n case 'js':\n content += `export const ${key} = \"${value}\";\\n`;\n break;\n case 'env':\n content += `${key} = \"${value}\"\\n`;\n break;\n default:\n throw new Error(`exportAs ${exportAs} not supported.`);\n }\n\n return content;\n};\n\n/**\n * Transform config\n *\n * @param {OutputMap} data\n * @param {string} env\n * @param {string} configKeyPrefix\n * @param {OutputOptions} options\n * @return {void}\n */\nconst transformConfig = (\n data: OutputMap,\n env: string,\n configKeyPrefix: string,\n options: OutputOptions,\n): void => {\n const envKey = configKeyPrefix ? `${configKeyPrefix}ENV` : 'ENV';\n\n let content = contentMap(envKey, envMap(env), options.exportAs!);\n\n Object.keys(data).forEach((key) => {\n const newConfigKey = configKeyPrefix ? `${configKeyPrefix}${key}` : key;\n\n if (key === 'BASE_PROJECT') {\n const extensionFile = [\n `.${data[key]}.js`,\n `.${data[key]}.jsx`,\n `.${data[key]}.ts`,\n `.${data[key]}.tsx`,\n `.${data[key]}.css`,\n `.${data[key]}.json`,\n `.${data[key]}.scss`,\n ];\n\n content += contentMap(\n newConfigKey,\n extensionFile.join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (key === 'SITEMAP') {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n\n return;\n }\n\n if (Array.isArray(data[key])) {\n content += contentMap(\n newConfigKey,\n data[key].join(','),\n options.exportAs!,\n );\n\n return;\n }\n\n if (typeof data[key] === 'object') {\n if (data[key].hasOwnProperty(env)) {\n content += contentMap(newConfigKey, data[key][env], options.exportAs!);\n } else {\n content += contentMap(\n newConfigKey,\n JSON.stringify(data[key]),\n options.exportAs!,\n );\n }\n\n return;\n }\n\n content += contentMap(newConfigKey, data[key], options.exportAs!);\n });\n\n outputToFile(content, options);\n};\n\nexport { exportConfig, processConfig, transformConfig };\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAGA,IAAAC,OAAA,GAAAD,OAAA;AAAwC,SAAAE,yBAAAC,CAAA,6BAAAC,OAAA,mBAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,CAAA,WAAAA,CAAA,GAAAG,CAAA,GAAAD,CAAA,KAAAF,CAAA;AAAA,SAAAJ,wBAAAI,CAAA,EAAAE,CAAA,SAAAA,CAAA,IAAAF,CAAA,IAAAA,CAAA,CAAAI,UAAA,SAAAJ,CAAA,eAAAA,CAAA,gBAAAK,OAAA,CAAAL,CAAA,0BAAAA,CAAA,sBAAAA,CAAA,QAAAG,CAAA,GAAAJ,wBAAA,CAAAG,CAAA,OAAAC,CAAA,IAAAA,CAAA,CAAAG,GAA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CAACG,QACV,CAAC;MAED;IACF;IAEA,IAAImB,KAAK,CAACC,OAAO,CAACpC,IAAI,CAACL,GAAG,CAAC,CAAC,EAAE;MAC5BoB,OAAO,IAAIU,UAAU,CACnBO,YAAY,EACZhC,IAAI,CAACL,GAAG,CAAC,CAACuC,IAAI,CAAC,GAAG,CAAC,EACnBrB,OAAO,CAACG,QACV,CAAC;MAED;IACF;IAEA,IAAI9C,OAAA,CAAO8B,IAAI,CAACL,GAAG,CAAC,MAAK,QAAQ,EAAE;MACjC,IAAIK,IAAI,CAACL,GAAG,CAAC,CAACf,cAAc,CAAC2C,GAAG,CAAC,EAAE;QACjCR,OAAO,IAAIU,UAAU,CAACO,YAAY,EAAEhC,IAAI,CAACL,GAAG,CAAC,CAAC4B,GAAG,CAAC,EAAEV,OAAO,CAACG,QAAS,CAAC;MACxE,CAAC,MAAM;QACLD,OAAO,IAAIU,UAAU,CACnBO,YAAY,EACZzB,IAAI,CAACU,SAAS,CAACjB,IAAI,CAACL,GAAG,CAAC,CAAC,EACzBkB,OAAO,CAACG,QACV,CAAC;MACH;MAEA;IACF;IAEAD,OAAO,IAAIU,UAAU,CAACO,YAAY,EAAEhC,IAAI,CAACL,GAAG,CAAC,EAAEkB,OAAO,CAACG,QAAS,CAAC;EACnE,CAAC,CAAC;EAEF,IAAAK,oBAAY,EAACN,OAAO,EAAEF,OAAO,CAAC;AAChC,CAAC","ignoreList":[]}
@@ -18,7 +18,15 @@ var outputToFile = exports.outputToFile = function outputToFile(content, options
18
18
  filename = filename.toLowerCase();
19
19
  }
20
20
  var filePath = "".concat(options.folder, "/").concat(filename);
21
- (0, _fs.writeFile)(filePath, content, 'utf8', function (err) {
21
+ if (!(0, _fs.existsSync)(options.folder)) {
22
+ (0, _fs.mkdirSync)(options.folder, {
23
+ recursive: true
24
+ });
25
+ }
26
+ (0, _fs.writeFile)(filePath, content, {
27
+ encoding: 'utf-8',
28
+ flag: 'w'
29
+ }, function (err) {
22
30
  if (err) {
23
31
  throw err;
24
32
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Output.js","names":["_fs","require","outputToFile","exports","content","options","filename","isFilenameLowercase","toLowerCase","filePath","concat","folder","writeFile","err","console","log"],"sources":["../../src/Config/Output.ts"],"sourcesContent":["import { writeFile } from 'fs';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\n\n/**\n * Write content into target file\n *\n * @param {string} content\n * @param {OutputOptions} options\n * @return {void}\n */\nconst outputToFile = (content: string, options: OutputOptions): void => {\n let filename = options.filename;\n\n if (options.isFilenameLowercase) {\n filename = filename.toLowerCase();\n }\n\n const filePath = `${options.folder}/${filename}`;\n\n writeFile(filePath, content, 'utf8', function (err) {\n if (err) {\n throw err;\n }\n\n console.log(filePath, content);\n });\n};\n\nexport { outputToFile };\n"],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,SAAfA,YAAYA,CAAIE,OAAe,EAAEC,OAAsB,EAAW;EACtE,IAAIC,QAAQ,GAAGD,OAAO,CAACC,QAAQ;EAE/B,IAAID,OAAO,CAACE,mBAAmB,EAAE;IAC/BD,QAAQ,GAAGA,QAAQ,CAACE,WAAW,CAAC,CAAC;EACnC;EAEA,IAAMC,QAAQ,MAAAC,MAAA,CAAML,OAAO,CAACM,MAAM,OAAAD,MAAA,CAAIJ,QAAQ,CAAE;EAEhD,IAAAM,aAAS,EAACH,QAAQ,EAAEL,OAAO,EAAE,MAAM,EAAE,UAAUS,GAAG,EAAE;IAClD,IAAIA,GAAG,EAAE;MACP,MAAMA,GAAG;IACX;IAEAC,OAAO,CAACC,GAAG,CAACN,QAAQ,EAAEL,OAAO,CAAC;EAChC,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"Output.js","names":["_fs","require","outputToFile","exports","content","options","filename","isFilenameLowercase","toLowerCase","filePath","concat","folder","existsSync","mkdirSync","recursive","writeFile","encoding","flag","err","console","log"],"sources":["../../src/Config/Output.ts"],"sourcesContent":["import { existsSync, mkdirSync, writeFile } from 'fs';\nimport { OutputOptions } from '../interfaces/Config/OutputOptions';\n\n/**\n * Write content into target file\n *\n * @param {string} content\n * @param {OutputOptions} options\n * @return {void}\n */\nconst outputToFile = (content: string, options: OutputOptions): void => {\n let filename = options.filename;\n\n if (options.isFilenameLowercase) {\n filename = filename.toLowerCase();\n }\n\n const filePath = `${options.folder}/${filename}`;\n\n if (!existsSync(options.folder)) {\n mkdirSync(options.folder, { recursive: true });\n }\n\n writeFile(\n filePath,\n content,\n { encoding: 'utf-8', flag: 'w' },\n function (err) {\n if (err) {\n throw err;\n }\n\n console.log(filePath, content);\n },\n );\n};\n\nexport { outputToFile };\n"],"mappings":";;;;;;AAAA,IAAAA,GAAA,GAAAC,OAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAMC,YAAY,GAAAC,OAAA,CAAAD,YAAA,GAAG,SAAfA,YAAYA,CAAIE,OAAe,EAAEC,OAAsB,EAAW;EACtE,IAAIC,QAAQ,GAAGD,OAAO,CAACC,QAAQ;EAE/B,IAAID,OAAO,CAACE,mBAAmB,EAAE;IAC/BD,QAAQ,GAAGA,QAAQ,CAACE,WAAW,CAAC,CAAC;EACnC;EAEA,IAAMC,QAAQ,MAAAC,MAAA,CAAML,OAAO,CAACM,MAAM,OAAAD,MAAA,CAAIJ,QAAQ,CAAE;EAEhD,IAAI,CAAC,IAAAM,cAAU,EAACP,OAAO,CAACM,MAAM,CAAC,EAAE;IAC/B,IAAAE,aAAS,EAACR,OAAO,CAACM,MAAM,EAAE;MAAEG,SAAS,EAAE;IAAK,CAAC,CAAC;EAChD;EAEA,IAAAC,aAAS,EACPN,QAAQ,EACRL,OAAO,EACP;IAAEY,QAAQ,EAAE,OAAO;IAAEC,IAAI,EAAE;EAAI,CAAC,EAChC,UAAUC,GAAG,EAAE;IACb,IAAIA,GAAG,EAAE;MACP,MAAMA,GAAG;IACX;IAEAC,OAAO,CAACC,GAAG,CAACX,QAAQ,EAAEL,OAAO,CAAC;EAChC,CACF,CAAC;AACH,CAAC","ignoreList":[]}
@@ -43,7 +43,15 @@ const outputToFile = (content, options) => {
43
43
  filename = filename.toLowerCase();
44
44
  }
45
45
  const filePath = `${options.folder}/${filename}`;
46
- fs.writeFile(filePath, content, 'utf8', function (err) {
46
+ if (!fs.existsSync(options.folder)) {
47
+ fs.mkdirSync(options.folder, {
48
+ recursive: true
49
+ });
50
+ }
51
+ fs.writeFile(filePath, content, {
52
+ encoding: 'utf-8',
53
+ flag: 'w'
54
+ }, function (err) {
47
55
  if (err) {
48
56
  throw err;
49
57
  }
@@ -130,7 +138,23 @@ const exportConfig = (data, options) => {
130
138
  const config = {
131
139
  params: data
132
140
  };
133
- const content = `module.exports = ${JSON.stringify(config, null, 2)}`;
141
+ let content = '';
142
+ switch (options.exportAs) {
143
+ case 'ts':
144
+ content = 'export default ' + JSON.stringify(config, null, 2);
145
+ options.filename = `${options.filename}.ts`;
146
+ break;
147
+ case 'json':
148
+ content = JSON.stringify(config, null, 2);
149
+ options.filename = `${options.filename}.json`;
150
+ break;
151
+ case 'js':
152
+ content = `module.exports = ${JSON.stringify(config, null, 2)}`;
153
+ options.filename = `${options.filename}.js`;
154
+ break;
155
+ default:
156
+ throw new Error(`exportAs ${options.exportAs} not supported.`);
157
+ }
134
158
  outputToFile(content, options);
135
159
  };
136
160
  /**
@@ -1 +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,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,CAACrC,IAAI,EAAE6C,MAAM,CAAC,CAAA;AACjC,OAAC,MAAM,IAAIA,MAAM,CAACC,QAAQ,KAAK,QAAQ,EAAE;AACvCN,QAAAA,gBAAgB,CAACxC,IAAI,EAAE6C,MAAM,CAAC,CAAA;AAChC,OAAA;AACF,KAAC,CAAC,CAAA;GACH,CAAC,OAAOH,KAAK,EAAE;AACdtG,IAAAA,OAAO,CAACsG,KAAK,CAACA,KAAK,CAAC,CAAA;AACtB,GAAA;AACF,EAAC;AAED;;;;;AAKG;AACUK,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;;;;;;;;;"}
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","existsSync","mkdirSync","recursive","writeFile","encoding","flag","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","exportAs","stringify","Error","envMap","env","result","contentMap","value","lodash","isNull","transformConfig","configKeyPrefix","envKey","Object","keys","newConfigKey","extensionFile","join","Array","isArray","hasOwnProperty","SCOPES","GOOGLE_APPLICATION_CREDENTIALS_PATH","path","process","cwd","authorizeServiceAccount","isExist","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;AAEhD,EAAA,IAAI,CAACK,aAAU,CAACN,OAAO,CAACK,MAAM,CAAC,EAAE;AAC/BE,IAAAA,YAAS,CAACP,OAAO,CAACK,MAAM,EAAE;AAAEG,MAAAA,SAAS,EAAE,IAAA;AAAM,KAAA,CAAC,CAAA;AAChD,GAAA;AAEAC,EAAAA,YAAS,CACPL,QAAQ,EACRL,OAAO,EACP;AAAEW,IAAAA,QAAQ,EAAE,OAAO;AAAEC,IAAAA,IAAI,EAAE,GAAA;GAAK,EAChC,UAAUC,GAAG,EAAA;AACX,IAAA,IAAIA,GAAG,EAAE;AACP,MAAA,MAAMA,GAAG,CAAA;AACX,KAAA;AAEAC,IAAAA,OAAO,CAACC,GAAG,CAACV,QAAQ,EAAEL,OAAO,CAAC,CAAA;AAChC,GAAC,CACF,CAAA;AACH,CAAC;;AC9BD;;;;;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AAI;AACF,IAAA,MAAMwE,IAAI,GAAGN,uBAAuB,EAAE,CAAA;AAEtC,IAAA,OAAO,MAAMK,gBAAgB,CAC3BC,IAAI,EACJxE,OAAO,CAACyE,aAAa,EACrBzE,OAAO,CAAC0E,cAAc,CACvB,CAAA;GACF,CAAC,OAAOwC,KAAK,EAAE;AACdrG,IAAAA,OAAO,CAACqG,KAAK,CAACA,KAAK,CAAC,CAAA;AACtB,GAAA;AAEA,EAAA,OAAO,IAAI,CAAA;AACb;;;;;;;;;"}
@@ -1,5 +1,5 @@
1
1
  import * as lodash from 'lodash';
2
- import { writeFile, existsSync } from 'fs';
2
+ import { existsSync, mkdirSync, writeFile } from 'fs';
3
3
  import { GoogleAuth } from 'google-auth-library';
4
4
  import { google } from 'googleapis';
5
5
  import * as path from 'path';
@@ -20,7 +20,15 @@ const outputToFile = (content, options) => {
20
20
  filename = filename.toLowerCase();
21
21
  }
22
22
  const filePath = `${options.folder}/${filename}`;
23
- writeFile(filePath, content, 'utf8', function (err) {
23
+ if (!existsSync(options.folder)) {
24
+ mkdirSync(options.folder, {
25
+ recursive: true
26
+ });
27
+ }
28
+ writeFile(filePath, content, {
29
+ encoding: 'utf-8',
30
+ flag: 'w'
31
+ }, function (err) {
24
32
  if (err) {
25
33
  throw err;
26
34
  }
@@ -107,7 +115,23 @@ const exportConfig = (data, options) => {
107
115
  const config = {
108
116
  params: data
109
117
  };
110
- const content = `module.exports = ${JSON.stringify(config, null, 2)}`;
118
+ let content = '';
119
+ switch (options.exportAs) {
120
+ case 'ts':
121
+ content = 'export default ' + JSON.stringify(config, null, 2);
122
+ options.filename = `${options.filename}.ts`;
123
+ break;
124
+ case 'json':
125
+ content = JSON.stringify(config, null, 2);
126
+ options.filename = `${options.filename}.json`;
127
+ break;
128
+ case 'js':
129
+ content = `module.exports = ${JSON.stringify(config, null, 2)}`;
130
+ options.filename = `${options.filename}.js`;
131
+ break;
132
+ default:
133
+ throw new Error(`exportAs ${options.exportAs} not supported.`);
134
+ }
111
135
  outputToFile(content, options);
112
136
  };
113
137
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"config-cli.mjs","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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tG,IAAAA,OAAO,CAACsG,KAAK,CAACA,KAAK,CAAC,CAAA;AACtB,GAAA;AACF,EAAC;AAED;;;;;AAKG;AACUE,MAAAA,QAAQ,GAAIhH,OAAwB,IAAU;EACzD,IAAI;AACF,IAAA,MAAMoE,IAAI,GAAGP,uBAAuB,EAAE,CAAA;AAEtC7D,IAAAA,OAAO,CAACgB,OAAO,CAAEiG,MAAM,IAAI;AACzB,MAAA,IAAIA,MAAM,CAACC,QAAQ,KAAK,SAAS,EAAE;AACjCT,QAAAA,iBAAiB,CAACrC,IAAI,EAAE6C,MAAM,CAAC,CAAA;AACjC,OAAC,MAAM,IAAIA,MAAM,CAACC,QAAQ,KAAK,QAAQ,EAAE;AACvCN,QAAAA,gBAAgB,CAACxC,IAAI,EAAE6C,MAAM,CAAC,CAAA;AAChC,OAAA;AACF,KAAC,CAAC,CAAA;GACH,CAAC,OAAOH,KAAK,EAAE;AACdtG,IAAAA,OAAO,CAACsG,KAAK,CAACA,KAAK,CAAC,CAAA;AACtB,GAAA;AACF,EAAC;AAED;;;;;AAKG;AACUK,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;;;;"}
1
+ {"version":3,"file":"config-cli.mjs","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","existsSync","mkdirSync","recursive","writeFile","encoding","flag","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","exportAs","stringify","Error","envMap","env","result","contentMap","value","lodash","isNull","transformConfig","configKeyPrefix","envKey","Object","keys","newConfigKey","extensionFile","join","Array","isArray","hasOwnProperty","SCOPES","GOOGLE_APPLICATION_CREDENTIALS_PATH","path","process","cwd","authorizeServiceAccount","isExist","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;AAEhD,EAAA,IAAI,CAACK,UAAU,CAACN,OAAO,CAACK,MAAM,CAAC,EAAE;AAC/BE,IAAAA,SAAS,CAACP,OAAO,CAACK,MAAM,EAAE;AAAEG,MAAAA,SAAS,EAAE,IAAA;AAAM,KAAA,CAAC,CAAA;AAChD,GAAA;AAEAC,EAAAA,SAAS,CACPL,QAAQ,EAC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,QAAQ,EAAE;AACvCN,QAAAA,gBAAgB,CAACxC,IAAI,EAAE6C,MAAM,CAAC,CAAA;AAChC,OAAA;AACF,KAAC,CAAC,CAAA;GACH,CAAC,OAAOH,KAAK,EAAE;AACdrG,IAAAA,OAAO,CAACqG,KAAK,CAACA,KAAK,CAAC,CAAA;AACtB,GAAA;AACF,EAAC;AAED;;;;;AAKG;AACUK,MAAAA,aAAa,GAAG,MAC3BvH,OAAsB,IACiB;EACvC,IAAI;AACF,IAAA,MAAMwE,IAAI,GAAGN,uBAAuB,EAAE,CAAA;AAEtC,IAAA,OAAO,MAAMK,gBAAgB,CAC3BC,IAAI,EACJxE,OAAO,CAACyE,aAAa,EACrBzE,OAAO,CAAC0E,cAAc,CACvB,CAAA;GACF,CAAC,OAAOwC,KAAK,EAAE;AACdrG,IAAAA,OAAO,CAACqG,KAAK,CAACA,KAAK,CAAC,CAAA;AACtB,GAAA;AAEA,EAAA,OAAO,IAAI,CAAA;AACb;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@andre1502/react-utilities",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "module to combine common functions",
5
5
  "repository": {
6
6
  "type": "git",
@@ -102,7 +102,24 @@ const exportConfig = (data: OutputMap, options: OutputOptions): void => {
102
102
  params: data,
103
103
  };
104
104
 
105
- const content = `module.exports = ${JSON.stringify(config, null, 2)}`;
105
+ let content = '';
106
+
107
+ switch (options.exportAs) {
108
+ case 'ts':
109
+ content = 'export default ' + JSON.stringify(config, null, 2);
110
+ options.filename = `${options.filename}.ts`;
111
+ break;
112
+ case 'json':
113
+ content = JSON.stringify(config, null, 2);
114
+ options.filename = `${options.filename}.json`;
115
+ break;
116
+ case 'js':
117
+ content = `module.exports = ${JSON.stringify(config, null, 2)}`;
118
+ options.filename = `${options.filename}.js`;
119
+ break;
120
+ default:
121
+ throw new Error(`exportAs ${options.exportAs} not supported.`);
122
+ }
106
123
 
107
124
  outputToFile(content, options);
108
125
  };
@@ -1,4 +1,4 @@
1
- import { writeFile } from 'fs';
1
+ import { existsSync, mkdirSync, writeFile } from 'fs';
2
2
  import { OutputOptions } from '../interfaces/Config/OutputOptions';
3
3
 
4
4
  /**
@@ -17,13 +17,22 @@ const outputToFile = (content: string, options: OutputOptions): void => {
17
17
 
18
18
  const filePath = `${options.folder}/${filename}`;
19
19
 
20
- writeFile(filePath, content, 'utf8', function (err) {
21
- if (err) {
22
- throw err;
23
- }
20
+ if (!existsSync(options.folder)) {
21
+ mkdirSync(options.folder, { recursive: true });
22
+ }
23
+
24
+ writeFile(
25
+ filePath,
26
+ content,
27
+ { encoding: 'utf-8', flag: 'w' },
28
+ function (err) {
29
+ if (err) {
30
+ throw err;
31
+ }
24
32
 
25
- console.log(filePath, content);
26
- });
33
+ console.log(filePath, content);
34
+ },
35
+ );
27
36
  };
28
37
 
29
38
  export { outputToFile };