|
| 1 | +/** |
| 2 | + * @license |
| 3 | + * Copyright 2021 Google LLC |
| 4 | + * |
| 5 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | + * you may not use this file except in compliance with the License. |
| 7 | + * You may obtain a copy of the License at |
| 8 | + * |
| 9 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + * |
| 11 | + * Unless required by applicable law or agreed to in writing, software |
| 12 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | + * See the License for the specific language governing permissions and |
| 15 | + * limitations under the License. |
| 16 | + */ |
| 17 | +import { spawn } from 'child-process-promise'; |
| 18 | +import simpleGit from 'simple-git/promise'; |
| 19 | +import { projectRoot } from '../utils'; |
| 20 | + |
| 21 | +const git = simpleGit(projectRoot); |
| 22 | + |
| 23 | +async function updateApiReports() { |
| 24 | + /** API reports are generated as part of the builds */ |
| 25 | + // TODO: change yarn command once exp packages become official |
| 26 | + await spawn('yarn', ['lerna', 'run', '--scope', '@firebase/*-exp', 'build'], { |
| 27 | + stdio: 'inherit' |
| 28 | + }); |
| 29 | + |
| 30 | + // build storage-exp |
| 31 | + await spawn( |
| 32 | + 'yarn', |
| 33 | + ['lerna', 'run', '--scope', '@firebase/storage', 'build:exp'], |
| 34 | + { |
| 35 | + stdio: 'inherit' |
| 36 | + } |
| 37 | + ); |
| 38 | + |
| 39 | + // build database-exp |
| 40 | + await spawn( |
| 41 | + 'yarn', |
| 42 | + ['lerna', 'run', '--scope', '@firebase/database', 'build:exp'], |
| 43 | + { |
| 44 | + stdio: 'inherit' |
| 45 | + } |
| 46 | + ); |
| 47 | + |
| 48 | + // generate public typings for firestore |
| 49 | + await spawn( |
| 50 | + 'yarn', |
| 51 | + ['lerna', 'run', '--scope', '@firebase/firestore', 'prebuild'], |
| 52 | + { |
| 53 | + stdio: 'inherit' |
| 54 | + } |
| 55 | + ); |
| 56 | + |
| 57 | + // stage api reviews |
| 58 | + await git.add('common/api-review/*'); |
| 59 | + |
| 60 | + // reset unrelated changes |
| 61 | + await git.checkout('.'); |
| 62 | + |
| 63 | + await git.commit('Update API reports'); |
| 64 | + |
| 65 | + // Pushing to the remote branch is done in the GHA workflow, see .github/workflows/update-api-reports.yml |
| 66 | +} |
| 67 | + |
| 68 | +updateApiReports(); |
0 commit comments