diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-07 12:22:26 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-04-07 12:22:26 +0000 |
commit | d50fca7dd40f596ebb8b50cd9c4140857f2a0637 (patch) | |
tree | a8b40991dcab905c34658c3d860ad7e0a4554c9d /build | |
parent | Releasing debian version 1.10.3+dfsg-1. (diff) | |
download | bootstrap-icons-d50fca7dd40f596ebb8b50cd9c4140857f2a0637.tar.xz bootstrap-icons-d50fca7dd40f596ebb8b50cd9c4140857f2a0637.zip |
Merging upstream version 1.10.4+dfsg.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'build')
-rw-r--r-- | build/build-pages.js | 6 | ||||
-rw-r--r-- | build/build-svgs.js | 8 | ||||
-rwxr-xr-x | build/check-icons.js | 59 | ||||
-rw-r--r-- | build/font/css.hbs | 6 | ||||
-rw-r--r-- | build/font/scss.hbs | 16 | ||||
-rw-r--r-- | build/vnu-jar.js | 12 |
6 files changed, 91 insertions, 16 deletions
diff --git a/build/build-pages.js b/build/build-pages.js index 911524d..6825be4 100644 --- a/build/build-pages.js +++ b/build/build-pages.js @@ -2,8 +2,8 @@ 'use strict' -const fs = require('fs').promises -const path = require('path') +const fs = require('node:fs').promises +const path = require('node:path') const picocolors = require('picocolors') const iconsDir = path.join(__dirname, '../icons/') @@ -53,7 +53,7 @@ tags: const filesLength = files.length - console.log(picocolors.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) diff --git a/build/build-svgs.js b/build/build-svgs.js index c889ce5..ed868e6 100644 --- a/build/build-svgs.js +++ b/build/build-svgs.js @@ -2,9 +2,9 @@ 'use strict' -const fs = require('fs').promises -const path = require('path') -const process = require('process') +const fs = require('node:fs').promises +const path = require('node:path') +const process = require('node:process') const picocolors = require('picocolors') const { loadConfig, optimize } = require('svgo') @@ -46,7 +46,7 @@ async function processFile(file, config) { const filesLength = files.length - console.log(picocolors.green('\nSuccess, prepared %s icon%s!'), filesLength, filesLength !== 1 ? 's' : '') + console.log(picocolors.green('\nSuccess, prepared %s icon%s!'), filesLength, filesLength === 1 ? '' : 's') console.timeEnd(timeLabel) } catch (error) { console.error(error) diff --git a/build/check-icons.js b/build/check-icons.js new file mode 100755 index 0000000..73f1a5b --- /dev/null +++ b/build/check-icons.js @@ -0,0 +1,59 @@ +#!/usr/bin/env node + +'use strict' + +const fs = require('node:fs').promises +const path = require('node:path') +const process = require('node:process') +const picocolors = require('picocolors') + +const fontJsonPath = path.join(__dirname, '../font/bootstrap-icons.json') +const iconsDir = path.join(__dirname, '../icons/') + +;(async () => { + try { + const basename = path.basename(__filename) + const timeLabel = picocolors.cyan(`[${basename}] finished`) + + console.log(picocolors.cyan(`[${basename}] started`)) + console.time(timeLabel) + + const fontJsonString = await fs.readFile(fontJsonPath, 'utf8') + const fontJson = JSON.parse(fontJsonString) + const svgFiles = await fs.readdir(iconsDir) + + const jsonIconList = Object.keys(fontJson) + const svgIconList = svgFiles.map(svg => path.basename(svg, path.extname(svg))) + + const onlyInJson = jsonIconList.filter(icon => !svgIconList.includes(icon)) + const onlyInSvg = svgIconList.filter(icon => !jsonIconList.includes(icon)) + + if (onlyInJson.length === 0 || onlyInSvg === 0) { + console.log(picocolors.green('Success, found no differences!')) + console.timeEnd(timeLabel) + + return + } + + if (onlyInJson.length > 0) { + console.error(picocolors.red(`Found additional icons in ${fontJsonPath}:`)) + + for (const icon of onlyInJson) { + console.log(` - ${picocolors.red(icon)}`) + } + } + + if (onlyInSvg.length > 0) { + console.error(picocolors.red('Found additional icons in SVG files:')) + + for (const icon of onlyInSvg) { + console.log(` - ${picocolors.red(icon)}`) + } + } + + process.exit(1) + } catch (error) { + console.error(error) + process.exit(1) + } +})() diff --git a/build/font/css.hbs b/build/font/css.hbs index b6de062..6f2aa30 100644 --- a/build/font/css.hbs +++ b/build/font/css.hbs @@ -1,3 +1,9 @@ +/*! + * Bootstrap Icons (https://icons.getbootstrap.com/) + * Copyright 2019-2023 The Bootstrap Authors + * Licensed under MIT (https://github.com/twbs/icons/blob/main/LICENSE.md) + */ + @font-face { font-display: block; font-family: "{{ name }}"; diff --git a/build/font/scss.hbs b/build/font/scss.hbs index ce0617d..710b45c 100644 --- a/build/font/scss.hbs +++ b/build/font/scss.hbs @@ -1,9 +1,15 @@ +/*! + * Bootstrap Icons (https://icons.getbootstrap.com/) + * Copyright 2019-2023 The Bootstrap Authors + * Licensed under MIT (https://github.com/twbs/icons/blob/main/LICENSE.md) + */ + ${{ name }}-font: "{{ name }}" !default; ${{ name }}-font-dir: "{{ fontsUrl }}" !default; -${{ name }}-font-file: #{${{ name }}-font-dir}/#{${{ name }}-font} !default; +${{ name }}-font-file: "#{${{ name }}-font-dir}/#{${{ name }}-font}" !default; ${{ name }}-font-hash: "24e3eb84d0bcaf83d77f904c78ac1f47" !default; ${{ name }}-font-src: url("#{${{ name }}-font-file}.woff2?#{${{ name }}-font-hash}") format("woff2"), - url("#{${{ name }}-font-file}.woff?#{${{ name }}-font-hash}") format("woff") !default; + url("#{${{ name }}-font-file}.woff?#{${{ name }}-font-hash}") format("woff") !default; @font-face { font-display: block; @@ -32,6 +38,6 @@ ${{ name }}-map: ( {{/ each }} ); -{{# each codepoints }} -.{{ ../prefix }}-{{ @key }}::before { content: map-get(${{ ../name }}-map, "{{ @key }}"); } -{{/ each }} +@each $icon, $codepoint in ${{ name }}-map { + .{{ prefix }}-#{$icon}::before { content: $codepoint; } +} diff --git a/build/vnu-jar.js b/build/vnu-jar.js index 6885015..c87d518 100644 --- a/build/vnu-jar.js +++ b/build/vnu-jar.js @@ -2,22 +2,24 @@ /*! * Script to run vnu-jar if Java is available. - * Copyright 2017-2022 The Bootstrap Authors - * Copyright 2017-2022 Twitter, Inc. + * Copyright 2017-2023 The Bootstrap Authors * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ 'use strict' -const { execFile, spawn } = require('child_process') +const { execFile, spawn } = require('node:child_process') const vnu = require('vnu-jar') execFile('java', ['-version'], (error, stdout, stderr) => { if (error) { - console.error('Skipping vnu-jar test; Java is missing.') + console.error('Skipping vnu-jar test; Java is probably missing.') + console.error(error) return } + console.log('Running vnu-jar validation...') + const is32bitJava = !/64-Bit/.test(stderr) // vnu-jar accepts multiple ignores joined with a `|`. @@ -40,6 +42,8 @@ execFile('java', ['-version'], (error, stdout, stderr) => { args.splice(0, 0, '-Xss512k') } + console.log(`command used: java ${args.join(' ')}`) + return spawn('java', args, { shell: true, stdio: 'inherit' |