Optimise image conversion script, minor fixes

main
Elbert Alias 4 years ago
parent 2b3adf1c0a
commit fd619684fd

@ -1,6 +1,6 @@
const fs = require('fs')
const path = require('path')
const { convertFile } = require('convert-svg-to-png')
const { createConverter } = require('convert-svg-to-png')
const appPaths = () => {
const fileDir = path.dirname(require.main.filename).split('/')
@ -77,22 +77,47 @@ function dateDiff(file) {
return Math.round(Math.abs((then - now) / 86400000))
}
// Main script
fs.readdirSync(appPaths().iconPath).forEach((fileName) => {
const converter = createConverter()
;(async () => {
// Main script
const files = fs.readdirSync(appPaths().iconPath)
const totalFiles = files.length
do {
await Promise.all(
files.splice(0, 50).map(async (fileName) => {
const image = {
id: fileName,
path: `${appPaths().iconPath}/${fileName}`,
convertPath: `${appPaths().convertPath}/${fileName}`,
async convertAndCopy() {
await convertFile(this.path, {
for (let attempt = 1; attempt <= 3; attempt++) {
try {
await converter
.convertFile(this.path, {
height: 32,
width: 32,
outputFilePath: this.convertPath,
}).then((outputFile) => {
console.log(`SVG Converted: ${outputFile}`)
})
.catch((error) => {
throw new Error(`${error} (${fileName})`)
})
} catch (error) {
if (attempt >= 3) {
throw error
} else {
await new Promise((resolve) =>
setTimeout(resolve, 500 * attempt)
)
}
}
break
}
},
processFile() {
async processFile() {
// Setup variables.
const ext = getFileExtension(this.path)
@ -103,26 +128,34 @@ fs.readdirSync(appPaths().iconPath).forEach((fileName) => {
if (checkFileExists(convertFilePath)) {
// If file has changed in past 7 days.
if (dateDiff(this.path) > 8) {
console.log(`File exists, skipping: ${this.id}`)
return null
}
}
// Convert and copy file.
this.convertAndCopy()
await this.convertAndCopy()
} else {
// If PNG or other, just copy the file as-is.
// eslint-disable-next-line no-lonely-if
if (checkIfFile(this.path)) {
copyFiles(this.path, this.convertPath)
} else {
console.info('Not a file, skipping...')
}
}
},
}
image.processFile()
})
await image.processFile()
})
)
console.log(`${100 - Math.round((100 / totalFiles) * files.length)}%`)
} while (files.length)
await converter.destroy()
console.log(`Converted ${totalFiles.toLocaleString()} files.`)
process.exit()
})()
/**

@ -13,7 +13,7 @@
"software"
],
"homepage": "https://www.wappalyzer.com/",
"version": "6.6.0",
"version": "6.7.0",
"author": "Wappalyzer",
"license": "MIT",
"repository": {

@ -23,7 +23,6 @@ body {
line-height: 1.5rem;
margin: 0;
min-width: 24rem;
overflow-x: hidden;
}
a, a:focus, a:hover {
@ -305,6 +304,7 @@ body.dynamic-icon .category__heading:hover .category__pin {
padding: .1rem .3rem;
margin-left: .3rem;
vertical-align: middle;
white-space: nowrap;
}
.technology__version {

@ -0,0 +1,9 @@
<svg width="237" height="236" viewBox="0 0 237 236" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M236.6 123.5C236.6 103.7 224.3 86.3 205.8 79.6C206.6 75.4 207 71.2 207 66.9C207 30 177 -1.52588e-05 140.2 -1.52588e-05C118.6 -1.52588e-05 98.6 10.3 86 27.7C79.8 22.9 72.2 20.3 64.3 20.3C44.7 20.3 28.8 36.2 28.8 55.8C28.8 60.1 29.6 64.3 31 68.2C12.6 74.8 0 92.5 0 112.2C0 132.1 12.4 149.5 30.9 156.2C30.1 160.3 29.7 164.6 29.7 168.9C29.7 205.7 59.6 235.6 96.4 235.6C118 235.6 138 225.2 150.5 207.8C156.7 212.7 164.3 215.4 172.2 215.4C191.8 215.4 207.7 199.5 207.7 179.9C207.7 175.6 206.9 171.4 205.5 167.5C223.9 160.9 236.6 143.2 236.6 123.5Z" fill="white"/>
<path d="M93 101.5L144.8 125.1L197 79.3C197.8 75.5 198.1 71.8 198.1 67.8C198.1 35.6 171.9 9.40001 139.7 9.40001C120.4 9.40001 102.5 18.9 91.6 34.8L82.9 79.9L93 101.5Z" fill="#FED10A"/>
<path d="M39.4 156.3C38.6 160.1 38.3 164 38.3 168C38.3 200.3 64.6 226.5 96.9 226.5C116.3 226.5 134.4 216.9 145.3 200.9L153.9 156L142.4 134L90.4 110.3L39.4 156.3Z" fill="#24BBB1"/>
<path d="M39.1 66.7L74.6 75.1L82.4 34.8C77.6 31.1 71.6 29.1 65.4 29.1C50 29.1 37.4 41.6 37.4 57.1C37.4 60.4 38 63.7 39.1 66.7Z" fill="#EF5098"/>
<path d="M36 75.2C20.2 80.4 9.10001 95.6 9.10001 112.3C9.10001 128.6 19.2 143.1 34.3 148.9L84.1 103.9L75 84.4L36 75.2Z" fill="#17A8E0"/>
<path d="M154.3 200.9C159.2 204.6 165.1 206.7 171.2 206.7C186.6 206.7 199.2 194.2 199.2 178.7C199.2 175.3 198.6 172 197.5 169L162.1 160.7L154.3 200.9Z" fill="#93C83E"/>
<path d="M161.5 151.4L200.5 160.5C216.4 155.3 227.4 140.1 227.4 123.3C227.4 107.1 217.3 92.5 202.2 86.8L151.2 131.5L161.5 151.4Z" fill="#0779A1"/>
</svg>

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 1.6 KiB

@ -1,3 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="264" height="288" viewBox="0 0 264 288">
<path fill="#7A34FF" fill-rule="evenodd" d="M180,260.874545 L142.532111,247.249859 C136.209084,244.950576 132,238.941267 132,232.213164 L132,155.42 L132,155.42 L26.6378426,59.6362206 C9.67222516,44.212932 0,22.9283669 0,0 L180,0 L180,260.874545 Z M216,273.965455 L216,0 L248,0 C256.836556,-1.623249e-15 264,7.163444 264,16 L264,279.9984 C264,284.416678 260.418278,287.9984 256,287.9984 C255.06758,287.9984 254.142338,287.835396 253.266055,287.516747 L216,273.965455 L216,273.965455 Z"/>
<svg width="288" height="288" viewBox="0 0 288 288" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M192 260.875L154.532 247.25C148.209 244.951 144 238.941 144 232.213V155.42L38.6378 59.6362C21.6722 44.2129 12 22.9284 12 0H192V260.875ZM228 273.965V0H260C268.837 0 276 7.16344 276 16V279.998C276 284.417 272.418 287.998 268 287.998C267.068 287.998 266.142 287.835 265.266 287.517L228 273.965Z" fill="#7A34FF"/>
</svg>

Before

Width:  |  Height:  |  Size: 584 B

After

Width:  |  Height:  |  Size: 466 B

@ -122,7 +122,10 @@ const Content = {
},
(response) => {
chrome.runtime.lastError
? reject(
? func === 'error'
? resolve()
: Content.driver(
'error',
new Error(
`${chrome.runtime.lastError}: Driver.${func}(${args})`
)

@ -4,7 +4,7 @@
"author": "Wappalyzer",
"homepage_url": "https://www.wappalyzer.com/",
"description": "Identify web technologies",
"version": "6.5.20",
"version": "6.7.0",
"default_locale": "en",
"manifest_version": 2,
"icons": {

@ -4,7 +4,7 @@
"author": "Wappalyzer",
"homepage_url": "https://www.wappalyzer.com/",
"description": "Identify web technologies",
"version": "6.6.0",
"version": "6.7.0",
"default_locale": "en",
"manifest_version": 2,
"icons": {

@ -13,7 +13,7 @@
"software"
],
"homepage": "https://www.wappalyzer.com/",
"version": "6.6.0",
"version": "6.7.0",
"author": "Wappalyzer",
"license": "MIT",
"repository": {

@ -619,20 +619,6 @@
"scripts": "acsbapp?\\.com/.*/acsb\\.js",
"website": "https://accessibe.com"
},
"Bookero": {
"cats": [
72
],
"description": "Bookero is online booking system for you website or Facebook page.",
"icon": "Bookero.svg",
"scripts": "cdn\\.bookero\\.pl",
"js": {
"bookero_config": ""
},
"url": "\\.bookero\\.(?:org|pl)",
"pricing": ["low", "recurring"],
"website": "https://www.bookero.org"
},
"Accesso": {
"cats": [
6,
@ -677,34 +663,6 @@
"saas": true,
"website": "https://www.acquia.com/"
},
"Elasticsearch": {
"cats": [
29
],
"description": "Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.",
"icon": "Elasticsearch.svg",
"website": "https://www.elastic.co"
},
"Adabra": {
"cats": [
32
],
"description": "Adabra is a SaaS omnichannel marketing automation platform to help boost sales. Adabra allows you to manage user segmentation, create workflow and campaigns through email, social, SMS and more.",
"icon": "Adabra.svg",
"pricing": [
"poa",
"recurring"
],
"xhr": "my\\.adabra\\.com",
"js": {
"adabra_version_track": "(^.+$)\\;version:\\1",
"adabra_version_panel": "(^.+$)\\;version:\\1",
"adabraPreview": ""
},
"scripts": "track\\.adabra\\.com",
"saas": true,
"website": "https://www.adabra.com"
},
"Act-On": {
"cats": [
32
@ -865,6 +823,26 @@
"scripts": "\\.ada\\.support",
"website": "https://www.ada.cx"
},
"Adabra": {
"cats": [
32
],
"description": "Adabra is a SaaS omnichannel marketing automation platform to help boost sales. Adabra allows you to manage user segmentation, create workflow and campaigns through email, social, SMS and more.",
"icon": "Adabra.svg",
"js": {
"adabraPreview": "",
"adabra_version_panel": "(^.+$)\\;version:\\1",
"adabra_version_track": "(^.+$)\\;version:\\1"
},
"pricing": [
"poa",
"recurring"
],
"saas": true,
"scripts": "track\\.adabra\\.com",
"website": "https://www.adabra.com",
"xhr": "my\\.adabra\\.com"
},
"Adally": {
"cats": [
68
@ -2016,27 +1994,6 @@
},
"website": "http://wicket.apache.org"
},
"STUDIO": {
"description": "STUDIO is a Japan-based company and SaaS application for designing and hosting websites. The service includes a visual editor with built-in CMS and analytics.",
"cats": [
51
],
"icon": "STUDIO.svg",
"dom": ".StudioCanvas, .publish-studio-style",
"meta": {
"generator": "^STUDIO$"
},
"saas": true,
"pricing": ["low", "recurring", "freemium"],
"implies": [
"Vue.js",
"Nuxt.js",
"Firebase",
"Google Cloud",
"Google Tag Manager"
],
"website": "https://studio.design"
},
"ApexPages": {
"cats": [
51
@ -3259,6 +3216,23 @@
"scripts": "bda\\.bookatable\\.com/deploy/lbui\\.direct\\.min\\.js",
"website": "https://www.bookatable.co.uk"
},
"Bookero": {
"cats": [
72
],
"description": "Bookero is online booking system for you website or Facebook page.",
"icon": "Bookero.svg",
"js": {
"bookero_config": ""
},
"pricing": [
"low",
"recurring"
],
"scripts": "cdn\\.bookero\\.pl",
"url": "\\.bookero\\.(?:org|pl)",
"website": "https://www.bookero.org"
},
"Bookingkit": {
"cats": [
5,
@ -4737,6 +4711,22 @@
"url": "\\.spaces.chec\\.io",
"website": "https://www.commercejs.com"
},
"Commerce7": {
"cats": [
6
],
"description": "Commerce7 is an ecommerce platform for wineries.",
"icon": "Commerce7.svg",
"pricing": [
"mid",
"recurring",
"payg"
],
"saas": true,
"scripts": "cdn\\.commerce7\\.com",
"website": "https://commerce7.com",
"xhr": "api\\.commerce7\\.com"
},
"Concrete5": {
"cats": [
1
@ -6136,6 +6126,14 @@
"url": "https?://(?:[^/]+\\.)?edgecastcdn\\.net/",
"website": "http://www.edgecast.com"
},
"Elasticsearch": {
"cats": [
29
],
"description": "Elasticsearch is a search engine based on the Lucene library. It provides a distributed, multitenant-capable full-text search engine with an HTTP web interface and schema-free JSON documents.",
"icon": "Elasticsearch.svg",
"website": "https://www.elastic.co"
},
"Elcodi": {
"cats": [
6
@ -10063,7 +10061,10 @@
},
"html": "<title>Kibana</title>",
"icon": "kibana.svg",
"implies": ["Node.js", "Elasticsearch"],
"implies": [
"Node.js",
"Elasticsearch"
],
"url": "kibana#/dashboard/",
"website": "http://www.elastic.co/products/kibana"
},
@ -12958,18 +12959,22 @@
72
],
"description": "Occasion is an online booking system.",
"icon": "Occasion.png",
"dom": [
"iframe[src*='app.getoccasion.com']",
"a[href*='app.getoccasion.com']"
],
"icon": "Occasion.png",
"js": {
"occsnMerchantToken": "",
"OCCSN.stack": ""
"OCCSN.stack": "",
"occsnMerchantToken": ""
},
"scripts": "app\\.getoccasion\\.com",
"pricing": [
"low",
"payg",
"recurring"
],
"saas": true,
"pricing": ["low", "payg", "recurring"],
"scripts": "app\\.getoccasion\\.com",
"website": "https://www.getoccasion.com"
},
"Ochanoko": {
@ -15690,15 +15695,19 @@
72
],
"description": "Reservio is a cloud-based appointment scheduling and online booking solution.",
"icon": "Reservio.svg",
"dom": [
".reservio-booking-button",
"a[href*='.reservio.com'][target='_blank']",
"a[href*='bookings.reservio.com']"
],
"scripts": "static\\.reservio\\.com",
"icon": "Reservio.svg",
"pricing": [
"freemium",
"recurring",
"low"
],
"saas": true,
"pricing": ["freemium", "recurring","low"],
"scripts": "static\\.reservio\\.com",
"website": "https://www.reservio.com"
},
"Resin": {
@ -16279,6 +16288,31 @@
"icon": "SQLite.png",
"website": "http://www.sqlite.org"
},
"STUDIO": {
"cats": [
51
],
"description": "STUDIO is a Japan-based company and SaaS application for designing and hosting websites. The service includes a visual editor with built-in CMS and analytics.",
"dom": ".StudioCanvas, .publish-studio-style",
"icon": "STUDIO.svg",
"implies": [
"Vue.js",
"Nuxt.js",
"Firebase",
"Google Cloud",
"Google Tag Manager"
],
"meta": {
"generator": "^STUDIO$"
},
"pricing": [
"low",
"recurring",
"freemium"
],
"saas": true,
"website": "https://studio.design"
},
"SUSE": {
"cats": [
28
@ -21855,18 +21889,6 @@
"scripts": "zkau/",
"website": "http://zkoss.org"
},
"Zocdoc": {
"cats": [
72
],
"description": "Zocdoc is a New York City-based company offering an online service that allows people to find and book in-person or telemedicine appointments for medical or dental care.",
"icon": "Zocdoc.svg",
"dom": "a[href*='www.zocdoc.com'][target='_blank']",
"scripts": "offsiteschedule\\.zocdoc\\.com",
"saas": true,
"pricing": ["payg"],
"website": "https://www.zocdoc.com"
},
"ZURB Foundation": {
"cats": [
66
@ -22048,6 +22070,20 @@
"icon": "Zipkin.png",
"website": "https://zipkin.io/"
},
"Zocdoc": {
"cats": [
72
],
"description": "Zocdoc is a New York City-based company offering an online service that allows people to find and book in-person or telemedicine appointments for medical or dental care.",
"dom": "a[href*='www.zocdoc.com'][target='_blank']",
"icon": "Zocdoc.svg",
"pricing": [
"payg"
],
"saas": true,
"scripts": "offsiteschedule\\.zocdoc\\.com",
"website": "https://www.zocdoc.com"
},
"Zoey": {
"cats": [
6
@ -22631,11 +22667,7 @@
"js": {
"jQuery.fn.jquery": "([\\d.]+)\\;version:\\1"
},
"scripts": [
"jquery[.-]([\\d.]*\\d)[^/]*\\.js\\;version:\\1",
"/([\\d.]+)/jquery(?:\\.min)?\\.js\\;version:\\1",
"jquery.*\\.js(?:\\?ver(?:sion)?=([\\d.]+))?\\;version:\\1"
],
"scripts": "jquery",
"website": "https://jquery.com"
},
"jQuery DevBridge Autocomplete": {
@ -23561,18 +23593,6 @@
"scripts": "xcharts\\.js",
"website": "https://tenxer.github.io/xcharts/"
},
"Commerce7": {
"cats": [
6
],
"description": "Commerce7 is an ecommerce platform for wineries.",
"icon": "Commerce7.svg",
"xhr": "api\\.commerce7\\.com",
"pricing": ["mid", "recurring", "payg"],
"scripts": "cdn\\.commerce7\\.com",
"saas": true,
"website": "https://commerce7.com"
},
"xtCommerce": {
"cats": [
6

@ -1,11 +1,7 @@
'use strict'
function next() {
return new Promise((resolve) =>
(typeof setImmediate !== 'undefined'
? setImmediate
: requestAnimationFrame)(resolve)
)
return new Promise((resolve) => setTimeout(resolve, 0))
}
function toArray(value) {