Skip to content

Commit

Permalink
update dependencies also changes that should improve the demo storybo…
Browse files Browse the repository at this point in the history
…ok load time
  • Loading branch information
South-Paw committed Jun 3, 2019
1 parent 69597ba commit 3b66cd4
Show file tree
Hide file tree
Showing 7 changed files with 2,075 additions and 1,323 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# react-vector-maps

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

[![Live Demo](https://img.shields.io/badge/netlify-live_demo-1e9498.svg)](https://react-vector-maps.netlify.com/)
[![npm](https://img.shields.io/npm/v/@south-paw/react-vector-maps.svg)](https://www.npmjs.com/package/@south-paw/react-vector-maps)
Expand Down
27 changes: 12 additions & 15 deletions maps/convert-svgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,11 @@ const stringify = object => {

class ConvertSVGs {
constructor(config) {
const { inputSvgsPath, outputJsonPath } = config;
const { inputSvgsPath, outputJsonPath, outputSummary = false } = config;

this.inputSvgsPath = inputSvgsPath;
this.outputJsonPath = outputJsonPath;
this.outputSummary = outputSummary;
}

async cleanAndCreateFolder(path) {
Expand All @@ -42,25 +43,12 @@ class ConvertSVGs {
}
}

async cleanAndCreateFile(path, data) {
await rimraf.sync(path);

if (!fs.existsSync(path)) {
try {
fs.writeFileSync(path, data);
} catch (e) {
throw e;
}
}
}

async run() {
await this.cleanAndCreateFolder(this.outputJsonPath);

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

const exports = [];
const imports = [];
const output = [];

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

output.push({
name: capitalize(name.split('-').join(' ')),
filename,
});

fs.writeFileSync(`${this.outputJsonPath}\\${name}.json`, stringify(map));
});
});

if (this.outputSummary) {
fs.writeFileSync(`${this.outputJsonPath}\\..\\summary.json`, stringify(output));
}
}
}

Expand Down
1 change: 1 addition & 0 deletions maps/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ const JSON_MAP_FILES = `${__dirname}\\json`;
const convertSVGs = new ConvertSVGs({
inputSvgsPath: SVG_MAP_FILES,
outputJsonPath: JSON_MAP_FILES,
outputSummary: true,
});
convertSVGs.run();
Loading

0 comments on commit 3b66cd4

Please sign in to comment.