krisk / Fuse

Lightweight fuzzy-search, in JavaScript
https://fusejs.io/
Apache License 2.0
17.76k stars 753 forks source link

Repo & development updates, Docs rewrite, CI improvements, and more #711

Closed favna closed 12 months ago

favna commented 1 year ago

It's been nearly 4 years since I created #291 changing this repository from Vows to Jest and the Node ecosystem has definitely not been standing still so I figured "let's create another general update PR".

  1. Migrated from Jest to Vitest. Vitest is a new test runner powered by Vite and is much faster than Jest. Like was the motivation for Jest in #291 it has TypeScript support built in, adding to that, in the future we can even make the TypeScript tests even better through Type Testing

  2. Updated from Vuepress v1 to Vuepress v2. This brings with it maaaaaaannnyy fixes, improvements, enhancements and so on. Both because I put quite a lot of effort in the rewrite, as well as because in general this updates from Vue 2 to Vue 3 and Vuepress has gone through many changes as well. Some notable things:

    • Dark mode! Wooh! Like modern websites it responds to the OS preference, and there is a button to switch.
    • The live demo now uses monaco editors (vscode's editor)! instead of codemirror. So a much better editing experience.
    • The "Twitter follow" button is now a custom component rather than a widget, which means it will no longer be blocked by content blockers (like adblockers)
    • Everything uses the Vue3 composition API instead of the Vue2 options API. This makes Vue scripts waaay easier to read.
    • Dropped stylus in favour of raw CSS and SCSS because Vuepress v2 only so/so seems to support Stylus. They dropped support for Stylus for customizing the theme, switching to SCSS. I figured for consistency it'd be best to drop it entirely.

    I am not sure how the current production website is deployed. You can reference https://v2.vuepress.vuejs.org/guide/deployment.html to learn how to deploy the new site. That said, if it's through GitHub pages then do let me know because these days it is possible to use a GH Action to deploy directly, you don't even need a gh-pages branch anymore then.

  3. Migrated from yarn to npm. Previously in #291 I made a change to prefer yarn.lock but I noticed that since then you have added scripts that use npm so I am making the assumption that is your package manager of choice. To ensure the repo is not in a 50/50 state of package managers I now fully switched the repo over to using npm in all references.

  4. Updated Husky to v8 and changed how it is configured to how it should've been above v4 (https://typicode.github.io/husky/#/?id=migrate-from-v4-to-v8). The old way of doing it through package.json hasn't been working since v4, so the current repo wasn't protected by husky at all.

  5. Updated various dev dependencies. I did not update rollup because it included the breaking changes of v3.0.0 which I'm not sure if they will affect the project. Of note is that Fuse's engines are set to Node 10, whereas Rollup v3 targets Node >= 14.

  6. Added eslint-config-prettier to the eslintrc file, it was a dev dep that was never loaded before.

  7. Ran prettier on the whole repo

  8. Updated the GitHub issue templates to YAML style so issues are form-like inputs. These can be previewed on my branch: https://github.com/favna/Fuse/blob/chore/dev-migrations/.github/ISSUE_TEMPLATE/bug_report.yml

  9. Split tsconfig.json into 2 files, 1 for src and 1 for test. This is to ensure that each set can have its own dedicated config, and it's also a slight improvement for the TS language services of IDEs because they only load the ones for the files opened. A negligible difference for this repo, but it's a difference nonetheless.

  10. Add .prettierignore file to allow running npx prettier --write . without modifying files that shouldn't be formatted with Prettier. Just something I ran into when doing point 6.

  11. Update GitHub workflows

  12. Updated the files in dist by running npm run build to update their code with all the changes above

favna commented 1 year ago

This PR is now ready for review. Sorry not sorry for the file count haha, that's mostly because of the vuepress changes.

krisk commented 12 months ago

Oh wow this is huge. Will review it now. Thanks!