( workPath: string )
| 95 | } |
| 96 | |
| 97 | export async function getPyprojectSubscribers( |
| 98 | workPath: string |
| 99 | ): Promise<Subscriber[]> { |
| 100 | const pyprojectPath = join(workPath, 'pyproject.toml'); |
| 101 | if (!fs.existsSync(pyprojectPath)) { |
| 102 | return []; |
| 103 | } |
| 104 | |
| 105 | const pyproject = await readConfigFile<Pyproject>(pyprojectPath); |
| 106 | const subscribers = pyproject?.tool?.vercel?.subscribers; |
| 107 | if (!subscribers) { |
| 108 | return []; |
| 109 | } |
| 110 | if (typeof subscribers !== 'object' || Array.isArray(subscribers)) { |
| 111 | throw subscriberError('"tool.vercel.subscribers" must be an object'); |
| 112 | } |
| 113 | |
| 114 | return Promise.all( |
| 115 | Object.entries(subscribers).map(([name, config]) => |
| 116 | parseSubscriber(workPath, name, config) |
| 117 | ) |
| 118 | ); |
| 119 | } |
| 120 | |
| 121 | async function parseSubscriber( |
| 122 | workPath: string, |
no test coverage detected