config2ts 2.2.4 → 2.2.6

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.
@@ -1,9 +1,9 @@
1
1
  export const IniFileIni = {
2
- "num": 1,
3
- "str": "string",
4
- "bool": true,
5
- "ItemType": {
6
- "book": 1,
7
- "fruit": 2
8
- }
2
+ num: 1,
3
+ str: 'string',
4
+ bool: true,
5
+ ItemType: {
6
+ book: 1,
7
+ fruit: 2,
8
+ },
9
9
  };
@@ -1,8 +1,8 @@
1
1
  export const TomlFileToml = {
2
- "num": 1,
3
- "str": "test",
4
- "ItemType": {
5
- "book": 1,
6
- "fruit": 2
7
- }
2
+ num: 1,
3
+ str: 'test',
4
+ ItemType: {
5
+ book: 1,
6
+ fruit: 2,
7
+ },
8
8
  };
package/config/total.ts CHANGED
@@ -103,13 +103,13 @@ export namespace DataCsv {
103
103
  };
104
104
 
105
105
  export const IniFileIni = {
106
- "num": 1,
107
- "str": "string",
108
- "bool": true,
109
- "ItemType": {
110
- "book": 1,
111
- "fruit": 2
112
- }
106
+ num: 1,
107
+ str: 'string',
108
+ bool: true,
109
+ ItemType: {
110
+ book: 1,
111
+ fruit: 2,
112
+ },
113
113
  };
114
114
 
115
115
  export namespace NoIdCsv {
@@ -141,10 +141,10 @@ export namespace NoIdCsv {
141
141
  };
142
142
 
143
143
  export const TomlFileToml = {
144
- "num": 1,
145
- "str": "test",
146
- "ItemType": {
147
- "book": 1,
148
- "fruit": 2
149
- }
144
+ num: 1,
145
+ str: 'test',
146
+ ItemType: {
147
+ book: 1,
148
+ fruit: 2,
149
+ },
150
150
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "config2ts",
3
- "version": "2.2.4",
3
+ "version": "2.2.6",
4
4
  "description": "convert config to ts file.",
5
5
  "main": "index.js",
6
6
  "type": "commonjs",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "change-case": "^4.1.2",
29
29
  "commander": "^9.5.0",
30
- "d3": "^7.9.0",
30
+ "d3": "^4.12.2",
31
31
  "ini": "^3.0.1",
32
32
  "json5": "^2.2.3",
33
33
  "toml": "^3.0.0"
package/src/config2ts.js CHANGED
@@ -13,14 +13,14 @@ var IndexStr = 'Index';
13
13
  exports.Convert = {
14
14
  ini: function (str, moduleName) {
15
15
  var obj = toml.parse(str);
16
- return "export const ".concat(moduleName, " = ").concat(JSON.stringify(obj, null, 4), ";");
16
+ return "export const ".concat(moduleName, " = ").concat(json5.stringify(obj, null, 4), ";");
17
17
  },
18
18
  csv: function (str, moduleName) {
19
19
  return csv2ts(str, moduleName);
20
20
  },
21
21
  toml: function (str, moduleName) {
22
22
  var obj = toml.parse(str);
23
- return "export const ".concat(moduleName, " = ").concat(JSON.stringify(obj, null, 4), ";");
23
+ return "export const ".concat(moduleName, " = ").concat(json5.stringify(obj, null, 4), ";");
24
24
  }
25
25
  };
26
26
  function csv2ts(csvString, moduleName) {
@@ -10,13 +10,13 @@ test('convert csv file with id', function () {
10
10
  expect(config2ts.GetTsString('./config/data.csv').replace(reg, '')).toBe(getTsFileString('./config/data.csv.ts'));
11
11
  });
12
12
  test('convert csv file without id', function () {
13
- // console.log(config2ts.GetTsString('./config/no-id.csv'))
14
13
  expect(config2ts.GetTsString('./config/no-id.csv').replace(reg, '')).toBe(getTsFileString('./config/no-id.csv.ts'));
15
14
  });
16
15
  test('convert ini file', function () {
17
16
  expect(config2ts.GetTsString('./config/ini-file.ini').replace(reg, '')).toBe(getTsFileString('./config/ini-file.ini.ts'));
18
17
  });
19
18
  test('convert toml file', function () {
19
+ // console.log(config2ts.GetTsString('./config/toml_file.toml'))
20
20
  expect(config2ts.GetTsString('./config/toml_file.toml').replace(reg, '')).toBe(getTsFileString('./config/toml_file.toml.ts'));
21
21
  });
22
22
  test('config2ts merge csv file list', function () {
package/jest.config.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- moduleNameMapper: {
3
- "^d3$": "<rootDir>/node_modules/d3/dist/d3.min.js",
4
- },
5
- };