diff --git a/CHANGELOG.md b/CHANGELOG.md index e9104a0280d2..6a2b40e8ce5d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1 +1,2 @@ - Avoid emulator data loss when there an error during export (#3504) +- Ask before overwriting `storage.rules` during `firebase init` (#1833) diff --git a/src/init/features/storage.ts b/src/init/features/storage.ts index 096e8f9d9847..0db674109c5e 100644 --- a/src/init/features/storage.ts +++ b/src/init/features/storage.ts @@ -27,5 +27,5 @@ export async function doSetup(setup: any, config: any): Promise { default: "storage.rules", }); setup.config.storage.rules = storageRulesFile; - config.writeProjectFile(setup.config.storage.rules, RULES_TEMPLATE); + await config.askWriteProjectFile(setup.config.storage.rules, RULES_TEMPLATE); } diff --git a/src/test/init/features/storage.spec.ts b/src/test/init/features/storage.spec.ts index 09c302eacf81..5c2ddd114420 100644 --- a/src/test/init/features/storage.spec.ts +++ b/src/test/init/features/storage.spec.ts @@ -9,11 +9,11 @@ import * as prompt from "../../../prompt"; describe("storage", () => { const sandbox: sinon.SinonSandbox = sinon.createSandbox(); - let writeProjectFileStub: sinon.SinonStub; + let askWriteProjectFileStub: sinon.SinonStub; let promptStub: sinon.SinonStub; beforeEach(() => { - writeProjectFileStub = sandbox.stub(Config.prototype, "writeProjectFile"); + askWriteProjectFileStub = sandbox.stub(Config.prototype, "askWriteProjectFile"); promptStub = sandbox.stub(prompt, "promptOnce"); }); @@ -30,7 +30,7 @@ describe("storage", () => { projectLocation: "us-central", }; promptStub.returns("storage.rules"); - writeProjectFileStub.resolves(); + askWriteProjectFileStub.resolves(); await doSetup(setup, new Config("/path/to/src", {}));