Closed csandman closed 2 years ago
As a side note, this should close a few issues:
I made a test project to see what they looked like and they all work:
I'm also thinking about just making a fork of the file-icons-js
package and setting up a GitHub action to keep it updated, but that probably won't exist for a bit. I can let you know if I get a working version at some point though!
I'm also thinking about just making a fork of the file-icons-js package and setting up a GitHub action to keep it updated, but that probably won't exist for a bit. I can let you know if I get a working version at some point though!
Yes that will be even better. We can use your package from npm in this extension and no need to implement a local version. That can also help other potential projects too. Please consider doing so 🙏
Yes that will be even better. We can use your package from npm in this extension and no need to implement a local version. That can also help other potential projects too. Please consider doing so 🙏
I have started looking into this, and I will probably do it at some point. My main thing is, if I'm going to do it, I'd like to make sure I have an action set up to automatically update the package, otherwise I'd probably end up forgetting about it at some point and letting it get just as outdated as file-icons-js
.
I have started looking into this, and I will probably do it at some point. My main thing is, if I'm going to do it, I'd like to make sure I have an action set up to automatically update the package, otherwise I'd probably end up forgetting about it at some point and letting it get just as outdated as file-icons-js.
Got it. Hope you get it done soon! Please also open a PR to this repo once you finish creating it.
Got it. Hope you get it done soon! Please also open a PR to this repo once you finish creating it.
Will do!
This PR would close #120, the issue I made. The purpose of this PR is to replace the package
file-icons-js
, which hasn't been updated in 2 years, with a local version of it.Summary of Changes
file-icons
rimraf
andless
to dev depsfile-icons-js
packageicondb.js
fileicondb.js
file to the.eslintignore
and.prettierignore
filesfile-icons-js
usage with the local versionfile-icons-js
package and associated types/stylesresolve
key to webpack config to allow it to grab theicondb.js
fileExplanation
For the most part, the new code in
file-icons.ts
is a TypeScript port of thefile-icons-js
package. However, instead of adding the content of theiconsdb.js
file to the main part of the code (like they do in thefile-icons-js
package), I added a script which automatically downloads the newest version of that file from thefile-icons/atom
package.This script also downloads all the associated style and font files. The original style files are
.less
files, so I added theless
package to compile them at download time. This could probably be done in the webpack config, but I thought it might be simpler to do so in the download process to prevent it from running every time the extension is built.This script can be run manually periodically, or using an action of some sort like they do in the
github-material-icons-extension
package. That part is up to you, but at least you have a base to go off of, and have control over when the files are updated. At least when run manually, you can see a git diff if the files were actually changed and you can push based on that.As for the folder structure, I decided to keep all of the assets and code files related to
file-icons
in their own directory insrc
. It's up to you whether you like that structure, but I felt like it was simpler to keep them together. Most of the files in that directory are downloaded automatically and probably shouldn't be touched because the changes will be overrode. However, there are a few files I added manually that should be taken note of:file-icons.ts
- The code for loading in the icons db and finding matches based on filenames.types.ts
- The types associated with theicondb.js
file.db/icondb.d.ts
- The declaration file associated with theicondb.js
file, so that types are assigned automatically when it is imported. This pulls in types from thetypes.ts
file.css/fonts.css
- The css file which adds font face declarations for the downloaded font files.These files can be modified manually as needed.
And finally, I just fixed a few lint warnings because they were bugging the hell out of me haha. They were pretty small so this shouldn't fall outside of the scope too much.