Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the integration with Firebase #25

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
env: {
browser: true,
es2021: true
},
extends: [
'standard',
'plugin:react/recommended'
],
overrides: [
{
env: {
node: true
},
files: [
'.eslintrc.{js,cjs}'
],
parserOptions: {
sourceType: 'script'
}
}
],
parserOptions: {
ecmaVersion: 'latest',
sourceType: 'module'
},
plugins: [
'react'
],
rules: {
}
}
5 changes: 5 additions & 0 deletions .firebaserc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"projects": {
"default": "lofty-equinox-416801"
}
}
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,9 @@ tests\ and\ raw\ models

*.duplicate.*

.idea
.vs
.firebase
*.hot-update.js
*.hot-update.json
public/static/bundle*
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# turing-machine
# Turing Machine
A web based Turing Machine simulator

# Firebase
1. Follow https://firebase.google.com/docs/cli#initialize_a_firebase_project
2. Run `firebase login`
3. Fill in `firebaseProjectId` in /config/config.js.

# Dev
1. Run `npm run backend`, which starts a local firebase emulator.
2. Run `npm run dev`, which watches for dependency changes and builds app.
3. The app will be hosted locally http://localhost:5000.

# Production
1. Run `npm run pre-deploy` for preview.
2. Run `npm run deploy` to rollout production release.
10 changes: 10 additions & 0 deletions config/config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const Config = {
dev: {
firebaseProjectId: '',
},
prod: {
firebaseProjectId: '',
},
};

module.exports = Config;
7 changes: 6 additions & 1 deletion config/webpack.config.development.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path')
var webpack = require('webpack')
var config = require('./config.js')

process.noDeprecation = true;
module.exports = {
Expand All @@ -11,11 +12,15 @@ module.exports = {
path.resolve(__dirname, '../src/client/index.js')
],
output: {
path: path.join(__dirname, 'dist'),
path: path.join(__dirname, '../public/static'),
filename: 'bundle.js',
publicPath: '/static/'
},
plugins: [
new webpack.DefinePlugin({
ENV: JSON.stringify('development'),
FIREBASE_PROJECT_ID: JSON.stringify(config.dev.firebaseProjectId)
}),
new webpack.HotModuleReplacementPlugin(),
],
module: {
Expand Down
5 changes: 4 additions & 1 deletion config/webpack.config.production.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
var path = require('path')
var webpack = require('webpack')
var config = require('./config.js')

process.noDeprecation = true;
module.exports = {
Expand All @@ -16,7 +17,9 @@ module.exports = {
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
'process.env.NODE_ENV': JSON.stringify('production'),
ENV: JSON.stringify('production'),
FIREBASE_PROJECT_ID: JSON.stringify(config.prod.firebaseProjectId)
}),
new webpack.HotModuleReplacementPlugin(),
new webpack.optimize.UglifyJsPlugin({
Expand Down
7 changes: 7 additions & 0 deletions database.rules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
/* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */
"rules": {
".read": true,
".write": true
}
}
1 change: 0 additions & 1 deletion deploy.sh

This file was deleted.

35 changes: 35 additions & 0 deletions firebase.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"database": {
"rules": "database.rules.json"
},
"hosting": {
"public": "public",
"rewrites": [ {
"source": "**",
"destination": "/index.html"
}],
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
},
"emulators": {
"auth": {
"port": 9099
},
"firestore": {
"port": 8080
},
"database": {
"port": 9000
},
"hosting": {
"port": 5000
},
"ui": {
"enabled": true
},
"singleProjectMode": true
}
}
Loading