Skip to content
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

Use application tsconfig file for indexTransform and customWebpackConfig #879

Merged
merged 8 commits into from
Feb 3, 2021
Merged

Conversation

michelherv
Copy link
Contributor

@michelherv michelherv commented Nov 18, 2020

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

The application's tsconfig is ignore. Accordingly, indexTransform and customWebpackConfig cannot use project configuration for custom modules for example

Issue Number: #607 #749

What is the new behavior?

The application's tsconfig is now use. indexTransform and customWebpackConfig can now use all the application resources.

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@just-jeb
Copy link
Owner

Hi. First of all thanks for your contribution - it is highly appreciated!
Your PR in some way intersects with #824, and the reason the build is failing is the same reason.
If you have time and desire to investigate this issue, it will be incredibly helpful.

@michelherv michelherv closed this Nov 24, 2020
@michelherv michelherv mentioned this pull request Nov 24, 2020
2 tasks
@michelherv michelherv reopened this Nov 25, 2020
@michelherv michelherv mentioned this pull request Nov 25, 2020
2 tasks
@just-jeb
Copy link
Owner

Hey, thanks for the contribution.
Currently two things are missing here - updating e2e tests and docs.
I'd start with e2e, since I have a strong suspicion they will start failing once you try to use .ts config with Karma builder like here.

@@ -42,6 +42,7 @@
"@angular-devkit/core": "^11.0.0",
"lodash": "^4.17.15",
"ts-node": "^9.0.0",
"tsconfig-paths": "^3.9.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am currently merging part of your changes into my PR (#824) and adding tsconfig-paths was not needed. Why are you adding it, are there any benefits?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I remember ts-node does not support paths property, so if you want to have the exact same config (including paths) for your webpack (or index) configuration you need this one.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! But ts-node isn't needed for any Angular project since it compiles through tsc and does not require to be "started" through Node, so I wouldn't add this or do I miss any usecase here?

Copy link
Owner

@just-jeb just-jeb Dec 10, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ts-node is indeed not needed for Angular app, because Angular compiler (not exactly tsc) builds it, that's correct.
However, index transform and webpack config are not part of the app, they are part of the build chain, which in our case is custom-webpack builder. The builder needs ts-node in order to understand the TS syntax of the files it loads (webpack config and index transform).

@michelherv
Copy link
Contributor Author

Hi,
I updated e2e tests. Can you read the pull request again and tell me if tests are ok for you. Else can you help me by pushing some tests? I will try to improve the solution by TDD.

About the documentation, I have no improvement idear. tsConfig is a @angular-devkit/architect:browser property. It's not like customWebpackConfig or indexTransform which are custom properties. I don't know what to add about.

@just-jeb just-jeb force-pushed the master branch 3 times, most recently from b1c8c3a to 5d8194c Compare December 14, 2020 13:11
@just-jeb
Copy link
Owner

@muuvmuuv @michelherv I appreciate the effort and thank you both, but currently we have two PRs that do practically the same. Can we please have a single PR that takes the best of the existing PRs?
Would be much easier for me to follow and comment.
Thank you!

@muuvmuuv
Copy link

@michelherv @just-jeb before new year I won't have time for any OSS, so I would close mine and Michel can include all parts you both think that are missing here.

Below or things I would change or add, doesn't mean they should be included in this PR.

@just-jeb
Copy link
Owner

Hey, sorry it takes me so long to respond, I'm trying to make the v11 stable (#908).

Hi,
I updated e2e tests. Can you read the pull request again and tell me if tests are ok for you. Else can you help me by pushing some tests? I will try to improve the solution by TDD.

About the documentation, I have no improvement idear. tsConfig is a @angular-devkit/architect:browser property. It's not like customWebpackConfig or indexTransform which are custom properties. I don't know what to add about.

I'll take a look at tests and leave my comments as a review.
Regarding documentation; by adding docs I meant that we need to specify in the docs that indexTransform can now be written with Typescript, and that both customWebpackConfig.ts and indexTransfrom.ts are using the app tsConfig now.
Also if any changes have to be applied to tsconfig.json in order to make it work, (like "types": [ "node" ]) then we should mention it in the docs as well.

Copy link
Owner

@just-jeb just-jeb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good overall. But I think we also need a test that makes sure indexTransform uses the app config as well.

@michelherv
Copy link
Contributor Author

Hi,
I have a problem with the build process
image

Do you understand what is the problem ?

@just-jeb
Copy link
Owner

Hi,
I have a problem with the build process
image

Do you understand what is the problem ?

Oh, I think I read something about it. As far as I remember it's because it's a fork, and you don't have a token defined in your GH secrets.
Let me try to find the issue.

@just-jeb
Copy link
Owner

Here it is: actions/checkout#298

@just-jeb
Copy link
Owner

Seems like there is a workaround. I'll try to apply it.

@just-jeb
Copy link
Owner

Aaaand fixed!

@just-jeb
Copy link
Owner

@michelherv are we good to go? Can this be merged?

@michelherv michelherv mentioned this pull request Jan 29, 2021
1 task
@michelherv
Copy link
Contributor Author

Hi @just-jeb , it is ok now for merging. Sorry for the late, I was very busy these last days.

According @muuvmuuv suggestions :

  • I just use the version without © for better test parsing ;
  • I add some note why we use the node-typing.

The others suggestions are also very important. I think we should have to treat them as real independent improvements which will be keep anyway independently of this PR. They would can be merge before or after this PR. It it why I opened the PR #925

@@ -50,7 +53,6 @@
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Option "extractCss" is deprecated: Deprecated since version 11.0. No longer required to disable CSS extraction for HMR.

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.

4 participants