Skip to content

Commit 473760c

Browse files
committed
Get everything working
1 parent 8af7cc0 commit 473760c

File tree

10 files changed

+115
-226
lines changed

10 files changed

+115
-226
lines changed

.dockerignore

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.DS_Store
2+
.git
3+
cloudbuild.yaml
4+
.travis.yml
5+
Dockerfile
6+
7+
npm-debug.log
8+
9+
dist/
10+
node_modules/
11+
12+
.vscode/*
13+
reactfire/**/*.js
14+
!reactfire/babel.config.js
15+
16+
reactfire/**/*.jsx
17+
reactfire/**/*.js.map
18+
reactfire/**/*.jsx.map
19+
reactfire/**/*.d.ts
20+
reactfire/pub/*
21+
reactfire/docs/reactfire-metadata.json
22+
.cache
23+
sample-complex/src/firebase-key.json

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
lts/*
1+
12.11.1

.travis.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
language: node_js
22
sudo: false
3-
node_js:
4-
- 'lts/*'
53

64
addons:
75
chrome: stable
6+
apt:
7+
update: true
8+
packages:
9+
- default-jre
10+
- default-jdk
11+
- build-essential
12+
- python2.7
813

914
cache:
1015
yarn: true
@@ -37,6 +42,8 @@ install:
3742
yarn install --frozen-lockfile
3843
fi
3944
fi
45+
- yarn global add firebase-tools
46+
- firebase setup:emulators:firestore
4047

4148
script:
4249
- cd reactfire

Dockerfile

+26-7
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
11
FROM debian:latest
22

3+
SHELL ["/bin/bash", "-l", "-c"]
4+
5+
ENV CI true
6+
37
# Installing Java (and curl)
4-
RUN apt-get update && apt-get install -y curl default-jre default-jdk
5-
RUN apt-get install -y build-essential
6-
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
7-
RUN nvm install .
8-
RUN nvm use .
8+
RUN DEBIAN_FRONTEND=noninteractive apt-get update -qq < /dev/null > /dev/null
9+
RUN DEBIAN_FRONTEND=noninteractive apt-get install -qq curl default-jre < /dev/null > /dev/null
910

11+
RUN curl --silent -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.0/install.sh | bash
12+
COPY .nvmrc /
13+
RUN nvm install .
1014
RUN npm install -g yarn firebase-tools
11-
1215
RUN firebase setup:emulators:firestore
1316

17+
ENV PYTHON /usr/bin/python2.7
18+
19+
COPY package.json /
20+
COPY yarn.lock /
21+
COPY reactfire/package.json reactfire/
22+
COPY sample-complex/package.json sample-complex/
23+
COPY sample-simple/package.json sample-simple/
24+
RUN yarn install --frozen-lockfile
25+
1426
COPY . /
1527

16-
CMD yarn
28+
RUN cd reactfire && yarn build
29+
RUN cd reactfire && yarn test
30+
31+
ARG SHORT_SHA=""
32+
ARG NPM_TOKEN=""
33+
ARG TAG_NAME=""
34+
35+
RUN ./publish.sh

cloudbuild.yaml

+7-24
Original file line numberDiff line numberDiff line change
@@ -3,34 +3,17 @@
33
# @canary `gcloud builds submit --substitutions=SHORT_SHA="9b0a0b0"`
44
# @next `gcloud builds submit --substitutions=TAG_NAME="v1.2.3-rc.1"`
55
# @latest `gcloud builds submit --substitutions=TAG_NAME="v1.2.3"`
6+
7+
# Not caching with kaniko due to https://github.com/GoogleContainerTools/kaniko/issues/713
68
steps:
7-
- name: 'gcr.io/cloud-builders/docker'
8-
args: ['pull', 'gcr.io/reactfire/docker']
9-
- name: 'gcr.io/cloud-builders/docker'
10-
args: ['build', '-t', 'gcr.io/reactfire/docker', '--cache-from', 'gcr.io/reactfire/docker']
11-
- name: 'gcr.io/cloud-builders/docker'
12-
args: ['push', 'gcr.io/reactfire/firebase']
13-
- name: 'gcr.io/reactfire/docker'
14-
args: ['install', '--frozen-lockfile']
15-
- name: 'gcr.io/reactfire/docker'
16-
dir: 'reactfire'
17-
args: ['build']
18-
- name: 'gcr.io/reactfire/docker'
19-
dir: 'reactfire'
20-
args: ['test']
21-
- name: 'gcr.io/reactfire/docker'
22-
dir: 'reactfire/pub/reactfire'
9+
- name: gcr.io/cloud-builders/docker
2310
entrypoint: 'bash'
24-
env:
25-
- 'SHORT_SHA=$SHORT_SHA'
26-
- 'TAG_NAME=$TAG_NAME'
27-
args: ["../../../publish.sh"]
11+
args:
12+
- -c
13+
- 'docker pull gcr.io/$PROJECT_ID/publish:latest; docker build -t gcr.io/$PROJECT_ID/publish:latest --cache-from gcr.io/$PROJECT_ID/publish:latest --build-arg SHORT_SHA=$SHORT_SHA --build-arg TAG_NAME=$TAG_NAME --build-arg NPM_TOKEN=$(echo $$NPM_TOKEN) . && docker push gcr.io/$PROJECT_ID/publish:latest'
2814
secretEnv: ['NPM_TOKEN']
2915

3016
secrets:
3117
- kmsKeyName: projects/reactfire/locations/global/keyRings/cloud-build/cryptoKeys/cloud-build
3218
secretEnv:
33-
NPM_TOKEN: CiQADamFn5XzbeNQgzTGST9r3Tp5skWlDbBiWaZljffgEm0yIxYSTQC1QbtmDtScXx1BPE+d3CP9rXvOY+n5J0XRuLTTqN7RaqyipCEqTi7+z1kI6mKyBo2ilsMtOtngNzbOZ8kZeUDA80ISLWrNs0hF8k78
34-
35-
images:
36-
- gcr.io/reactfire/docker
19+
NPM_TOKEN: CiQADamFn5XzbeNQgzTGST9r3Tp5skWlDbBiWaZljffgEm0yIxYSTQC1QbtmDtScXx1BPE+d3CP9rXvOY+n5J0XRuLTTqN7RaqyipCEqTi7+z1kI6mKyBo2ilsMtOtngNzbOZ8kZeUDA80ISLWrNs0hF8k78

publish.sh

+21-10
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,25 @@
1-
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
1+
cd reactfire/pub/reactfire
22

3-
cp ../README.md .
4-
cp ../LICENSE .
3+
if test $NPM_TOKEN; then
4+
5+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" > .npmrc
6+
7+
cp ../../../README.md .
8+
cp -r ../../../docs .
9+
cp ../../../LICENSE .
10+
11+
if test $TAG_NAME; then
12+
npm version $(echo $TAG_NAME | sed 's/^v\(.*\)$/\1/')
13+
npm publish . --tag next
14+
ret=$?
15+
else
16+
npm version $(npm version | sed -n "s/^ reactfire: '\(.*\)',/\1/p")-canary.$SHORT_SHA
17+
npm publish . --tag canary
18+
ret=$?
19+
fi
20+
21+
rm -f .npmrc
522

6-
if test $TAG_NAME; then
7-
npm version $(echo $TAG_NAME | sed 's/^v\(.*\)$/\1/')
8-
npm publish . --tag next
9-
else
10-
npm version $(npm version | head -n 1 | sed "s/^.*: '\([^']*\).*/\1/")-canary.$SHORT_SHA
11-
npm publish . --tag canary
1223
fi
1324

