* Returns paths to client bundle files based on execution context
(pluginName: string)
| 17 | * Returns paths to client bundle files based on execution context |
| 18 | */ |
| 19 | function getClientBundlePaths(pluginName: string): { |
| 20 | clientPath: string; |
| 21 | corePath: string; |
| 22 | } { |
| 23 | const clientName = pluginName.slice('@hey-api/client-'.length); |
| 24 | |
| 25 | if (isEnvironment('development')) { |
| 26 | // Dev: source bundle folders at src/plugins/@hey-api/{client}/bundle |
| 27 | const pluginsDir = path.resolve(__dirname, '..', 'plugins', '@hey-api'); |
| 28 | return { |
| 29 | clientPath: path.resolve(pluginsDir, `client-${clientName}`, 'bundle'), |
| 30 | corePath: path.resolve(pluginsDir, 'client-core', 'bundle'), |
| 31 | }; |
| 32 | } |
| 33 | |
| 34 | // Prod: copied to dist/clients/{clientName} |
| 35 | return { |
| 36 | clientPath: path.resolve(__dirname, 'clients', clientName), |
| 37 | corePath: path.resolve(__dirname, 'clients', 'core'), |
| 38 | }; |
| 39 | } |
| 40 | |
| 41 | /** |
| 42 | * Returns absolute path to the client folder. This is hard-coded for now. |
no test coverage detected