Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 39 additions & 2 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
const fs = require('fs');
const zlib = require('zlib');
const archiver = require('archiver');
const uuid = require('uuid');

const name = "Material Design Icons";
const encoding = "utf8";
Expand Down Expand Up @@ -39,7 +40,7 @@ const template = {
sets: {},
items: {}
};
template.sets[packageId] = {
template.groups[name] = {
date: date,
name: name,
url: "https://materialdesignicons.com",
Expand All @@ -48,6 +49,16 @@ template.sets[packageId] = {
licence: "69A6D789-4E3C-4379-86CC-4D83B1C3F8D8",
identifier: packageId
};
template.sets["_ALL"] = {
date: date,
name: "_ALL",
url: "https://materialdesignicons.com",
description: "https://materialdesignicons.com Maintained by Austin Andrews (@Templarian)",
sort: 1,
licence: "69A6D789-4E3C-4379-86CC-4D83B1C3F8D8",
identifier: uuid.v4(),
parent: template.groups[name].identifier
};

function getMetaJson() {
const contents = fs.readFileSync(`${svgPackageFolder}/meta.json`, { encoding });
Expand All @@ -57,10 +68,36 @@ function getMetaJson() {
function build() {
const icons = getMetaJson();
icons.forEach((icon) => {
icon.tags.forEach((tag) => {
if (!template.sets[tag]) {
template.sets[tag] = {
date: date,
name: tag,
url: "https://materialdesignicons.com",
description: "https://materialdesignicons.com Maintained by Austin Andrews (@Templarian)",
sort: 1,
licence: "69A6D789-4E3C-4379-86CC-4D83B1C3F8D8",
identifier: uuid.v4(),
parent: template.groups[name].identifier
};
}
var iconuuid = uuid.v4();
template.items[iconuuid] = {
width: 24,
height: 24,
parent: template.sets[tag].identifier,
date: date,
identifier: iconuuid,
file: `${icon.name}.svg`,
type: 0, // SVG
name: icon.name,
tags: [...icon.tags, ...icon.aliases].join(',').replace(/ \/ /g, "-").replace(/ /g, "-")
}
})
template.items[icon.id] = {
width: 24,
height: 24,
parent: packageId,
parent: template.sets["_ALL"].identifier,
date: date,
identifier: icon.id,
file: `${icon.name}.svg`,
Expand Down
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@
},
"homepage": "https://materialdesignicons.com",
"devDependencies": {
"@mdi/svg": "^2.2.43",
"archiver": "^2.1.1"
"@mdi/svg": "^7.0.96"
},
"dependencies": {
"archiver": "^5.3.1",
"uuid": "^9.0.0"
}
}