Skip to content

Commit

Permalink
v0.10.0 (#128)
Browse files Browse the repository at this point in the history
* feat(core): update to node 12
* feat(app): add adornments to `databaseURL` fields so only database name needs to be entered in forms
* chore(deps): update docs dev dependencies
* chore(ci): add timeouts to workflows
  • Loading branch information
prescottprue authored Jul 27, 2020
1 parent dd681d3 commit d372b4a
Show file tree
Hide file tree
Showing 20 changed files with 6,240 additions and 4,933 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/app-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
build:
name: Deploy
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -24,7 +25,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 10
node-version: 12

- name: Get Cache Settings
id: cache-settings
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/app-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ jobs:
verify-build:
name: Verify + Build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -21,7 +22,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 10
node-version: 12

- name: Get cache settings
id: cache-settings
Expand Down Expand Up @@ -126,6 +127,7 @@ jobs:
name: UI Test Emulated App
needs: verify-build
runs-on: ubuntu-16.04
timeout-minutes: 20
strategy:
# Keep all in-progress jobs running if any matrix job fails. Needed to prevent
# the Cypress Dashboard from being stuck in "in progress" state since not all tests run.
Expand All @@ -140,7 +142,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 10
node-version: 12

- name: Checkout Repo
uses: actions/checkout@v2
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docs-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
build-deploy:
name: Verify + Build + Deploy
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -25,7 +26,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 10
node-version: 12

- name: Get yarn cache
id: yarn-cache
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/docs-verify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
verify-build:
name: Verify + Build
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
Expand All @@ -22,7 +23,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: 10
node-version: 12

- name: Get yarn cache
id: yarn-cache
Expand Down
65 changes: 25 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
- Action Features include support for:
- Multiple steps allowing many actions in one run
- Backup phase (for easy backing up data before running your actions)
- Custom logic (JS written in the browser with ESNext features like `async/await`)
<!-- - Custom logic (JS written in the browser with ESNext features like `async/await`) -->
- Project level tracking of actions which have been run through Action Runner
- Get/Set CORS Config of Storage Buckets
- Testing for React App (Cypress) and Cloud Functions (Mocha)
Expand All @@ -54,18 +54,17 @@ Since this is source code, a great place to start is checking the [hosted versio

While developing, you will probably rely mostly on `npm start`; however, there are additional scripts at your disposal:

| `npm run <script>` | Description |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------- |
| `start` | Serves your app at `localhost:3000` and displays [Webpack Dashboard](https://github.com/FormidableLabs/webpack-dashboard) |
| `start:simple` | Serves your app at `localhost:3000` without [Webpack Dashboard](https://github.com/FormidableLabs/webpack-dashboard) |
| `start:dist` | Builds the application to ./dist and Serves it at `localhost:3000` using `firebase serve` |
| `functions:start` | Runs Functions locally using `firebase functions:shell` |
| `functions:build` | Builds Cloud Functions to ./functions/dist |
| `functions:test` | Runs Functions Unit Tests with Mocha |
| `build` | Builds the application to ./dist |
| `test` | Runs E2E Tests with Cypress. See [testing](#testing) |
| `lint` | [Lints](http://stackoverflow.com/questions/8503559/what-is-linting) the project for potential errors |
| `lint:fix` | Lints the project and [fixes all correctable errors](http://eslint.org/docs/user-guide/command-line-interface.html#fix) |
| `yarn <script>` | Description |
| ----------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `start` | Serves your app at `localhost:3000` |
| `start:dist` | Builds the application to `./dist` and Serves it at `localhost:3000` using `firebase serve` |
| `functions:start` | Runs Functions REPL locally (uses `firebase functions:shell` |
| `functions:build` | Builds Cloud Functions to `./functions/dist` |
| `functions:test` | Runs Functions Unit Tests with Mocha |
| `build` | Builds the application to `./dist` |
| `test` | Runs E2E Tests with Cypress. See [testing](#testing) |
| `lint` | [Lints](http://stackoverflow.com/questions/8503559/what-is-linting) the project for potential errors |
| `lint:fix` | Lints the project and [fixes all correctable errors](http://eslint.org/docs/user-guide/command-line-interface.html#fix) |

[Husky](https://github.com/typicode/husky) is used to enable `prepush` hook capability. The `prepush` script currently runs `eslint`, which will keep you from pushing if there is any lint within your code. If you would like to disable this, remove the `prepush` script from the `package.json`.

Expand Down Expand Up @@ -168,10 +167,10 @@ While developing, you will probably rely mostly on `npm start`; however, there a
firebase functions:config:set $(jq -r 'to_entries[] | [.key, (.value | tojson)] | join("=")' < functions/.runtimeconfig.json)
```

1. Build Project: `npm run build`
1. Build Project: `yarn build`
1. Deploy to Firebase: `firebase deploy` (deploys, Cloud Functions, Rules, and Hosting)
1. Start Development server: `npm start`
**NOTE:** You can also use `npm run start:dist` to test how your application will work when deployed to Firebase
**NOTE:** You can also use `yarn start:dist` to test how your application will work when deployed to Firebase
1. View the deployed version of the site by running `firebase open hosting:site`

### Deployment
Expand All @@ -198,18 +197,9 @@ For more options on CI settings checkout the [firebase-ci docs](https://github.c
#### Manual deploy
1. Make sure you have created a `src/config.js` file as mentioned above
1. Initialize project with `firebase init` then answer:
- What file should be used for Database Rules? -> `database.rules.json`
- What do you want to use as your public directory? -> `build`
- Configure as a single-page app (rewrite all urls to /index.html)? -> `Yes`
- What Firebase project do you want to associate as default? -> **your Firebase project name**
1. Build Project: `npm run build`
1. Confirm Firebase config by running locally: `firebase serve`
1. Build Project: `yarn build`
1. Deploy to firebase: `firebase deploy`
**NOTE:** You can use `firebase serve` to test how your application will work when deployed to Firebase, but make sure you run `npm run build` first.
**NOTE:** You can use `firebase serve` to test how your application will work when deployed to Firebase, but make sure you run `yarn build` first.
### Docs
Expand All @@ -232,7 +222,7 @@ Cloud Functions Unit tests are written in [Mocha](https://github.com/mochajs/moc
1. Go into the functions folder: `cd functions`
1. Confirm you have dependencies installed: `npm i`
1. Run unit tests: `npm test`
1. To also generate coverage while testing, run `npm run test:cov`
1. To also generate coverage while testing, run `yarn test:cov`
#### App UI Tests
Expand All @@ -243,33 +233,28 @@ End to End tests are done using [Cypress](https://cypress.io) and they live with
1. Create a service account within the Firebase console
1. Save the service account as `serviceAccount.json` within the root of the project
1. Get the UID of the user that you want to use while testing from the Authentication tab of the Firebase console to
1. Create `cyress.env.json` with the following format:
1. Create `cypress.env.json` with the following format:
```json
{
"TEST_UID": "<- user account's UID ->"
}
```
1. Run `npm run start:dist`. This will:
1. Build the React app to the `dist` folder
1. Host the build app on a local server using `firebase serve`
1. In a different terminal tab, run `npm run test:ui`. This will:
1. Create test environment configuration (includes JWT created using service account)
1. Run Cypress tests locally through cli
To Open Cypress's local test runner UI where you can run single tests or all tests use `npm run test:ui:open`.
1. Run `yarn emulators`. This will bootup the emulators (pointed to during testing)
1. In a different terminal yun `yarn start:emulate`. This will bootup the application pointed to the emulators
1. In a different terminal tab, run `yarn test:emulate:run`. This will run Cypress integration tests pointed at emulators (for seeding and verifing)
NOTE: `npm run start:dist` is used to start the local server in the example above for speed while running all tests. If you are developing the application while re-running a single test, or just a few, you can use `npm run start` instead.
To Open Cypress's local test runner UI where you can run single tests or all tests use `yarn test:emulate`.
## FAQ
1. Why node `10.18.0` instead of a newer version?
[Cloud Functions runtime supports `8` or `10`][functions-runtime-url], which is why that is what is used for the CI build version. This will be switched when the functions runtime is updated
1. Why node `12` instead of a newer version?
[Cloud Functions runtime supports up to `12`][functions-runtime-url], which is why that is what is used for the CI build version. This will be switched when the functions runtime is updated
1. Uploading service accounts? Where do they go and how are my service accounts stored?
When uploading a service account, it first goes to a Google Cloud Storage Bucket which [has security rules](/storage.rules) and does not have CORS access. The [copyServiceAccountToFirestore Cloud Function](/functions/src/copyServiceAccountToFirestore) converts it into an encrypted string, stores it within Firestore, then removes the original file from Cloud Storage. Firestore rules keep anyone that is not a collaborator on your project using or reading the service account. Since it is associated with a specific environment, you can then limit access to what can be done with it right in the Users/Permissions tab of Fireadmin.
[functions-runtime-url]: https://cloud.google.com/functions/docs/concepts/exec
[functions-runtime-url]: https://cloud.google.com/functions/docs/concepts/nodejs-runtime
[build-status-url]: https://github.com/prescottprue/fireadmin/actions
[build-status-image]: https://img.shields.io/github/workflow/status/prescottprue/fireadmin/Verify%20App?style=flat-square
[cypress-dashboard-image]: https://img.shields.io/static/v1?label=Cypress&message=Dashboard&color=00BF88&style=flat-square
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/Project/Environments.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('Project - Environments Page', () => {
// Type in new environment url
cy.get(createSelector('new-environment-db-url'))
.find('input')
.type(`https://some-project.firebaseio.com`, { delay: 0 })
.type('some-project', { delay: 0 })

// Upload service account
cy.uploadFile(
Expand Down
2 changes: 1 addition & 1 deletion docs/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module.exports = {
plugins: ['import', 'babel', 'react', 'react-hooks', 'prettier'],
settings: {
react: {
version: '16.11'
version: '16.18'
},
'import/resolver': {
node: {
Expand Down
2 changes: 1 addition & 1 deletion docs/data/siteConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
authorAvatar: '/images/avatar.png',
authorDescription:
'Mechanical/Aerospace engineer turned fullstack javascript developer. Author of react-redux-firebase, redux-firestore and other tools.',
siteUrl: 'fireadmin.io',
siteUrl: 'https://docs.fireadmin.io',
// Prefixes all links
pathPrefix: '/docs', // Note: it must *not* have a trailing slash.
siteCover: '/images/cover.jpg',
Expand Down
43 changes: 18 additions & 25 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,20 @@
"develop": "gatsby develop -p $npm_package_config_port",
"serve": "firebase serve --only hosting:docs -p $npm_package_config_port",
"build": "gatsby build",
"deploy": "firebase-ci deploy --only",
"fix-semi": "eslint --quiet --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix gatsby-node.js",
"prepush": "npm run lint"
"fix-semi": "eslint --quiet --parser babel-eslint --no-eslintrc --rule '{\"semi\": [2, \"never\"], \"no-extra-semi\": [2]}' --fix gatsby-node.js"
},
"dependencies": {
"@material-ui/core": "^4.9.14",
"@material-ui/icons": "^4.9.1",
"lodash": "^4.17.15",
"lodash": "^4.17.19",
"prismjs": "^1.20.0",
"prop-types": "^15.7.2",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-helmet": "^5.2.0"
},
"devDependencies": {
"babel-eslint": "^10.1.0",
"cross-env": "^7.0.2",
"eslint": "^7.0.0",
"eslint-config-prettier": "^6.5.0",
Expand All @@ -42,23 +41,23 @@
"eslint-plugin-react": "^7.19.0",
"eslint-plugin-react-hooks": "^3.0.0",
"eslint-plugin-standard": "^4.0.0",
"gatsby": "^2.0.97",
"gatsby-plugin-google-analytics": "2.0.8",
"gatsby": "^2.24.11",
"gatsby-plugin-google-analytics": "2.3.13",
"gatsby-plugin-lodash": "^3.0.3",
"gatsby-plugin-manifest": "^2.0.11",
"gatsby-plugin-manifest": "^2.4.21",
"gatsby-plugin-offline": "^2.0.19",
"gatsby-plugin-react-helmet": "3.0.4",
"gatsby-plugin-react-helmet": "3.3.10",
"gatsby-plugin-root-import": "^2.0.5",
"gatsby-plugin-sharp": "2.0.15",
"gatsby-remark-autolink-headers": "^2.0.12",
"gatsby-remark-copy-linked-files": "2.0.7",
"gatsby-remark-images": "3.0.1",
"gatsby-remark-prismjs": "3.1.4",
"gatsby-remark-responsive-iframe": "2.0.7",
"gatsby-remark-smartypants": "2.0.7",
"gatsby-source-filesystem": "2.0.12",
"gatsby-transformer-remark": "2.1.15",
"gatsby-transformer-sharp": "2.1.9",
"gatsby-plugin-sharp": "2.6.22",
"gatsby-remark-autolink-headers": "^2.3.11",
"gatsby-remark-copy-linked-files": "2.3.11",
"gatsby-remark-images": "3.3.21",
"gatsby-remark-prismjs": "3.5.10",
"gatsby-remark-responsive-iframe": "2.4.11",
"gatsby-remark-smartypants": "2.3.10",
"gatsby-source-filesystem": "2.3.23",
"gatsby-transformer-remark": "2.8.27",
"gatsby-transformer-sharp": "2.5.11",
"prettier": "^2.0.5",
"rimraf": "^3.0.0",
"webpack": "^4.41.2"
Expand All @@ -71,11 +70,5 @@
"type": "git",
"url": "git+https://github.com/prescottprue/fireadmin.git"
},
"keywords": [
"fireadmin"
],
"license": "MIT",
"engines": {
"node": ">= 8.12.0"
}
"license": "MIT"
}
Loading

0 comments on commit d372b4a

Please sign in to comment.