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

fix: add default export detection #24954

Merged

Conversation

ZachJW34
Copy link
Contributor

@ZachJW34 ZachJW34 commented Dec 2, 2022

User facing changelog

na

Additional details

Allows the detection of default exports, as well as exports that have been aliased e.g. export { Foo as bar }. There are some edge-cases that aren't covered like HOCs (export default connect(Counter)) but adding support for those would be complex.

Steps to test

Run the system-tests for data-context yarn workspace @packages/data-context test

PR Tasks

  • Have tests been added/updated?
  • [na] Has the original issue (or this PR, if no issue exists) been tagged with a release in ZenHub? (user-facing changes only)
  • [na] Has a PR for user-facing changes been opened in cypress-documentation?
  • [na] Have API changes been updated in the type definitions?

@cypress-bot
Copy link
Contributor

cypress-bot bot commented Dec 2, 2022

Thanks for taking the time to open a PR!

Base automatically changed from astone123/create-from-react-server to feature/create-from-react-component December 5, 2022 15:25
@ZachJW34 ZachJW34 marked this pull request as ready for review December 5, 2022 21:56
@cypress
Copy link

cypress bot commented Dec 5, 2022



Test summary

22761 0 1796 0Flakiness 4


Run details

Project cypress
Status Passed
Commit e3756fa
Started Dec 5, 2022 10:18 PM
Ended Dec 5, 2022 10:36 PM
Duration 17:44 💡
OS Linux Debian -
Browser Multiple

View run in Cypress Dashboard ➡️


Flakiness

global-mode.cy.ts Flakiness
1 Launchpad: Global Mode > when projects have been added > updates most-recently opened project list when returning from next step
2 Launchpad: Global Mode > error state > should not persist the error when going back to the main screen projects
cypress-in-cypress-run-mode.cy.ts Flakiness
1 Cypress In Cypress - run mode > e2e run mode spec runner header is correct
2 Cypress In Cypress - run mode > hides reporter when NO_COMMAND_LOG is set in run mode

This comment has been generated by cypress-bot as a result of this project's GitHub integration settings. You can manage this integration in this project's settings in the Cypress Dashboard

@lmiller1990
Copy link
Contributor

HOCs (export default connect(Counter)

I think this is fine to skip for the initial release, talked to @astone123 but we should just ignore non capital exports - so HOCs are off the table, at least for now.

Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

Some thoughts... I think we should eliminate displayName, superseded by exportName.

packages/data-context/src/actions/CodegenActions.ts Outdated Show resolved Hide resolved
packages/data-context/src/actions/CodegenActions.ts Outdated Show resolved Hide resolved
packages/data-context/src/actions/CodegenActions.ts Outdated Show resolved Hide resolved
packages/data-context/src/actions/CodegenActions.ts Outdated Show resolved Hide resolved
@lmiller1990 lmiller1990 self-requested a review December 6, 2022 20:18
Copy link
Contributor

@astone123 astone123 left a comment

Choose a reason for hiding this comment

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

Nice 👍🏻 I'm going to add the arguments to the GraphQL mutation in my UI PR

Copy link
Contributor

@lmiller1990 lmiller1990 left a comment

Choose a reason for hiding this comment

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

Sorry, one more nit - I'll approve, though ✔️

packages/data-context/src/actions/CodegenActions.ts Outdated Show resolved Hide resolved
@astone123 astone123 merged commit 2d9c4fa into feature/create-from-react-component Dec 6, 2022
@astone123 astone123 deleted the zachw/cfr-default-exports branch December 6, 2022 23:33
lmiller1990 added a commit that referenced this pull request Dec 19, 2022
* feat: server logic for create from React component (#24881)

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>

* fix: add default export detection (#24954)

Co-authored-by: astone123 <adams@cypress.io>

* update cache

* update yarn.lock to fix builds

* fix: compilation with webpack preprocessor

* feat: create from React component UI (#24982)

* feat: WIP server logic for create from React component

* feat: add more tests; error handling

* feat: WIP create from React UI

* feat: PR feedback [run CI]

* feat: try committing snapshot cache changes [run ci]

* feat: try re-generating snapshot [run ci]

* fix build

* regenerate cache on darwin

* update caches

* Revert "feat: try re-generating snapshot [run ci]"

This reverts commit d763e1f.

* fix typing error

* types

* fix test

* chore: try using react-docgen@6.0.0-alpha.3

* update test

* regen linux snapshot

* update snapshots for darwin

* re-gen linux snapshot

* yarn install

* update snapshots

* update snapshot metadata

* update snapshots due to babel deps changing slightly

* make react docgen a dep

* update tests

* revert

* snapshots again??

* revert

* update

* update

* try change snapshot

* change snap

* update snap

* feat: remove unnecessary ts-ignore

* feat: add more test cases

* feat: create CodegenActions; other minor refactors

* feat: continue UI work

* feat: ignore config and Cypress-related files

* feat: PR feedback

* update Vue component link

* merge in default export work

* consolidate graphql queries

* other misc feedback

* use network-only policy to fetch files; include cypress/ dir for code gen candidates; fix type error

* add basic e2e test

* fix app integration tests

* refactor and fix app component and webpack dev server tests

* add error state; fix unit tests [skip ci]

* simplify generator show logic [skip ci]

* more testing

* fix types

* style updates [skip ci]

* fix error state [skip ci]

* fix list padding [skip ci]

* use slots (#25079)

* add more tests; fix unit tests

* fix types

* fix test describe

* add percy snapshots for new list

* update trouble rendering banner link [skip ci]

* use collapsible component

* use button for component list items

* fix tests

* build binaries

* revert changes to circle config

* remove eslintignore and extra loading div [skip ci] because we know it will fail

* revert changes to framework glob patterns [skip ci]

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>

* feat: pass parser options to allow parsing of tsx files (#25145)

* fix create from component e2e test

* build binaries [run ci]

* fix component tests [run ci]

* regen windows snapshot

Co-authored-by: Ryan Manuel <ryanm@cypress.io>
Co-authored-by: Lachlan Miller <lachlan.miller.1990@outlook.com>
Co-authored-by: Zachary Williams <ZachJW34@gmail.com>
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.

3 participants