-
-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Typescript Fix cli commands when outDir is changed #13309
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
Conversation
Codecov Report
@@ Coverage Diff @@
## features/typescript #13309 +/- ##
=======================================================
+ Coverage 48.20% 48.24% +0.04%
=======================================================
Files 251 252 +1
Lines 8954 8963 +9
Branches 2008 2016 +8
=======================================================
+ Hits 4316 4324 +8
- Misses 3820 3821 +1
Partials 818 818
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
| : null; | ||
| const distDir = isTSProject && !specifiedDir ? compiledDirectoryPath : specifiedDir; | ||
| const outDir = await tsUtils.resolveOutDir(appDir); | ||
| if (isTSProject) |
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.
So now we compile before the start command? Didn't we say that we wanted to avoid this behavior?
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.
yeah my bad, I thought the behavior of the start command was the same as in v3 (it need a build file), I thought it was the same but it works without in v4 so it's actually just the same as the other commands
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.
I'm just a bit concerned as doing so bypasses the build command and forces to compile the server code twice (once during the build and once during the start).
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.
yeah, but from what I understood yesterday while I checked the commands is that the Start and Build commands are unrelated steps, meaning you can start without a build, so there could be a scenario where it builds twice but that's also the case for other CLI commands they all force the compile.
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.
I think the start command should not build anything if it doesn't need too either. It is a commands that expects both server and admin code to already be built.
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.
ok well go in that direction, will add a custom error message for the user that they should build first
|
This pull request has been mentioned on Strapi Community Forum. There might be relevant details there: https://forum.strapi.io/t/strapi-v4-2-0-fourth-beta-for-typescript-support/18869/1 |
What does it do?
Get the outDir path for compiled code from tsconfig instead of using 'dist' statically
Why is it needed?
if the user changes the outDir value all cli commands fail to excute since they will be looking for a dist folder
How to test it?
Start a typescript project, and change outDir value in tsconfig, then test the cli commands, the compiled and build code should be in a directory with the name specified in outDir.