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

chore: native typescript remove all eslint annotation and rollback version #2285

Merged
merged 19 commits into from
Apr 10, 2024

Conversation

zhoushaw
Copy link
Collaborator

@zhoushaw zhoushaw commented Apr 4, 2024

Description

  • chore: remove all eslint annotation and rollback version

Related Issue

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Checklist

  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • I have updated the documentation.

@zhoushaw zhoushaw requested a review from ilteoood April 4, 2024 01:34
@zhoushaw zhoushaw marked this pull request as draft April 4, 2024 01:37
@zhoushaw
Copy link
Collaborator Author

zhoushaw commented Apr 4, 2024

@2heal1 The rpc section can add some tests

@zhoushaw
Copy link
Collaborator Author

zhoushaw commented Apr 4, 2024

@ilteoood I don't know where exactly you're referring to readme,Can you be more specific?

@zhoushaw zhoushaw mentioned this pull request Apr 4, 2024
5 tasks
@zhoushaw zhoushaw marked this pull request as ready for review April 4, 2024 02:50
@ilteoood
Copy link
Collaborator

ilteoood commented Apr 4, 2024

@ilteoood I don't know where exactly you're referring to readme,Can you be more specific?

Hi, I'm referring to the readme that's inside the plugin directory: https://github.com/module-federation/universe/blob/main/packages/native-federation-typescript/README.md

As you can see, it includes an explaination of the functionalities, the configuration structure and how to use it for every supported browser. If something changed under the hood (e.g. additional configs or new functionalities) they should be also documented here. Since this is also published to NPM, it should be always updated as well to allow users to have a clear documentation while they download the package

@zhoushaw zhoushaw requested a review from 2heal1 April 4, 2024 08:27
@zhoushaw
Copy link
Collaborator Author

zhoushaw commented Apr 4, 2024

@ilteoood I don't know where exactly you're referring to readme,Can you be more specific?

Hi, I'm referring to the readme that's inside the plugin directory: https://github.com/module-federation/universe/blob/main/packages/native-federation-typescript/README.md

As you can see, it includes an explaination of the functionalities, the configuration structure and how to use it for every supported browser. If something changed under the hood (e.g. additional configs or new functionalities) they should be also documented here. Since this is also published to NPM, it should be always updated as well to allow users to have a clear documentation while they download the package

@2heal1 I think you can help to supplement the new configuration items in this part, and add more instructions

@2heal1
Copy link
Member

2heal1 commented Apr 4, 2024

the new configuration items in this part, and add more instructions

Yeah sure, i will make n new pr to supplement README

@zhoushaw zhoushaw marked this pull request as draft April 4, 2024 14:00
Copy link

netlify bot commented Apr 7, 2024

Deploy Preview for module-federation-docs ready!

Name Link
🔨 Latest commit 4cbbffe
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-docs/deploys/6614f129bda96500083a63f1
😎 Deploy Preview https://deploy-preview-2285--module-federation-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 7, 2024

Deploy Preview for module-federation-new ready!

Name Link
🔨 Latest commit 4cbbffe
🔍 Latest deploy log https://app.netlify.com/sites/module-federation-new/deploys/6614f1284fb37f00095452e6
😎 Deploy Preview https://deploy-preview-2285--module-federation-new.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@2heal1 2heal1 force-pushed the chore/optimize-federation-type-code-style branch from 9200edf to 5eab747 Compare April 7, 2024 12:05
@zhoushaw zhoushaw requested a review from ilteoood April 7, 2024 12:49
@zhoushaw zhoushaw marked this pull request as ready for review April 7, 2024 12:50
@zhoushaw
Copy link
Collaborator Author

zhoushaw commented Apr 7, 2024

@ilteoood The problem has been fixed, you can help check again

@zhoushaw zhoushaw changed the title chore: remove all eslint annotation and rollback version chore: native typescript remove all eslint annotation and rollback version Apr 7, 2024
Copy link
Collaborator

@ilteoood ilteoood left a comment

Choose a reason for hiding this comment

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

I have looked at this PR together with the code that has been already merged, and I would like to make the following considerations:

  1. Some of the configuration parameters have been introduced even if not needed: IMO we should consider removing them and force the user to remove the plugin from the chain instead of soft-skip it in order to improve performances;
  2. Some of these new configurations have not been declared: e.g. Property 'consumeAPITypes' does not exist on type 'Required<HostOptions>'.
  3. Some of these configurations have been wrongly implemented: e.g., if consumeAPITypes is configured to false, we are still logging Federated types extraction completed. If the user is skipping it, it should not appear;
  4. The NativeFederationTypeScriptHost behaviour is completely broken at the moment: the consumeTypesPromise is created just once, so the types are synced only at the bundler startup. In all the other cases, we are serving an already fulfilled promise which doesn't do anything.

Said so, since me, my company (which sponsored the plugins) and other people I involved during meetups rely a lot on the correct behaviour of these plugins, may I ask you to bring back the original implementation?

I would love to help you achieving what you need, but I really think this is not the correct way to do it.

As an alternative, since I understand your will of being completely indipendent from me, I suggest you to copy what you need into another plugin and proceed in the way you like

