Skip to content

Commit 5d57182

Browse files
authored
Update Material Example To React 16.6 (#565)
* fix(examples): update material complete example to `react@^16.6` + `react-scripts` + `react-router-dom` +`redux-auth-wrapper@^2` (output of [`[email protected]`](prescottprue/generator-react-firebase#132))
1 parent ad3bf1f commit 5d57182

File tree

162 files changed

+8973
-46757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

162 files changed

+8973
-46757
lines changed

.eslintignore

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
examples/**
21
coverage/**
32
node_modules/**
43
dist/**

examples/complete/material/.env.local

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
NODE_PATH=src/
2+
CI=false
3+
# Needed to skip warnings from jest@beta in package.json
4+
SKIP_PREFLIGHT_CHECK=true

examples/complete/material/.eslintrc

-35
This file was deleted.
+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
module.exports = {
2+
root: true,
3+
parser: 'babel-eslint',
4+
extends: ['react-app', 'prettier'],
5+
plugins: ['import', 'babel', 'react', 'prettier'],
6+
settings: {
7+
react: {
8+
version: '16.6'
9+
},
10+
'import/resolver': {
11+
node: {
12+
moduleDirectory: ['node_modules', '/']
13+
}
14+
}
15+
},
16+
rules: {
17+
semi: [
18+
2, 'never'
19+
],
20+
'no-console': 'error',
21+
'react/forbid-prop-types': 0,
22+
'react/require-default-props': 0,
23+
'react/jsx-filename-extension': 0,
24+
'import/no-named-as-default': 0,
25+
'prettier/prettier': [
26+
'error',
27+
{
28+
singleQuote: true,
29+
trailingComma: 'none',
30+
semi: false,
31+
bracketSpacing: true,
32+
jsxBracketSameLine: true,
33+
printWidth: 80,
34+
tabWidth: 2,
35+
useTabs: false
36+
}
37+
]
38+
},
39+
overrides: [
40+
{
41+
files: ['*.test.js', '*.spec.js'],
42+
env: {
43+
jest: true
44+
}
45+
},
46+
{
47+
files: ['config/*', 'scripts/*'],
48+
rules: {
49+
'no-console': 0,
50+
'func-names': 0,
51+
'prefer-destructuring': 0,
52+
'no-use-before-define': 0,
53+
'import/order': 0,
54+
'consistent-return': 0,
55+
'no-param-reassign': 0,
56+
'import/no-extraneous-dependencies': 0,
57+
'global-require': 0,
58+
'import/no-dynamic-require': 0
59+
}
60+
}
61+
]
62+
}

examples/complete/material/.firebaserc

+3-17
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,29 @@
11
{
22
"projects": {
3-
"dev": "redux-firebasev3",
4-
"stage": "redux-firebasev3",
3+
"default": "redux-firebasev3",
54
"master": "redux-firebasev3",
6-
"prod": "redux-firebasev3",
7-
"default": "redux-firebasev3"
5+
"prod": "redux-firebasev3"
86
},
97
"ci": {
108
"createConfig": {
119
"master": {
12-
"version": "${npm_package_version}",
13-
"env": "development",
10+
"env": "staging",
1411
"firebase": {
1512
"apiKey": "AIzaSyCTUERDM-Pchn_UDTsfhVPiwM4TtNIxots",
1613
"authDomain": "redux-firebasev3.firebaseapp.com",
1714
"databaseURL": "https://redux-firebasev3.firebaseio.com",
1815
"projectId": "redux-firebasev3",
1916
"storageBucket": "redux-firebasev3.appspot.com"
20-
},
21-
"reduxFirebase": {
22-
"userProfile": "users",
23-
"enableLogging": false,
24-
"updateProfileOnLogin": false
2517
}
2618
},
2719
"prod": {
28-
"version": "${npm_package_version}",
2920
"env": "production",
3021
"firebase": {
3122
"apiKey": "AIzaSyCTUERDM-Pchn_UDTsfhVPiwM4TtNIxots",
3223
"authDomain": "redux-firebasev3.firebaseapp.com",
3324
"databaseURL": "https://redux-firebasev3.firebaseio.com",
3425
"projectId": "redux-firebasev3",
3526
"storageBucket": "redux-firebasev3.appspot.com"
36-
},
37-
"reduxFirebase": {
38-
"userProfile": "users",
39-
"enableLogging": false,
40-
"updateProfileOnLogin": false
4127
}
4228
}
4329
}

examples/complete/material/.gitignore

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
1+
# OS
12
*.log
23
**/*.log
34
.DS_Store
45
**/.DS_Store
5-
**/dist
6+
7+
# Dependencies
68
**/node_modules
7-
coverage
9+
10+
# React App
11+
**/dist
812
src/config.js
13+
.env
+142
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,142 @@
1+
stages:
2+
- build
3+
- deploy_staging
4+
- build_production
5+
- deploy_production
6+
7+
# Cache dependencies across jobs only pulling not uploading (upload to cache
8+
# happens in build stage)
9+
cache:
10+
untracked: true
11+
key: ${CI_COMMIT_REF_SLUG}
12+
policy: pull # only pull cache, skip uploading
13+
paths:
14+
- node_modules/
15+
16+
# Install dependencies for React App.
17+
# Script run before all stages unless otherwise overriden
18+
before_script:
19+
- CYPRESS_INSTALL_BINARY=0 npm i
20+
- npm i [email protected] firebase-ci@next
21+
22+
# Build Stage
23+
# Installs dependencies, builds app, and saves results for later (artifacts).
24+
# 1. Install dependencies for React App and Cloud Functions. Installing of
25+
# cypress binary is skipped (done in E2E Testing Stage)
26+
# 2. Build environment specific config file in src/config.js
27+
# 3. Confirm there is no lint within code (after config is injected for import linting)
28+
# 4. Build React app to dist folder
29+
# 5. Preserve build results and dependencies for future jobs in the pipeline
30+
Build:
31+
stage: build
32+
image: node:8
33+
when: always
34+
except:
35+
variables:
36+
- $CI_COMMIT_MESSAGE =~ /skip-build/
37+
artifacts:
38+
expire_in: 2 weeks
39+
when: always
40+
paths:
41+
- dist
42+
- functions/dist
43+
- node_modules/
44+
- functions/node_modules/
45+
# Override cache behavior set above since we want to both pull and push to
46+
# the cache (no "policy" provided since pull-push is default)
47+
cache:
48+
untracked: true # track files that are untracked in git
49+
key: ${CI_COMMIT_REF_SLUG}
50+
paths:
51+
- node_modules/
52+
- functions/node_modules/
53+
script:
54+
- npm run build:config # create env specific src/config.js
55+
- npm run lint
56+
- npm run build
57+
- npm run build:functions
58+
59+
# Deploy Staging
60+
# Deploy React App and Cloud Functions
61+
Deploy Staging:
62+
stage: deploy_staging
63+
image: node:8
64+
environment:
65+
name: staging
66+
url: https://material-stage.firebaseapp.com
67+
when: on_success
68+
only:
69+
- master
70+
- web
71+
except:
72+
variables:
73+
- $CI_COMMIT_MESSAGE =~ /skip-deploy/
74+
- $CI_COMMIT_MESSAGE =~ /skip-stage-deploy/
75+
artifacts:
76+
name: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
77+
expire_in: 1 weeks
78+
when: on_failure
79+
paths:
80+
- firebase-debug.log
81+
dependencies:
82+
- Build
83+
script:
84+
- npm run deploy
85+
86+
# Build Production version of bundle (has different config)
87+
Build Production:
88+
stage: build_production
89+
image: node:8
90+
when: on_success
91+
only:
92+
- master
93+
- prod
94+
- web
95+
except:
96+
variables:
97+
- $CI_COMMIT_MESSAGE =~ /skip-deploy/
98+
- $CI_COMMIT_MESSAGE =~ /skip-prod-deploy/
99+
artifacts:
100+
name: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
101+
expire_in: 1 week
102+
when: always
103+
paths:
104+
- dist
105+
dependencies:
106+
- Build
107+
script:
108+
- npm run clean # remove existing dist folder
109+
- npm run build:config # create env specific src/config.js
110+
- npm run build # rebuild bundle with new config
111+
# Note: Functions are not rebuilt since a bundle with env specific config
112+
# is not created as with React App
113+
114+
# Deploy Production
115+
# Deploy React App and Cloud Functions to production environment
116+
Deploy Production:
117+
stage: deploy_production
118+
image: node:8
119+
environment:
120+
name: production
121+
url: https://material.firebaseapp.com
122+
when: manual # Only allow run through button on Gitlab site
123+
only:
124+
- master
125+
- prod
126+
- web
127+
variables:
128+
FIREBASE_CI_PROJECT: "prod" # deploy using prod project in .firebaserc
129+
artifacts:
130+
name: "$CI_JOB_STAGE-$CI_COMMIT_REF_SLUG"
131+
expire_in: 1 week
132+
when: on_failure
133+
paths:
134+
- firebase-debug.log
135+
dependencies:
136+
- Build # Load artifacts from build stage
137+
except:
138+
variables:
139+
- $CI_COMMIT_MESSAGE =~ /skip-deploy/
140+
- $CI_COMMIT_MESSAGE =~ /skip-prod-deploy/
141+
script:
142+
- npm run deploy # Deploy Cloud Functions and React App (Firebase Hosting)

examples/complete/material/.travis.yml

-37
This file was deleted.

examples/complete/material/LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2017 testuser
3+
Copyright (c) 2018 - present prescottprue
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

0 commit comments

Comments
 (0)