14-
rm -f .npmrc
25+
exit $ret

reactfire/package.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,13 @@
2626
"rxfire": "^3.6.3",
2727
"rxjs": "^6.4.0"
2828
},
29-
"peerDependencies": {
30-
"firebase": "^6.0.0",
31-
"react": "^16.9.0"
32-
},
3329
"devDependencies": {
30+
"firebase": "^7.0.0",
31+
"react": "^16.9.0",
3432
"@babel/core": "^7.4.3",
3533
"@babel/preset-env": "^7.4.3",
3634
"@babel/preset-react": "^7.0.0",
3735
"@babel/preset-typescript": "^7.3.3",
38-
"@firebase/app": "^0.4.8",
39-
"@firebase/app-types": "^0.4.0",
4036
"@testing-library/jest-dom": "^4.1.1",
4137
"@testing-library/react": "^9.3.0",
4238
"@testing-library/react-hooks": "^2.0.3",

reactfire/package.pub.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"rxjs": "^6.4.0"
2424
},
2525
"peerDependencies": {
26-
"firebase": "^6.0.0",
26+
"firebase": "^7.0.0",
2727
"react": "^16.9.0"
2828
}
2929
}

sample-complex/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"@types/react": "^16.8.14",
2323
"@types/react-dom": "^16.8.4",
2424
"express": "^4.16.4",
25-
"firebase": "^5.10.0",
25+
"firebase": "^7.0.0",
2626
"firebase-admin": "^7.3.0",
2727
"react": "^16.8.6",
2828
"react-dom": "^16.8.6",

0 commit comments

Comments
 (0)