Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,8 @@ Options:
firebase.json) (type: string)
--message MSG Message describing this deployment. (type: string)
--only SERVICES Firebase services to deploy (type: string, note: can be a comma-separated list)
--except SERVICES Firebase services to not deploy (type: string, note: can be a comma-separated list)
--public PATH Override the Hosting public directory specified in firebase.json
--[no-]force Whether or not to delete Cloud Functions missing from the current working
directory

Expand All @@ -1120,7 +1122,7 @@ Common Options:
Examples:

dpl firebase --token token
dpl firebase --token token --project name --message msg --only services --force
dpl firebase --token token --project name --message msg --only services --except services --public path --force
```

Options can be given via env vars if prefixed with `FIREBASE_`. E.g. the option `--token` can be
Expand Down
10 changes: 6 additions & 4 deletions lib/dpl/providers/firebase.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ class Firebase < Provider
tbd
str

node_js '>= 8.0.0'
node_js '>= 10.13.0'

npm 'firebase-tools@^6.3', 'firebase'
npm 'firebase-tools@^9.16', 'firebase'

path 'node_modules/.bin'

Expand All @@ -21,9 +21,11 @@ class Firebase < Provider
opt '--project NAME', 'Firebase project to deploy to (defaults to the one specified in your firebase.json)'
opt '--message MSG', 'Message describing this deployment.'
opt '--only SERVICES', 'Firebase services to deploy', note: 'can be a comma-separated list'
opt '--except SERVICES', 'Firebase services to not deploy', note: 'can be a comma-separated list'
opt '--public PATH', 'Override the Hosting public directory specified in firebase.json'
opt '--force', 'Whether or not to delete Cloud Functions missing from the current working directory'

cmds deploy: 'firebase deploy --non-interactive %{deploy_opts}'
cmds deploy: 'firebase deploy %{deploy_opts}'
errs deploy: 'Firebase deployment failed'
msgs missing_config: 'Missing firebase.json'

Expand All @@ -36,7 +38,7 @@ def deploy
end

def deploy_opts
opts_for(%i(project message token only force))
opts_for(%i(project message token only except public force))
end
end
end
Expand Down
21 changes: 15 additions & 6 deletions spec/dpl/providers/firebase_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,33 @@
before { |c| subject.run if run?(c) }

describe 'by default' do
it { should have_run '[npm:install] firebase-tools@^6.3 (firebase)' }
it { should have_run 'firebase deploy --non-interactive --token="token"' }
it { should have_run '[validate:runtime] node_js (>= 10.13.0)' }
it { should have_run '[npm:install] firebase-tools@^9.16 (firebase)' }
it { should have_run 'firebase deploy --token="token"' }
end

describe 'given --project name' do
it { should have_run 'firebase deploy --non-interactive --project="name" --token="token"' }
it { should have_run 'firebase deploy --project="name" --token="token"' }
end

describe 'given --message msg' do
it { should have_run 'firebase deploy --non-interactive --message="msg" --token="token"' }
it { should have_run 'firebase deploy --message="msg" --token="token"' }
end

describe 'given --only only' do
it { should have_run 'firebase deploy --non-interactive --token="token" --only="only"' }
it { should have_run 'firebase deploy --token="token" --only="only"' }
end

describe 'given --except except' do
it { should have_run 'firebase deploy --token="token" --except="except"' }
end

describe 'given --public public' do
it { should have_run 'firebase deploy --token="token" --public="public"' }
end

describe 'given --force' do
it { should have_run 'firebase deploy --non-interactive --token="token" --force' }
it { should have_run 'firebase deploy --token="token" --force' }
end

describe 'missing firebase.json', run: false do
Expand Down