Skip to content

Commit

Permalink
Use APP_KEY instead of APP_ID (#6)
Browse files Browse the repository at this point in the history
* build: use APP_KEY instead of APP_ID

close #5

* chore(deps): minor upgrade
  • Loading branch information
swouf authored Jul 26, 2023
1 parent 881af59 commit 5bff983
Show file tree
Hide file tree
Showing 11 changed files with 1,497 additions and 324 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
env:
VITE_PORT: 3000
VITE_API_HOST: http://localhost:3636
VITE_GRAASP_APP_ID: id-1234567890
VITE_GRAASP_APP_KEY: id-1234567890
VITE_MOCK_API: true
VITE_VERSION: cypress-tests
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
# Set environment variables required to perform the build. These are only available to this step
env:
VITE_API_HOST: ${{ secrets.REACT_APP_API_HOST_DEV }}
VITE_GRAASP_APP_ID: ${{ secrets.APP_ID }}
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
VITE_SENTRY_ENV: development
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
VITE_VERSION: ${{ github.sha }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# Set environment variables required to perform the build. These are only available to this step
env:
VITE_API_HOST: ${{ secrets.REACT_APP_API_HOST_PROD }}
VITE_GRAASP_APP_ID: ${{ secrets.APP_ID }}
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
VITE_SENTRY_ENV: production
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
VITE_VERSION: ${{ github.event.client_payload.tag }}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
repository_dispatch:
types: [staging-deployment]


jobs:
deploy-app:
name: Deploy to dev
Expand All @@ -25,7 +24,7 @@ jobs:
# Set environment variables required to perform the build. These are only available to this step
env:
VITE_API_HOST: ${{ secrets.REACT_APP_API_HOST_STAGE }}
VITE_GRAASP_APP_ID: ${{ secrets.APP_ID }}
VITE_GRAASP_APP_KEY: ${{ secrets.APP_KEY }}
VITE_SENTRY_ENV: staging
VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
VITE_VERSION: ${{ github.event.client_payload.tag }}
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ First create a copy of this repo using either the `Use this template` button, or
With `git`:

```bash
git clone
git clone
```

With the [GitHub CLI](https://cli.github.com/):
Expand All @@ -49,7 +49,7 @@ You will have to look rename

If you choose to deploy your app with the provided GitHubActions workflows you will need to create the following secrets:

- `APP_ID`: a UUID v4 that identifies your app
- `APP_KEY`: a UUID v4 that identifies your app
- `SENTRY_DSN`: your Sentry url to report issues and send telemetry

## Installation
Expand All @@ -62,7 +62,7 @@ Create a `.env.development` file with the following content:
VITE_PORT=3005
VITE_API_HOST=localhost
VITE_MOCK_API=true
VITE_GRAASP_APP_ID=45678-677889
VITE_GRAASP_APP_KEY=45678-677889
VITE_VERSION=latest
```

Expand All @@ -74,7 +74,7 @@ Create a `.env.test` file with the following content:
VITE_PORT=3333
VITE_API_HOST=localhost
VITE_MOCK_API=true
VITE_GRAASP_APP_ID=45678-677889
VITE_GRAASP_APP_KEY=45678-677889
VITE_VERSION=latest

# dont open browser
Expand Down
2 changes: 1 addition & 1 deletion cypress/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ module.exports = (on, config) => {
...config.env,
VITE_API_HOST: process.env.VITE_API_HOST,
VITE_MOCK_API: process.env.VITE_MOCK_API,
VITE_GRAASP_APP_ID: process.env.VITE_GRAASP_APP_ID,
VITE_GRAASP_APP_KEY: process.env.VITE_GRAASP_APP_KEY,
VITE_VERSION: process.env.VITE_VERSION,
},
};
Expand Down
34 changes: 17 additions & 17 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
"@emotion/react": "11.11.1",
"@emotion/styled": "11.11.0",
"@graasp/apps-query-client": "2.0.1",
"@graasp/sdk": "1.1.2",
"@graasp/ui": "3.2.4",
"@mui/icons-material": "5.14.0",
"@mui/lab": "5.0.0-alpha.136",
"@mui/material": "5.14.0",
"@sentry/browser": "7.59.2",
"@sentry/react": "7.59.2",
"@sentry/tracing": "7.59.2",
"@tanstack/react-query": "^4.29.25",
"@tanstack/react-query-devtools": "^4.29.25",
"@graasp/sdk": "1.1.3",
"@graasp/ui": "3.2.5",
"@mui/icons-material": "5.14.1",
"@mui/lab": "5.0.0-alpha.137",
"@mui/material": "5.14.2",
"@sentry/browser": "7.60.0",
"@sentry/react": "7.60.0",
"@sentry/tracing": "7.60.0",
"@tanstack/react-query": "^4.32.0",
"@tanstack/react-query-devtools": "^4.32.0",
"@types/node": "17.0.45",
"@types/react": "18.2.15",
"@types/react": "18.2.16",
"@types/react-dom": "18.2.7",
"i18next": "22.5.1",
"immutable": "4.3.1",
Expand Down Expand Up @@ -53,17 +53,17 @@
"cov:report": "open ./coverage/lcov-report/index.html"
},
"devDependencies": {
"@commitlint/cli": "17.6.6",
"@commitlint/config-conventional": "17.6.6",
"@commitlint/cli": "17.6.7",
"@commitlint/config-conventional": "17.6.7",
"@cypress/code-coverage": "3.11.0",
"@trivago/prettier-plugin-sort-imports": "4.1.1",
"@trivago/prettier-plugin-sort-imports": "4.2.0",
"@types/i18n": "0.13.6",
"@types/uuid": "9.0.2",
"@typescript-eslint/eslint-plugin": "5.62.0",
"@typescript-eslint/parser": "5.62.0",
"@vitejs/plugin-react": "^3.1.0",
"concurrently": "8.2.0",
"cypress": "12.17.1",
"cypress": "12.17.2",
"env-cmd": "10.1.0",
"eslint": "8.45.0",
"eslint-config-airbnb": "19.0.4",
Expand All @@ -74,14 +74,14 @@
"eslint-plugin-import": "2.27.5",
"eslint-plugin-jsx-a11y": "6.7.1",
"eslint-plugin-prettier": "4.2.1",
"eslint-plugin-react": "^7.32.2",
"eslint-plugin-react": "^7.33.0",
"eslint-plugin-react-hooks": "4.6.0",
"husky": "8.0.3",
"nyc": "15.1.0",
"prettier": "2.8.8",
"pretty-quick": "3.1.3",
"uuid": "9.0.0",
"vite": "^4.4.4",
"vite": "^4.4.7",
"vite-plugin-checker": "^0.5.6",
"vite-plugin-istanbul": "^4.1.0"
},
Expand Down
4 changes: 2 additions & 2 deletions src/config/env.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const {
VITE_GRAASP_APP_ID,
VITE_GRAASP_APP_KEY,
VITE_VERSION,
VITE_SENTRY_ENV,
VITE_SENTRY_DSN,
Expand All @@ -12,6 +12,6 @@ export const MOCK_API = VITE_MOCK_API === 'true';
export const GA_MEASUREMENT_ID = VITE_GA_MEASUREMENT_ID;
export const API_HOST = VITE_API_HOST;
export const VERSION = VITE_VERSION || 'latest';
export const GRAASP_APP_ID = VITE_GRAASP_APP_ID;
export const GRAASP_APP_KEY = VITE_GRAASP_APP_KEY;
export const SENTRY_ENV = VITE_SENTRY_ENV;
export const SENTRY_DSN = VITE_SENTRY_DSN;
4 changes: 2 additions & 2 deletions src/config/queryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {

import { mockContext } from '@/mocks/db';

import { GRAASP_APP_ID, MOCK_API } from './env';
import { GRAASP_APP_KEY, MOCK_API } from './env';

const {
queryClient,
Expand All @@ -24,7 +24,7 @@ const {
keepPreviousData: true,
// avoid refetching when same data are closely fetched
staleTime: 1000, // ms
GRAASP_APP_ID,
GRAASP_APP_KEY,
targetWindow: MOCK_API
? // build mock parent window given cypress (app) context or mock data
(buildMockParentWindow(
Expand Down
2 changes: 1 addition & 1 deletion src/env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ interface ImportMetaEnv {
readonly VITE_PORT?: number;
readonly VITE_API_HOST: string;
readonly VITE_MOCK_API?: string;
readonly VITE_GRAASP_APP_ID: string;
readonly VITE_GRAASP_APP_KEY: string;
readonly VITE_VERSION?: string;
}

Expand Down
Loading

0 comments on commit 5bff983

Please sign in to comment.