Commit graph

5 commits

Author SHA1 Message Date
Sachin Raja a930dc57ec
convert scripts to esm (#6946)
* convert scripts to esm

* fix tests

* fix tests

* fix lints

* syncFs to fsSync

* named export for fs

Co-authored-by: LitoMore <LitoMore@users.noreply.github.com>

* fsSync to { promises as fs }

* convert update-svgs-count to esm

* rename data to icons

* fix build script

* switch svglintrc file to mjs

* use node: protocol

* pluralize getIcons

Co-authored-by: LitoMore <LitoMore@users.noreply.github.com>
2021-12-25 06:22:56 -08:00
Eric Cornelissen e0df400494
Setup prettier (#6758)
* Add prettier as a dependency

* Add format command and configure prettier

I opted for single quotes to be in line with other simple-icons projects

I ignore the data file because changing its formatting is quite a bit of
trouble for all open PRs.

* Run prettier

* Replace all functions by arrow functions

* Move prettier configuration to config file

Move it to a file so editors (and other software) can pick up on the
configuration. I went with .js because (a) it allows for comments and
(2) it seems most of the config files are in JavaScript already.

* Add prettier --check when running npm run lint (This adds it to the CI as well)

* Add husky and format changes before committing

* Use object destructuring for imports consistently

* Add shebang and fileoverview to jsonlint.js
2021-10-25 21:13:10 +02:00
Eric Cornelissen 8431fd9683
Simplify how scripts get icon slugs (#5066)
* Accept icon rather than title in `iconToSlug`

This removes the need in (most of the) calls to this function to
seperately check if there is a custom slug already defined for the icon.

* Rename `titleToSlug` to `getIconSlug`

* Revert unnecessary style change

* Update function documentation

* Keep `titleToSlug` and add `getIconSlug` helper

Unfortunately `this` is not available because we're using arrow syntax
for these functions, but refering to `titleToSlug` through
`module.exports` works fine as well.

* Fix parameter name in `getIconSlug` docs
2021-02-22 14:15:37 +01:00
Eric Cornelissen 8ecfcafeba
Refactor scripts in scripts/ (#4931)
- Rename `titleToFilename` to `titleToSlug`
- Fix indentation where necessary
- Use quotes internally consistently (to reduce the diff size, unfortunately this is the opposite quote from what we use in other projects)
- Update comments & documentation
- Construct file paths

And more...
2021-02-08 17:14:31 +01:00
Eric Cornelissen 7ebf7f71fa
Add documentation and tooling for SVG filenames (#2601)
* Create simple CLI tool to get the filename from a brandname

https://github.com/simple-icons/simple-icons/pull/2589#issuecomment-585902427

* Update contributing guidelines on new SVGs' filenames

* Fix incorrect filename in package.json script

* Add file header to get-filename script

* Update contributing guidelines' section on SVG filenames

Co-Authored-By: YoussefRaafatNasry <youssefraafatnasry@gmail.com>
2020-02-26 17:54:54 +01:00