teunmooij / payload-tools

Collection of payload plugins and tools: payload-openapi, payload-swagger, create-payload-api-docs, payload-rbac
https://github.com/teunmooij/payload-tools/#readme
MIT License
101 stars 12 forks source link

[Bug]: SWC Error: base_dir must be absolute & Error "db" is not allowed #83

Open ainsleyclark opened 7 months ago

ainsleyclark commented 7 months ago

Package name

create-payload-api-docs payload-openapi

What happened?

I'm wanting to generate an openapi spec from the CLI tool.

When running the command npx create-payload-api-docs --config=src/payload.config.ts from a PayloadCMS directory, I encountered the following error related to the SWC transpiler:

thread '<unnamed>' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/swc_ecma_transforms_module-0.180.13/src/path.rs:122:13:
base_dir(``) must be absolute. Please ensure that `jsc.baseUrl` is specified correctly...

By adding a simple .swrc file, it seems to start working, but there is no mention of this in the documentation:

{
  "$schema": "https://json.schemastore.org/swcrc",
  "jsc": {
    "baseUrl": "./",
  },
  "module": {
    "type": "es6"
  }
}

After getting passed this, I think recieve other errors in the terminal:

[09:54:29] ERROR (payload): There were 4 errors validating your Payload config
[09:54:29] ERROR (payload): 1: "editor" is not allowed
[09:54:29] ERROR (payload): 2: "db" is not allowed
[09:54:29] ERROR (payload): 3: Collection "payload-migrations" > "graphQL" must be of type object
[09:54:29] ERROR (payload): 4: Collection "payload-migrations" > "endpoints" must be an array

Thanks in advance.

What did you expect

No issue, it generates the docs.

Setps to reproduce

Create a blank application in Payload and add a simple content type, run the commands indicated above.

Tool version

Latest

Payload version

2.0.0

Node version

v18.11.0

ainsleyclark commented 6 months ago

Any idea on this?