-
I'm trying to write a plugin for seeding a payload instance, and I know I can use I've found the I took a look at the source code and found this: payload/packages/payload/src/bin/index.ts Lines 66 to 67 in f09ee0b It seems that the config is passed to a function that is the default export for the script file, but the payload instance is not passed in any way. Also, I'm not sure if the path passed to Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
For bin scripts this
shouldn't be a thing, since you don't want to introduce your bin script dependencies to user's app bundle and Payload's scripts don't work that way either. To answer your questions:
|
Beta Was this translation helpful? Give feedback.
-
Thanks, I wasn't aware of |
Beta Was this translation helpful? Give feedback.
For bin scripts this
shouldn't be a thing, since you don't want to introduce your bin script dependencies to user's app bundle and Payload's scripts don't work that way either.
To answer your questions:
scriptPath
should have an absolute path like/users/user/my-app/node_modules/payload-plugin/script.js
. So, for your plugin you should ensure that this path also will exist for those who installed it.config
is, so you can get payload fromgetPayload({ config })
.payload/packages/payload/src/bin/index.ts
Lines 66 to 67 in f09ee0b