Skip to content

Commit

Permalink
Enable changesets (#3268)
Browse files Browse the repository at this point in the history
* enable changeset

* Create release pull request

* change env variable name

* use the correct secret in GHA

* make firebase a devDependency in integration test projects

* initial changeset release rewrite

* clean up imports in cli.ts

* save progress

* implement canary release

* update changesets to the latest

* ignore integration test projects

* save updates

* update ignore list

* stream changeset output

* validate version for staging releases

* fix bug

* add option

* skip private packages

* remove unused things

* update release script

* fix type errors

* remove commented code

* fix types

* add Changeset check

* compare to master
  • Loading branch information
Feiyang1 authored Jun 25, 2020
1 parent 04874c9 commit fa70d0a
Show file tree
Hide file tree
Showing 31 changed files with 1,217 additions and 771 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/master/docs/common-questions.md)
26 changes: 26 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "firebase/firebase-js-sdk"}],
"commit": false,
"linked": [],
"access": "restricted",
"baseBranch": "master",
"updateInternalDependencies": "patch",
"ignore": [
"firebase-browserify-test",
"firebase-package-typings-test",
"firebase-firestore-integration-test",
"firebase-messaging-selenium-test",
"firebase-typescript-test",
"firebase-webpack-test",
"@firebase/app-exp",
"@firebase/app-types-exp",
"@firebase/functions-exp",
"@firebase/functions-types-exp",
"firebase-exp"
],
"___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH": {
"onlyUpdatePeerDependentsWhenOutOfRange": true,
"useCalculatedVersionForSnapshots": true
}
}
25 changes: 25 additions & 0 deletions .github/workflows/changesets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Changeset Check

on:
pull_request:
branches:
- master

jobs:
release:
name: Changeset Check
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master

- name: Setup Node.js 12.x
uses: actions/setup-node@master
with:
node-version: 12.x

- name: Install Dependencies
run: yarn

- name: Check if any Changeset file exists
run: yarn changeset status --since=master
30 changes: 30 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Release

on:
push:
branches:
- release

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@master
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0

- name: Setup Node.js 12.x
uses: actions/setup-node@master
with:
node-version: 12.x

- name: Install Dependencies
run: yarn

