Skip to content

Conversation

@Bassel17
Copy link
Member

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.

@Bassel17 Bassel17 requested review from Convly and Rymakarouf May 13, 2022 12:20
@codecov
Copy link

codecov bot commented May 13, 2022

Codecov Report

Merging #13309 (39c7f85) into features/typescript (40dede5) will increase coverage by 0.04%.
The diff coverage is 72.72%.

❗ Current head 39c7f85 differs from pull request most recent head 63bc28f. Consider uploading reports for the commit 63bc28f to get more accurate results

@@                   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              
Flag Coverage Δ
front ?
unit 48.24% <72.72%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
packages/utils/typescript/lib/compilers/basic.js 33.33% <33.33%> (ø)
packages/utils/typescript/lib/compile.js 42.85% <50.00%> (ø)
packages/core/strapi/lib/commands/admin-create.js 85.71% <75.00%> (ø)
packages/core/strapi/lib/commands/admin-reset.js 96.29% <75.00%> (ø)
...kages/utils/typescript/lib/utils/resolve-outdir.js 87.50% <87.50%> (ø)
packages/utils/typescript/lib/utils/index.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a41040f...63bc28f. Read the comment docs.

@Bassel17 Bassel17 requested a review from Convly May 17, 2022 13:51
: null;
const distDir = isTSProject && !specifiedDir ? compiledDirectoryPath : specifiedDir;
const outDir = await tsUtils.resolveOutDir(appDir);
if (isTSProject)
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

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).

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

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

@Bassel17 Bassel17 requested a review from Convly May 18, 2022 08:14
@Bassel17 Bassel17 requested a review from alexandrebodin May 20, 2022 12:54
@Bassel17 Bassel17 requested a review from Convly May 23, 2022 13:56
@Convly Convly merged commit c3a10ab into features/typescript May 23, 2022
@Convly Convly deleted the typescript/fix-cli branch May 23, 2022 14:15
@strapi-bot
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants