Skip to content

Commit 3b66cd4

Browse files
committed
update dependencies also changes that should improve the demo storybook load time
1 parent 69597ba commit 3b66cd4

File tree

7 files changed

+2075
-1323
lines changed

7 files changed

+2075
-1323
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# react-vector-maps
22

3-
🗺️ A React component for interactive vector maps of the world and 100+ countries.
3+
🗺️ React component for interactive vector maps of the world and 100+ countries.
44

55
[![Live Demo](https://img.shields.io/badge/netlify-live_demo-1e9498.svg)](https://react-vector-maps.netlify.com/)
66
[![npm](https://img.shields.io/npm/v/@south-paw/react-vector-maps.svg)](https://www.npmjs.com/package/@south-paw/react-vector-maps)

maps/convert-svgs.js

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,11 @@ const stringify = object => {
2828

2929
class ConvertSVGs {
3030
constructor(config) {
31-
const { inputSvgsPath, outputJsonPath } = config;
31+
const { inputSvgsPath, outputJsonPath, outputSummary = false } = config;
3232

3333
this.inputSvgsPath = inputSvgsPath;
3434
this.outputJsonPath = outputJsonPath;
35+
this.outputSummary = outputSummary;
3536
}
3637

3738
async cleanAndCreateFolder(path) {
@@ -42,25 +43,12 @@ class ConvertSVGs {
4243
}
4344
}
4445

45-
async cleanAndCreateFile(path, data) {
46-
await rimraf.sync(path);
47-
48-
if (!fs.existsSync(path)) {
49-
try {
50-
fs.writeFileSync(path, data);
51-
} catch (e) {
52-
throw e;
53-
}
54-
}
55-
}
56-
5746
async run() {
5847
await this.cleanAndCreateFolder(this.outputJsonPath);
5948

6049
const files = fs.readdirSync(this.inputSvgsPath);
6150

62-
const exports = [];
63-
const imports = [];
51+
const output = [];
6452

6553
await asyncForEach(files, async filename => {
6654
const path = `${this.inputSvgsPath}\\${filename}`;
@@ -84,9 +72,18 @@ class ConvertSVGs {
8472
layers,
8573
};
8674

75+
output.push({
76+
name: capitalize(name.split('-').join(' ')),
77+
filename,
78+
});
79+
8780
fs.writeFileSync(`${this.outputJsonPath}\\${name}.json`, stringify(map));
8881
});
8982
});
83+
84+
if (this.outputSummary) {
85+
fs.writeFileSync(`${this.outputJsonPath}\\..\\summary.json`, stringify(output));
86+
}
9087
}
9188
}
9289

maps/run.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,6 @@ const JSON_MAP_FILES = `${__dirname}\\json`;
66
const convertSVGs = new ConvertSVGs({
77
inputSvgsPath: SVG_MAP_FILES,
88
outputJsonPath: JSON_MAP_FILES,
9+
outputSummary: true,
910
});
1011
convertSVGs.run();

0 commit comments

Comments
 (0)