fix(templates): generates import map with given project name and misc housekeeping updates #12305
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What?
importMap.js
file with the project name provided by the user.README.md
file that we had when this template existed outside of the monorepo (here) to provide clear instructions of required steps.Why?
The plugin template when installed via
npx create-payload-app
asks the user for a project name, however the exports fromimportMap.js
do not get updated to the provided name. This throws errors when running the project and prevents it from building.The
/dev
folder requires the.env.example
to be copied and renamed to.env
- the project will not run until this is done. The template lacks instructions that this is a required step.How?
packages/create-payload-app/src/lib/configure-plugin-project.ts
to read theimportMap.js
file and replace the placeholder plugin name with the name provided by the users. Adds a test topackages/create-payload-app/src/lib/create-project.spec.ts
to verify that this file gets updated correctly.README.md
file, ensuring key steps (like adding the.env
file) are clearly stated.Additional housekeeping updates:
NextRESTClient
in favor of directly creating Request objectsgetCustomEndpointHandler
functionadmin.autoLogin
Fixes #12198