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

Export demo datasource utils from shared; Add plop generator for shared entrypoint #1484

Merged
merged 4 commits into from
Jul 19, 2023

Conversation

tinahollygb
Copy link
Contributor

Export the demo datasource utils from shared

The previous PR #1477 created utils. These were not made available due to the exporting. This fixes that.

Plop generator for shared entrypoint

The current process for writing a new entry point has a lot of manual steps, many that can be missed during the development and review process. These changes add a generator yarn plop shared-entrypoint so we can generate all the required things.

You can test this by running it and using the example resources in the description:

 yarn plop
yarn run v1.22.19
$ plop
? [PLOP] Please choose a generator. shared-entrypoint - [shared] Generates a new entry point for the shared package
? A new entry point for the shared package, e.g. 'todos' to make import { createTodo } from 'shared/todos' todos
? Name of the first function to add to this file, e.g. 'createTodo' to make import { createTodo } from 'shared/todos' createTodo
✔  ++ /packages/shared/todos.d.ts
✔  ++ /packages/shared/src/todos/todos.ts
✔  ++ /packages/shared/todos.js
✔  ++ /packages/shared/src/todos/index.ts
✔  _+ /packages/shared/src/index.ts
✨  Done in 8.91s.

It creates a packages/shared/src/todos which has a file intended to put private/public functions, types, etc. todos.ts and a barrel file for exporting public functions:

tree packages/shared/src/todos
packages/shared/src/todos
├── index.ts
└── todos.ts

It creates the relevant files, which should now be able to be imported into the front-end and back-end packages without issue:

import { createTodo } from 'shared/todos';

@tinahollygb tinahollygb requested a review from a team July 19, 2023 18:30
@github-actions
Copy link

github-actions bot commented Jul 19, 2023

Your preview environment pr-1484-bttf has been deployed.

Preview environment endpoints are available at:

@tinahollygb tinahollygb merged commit 91048c2 into main Jul 19, 2023
@tinahollygb tinahollygb deleted the shared-plop-demodatasource-exports branch July 19, 2023 23:59
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