-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type checking in the build process #52
base: main
Are you sure you want to change the base?
Type checking in the build process #52
Conversation
package.json
Outdated
"build": "vite build", | ||
"build:ssr": "vite build && vite build --ssr", | ||
"build:ssr": "npm run build && vite build --ssr", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the difference running npm run build && vite build --ssr
vs vite build && vite build --ssr
LMK. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you execute npm run build
, npm run prebuild
is automatically executed before the build.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aha, perfect. Thanks for letting me know.
Hey @christophstockinger. Thanks for the PR. So, if we add this as an NPM build step, why aren't you adding this to the CI workflow? Seems like if we are going to add it in, we might as well add it to the workflow file, right? |
More information you find here: https://docs.npmjs.com/cli/v8/using-npm/scripts |
resources/js/types/vite.d.ts
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any particular reason these declarations were included instead of the usual vite-env.d.ts
like the original Breeze templates had? Something along the lines of:
/// <reference types="vite/client" />
interface ImportMetaEnv {
readonly VITE_APP_NAME: string;
[key: string]: string | boolean | undefined;
}
interface ImportMeta {
readonly env: ImportMetaEnv;
readonly glob: <T>(pattern: string) => Record<string, () => Promise<T>>;
}
within a resources/js/types/vite-env.d.ts
file. I think this approach completely overrides anything declared in ImportMetaEnv
and ImportMeta
if it exists in vite/client
, rather than merging it (like the above). I know this PR is just moving this bit to a separate file, so it might be a better question for @tnylea.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JoeyMckenzie I have just tried it out. You are right, the type declaration for vite/client
is not needed. I have just adjusted the PR accordingly and removed it.
Thanks, Christoph 👏 Will be doing some discussion with Taylor on this tomorrow, and we'll follow up. Appreciate it! |
d3cbb54
to
84b7e71
Compare
@tnylea All conflicts are also resolved here. |
84b7e71
to
55a55e0
Compare
@@ -20,7 +21,7 @@ defineProps<{ | |||
<AppLogoIcon class="mr-2 size-8 fill-current text-white" /> | |||
{{ name }} | |||
</Link> | |||
<div v-if="quote" class="relative z-20 mt-auto"> | |||
<div v-if="quote && quote" class="relative z-20 mt-auto"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What does the extra && quote
do for that v-if where it's already checking if there is a quote?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, @christophstockinger, do you happen to know why there is this extra && quote
here. LMK
Hey @christophstockinger, Really appreciate the PR. So, after discussing this a bit more with the team, we decided that running It would be more beneficial to incorporate this check into CI so that any TypeScript issues are flagged during the PR process rather than blocking local builds. Would you be willing to adjust this PR to move the TSC check to CI instead? Thanks so much 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Per notes in the previous comment, we don't want vue-tsc
or the tsc
command to be required when running the build command.
This would be great if added to the Github Workflow though, if you could make those changes and fix any file conflicts that would be great.
Thanks!
Hello sir, Cannot find type definition file for 'vue/tsx'. |
55a55e0
to
07afe76
Compare
@tnylea PR is updated. I have introduced a new command The fix from #74 caused several problems in ssr.js. As far as I could understand it is a javascript hack, which is why I left a comment in the file why I deactivated eslint line by line and also use ts-ignore. A few more thoughts: Currently, however, this only does something in the internal Github action to keep the starter kit type-safe. However, I would still question whether there is any benefit in using the starter kit if other pipelines (e.g. Envoyer or Laravel Cloud) are used and not Github Action. You may need to find a way to point out how this is used. One of your arguments was also that people who are not familiar with Typescript may have problems with it. I agree with this and would therefore ask whether it wouldn't make more sense to provide a starter kit for Typescript or Javascript? If necessary, you can also include this in the |
Hi @sfatimah , I have to be honest, I'm not so deep into the Vue ecosystem anymore that I'm not so deeply convinced of the framework itself. But as far as I know, |
Thanks, @christophstockinger, for updating this to only run in the CI. Would you mind resolving the conflict with the Really appreciate the contribution. |
2101337
to
b2f5cda
Compare
ℹ️ Port of the react-starter-kit laravel/react-starter-kit#37
This pull request adds a tsc (TypeScript Compiler) task to the build process. Currently, the build pipeline does not include a TypeScript type-checking step, which means that potentially erroneous TypeScript code could be deployed to production without being caught during the build process.
By incorporating the tsc task, we ensure that type errors are detected early in the build cycle, preventing invalid or mis-typed code from being pushed to production. This enhances the overall stability and reliability of the codebase and reduces the risk of runtime errors caused by type mismatches. Type checking during the build process also helps maintain consistency in our code, making it easier to spot bugs early on and ensuring a higher level of confidence in the production deployment.
Benefits:
Please review and provide feedback. Thank you!