@@ -45,6 +50,7 @@ This plugin is used to download the federated types.
typesFolder?: string; // folder where all the files will be stored, default is '@mf-types',
deleteTypesFolder?: boolean; // indicate if the types folder will be deleted before the job starts, default is 'true'
maxRetries?: number; // The number of times the plugin will try to download the types before failing, default is 3
consumeAPITypes?: boolean; // whether to generate the type of runtime `loadRemote` API
Copy link
Collaborator

Choose a reason for hiding this comment

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

NativeFederationTypeScriptHost just download stuff, it doesn't generate any type at runtime.
Additionally, do we really need an option for this? If the user doesn't want to consume the types it would be better to exclude the plugin from the chain, to also improve performances and avoid false positive messages.
I'm already doing that in production

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@2heal1 cc

@@ -25,6 +25,11 @@ This plugin is used to build the federated types.
deleteTypesFolder?: boolean; // indicate if the types folder will be deleted when the job completes, default is 'true'
additionalFilesToCompile?: string[] // The path of each additional file which should be emitted
compilerInstance?: 'tsc' | 'vue-tsc' // The compiler to use to emit files, default is 'tsc'
generateAPITypes?: boolean; // whether to generate the `loadRemote` type in `Federation Runtime`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need this?
If the user doesn't want to generate types, he should exclude the plugin for the chain.

@2heal1
Copy link
Member

2heal1 commented Apr 8, 2024

I have looked at this PR together with the code that has been already merged, and I would like to make the following considerations:

  1. Some of the configuration parameters have been introduced even if not needed: IMO we should consider removing them and force the user to remove the plugin from the chain instead of soft-skip it in order to improve performances;
  2. Some of these new configurations have not been declared: e.g. Property 'consumeAPITypes' does not exist on type 'Required<HostOptions>'.
  3. Some of these configurations have been wrongly implemented: e.g., if consumeAPITypes is configured to false, we are still logging Federated types extraction completed. If the user is skipping it, it should not appear;
  4. The NativeFederationTypeScriptHost behaviour is completely broken at the moment: the consumeTypesPromise is created just once, so the types are synced only at the bundler startup. In all the other cases, we are serving an already fulfilled promise which doesn't do anything.

Said so, since me, my company (which sponsored the plugins) and other people I involved during meetups rely a lot on the correct behaviour of these plugins, may I ask you to bring back the original implementation?

I would love to help you achieving what you need, but I really think this is not the correct way to do it.

As an alternative, since I understand your will of being completely indipendent from me, I suggest you to copy what you need into another plugin and proceed in the way you like

I have looked at this PR together with the code that has been already merged, and I would like to make the following considerations:

  1. Some of the configuration parameters have been introduced even if not needed: IMO we should consider removing them and force the user to remove the plugin from the chain instead of soft-skip it in order to improve performances;
  2. Some of these new configurations have not been declared: e.g. Property 'consumeAPITypes' does not exist on type 'Required<HostOptions>'.
  3. Some of these configurations have been wrongly implemented: e.g., if consumeAPITypes is configured to false, we are still logging Federated types extraction completed. If the user is skipping it, it should not appear;
  4. The NativeFederationTypeScriptHost behaviour is completely broken at the moment: the consumeTypesPromise is created just once, so the types are synced only at the bundler startup. In all the other cases, we are serving an already fulfilled promise which doesn't do anything.

Said so, since me, my company (which sponsored the plugins) and other people I involved during meetups rely a lot on the correct behaviour of these plugins, may I ask you to bring back the original implementation?

I would love to help you achieving what you need, but I really think this is not the correct way to do it.

As an alternative, since I understand your will of being completely indipendent from me, I suggest you to copy what you need into another plugin and proceed in the way you like

@ilteoood I understand what you mean , so can we copy the currently implementation to another package ? And we will revert the native-federation-typescript to your implementation , what do you think ?

@2heal1
Copy link
Member

2heal1 commented Apr 8, 2024

Because we want to combine the types with runtime as well , and it aslo deeply coulpe with bundler , so it may not fit the native meaning.

Split the types into two packages should be better solutions, we will note the sources of key implementations in our new package.

@ilteoood
Copy link
Collaborator

ilteoood commented Apr 8, 2024

Even if I still think there's no need to couple this kind of stuff to the bundler, because typescript itself is bundler-agnostic, I prefer to have the same code copied into two different places rather than a broken plugin.
So yes, I opt for bringing back my original implementation and let you create a new plugin that suits your needs

@2heal1
Copy link
Member

2heal1 commented Apr 8, 2024

Thanks .

I agree that typescript itself is bundler-agnostic, but we need to record it to manifest and add to assets to suit our needs .

I will try to make a clearer distinction between the types generatation and bundler .

Back to the topic , i will revert your prev implementation in this pr .

@ilteoood
Copy link
Collaborator

ilteoood commented Apr 8, 2024

I would be interested in discuss it further, but let's go in this way for the moment

@2heal1
Copy link
Member

2heal1 commented Apr 9, 2024

@ilteoood I have reverted the previous implementation , and add changest to bump version to help correct the latest tag.

please help to check , if no problems , approve pls.

Copy link
Collaborator

@ilteoood ilteoood left a comment

Choose a reason for hiding this comment

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

Thank you so much

@zhoushaw zhoushaw merged commit f926b6c into main Apr 10, 2024
13 checks passed
@zhoushaw zhoushaw deleted the chore/optimize-federation-type-code-style branch April 10, 2024 01:16
@2heal1 2heal1 mentioned this pull request Apr 10, 2024
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