Skip to content

Commit

Permalink
build: switch to picocolors
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed Dec 1, 2021
1 parent 4efad69 commit 3121519
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 13 deletions.
12 changes: 6 additions & 6 deletions build/build-pages.js
Expand Up @@ -4,7 +4,7 @@

const fs = require('fs').promises
const path = require('path')
const chalk = require('chalk')
const picocolors = require('picocolors')

const iconsDir = path.join(__dirname, '../icons/')
const pagesDir = path.join(__dirname, '../docs/content/icons/')
Expand All @@ -31,20 +31,20 @@ tags:
await fs.access(pageName, fs.F_OK)

if (VERBOSE) {
console.log(`${chalk.cyan(iconBasename)}: Page already exists; skipping`)
console.log(`${picocolors.cyan(iconBasename)}: Page already exists; skipping`)
}
} catch (_) {
await fs.writeFile(pageName, pageTemplate)
console.log(chalk.green(`${iconBasename}: Page created`))
console.log(picocolors.green(`${iconBasename}: Page created`))
}
}

(async () => {
try {
const basename = path.basename(__filename)
const timeLabel = chalk.cyan(`[${basename}] finished`)
const timeLabel = picocolors.cyan(`[${basename}] finished`)

console.log(chalk.cyan(`[${basename}] started`))
console.log(picocolors.cyan(`[${basename}] started`))
console.time(timeLabel)

const files = await fs.readdir(iconsDir)
Expand All @@ -53,7 +53,7 @@ tags:

const filesLength = files.length

console.log(chalk.green('\nSuccess, %s page%s prepared!'), filesLength, filesLength !== 1 ? 's' : '')
console.log(picocolors.green('\nSuccess, %s page%s prepared!'), filesLength, filesLength !== 1 ? 's' : '')
console.timeEnd(timeLabel)
} catch (error) {
console.error(error)
Expand Down
8 changes: 4 additions & 4 deletions build/build-svgs.js
Expand Up @@ -4,7 +4,7 @@

const fs = require('fs').promises
const path = require('path')
const chalk = require('chalk')
const picocolors = require('picocolors')
const cheerio = require('cheerio')
const { loadConfig, optimize } = require('svgo')

Expand Down Expand Up @@ -63,9 +63,9 @@ async function processFile(file, config) {
(async () => {
try {
const basename = path.basename(__filename)
const timeLabel = chalk.cyan(`[${basename}] finished`)
const timeLabel = picocolors.cyan(`[${basename}] finished`)

console.log(chalk.cyan(`[${basename}] started`))
console.log(picocolors.cyan(`[${basename}] started`))
console.time(timeLabel)

const files = await fs.readdir(iconsDir)
Expand All @@ -75,7 +75,7 @@ async function processFile(file, config) {

const filesLength = files.length

console.log(chalk.green('\nSuccess, %s icon%s prepared!'), filesLength, filesLength !== 1 ? 's' : '')
console.log(picocolors.green('\nSuccess, %s icon%s prepared!'), filesLength, filesLength !== 1 ? 's' : '')
console.timeEnd(timeLabel)
} catch (error) {
console.error(error)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Expand Up @@ -37,10 +37,8 @@
"test:vnu": "node build/vnu-jar.js",
"test": "npm-run-all docs-build --parallel --aggregate-output --continue-on-error test:*"
},
"dependencies": {},
"devDependencies": {
"autoprefixer": "^10.4.0",
"chalk": "^4.1.2",
"cheerio": "^1.0.0-rc.10",
"cross-env": "^7.0.3",
"eslint": "^8.3.0",
Expand All @@ -50,6 +48,7 @@
"linkinator": "^2.16.2",
"lockfile-lint": "^4.6.2",
"npm-run-all": "^4.1.5",
"picocolors": "^1.0.0",
"postcss": "^8.4.4",
"postcss-cli": "^9.0.2",
"purgecss": "^4.1.3",
Expand Down

0 comments on commit 3121519

Please sign in to comment.