Skip to content

Commit bab18c0

Browse files
aalejjoehan
andauthored
handle powershell stripping commas (#10288)
* handle powershell stripping commas * remove console log * changelog entry * add ai suggestion --------- Co-authored-by: Joe Hanley <[email protected]>
1 parent 3abf55a commit bab18c0

3 files changed

Lines changed: 65 additions & 0 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
- Added Enterprise Edition support to the Firestore emulator. Configure it by setting `firebase.json#firestore.edition` or `firebase.json#emulators.firestore.edition`.
22
- Fixed an issue where functions deployments would silently fail (#6989)
3+
- Fixed issue where the CLI isn't able to correctly parse command arguments on PowerShell (#7506)
34
- Add support for Next.js 16 middleware (`proxy.ts`/`proxy.js`) (#9631)
45
- Updates the default region for new App Hosting backends to us-east4 (#10271)
56
- Fix Next.js image optimization detection in client components (#10228)

src/command.spec.ts

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,60 @@ describe("Command", () => {
170170
});
171171
});
172172
});
173+
174+
it("should handle comma separated values in 'only' options", async () => {
175+
const run = command
176+
.action((options) => {
177+
return {
178+
only: options.only,
179+
};
180+
})
181+
.runner();
182+
183+
const result = await run({
184+
only: "firestore,hosting,auth",
185+
});
186+
187+
expect(result).to.deep.eq({
188+
only: "firestore,hosting,auth",
189+
});
190+
});
191+
192+
it("should normalize space separated values in 'only' options", async () => {
193+
const run = command
194+
.action((options) => {
195+
return {
196+
only: options.only,
197+
};
198+
})
199+
.runner();
200+
201+
const result = await run({
202+
only: "firestore hosting auth",
203+
});
204+
205+
expect(result).to.deep.eq({
206+
only: "firestore,hosting,auth",
207+
});
208+
});
209+
210+
it("should normalize space and commas separated values in 'only' options", async () => {
211+
const run = command
212+
.action((options) => {
213+
return {
214+
only: options.only,
215+
};
216+
})
217+
.runner();
218+
219+
const result = await run({
220+
only: "firestore, hosting, auth",
221+
});
222+
223+
expect(result).to.deep.eq({
224+
only: "firestore,hosting,auth",
225+
});
226+
});
173227
});
174228

175229
describe("validateProjectId", () => {

src/command.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,16 @@ export class Command {
342342
options.configPath = getInheritedOption(options, "config");
343343
}
344344

345+
const onlyOption = getInheritedOption(options, "only");
346+
if (onlyOption) {
347+
// Handle cases where PowerShell replaces commas with spaces.
348+
// see https://github.com/firebase/firebase-tools/issues/7506
349+
options.only = onlyOption
350+
.split(/[\s,]+/)
351+
.filter(Boolean)
352+
.join(",");
353+
}
354+
345355
try {
346356
options.config = Config.load(options);
347357
} catch (e: any) {

0 commit comments

Comments
 (0)