keystone icon indicating copy to clipboard operation
keystone copied to clipboard

Use app router template

Open gautamsi opened this issue 1 year ago • 14 comments

ref #9183

Blocked by

  • [x] #9189

This PR updates the template to generate the App router, default to typescript version which can be turned off by setting config.ui.tsx = false

What is completed/Verified:

  • [x] generate app routes in app/(admin) folder (creates admin route specific layout page. if src page exist, it generates it in `src/app/(admin)
  • [x] Stop generating next.config.js file, this should be generated from create-keystone-app going forward (TODO)
  • [x] ~~set default ui.basePath to /admin~~ can set ui.basePath to /admin or any other sub path
  • [x] No longer copies admin files or generates pages export copy as they are no longer needed
  • [x] Does not clear the admin folder files if exist, only overwrites the special config files which contains up to date admin meta and view cache, this should be removed before GA
  • [x] Verified custom pages
  • [x] Verified custom fields and field views
  • [x] can use relative path or even "paths" from typescript (@fields/text/myView)
  • [x] Added --reset-admin flag to dev command to force clean (admin) folder, useful in regenerate the admin template if updated in future. should never be needed except braking upgrade
  • [x] fix build and start script
  • [x] @keystone-6/auth templates
  • [x] page middleware

Pending:

  • [ ] Documentation
  • [ ] fixing final set of failing tests

@dcousens can you create a v-next branch which should be actual target for these PRs instead of main


For anyone interested in testing this out, I have published temporary packages (use at your own risk) I have been using it with very large project of mine. @k6js-next/[email protected] @k6js-next/[email protected]

to use this you have to specify resolutions, for yarn I do it like this in (root package.json in monorepo)

"resolutions": {
    "graphql": "16.8.1",
    "next": "14.2.5",
    "react": "^18.3.1",
    "react-dom": "^18.3.1",
    "@keystone-6/core": "npm:@k6js-next/[email protected]",
    "@keystone-6/auth": "npm:@k6js-next/[email protected]"
  }

gautamsi avatar Jun 25 '24 05:06 gautamsi