- name: Create Release Pull Request
uses: changesets/action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 1 addition & 3 deletions integration/browserify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
"test": "karma start --single-run",
"test:ci": "node ../../scripts/run_tests_in_ci.js"
},
"dependencies": {
"firebase": "7.15.4"
},
"devDependencies": {
"firebase": "7.15.4",
"@babel/core": "7.9.6",
"@babel/preset-env": "7.9.6",
"browserify": "16.5.1",
Expand Down
4 changes: 1 addition & 3 deletions integration/firebase-typings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
"test": "tsc",
"test:ci": "node ../../scripts/run_tests_in_ci.js"
},
"dependencies": {
"firebase": "7.15.4"
},
"devDependencies": {
"firebase": "7.15.4",
"typescript": "3.8.3"
}
}
4 changes: 1 addition & 3 deletions integration/messaging/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
"test": "mocha --exit",
"test:manual": "mocha --exit"
},
"dependencies": {
"firebase": "7.15.4"
},
"devDependencies": {
"firebase": "7.15.4",
"chai": "4.2.0",
"chromedriver": "^83.0.0",
"express": "4.17.1",
Expand Down
4 changes: 1 addition & 3 deletions integration/typescript/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
"test": "karma start --single-run",
"test:ci": "node ../../scripts/run_tests_in_ci.js"
},
"dependencies": {
"firebase": "7.15.4"
},
"devDependencies": {
"firebase": "7.15.4",
"@babel/core": "7.9.6",
"@babel/preset-env": "7.9.6",
"@types/chai": "4.2.11",
Expand Down
4 changes: 1 addition & 3 deletions integration/webpack/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@
"test": "karma start --single-run",
"test:ci": "node ../../scripts/run_tests_in_ci.js"
},
"dependencies": {
"firebase": "7.15.4"
},
"devDependencies": {
"firebase": "7.15.4",
"@babel/core": "7.9.6",
"@babel/preset-env": "7.9.6",
"chai": "4.2.0",
Expand Down
8 changes: 7 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"link:packages": "lerna exec --scope @firebase/* --scope firebase --scope rxfire -- yarn link",
"stage:packages": "./scripts/prepublish.sh",
"repl": "node tools/repl.js",
"release": "node scripts/release/cli.js",
"release": "ts-node-script scripts/release/cli.ts",
"pretest": "node tools/pretest.js",
"test": "lerna run --concurrency 4 --stream test",
"test:ci": "lerna run --concurrency 4 --stream test:ci",
Expand Down Expand Up @@ -60,17 +60,23 @@
"integration/*"
],
"devDependencies": {
"@changesets/changelog-github": "0.2.5",
"@changesets/cli": "2.9.1",
"@microsoft/api-documenter": "7.7.20",
"@microsoft/api-extractor": "7.7.13",
"@types/chai": "4.2.11",
"@types/chai-as-promised": "7.1.2",
"@types/child-process-promise": "2.2.1",
"@types/clone": "0.1.30",
"@types/inquirer": "6.5.0",
"@types/long": "4.0.1",
"@types/mocha": "7.0.2",
"@types/node": "12.12.37",
"@types/sinon": "9.0.0",
"@types/sinon-chai": "3.2.4",
"@types/tmp": "0.2.0",
"@types/yargs": "15.0.4",
"@types/listr": "0.14.2",
"@typescript-eslint/eslint-plugin": "2.30.0",
"@typescript-eslint/eslint-plugin-tslint": "2.30.0",
"@typescript-eslint/parser": "2.30.0",
Expand Down
5 changes: 2 additions & 3 deletions scripts/emulator-testing/database-test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,15 @@ import { spawn } from 'child-process-promise';
import * as path from 'path';

import { DatabaseEmulator } from './emulators/database-emulator';
import { ChildProcessPromise } from './emulators/emulator';

function runTest(port: number, namespace: string): ChildProcessPromise {
function runTest(port: number, namespace: string) {
const options = {
cwd: path.resolve(__dirname, '../../packages/database'),
env: Object.assign({}, process.env, {
RTDB_EMULATOR_PORT: port,
RTDB_EMULATOR_NAMESPACE: namespace
}),
stdio: 'inherit'
stdio: 'inherit' as const
};
return spawn('yarn', ['test:all'], options);
}
Expand Down
13 changes: 7 additions & 6 deletions scripts/emulator-testing/emulators/emulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,6 @@ import * as request from 'request';
// @ts-ignore
import * as tmp from 'tmp';

export interface ChildProcessPromise extends Promise<void> {
childProcess: ChildProcess;
}

export abstract class Emulator {
binaryPath: string | null = null;
emulator: ChildProcess | null = null;
Expand Down Expand Up @@ -72,9 +68,14 @@ export abstract class Emulator {
if (!this.binaryPath) {
throw new Error('You must call download() before setUp()');
}
const promise: ChildProcessPromise = spawn(
const promise = spawn(
'java',
['-jar', path.basename(this.binaryPath), '--port', this.port],
[
'-jar',
path.basename(this.binaryPath),
'--port',
this.port.toString()
],
{
cwd: path.dirname(this.binaryPath),
stdio: 'inherit'
Expand Down
9 changes: 2 additions & 7 deletions scripts/emulator-testing/firestore-test-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,16 @@ import * as path from 'path';
// @ts-ignore
import * as freePortFinder from 'find-free-port';

import { ChildProcessPromise } from './emulators/emulator';
import { FirestoreEmulator } from './emulators/firestore-emulator';

function runTest(
port: number,
projectId: string,
withPersistence: boolean
): ChildProcessPromise {
function runTest(port: number, projectId: string, withPersistence: boolean) {
const options = {
cwd: path.resolve(__dirname, '../../packages/firestore'),
env: Object.assign({}, process.env, {
FIRESTORE_EMULATOR_PORT: port,
FIRESTORE_EMULATOR_PROJECT_ID: projectId
}),
stdio: 'inherit'
stdio: 'inherit' as const
};
// TODO(b/113267261): Include browser test once WebChannel support is
// ready in Firestore emulator.
Expand Down
Loading

0 comments on commit fa70d0a

Please sign in to comment.