From 084b947e8d5160c429703065892a885af9520e90 Mon Sep 17 00:00:00 2001 From: Jonas Broms Date: Tue, 30 Nov 2021 21:13:59 +0100 Subject: [PATCH 1/2] Recreate the commitizen logo in png & svg format (#878) * Recreate the commitizen logo in png & svg format * refactor(logos): dynamically generate pngs from svg files re #800 * build(generate.sh): fix existance checking for cairosvg executable in build envs Co-authored-by: Dave Welch --- .gitignore | 3 +- jobs/build.yml | 1 + logo/commitizen-logo-color.svg | 5 ++ logo/commitizen-logo-mono.svg | 100 +++++++++++++++++++++++++++++++++ logo/generate.sh | 58 +++++++++++++++++++ 5 files changed, 166 insertions(+), 1 deletion(-) create mode 100644 logo/commitizen-logo-color.svg create mode 100644 logo/commitizen-logo-mono.svg create mode 100644 logo/generate.sh diff --git a/.gitignore b/.gitignore index 118a0996..8673768e 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,5 @@ artifacts/ /dist npm-debug.log .nyc_output -test/tools/trigger-appveyor-tests.sh \ No newline at end of file +test/tools/trigger-appveyor-tests.sh +logo/*.png \ No newline at end of file diff --git a/jobs/build.yml b/jobs/build.yml index 18464a8c..3dfdda13 100644 --- a/jobs/build.yml +++ b/jobs/build.yml @@ -27,6 +27,7 @@ jobs: - script: npm install - script: npm run build - script: npm test && npm run write-coverage + - script: bash logo/generate.sh - task: PublishTestResults@2 displayName: 'Publish Test Results' inputs: diff --git a/logo/commitizen-logo-color.svg b/logo/commitizen-logo-color.svg new file mode 100644 index 00000000..0c2942b4 --- /dev/null +++ b/logo/commitizen-logo-color.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/logo/commitizen-logo-mono.svg b/logo/commitizen-logo-mono.svg new file mode 100644 index 00000000..66359fe7 --- /dev/null +++ b/logo/commitizen-logo-mono.svg @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/logo/generate.sh b/logo/generate.sh new file mode 100644 index 00000000..a9b2c051 --- /dev/null +++ b/logo/generate.sh @@ -0,0 +1,58 @@ +#!/bin/bash +set -o nounset +set -o errexit + +##################################################### +# Script to create PNG files from SVG source files. # +# Dependencies: cairosvg (https://cairosvg.org/) # +# # +# Rationale: Generating from SVG instead of storing # +# image files decreases size of repo and avoids # +# security vulnerabilites associated with binary # +# image files. # +##################################################### + +convert () { + COLOR=$1 + # echo "converting file $COLOR..." + FILE=logo/commitizen-logo-${COLOR}.svg + if [ ! -f ${FILE} ]; then + # echo "file $FILE missing!" + exit 1 + fi + # echo "conversion in progress..." + for SIZE in 16 48 96 256 512 1024; do + cairosvg ${FILE} -f png -W ${SIZE} -H ${SIZE} -d 300 -o logo/commitizen_logo_${COLOR}_${SIZE}x${SIZE}.png + done + # echo "done" + return 0 +} + +if [[ $(which cairosvg) == "" ]]; then + # We're not going to mess with installation on OSX or Windows in our build pipelines. + if [[ "$OSTYPE" == "darwin"* ]]; then + echo "cairosvg not found in PATH. Please see https://cairosvg.org/documentation/#installation" + exit 0 + elif [[ "$OSTYPE" == "msys"* ]]; then + echo "cairosvg not found in PATH. Please see https://cairosvg.org/documentation/#installation" + exit 0 + fi + pip3 install cairosvg +fi + +for COLOR in black blue white color; do + FILE=logo/commitizen-logo-${COLOR}.svg + if [ ! -f ${FILE} ]; then + # echo "generating file $FILE..." + sed 's|fill=\".*\"|fill=\"'${COLOR}'\"|g' ${FILE} + convert ${COLOR} + # echo "removing generated file $FILE..." + rm $FILE + # echo "success!" + else + # echo "file found: $FILE" + convert ${COLOR} + fi +done + +exit 0 \ No newline at end of file From 08de6ba656709feeda7ceaac01dd2d43d845b8ce Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 30 Nov 2021 20:38:51 +0000 Subject: [PATCH 2/2] fix(deps): update dependency fs-extra to v10 --- package-lock.json | 155 +++------------------------------------------- package.json | 2 +- 2 files changed, 9 insertions(+), 148 deletions(-) diff --git a/package-lock.json b/package-lock.json index e3e450fa..7b0c4421 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "detect-indent": "6.1.0", "find-node-modules": "^2.1.2", "find-root": "1.1.0", - "fs-extra": "9.1.0", + "fs-extra": "10.0.0", "glob": "7.2.0", "inquirer": "6.5.2", "is-utf8": "^0.2.1", @@ -2408,20 +2408,6 @@ } } }, - "node_modules/@semantic-release/github/node_modules/fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, "node_modules/@semantic-release/github/node_modules/http-proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", @@ -2436,33 +2422,12 @@ "node": ">= 6" } }, - "node_modules/@semantic-release/github/node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, "node_modules/@semantic-release/github/node_modules/ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "node_modules/@semantic-release/github/node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/@semantic-release/npm": { "version": "8.0.3", "resolved": "https://registry.npmjs.org/@semantic-release/npm/-/npm-8.0.3.tgz", @@ -2499,41 +2464,6 @@ "node": ">=14.17" } }, - "node_modules/@semantic-release/npm/node_modules/fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@semantic-release/npm/node_modules/jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "dependencies": { - "universalify": "^2.0.0" - }, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/@semantic-release/npm/node_modules/universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true, - "engines": { - "node": ">= 10.0.0" - } - }, "node_modules/@semantic-release/release-notes-generator": { "version": "10.0.2", "resolved": "https://registry.npmjs.org/@semantic-release/release-notes-generator/-/release-notes-generator-10.0.2.tgz", @@ -2918,14 +2848,6 @@ "node": "*" } }, - "node_modules/at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==", - "engines": { - "node": ">= 4.0.0" - } - }, "node_modules/axios": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", @@ -5002,17 +4924,16 @@ "dev": true }, "node_modules/fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", "dependencies": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" }, "engines": { - "node": ">=10" + "node": ">=12" } }, "node_modules/fs-extra/node_modules/jsonfile": { @@ -15143,17 +15064,6 @@ "ms": "2.1.2" } }, - "fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, "http-proxy-agent": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", @@ -15165,27 +15075,11 @@ "debug": "4" } }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true - }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true } } }, @@ -15215,33 +15109,6 @@ "resolved": "https://registry.npmjs.org/@semantic-release/error/-/error-3.0.0.tgz", "integrity": "sha512-5hiM4Un+tpl4cKw3lV4UgzJj+SmfNIDCLLw0TepzQxz9ZGV5ixnqkzIVF+3tp0ZHgcMKE+VNGHJjEeyFG2dcSw==", "dev": true - }, - "fs-extra": { - "version": "10.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", - "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^6.0.1", - "universalify": "^2.0.0" - } - }, - "jsonfile": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-6.1.0.tgz", - "integrity": "sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6", - "universalify": "^2.0.0" - } - }, - "universalify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", - "integrity": "sha512-hAZsKq7Yy11Zu1DE0OzWjw7nnLZmJZYTDZZyEFHZdUhV8FkH5MCfoU1XMaxXovpyW5nq5scPqq0ZDP9Zyl04oQ==", - "dev": true } } }, @@ -15553,11 +15420,6 @@ "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", "dev": true }, - "at-least-node": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/at-least-node/-/at-least-node-1.0.0.tgz", - "integrity": "sha512-+q/t7Ekv1EDY2l6Gda6LLiX14rU9TV20Wa3ofeQmwPFZbOMo9DXrLbOjFaaclkXKWidIaopwAObQDqwWtGUjqg==" - }, "axios": { "version": "0.24.0", "resolved": "https://registry.npmjs.org/axios/-/axios-0.24.0.tgz", @@ -17158,11 +17020,10 @@ "dev": true }, "fs-extra": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", - "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-10.0.0.tgz", + "integrity": "sha512-C5owb14u9eJwizKGdchcDUQeFtlSHHthBk8pbX9Vc1PFZrLombudjDnNns88aYslCyF6IY5SUw3Roz6xShcEIQ==", "requires": { - "at-least-node": "^1.0.0", "graceful-fs": "^4.2.0", "jsonfile": "^6.0.1", "universalify": "^2.0.0" diff --git a/package.json b/package.json index af88fa2b..30858b3c 100644 --- a/package.json +++ b/package.json @@ -80,7 +80,7 @@ "detect-indent": "6.1.0", "find-node-modules": "^2.1.2", "find-root": "1.1.0", - "fs-extra": "9.1.0", + "fs-extra": "10.0.0", "glob": "7.2.0", "inquirer": "6.5.2", "is-utf8": "^0.2.1",