diff --git a/.gitignore b/.gitignore index 9fe2ff3e..2e89f1ac 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ node_modules dist sandbox stash -coverage \ No newline at end of file +coverage +/.idea diff --git a/bin/build-icons-json.js b/bin/build-icons-json.js index 4212abb0..088a3e2c 100644 --- a/bin/build-icons-json.js +++ b/bin/build-icons-json.js @@ -3,17 +3,37 @@ import path from 'path'; import buildIconsObject from './build-icons-object'; -const IN_DIR = path.resolve(__dirname, '../icons'); +const IN_DIRS = [ + { + path: path.resolve(__dirname, '../icons'), + }, + { + path: path.resolve(__dirname, '../kontentino-icons'), + prefix: 'kont-', + }, +]; + const OUT_FILE = path.resolve(__dirname, '../dist/icons.json'); console.log(`Building ${OUT_FILE}...`); -const svgFiles = fs - .readdirSync(IN_DIR) - .filter(file => path.extname(file) === '.svg'); +function getSvgs(dir, prefix) { + const svgFiles = fs + .readdirSync(dir) + .filter(file => path.extname(file) === '.svg'); + + const getSvg = svgFile => fs.readFileSync(path.join(dir, svgFile)); + + return buildIconsObject(svgFiles, getSvg, prefix); +} -const getSvg = svgFile => fs.readFileSync(path.join(IN_DIR, svgFile)); +let icons = {}; -const icons = buildIconsObject(svgFiles, getSvg); +IN_DIRS.forEach(({ path, prefix }) => { + icons = { + ...icons, + ...getSvgs(path, prefix), + }; +}); fs.writeFileSync(OUT_FILE, JSON.stringify(icons)); diff --git a/bin/build-icons-object.js b/bin/build-icons-object.js index 1c8acc8a..44c6d826 100644 --- a/bin/build-icons-object.js +++ b/bin/build-icons-object.js @@ -6,12 +6,13 @@ import { minify } from 'html-minifier'; * Build an object in the format: `{ : }`. * @param {string[]} svgFiles - A list of filenames. * @param {Function} getSvg - A function that returns the contents of an SVG file given a filename. + * @param {string | undefined} prefix - prefix for icon name * @returns {Object} */ -function buildIconsObject(svgFiles, getSvg) { +function buildIconsObject(svgFiles, getSvg, prefix) { return svgFiles .map(svgFile => { - const name = path.basename(svgFile, '.svg'); + const name = `${prefix || ''}${path.basename(svgFile, '.svg')}`; const svg = getSvg(svgFile); const contents = getSvgContents(svg); return { name, contents }; diff --git a/bin/process-svg.js b/bin/process-svg.js index 44d3ec6b..6ca441d8 100644 --- a/bin/process-svg.js +++ b/bin/process-svg.js @@ -26,13 +26,15 @@ function processSvg(svg) { * @returns {Promise} */ function optimize(svg) { + const plugins = [ + { convertShapeToPath: false }, + { mergePaths: false }, + { removeTitle: true }, + { removeAttrs: { attrs: '(fill|stroke.*)' } }, + ]; + const svgo = new Svgo({ - plugins: [ - { convertShapeToPath: false }, - { mergePaths: false }, - { removeAttrs: { attrs: '(fill|stroke.*)' } }, - { removeTitle: true }, - ], + plugins, }); return new Promise(resolve => { diff --git a/bin/process-svgs.js b/bin/process-svgs.js index cb0a28b6..2741819e 100644 --- a/bin/process-svgs.js +++ b/bin/process-svgs.js @@ -3,16 +3,31 @@ import path from 'path'; import processSvg from './process-svg'; -const IN_DIR = path.resolve(__dirname, '../icons'); +const IN_DIRS = [ + { + path: path.resolve(__dirname, '../icons'), + useDefaultAttrs: true, + }, + { + path: path.resolve(__dirname, '../kontentino-icons'), + useDefaultAttrs: true, + }, +]; -console.log(`Processing SVGs in ${IN_DIR}...`); +function processSvgs(dir, useDefaultAttrs) { + console.log(`Processing SVGs in ${dir}...`); -fs - .readdirSync(IN_DIR) - .filter(file => path.extname(file) === '.svg') - .forEach(svgFile => { - const svg = fs.readFileSync(path.join(IN_DIR, svgFile)); - processSvg(svg).then(svg => - fs.writeFileSync(path.join(IN_DIR, svgFile), svg), - ); - }); + fs + .readdirSync(dir) + .filter(file => path.extname(file) === '.svg') + .forEach(svgFile => { + const svg = fs.readFileSync(path.join(dir, svgFile)); + processSvg(svg, useDefaultAttrs).then(svg => + fs.writeFileSync(path.join(dir, svgFile), svg), + ); + }); +} + +IN_DIRS.forEach(({ path, useDefaultAttrs }) => + processSvgs(path, useDefaultAttrs), +); diff --git a/icons/twitch.svg b/icons/twitch.svg index e1e517c6..5d49c524 100644 --- a/icons/twitch.svg +++ b/icons/twitch.svg @@ -9,5 +9,5 @@ stroke-linecap="round" stroke-linejoin="round" > - + diff --git a/kontentino-icons/adsPlanner.svg b/kontentino-icons/adsPlanner.svg new file mode 100644 index 00000000..3963a83b --- /dev/null +++ b/kontentino-icons/adsPlanner.svg @@ -0,0 +1,15 @@ + + + + + diff --git a/kontentino-icons/bell.svg b/kontentino-icons/bell.svg new file mode 100644 index 00000000..28edda8f --- /dev/null +++ b/kontentino-icons/bell.svg @@ -0,0 +1,13 @@ + + + diff --git a/kontentino-icons/clock.svg b/kontentino-icons/clock.svg new file mode 100644 index 00000000..a97c8e89 --- /dev/null +++ b/kontentino-icons/clock.svg @@ -0,0 +1,15 @@ + + + + diff --git a/kontentino-icons/cog.svg b/kontentino-icons/cog.svg new file mode 100644 index 00000000..3af422d7 --- /dev/null +++ b/kontentino-icons/cog.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/kontentino-icons/dashboard.svg b/kontentino-icons/dashboard.svg new file mode 100644 index 00000000..6a367080 --- /dev/null +++ b/kontentino-icons/dashboard.svg @@ -0,0 +1,16 @@ + + + + + + diff --git a/kontentino-icons/grid.svg b/kontentino-icons/grid.svg new file mode 100644 index 00000000..19f65aa7 --- /dev/null +++ b/kontentino-icons/grid.svg @@ -0,0 +1,17 @@ + + + + + + diff --git a/kontentino-icons/help.svg b/kontentino-icons/help.svg new file mode 100644 index 00000000..9d73d16b --- /dev/null +++ b/kontentino-icons/help.svg @@ -0,0 +1,15 @@ + + + + + diff --git a/kontentino-icons/image.svg b/kontentino-icons/image.svg new file mode 100644 index 00000000..0ebf68c8 --- /dev/null +++ b/kontentino-icons/image.svg @@ -0,0 +1,16 @@ + + + + + diff --git a/kontentino-icons/post-ideas.svg b/kontentino-icons/post-ideas.svg new file mode 100644 index 00000000..0498b9db --- /dev/null +++ b/kontentino-icons/post-ideas.svg @@ -0,0 +1,20 @@ + + + + + + + + diff --git a/package-lock.json b/package-lock.json index 644062aa..e753ed04 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { - "name": "feather-icons", - "version": "0.0.0-development", + "name": "@kontentino/feather-icons", + "version": "1.0.5", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -775,6 +775,7 @@ "resolved": "https://registry.npmjs.org/align-text/-/align-text-0.1.4.tgz", "integrity": "sha1-DNkKVhCT810KmSVsIrcGlDP60Rc=", "dev": true, + "optional": true, "requires": { "kind-of": "^3.0.2", "longest": "^1.0.1", @@ -2121,6 +2122,7 @@ "resolved": "https://registry.npmjs.org/block-stream/-/block-stream-0.0.9.tgz", "integrity": "sha1-E+v+d4oDIFz+A3UUgeu0szAMEmo=", "dev": true, + "optional": true, "requires": { "inherits": "~2.0.0" } @@ -3003,7 +3005,8 @@ "version": "1.1.0", "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true + "dev": true, + "optional": true }, "constants-browserify": { "version": "1.0.0", @@ -5199,6 +5202,7 @@ "resolved": "https://registry.npmjs.org/fstream/-/fstream-1.0.11.tgz", "integrity": "sha1-XB+x8RdHcRTwYyoOtLcbPLD9MXE=", "dev": true, + "optional": true, "requires": { "graceful-fs": "^4.1.2", "inherits": "~2.0.0", @@ -9178,6 +9182,7 @@ "resolved": "https://registry.npmjs.org/boom/-/boom-2.10.1.tgz", "integrity": "sha1-OciRjO/1eZ+D+UkqhI9iWt0Mdm8=", "dev": true, + "optional": true, "requires": { "hoek": "2.x.x" } @@ -9187,6 +9192,7 @@ "resolved": "https://registry.npmjs.org/cryptiles/-/cryptiles-2.0.5.tgz", "integrity": "sha1-O9/s3GCBR8HGcgL6KR59ylnqo7g=", "dev": true, + "optional": true, "requires": { "boom": "2.x.x" } @@ -9226,6 +9232,7 @@ "resolved": "https://registry.npmjs.org/hawk/-/hawk-3.1.3.tgz", "integrity": "sha1-B4REvXwWQLD+VA0sm3PVlnjo4cQ=", "dev": true, + "optional": true, "requires": { "boom": "2.x.x", "cryptiles": "2.x.x", @@ -9237,7 +9244,8 @@ "version": "2.16.3", "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz", "integrity": "sha1-ILt0A9POo5jpHcRxCo/xuCdKJe0=", - "dev": true + "dev": true, + "optional": true }, "http-signature": { "version": "1.1.1", @@ -9301,6 +9309,7 @@ "resolved": "https://registry.npmjs.org/sntp/-/sntp-1.0.9.tgz", "integrity": "sha1-ZUEYTMkK7qbG57NeJlkIJEPGYZg=", "dev": true, + "optional": true, "requires": { "hoek": "2.x.x" } @@ -11147,7 +11156,8 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "aproba": { "version": "1.2.0", @@ -11168,12 +11178,14 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, + "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" @@ -11188,17 +11200,20 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "core-util-is": { "version": "1.0.2", @@ -11315,7 +11330,8 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "ini": { "version": "1.3.5", @@ -11327,6 +11343,7 @@ "version": "1.0.0", "bundled": true, "dev": true, + "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -11341,6 +11358,7 @@ "version": "3.0.4", "bundled": true, "dev": true, + "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -11348,12 +11366,14 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "minipass": { "version": "2.2.4", "bundled": true, "dev": true, + "optional": true, "requires": { "safe-buffer": "^5.1.1", "yallist": "^3.0.0" @@ -11372,6 +11392,7 @@ "version": "0.5.1", "bundled": true, "dev": true, + "optional": true, "requires": { "minimist": "0.0.8" } @@ -11452,7 +11473,8 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "object-assign": { "version": "4.1.1", @@ -11464,6 +11486,7 @@ "version": "1.4.0", "bundled": true, "dev": true, + "optional": true, "requires": { "wrappy": "1" } @@ -11549,7 +11572,8 @@ "safe-buffer": { "version": "5.1.1", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "safer-buffer": { "version": "2.1.2", @@ -11585,6 +11609,7 @@ "version": "1.0.2", "bundled": true, "dev": true, + "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -11604,6 +11629,7 @@ "version": "3.0.1", "bundled": true, "dev": true, + "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -11647,12 +11673,14 @@ "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true }, "yallist": { "version": "3.0.2", "bundled": true, - "dev": true + "dev": true, + "optional": true } } }, @@ -12773,6 +12801,7 @@ "resolved": "https://registry.npmjs.org/tar/-/tar-2.2.1.tgz", "integrity": "sha1-jk0qJWwOIYXGsYrWlK7JaLg8sdE=", "dev": true, + "optional": true, "requires": { "block-stream": "*", "fstream": "^1.0.2", diff --git a/package.json b/package.json index d3eebf79..f19ddf5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "feather-icons", - "version": "0.0.0-development", + "name": "@kontentino/feather-icons", + "version": "1.0.5", "description": "Simply beautiful open source icons", "main": "dist/feather.js", "unpkg": "dist/feather.min.js", @@ -14,8 +14,7 @@ "test": "jest --watch", "test:coverage": "jest --coverage", "cm": "git-cz", - "precommit": "lint-staged", - "commitmsg": "commitlint --edit" + "precommit": "lint-staged" }, "config": { "commitizen": { @@ -60,7 +59,10 @@ }, "repository": { "type": "git", - "url": "https://github.com/feathericons/feather.git" + "url": "https://github.com/kontentino/feather.git" + }, + "publishConfig": { + "registry": "https://npm.pkg.github.com/" }, "author": "Cole Bemis (http://colebemis.com)", "license": "MIT"