Skip to content

Commit

Permalink
[MMB-195] Rewrite spaces demo into React (#92)
Browse files Browse the repository at this point in the history
Rewrite the Spaces demo into React.

---------

Co-authored-by: Dominik Piatek <dominik.piatek@ably.com>
  • Loading branch information
snikidev and Dominik Piatek authored Aug 7, 2023
1 parent 3d4c7bb commit c84252f
Show file tree
Hide file tree
Showing 74 changed files with 34,362 additions and 3,664 deletions.
1 change: 1 addition & 0 deletions demo/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ABLY_API_KEY=
20 changes: 20 additions & 0 deletions demo/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"env": {
"es6": true,
"node": true,
"browser": true
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"sourceType": "module"
},
"plugins": ["import"],
"overrides": [
{
"files": ["**/*.{ts,tsx}"],
"rules": {
"import/extensions": ["off"]
}
}
]
}
20 changes: 0 additions & 20 deletions demo/.eslintrc.js

This file was deleted.

24 changes: 24 additions & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
6 changes: 4 additions & 2 deletions demo/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ An app showcasing the usage of different multiplayer features enabled by the spa

First, create a `.env` file in this folder, based on the `.env.example`. You will need environment variables listed in there.

You will need [node.js](https://nodejs.org/en/) & the [netlify cli](https://docs.netlify.com/cli/get-started/) installed. The demo has separate dependencies to the library, you will need to run `npm install` in this folder as well as the root one.
You will need [node.js](https://nodejs.org/en/). The demo has separate dependencies to the library, you will need to run `npm install` in this folder as well as the root one.

To run the development server, do `npm run start`. This will start a Netlify dev server, and will make sure the auth endpoint in `api` works correctly locally.

## Deployment

To deploy, you will need access to the Ably Netlify account. If you have that, [login to Netlify on your machine with the CLI](https://docs.netlify.com/cli/get-started/#obtain-a-token-with-the-command-line). The run `npm run deploy` to deploy a test site and `npm run deploy:production` to deploy the production site.
To deploy, you will need access to the Ably Netlify account. Run `npx netlify login` to [login locally](https://docs.netlify.com/cli/get-started/#obtain-a-token-with-the-command-line).

We use Netlify [manual deploys](https://docs.netlify.com/site-deploys/create-deploys/), so do connect the repo to the github repo when prompted by the CLI. Run `npm run deploy` to deploy a test site and `npm run deploy:production` to deploy the production site.
2 changes: 1 addition & 1 deletion demo/api/ably-token-request/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Please see README.md for more details on configuring your Ably API Key.`);
};
}

const clientId = event.queryStringParameters['clientId'] || process.env.DEFAULT_CLIENT_ID || 'NO_CLIENT_ID';
const clientId = event.queryStringParameters?.['clientId'] || process.env.DEFAULT_CLIENT_ID || 'NO_CLIENT_ID';
const client = new Ably.Rest(process.env.ABLY_API_KEY);
const tokenRequestData = await client.auth.createTokenRequest({ clientId: clientId });

Expand Down
2 changes: 1 addition & 1 deletion demo/api/ably-token-request/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "ably token request",
"main": "index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"serve": "netlify functions:serve"
},
"keywords": [
"netlify",
Expand Down
7 changes: 0 additions & 7 deletions demo/app/assets/svg/placeholder-slide-1.svg

This file was deleted.

6 changes: 0 additions & 6 deletions demo/app/assets/svg/placeholder-slide-2.svg

This file was deleted.

6 changes: 0 additions & 6 deletions demo/app/assets/svg/placeholder-slide-3.svg

This file was deleted.

140 changes: 0 additions & 140 deletions demo/app/components/avatar-stack.ts

This file was deleted.

111 changes: 0 additions & 111 deletions demo/app/components/cursors.ts

This file was deleted.

Loading

0 comments on commit c84252f

Please sign in to comment.