|
1 | 1 | import {errorHandler, registerCleanBugsnagErrorsFromWithinPlugins} from './error-handler.js' |
2 | | -import {loadEnvironment, environmentFilePath} from './environments.js' |
| 2 | +import {loadEnvironment, environmentFilePath, expandEnvironmentPatterns} from './environments.js' |
3 | 3 | import {isDevelopment} from './context/local.js' |
4 | 4 | import {addPublicMetadata} from './metadata.js' |
5 | 5 | import {AbortError} from './error.js' |
@@ -146,16 +146,22 @@ This flag is required in non-interactive terminal environments, such as a CI env |
146 | 146 | const environmentFileExists = await environmentFilePath(environmentsFileName, {from: flags.path}) |
147 | 147 |
|
148 | 148 | // Handle both string and array cases for environment flag |
149 | | - let environments: string[] = [] |
| 149 | + let environmentPatterns: string[] = [] |
150 | 150 | if (flags.environment) { |
151 | | - environments = Array.isArray(flags.environment) ? flags.environment : [flags.environment] |
| 151 | + environmentPatterns = Array.isArray(flags.environment) ? flags.environment : [flags.environment] |
152 | 152 | } |
153 | 153 |
|
154 | | - const environmentSpecified = environments.length > 0 |
| 154 | + const environmentSpecified = environmentPatterns.length > 0 |
155 | 155 |
|
156 | 156 | // Noop if no environment file exists and none was specified |
157 | 157 | if (!environmentFileExists && !environmentSpecified) return originalResult |
158 | 158 |
|
| 159 | + // Theme commands can have environment names with glob patterns, in order |
| 160 | + // to check if there are multiple environments being specified we need to |
| 161 | + // expand them before continuing even if other commands might not support |
| 162 | + // multi environment behaviour. |
| 163 | + const environments = await expandEnvironmentPatterns(environmentPatterns, environmentsFileName) |
| 164 | + |
159 | 165 | // Noop if multiple environments were specified (let commands handle this) |
160 | 166 | if (environmentSpecified && environments.length > 1) return originalResult |
161 | 167 |
|
|
0 commit comments