vite-plugin-sass-dts
vite-plugin-sass-dts copied to clipboard
Only generate types in CI?
Is there a way to generate the type definitions only in CI?
I would prefer to .gitignore the files locally and re-generate them in CI. Is this possible to do?
@aakagi What kind of use do you want to make of it?
- I would like to have the
*.scss.d.tsfiles generated locally, for local type-safety while developing. - I do not want to have to commit the file changes to git. I would like to add
*.scss.d.tsto my.gitignore. - I want to run a command in my github actions CI script to generate these types because I do not want the build to succeed if there are any typescript errors.
It would be nice to be able to run a command like this to check type safety:
# Generate types
yarn vite-plugin-sass-dts # [--args]
# Check type safety
yarn tsc
Is it easy to add a command like this?
Understood, I'll see what I can do.
@aakagi
I'll need a configuration file for execution in cli, but I'm not sure.
I figured out a solution that works!
I wrote a script that checks to make sure each .module.scss file has a sibling .module.scss.d.ts file, and throws an error if it doesn't, or if a "rogue" one is found.
The script I wrote also allows you to pass in a --fix flag which updates the file timestamp for .module.scss files that are missing a sibling .module.scss.d.ts file, which then causes vite-plugin-sass-dts to generate the file 😄. The --fix flag will also delete any "rogue" .module.scss.d.ts files that are found.
You can read through the full implementation here: https://gist.github.com/aakagi/d0c9954b1ec617b9b6ab150d7d78a892