-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ef988db
commit b267bfc
Showing
2 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"name": "@mdi/util", | ||
"version": "0.1.0", | ||
"description": "Util helpers for support builds.", | ||
"main": "util.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Templarian/MaterialDesign-Util.git" | ||
}, | ||
"author": "Austin Andrews (@Templarian)", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/Templarian/MaterialDesign-Util/issues" | ||
}, | ||
"homepage": "https://github.com/Templarian/MaterialDesign-Util#readme" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const fs = require('fs'); | ||
|
||
const encoding = "utf8"; | ||
const folder = `${__dirname}/../svg`; | ||
|
||
exports.getVersion = () => { | ||
const file = fs.readFileSync(`${folder}/package.json`, { encoding }); | ||
return JSON.parse(file).version; | ||
}; | ||
|
||
exports.getMeta = (withPaths) => { | ||
const file = fs.readFileSync(`${folder}/meta.json`, { encoding }); | ||
const meta = JSON.parse(file); | ||
if (withPaths) { | ||
const total = meta.length; | ||
meta.forEach((icon, i) => { | ||
const svg = fs.readFileSync(`${folder}/svg/${icon.name}.svg`, { encoding }); | ||
icon.path = svg.match(/d="([^"]+)"/)[1]; | ||
}); | ||
} | ||
return meta; | ||
}; | ||
|
||
exports.write = (file, data) => { | ||
fs.writeFileSync(file, data); | ||
}; | ||
|
||
exports.read = (file, data) => { | ||
fs.readFileSync(file); | ||
}; | ||
|
||
exports.exists = (file) => { | ||
return fs.exists(file); | ||
}; |