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

Provide shim file #353

Closed
micalevisk opened this issue Sep 28, 2021 · 2 comments · Fixed by #354
Closed

Provide shim file #353

micalevisk opened this issue Sep 28, 2021 · 2 comments · Fixed by #354
Labels
enhancement New feature or request

Comments

@micalevisk
Copy link
Contributor

micalevisk commented Sep 28, 2021

Is your feature request related to a problem? Please describe.

I want to share with my frontend (a TS app that runs in a browser) all my DTO classes developed to my backend, but since they are annotated with the decorator factory @AutoMap() from @automapper/classes I can't do this unless I bundle @automapper/classes with my frontend app, and I'm trying to avoid this since I don't need this package there.

Describe the solution you'd like

Developers can use classes annotated with decorators from @automapper/* in TypeScript apps that are run in the browser. This is done by telling either the TS compiler or a bundler used in the browser app to use the newly added shim file instead of the actual package.

The shim file is a lot smaller in size and does not introduce any dependencies on node packages that would otherwise require even larger polyfills.

An example of this kind of file: https://github.com/nestjs/graphql/pull/1184/files for @nestjs/graphql package. Another one: https://github.com/nestjs/swagger/pull/1505/files (with a test suite!)

The shim file can live under @automapper/classes/extra directory, and it will only exports AutoMap function I guess.

Describe alternatives you've considered

Create the shim file locally

export function AutoMap(): PropertyDecorator {
  return () => {};
}

Additional context

No response

@micalevisk micalevisk added the enhancement New feature or request label Sep 28, 2021
@nartc
Copy link
Owner

nartc commented Sep 29, 2021

That'd be nice. Would you like to make a PR? Hacktoberfest is around the corner :D

@micalevisk
Copy link
Contributor Author

Hacktoberfest is around the corner

oh I'll wait then haha

@nartc nartc closed this as completed in #354 Oct 7, 2021
nartc pushed a commit that referenced this issue Oct 7, 2021
* feat(classes): add shim file for browsers

Closes #353

* docs: add page under misc about shim models for browsers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants