mirror of
https://github.com/cupcakearmy/rauchmelder.git
synced 2024-12-22 08:06:30 +00:00
Rauchmelder
This commit is contained in:
commit
958c051298
48
.drone.yml
Normal file
48
.drone.yml
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
kind: pipeline
|
||||||
|
name: default
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: install
|
||||||
|
image: node:11-alpine
|
||||||
|
commands:
|
||||||
|
- node -v
|
||||||
|
- npm -v
|
||||||
|
- npm i
|
||||||
|
|
||||||
|
- name: build
|
||||||
|
image: node:11-alpine
|
||||||
|
commands:
|
||||||
|
- npm run build:prod
|
||||||
|
|
||||||
|
- name: copy
|
||||||
|
image: appleboy/drone-scp
|
||||||
|
environment:
|
||||||
|
PLUGIN_KEY:
|
||||||
|
from_secret: ssh_key
|
||||||
|
settings:
|
||||||
|
host: nicco.io
|
||||||
|
username: root
|
||||||
|
port: 1312
|
||||||
|
target: /srv/web/home
|
||||||
|
source:
|
||||||
|
- ./public
|
||||||
|
- ./docker-compose.yml
|
||||||
|
- ./docker-compose.prod.yml
|
||||||
|
when:
|
||||||
|
event: push
|
||||||
|
branch: master
|
||||||
|
|
||||||
|
|
||||||
|
- name: run
|
||||||
|
image: appleboy/drone-ssh
|
||||||
|
environment:
|
||||||
|
PLUGIN_KEY:
|
||||||
|
from_secret: ssh_key
|
||||||
|
settings:
|
||||||
|
host: nicco.io
|
||||||
|
username: root
|
||||||
|
port: 1312
|
||||||
|
script:
|
||||||
|
- cd /srv/web/home
|
||||||
|
- docker-compose -f docker-compose.yml -f docker-compose.prod.yml down
|
||||||
|
- docker-compose -f docker-compose.yml -f docker-compose.prod.yml up -d
|
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
node_modules
|
||||||
|
public
|
||||||
|
|
||||||
|
.idea
|
||||||
|
.vscode
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2018 Nicco
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
16
docker-compose.prod.yml
Normal file
16
docker-compose.prod.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
home:
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
labels:
|
||||||
|
- traefik.enable=true
|
||||||
|
- traefik.port=80
|
||||||
|
- traefik.docker.network=traefik
|
||||||
|
- traefik.backend=rauchmelder
|
||||||
|
- traefik.frontend.rule=Host:rauchmelder.nicco.io
|
||||||
|
|
||||||
|
networks:
|
||||||
|
traefik:
|
||||||
|
external: true
|
10
docker-compose.yml
Normal file
10
docker-compose.yml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
version: '3'
|
||||||
|
|
||||||
|
services:
|
||||||
|
home:
|
||||||
|
image: nginx:alpine
|
||||||
|
restart: always
|
||||||
|
ports:
|
||||||
|
- 80
|
||||||
|
volumes:
|
||||||
|
- ./public:/usr/share/nginx/html:ro
|
30
package.json
Executable file
30
package.json
Executable file
@ -0,0 +1,30 @@
|
|||||||
|
{
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"build:dev": "webpack -d",
|
||||||
|
"build:prod": "webpack -p",
|
||||||
|
"dev": "webpack-dev-server -d"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"moment": "^2.24.0",
|
||||||
|
"react": "^16.8",
|
||||||
|
"react-dom": "^16.8",
|
||||||
|
"react-fittext": "^1.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/react": "^16.8",
|
||||||
|
"@types/react-dom": "^16.8",
|
||||||
|
"awesome-typescript-loader": "^5",
|
||||||
|
"css-loader": "^2",
|
||||||
|
"file-loader": "^3",
|
||||||
|
"html-webpack-plugin": "^3",
|
||||||
|
"mini-css-extract-plugin": "^0.5.0",
|
||||||
|
"style-loader": "^0",
|
||||||
|
"stylus": "^0",
|
||||||
|
"stylus-loader": "^3",
|
||||||
|
"typescript": "^3.3.3",
|
||||||
|
"webpack": "^4",
|
||||||
|
"webpack-cli": "^3",
|
||||||
|
"webpack-dev-server": "^3.1.14"
|
||||||
|
}
|
||||||
|
}
|
42
src/App.styl
Normal file
42
src/App.styl
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
@import url('https://fonts.googleapis.com/css?family=PT+Sans')
|
||||||
|
|
||||||
|
*
|
||||||
|
box-sizing border-box
|
||||||
|
|
||||||
|
html
|
||||||
|
body
|
||||||
|
#root
|
||||||
|
margin 0
|
||||||
|
padding 0
|
||||||
|
width 100vw
|
||||||
|
height 100vh
|
||||||
|
overflow hidden
|
||||||
|
font-family 'PT Sans', sans-serif
|
||||||
|
font-weight bold
|
||||||
|
|
||||||
|
#app
|
||||||
|
height: 100%
|
||||||
|
width: 100%
|
||||||
|
//background-color #eeffee
|
||||||
|
background linear-gradient(45deg, #111, #222)
|
||||||
|
color #fff
|
||||||
|
display flex
|
||||||
|
justify-content center
|
||||||
|
align-items center
|
||||||
|
text-align center
|
||||||
|
|
||||||
|
@media (min-width: 0px)
|
||||||
|
#text
|
||||||
|
font-size 3em
|
||||||
|
#title
|
||||||
|
font-size 2em
|
||||||
|
@media (min-width: 900px)
|
||||||
|
#text
|
||||||
|
font-size 4em
|
||||||
|
#title
|
||||||
|
font-size 3em
|
||||||
|
@media (min-width: 1200px)
|
||||||
|
#text
|
||||||
|
font-size 5em
|
||||||
|
#title
|
||||||
|
font-size 4em
|
31
src/App.tsx
Normal file
31
src/App.tsx
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
import moment from 'moment'
|
||||||
|
import React, { useEffect, useState } from 'react'
|
||||||
|
// @ts-ignore
|
||||||
|
|
||||||
|
|
||||||
|
const App: React.FC = () => {
|
||||||
|
|
||||||
|
const [refresh, setRefresh] = useState<number>(0)
|
||||||
|
|
||||||
|
const gloryTime = moment('2019-02-12').unix()
|
||||||
|
const now = Date.now() / 1000 | 0
|
||||||
|
const delta = moment.duration(now - gloryTime, 'seconds')
|
||||||
|
|
||||||
|
useEffect(()=> {
|
||||||
|
setTimeout(()=> setRefresh(refresh + 1), 1000)
|
||||||
|
}, [refresh])
|
||||||
|
|
||||||
|
return <div id="app">
|
||||||
|
<div>
|
||||||
|
<div id={'title'}>Rauchmelder 💨</div>
|
||||||
|
<br/>
|
||||||
|
<div id={'text'}>
|
||||||
|
{delta.humanize()}
|
||||||
|
<br/>
|
||||||
|
{delta.asSeconds()}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
|
||||||
|
export default App
|
14
src/index.html
Executable file
14
src/index.html
Executable file
@ -0,0 +1,14 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
|
||||||
|
<head>
|
||||||
|
<title>💨</title>
|
||||||
|
<meta charset="utf-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<main id="root"></main>
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
7
src/index.tsx
Executable file
7
src/index.tsx
Executable file
@ -0,0 +1,7 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import ReactDOM from 'react-dom'
|
||||||
|
|
||||||
|
import './App.styl'
|
||||||
|
import App from './App'
|
||||||
|
|
||||||
|
ReactDOM.render(<App />, document.getElementById('root'))
|
60
tsconfig.json
Normal file
60
tsconfig.json
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
/* Basic Options */
|
||||||
|
"target": "esnext", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
|
||||||
|
"module": "esnext", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||||
|
// "lib": [], /* Specify library files to be included in the compilation. */
|
||||||
|
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||||
|
// "checkJs": true, /* Report errors in .js files. */
|
||||||
|
"jsx": "react", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||||
|
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||||
|
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||||
|
// "sourceMap": true, /* Generates corresponding '.map' file. */
|
||||||
|
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||||
|
// "outDir": "./", /* Redirect output structure to the directory. */
|
||||||
|
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||||
|
// "composite": true, /* Enable project compilation */
|
||||||
|
"removeComments": true, /* Do not emit comments to output. */
|
||||||
|
// "noEmit": true, /* Do not emit outputs. */
|
||||||
|
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||||
|
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||||
|
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||||
|
|
||||||
|
/* Strict Type-Checking Options */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||||
|
"strictNullChecks": true, /* Enable strict null checks. */
|
||||||
|
"strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||||
|
"strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||||
|
"strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||||
|
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||||
|
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||||
|
|
||||||
|
/* Additional Checks */
|
||||||
|
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||||
|
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||||
|
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||||
|
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||||
|
|
||||||
|
/* Module Resolution Options */
|
||||||
|
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||||
|
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||||
|
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||||
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||||
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||||
|
// "types": [], /* Type declaration files to be included in compilation. */
|
||||||
|
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||||
|
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||||
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||||
|
|
||||||
|
/* Source Map Options */
|
||||||
|
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||||
|
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||||
|
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||||
|
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||||
|
|
||||||
|
/* Experimental Options */
|
||||||
|
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||||
|
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||||
|
}
|
||||||
|
}
|
65
webpack.config.js
Executable file
65
webpack.config.js
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
const path = require('path')
|
||||||
|
|
||||||
|
const HtmlWebpackPlugin = require('html-webpack-plugin')
|
||||||
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
entry: [
|
||||||
|
'./index.tsx'
|
||||||
|
],
|
||||||
|
output: {
|
||||||
|
filename: 'bundle.js',
|
||||||
|
path: path.resolve(__dirname, 'public')
|
||||||
|
},
|
||||||
|
resolve: {
|
||||||
|
extensions: ['.js', '.jsx', '.ts', '.tsx']
|
||||||
|
},
|
||||||
|
context: path.resolve(__dirname, 'src'),
|
||||||
|
devServer: {
|
||||||
|
contentBase: path.resolve(__dirname, 'public/assets'),
|
||||||
|
open: true,
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
new HtmlWebpackPlugin({
|
||||||
|
template: 'index.html'
|
||||||
|
}),
|
||||||
|
new MiniCssExtractPlugin({
|
||||||
|
filename: 'bundle.css'
|
||||||
|
})
|
||||||
|
],
|
||||||
|
stats: {
|
||||||
|
assets: true,
|
||||||
|
assetsSort: 'size',
|
||||||
|
all: false,
|
||||||
|
errors: true,
|
||||||
|
colors: true,
|
||||||
|
performance: true,
|
||||||
|
timings: true,
|
||||||
|
},
|
||||||
|
module: {
|
||||||
|
rules: [{
|
||||||
|
test: /\.tsx?$/,
|
||||||
|
loader: 'awesome-typescript-loader',
|
||||||
|
},
|
||||||
|
// {
|
||||||
|
// test: /\.html$/,
|
||||||
|
// use: ['html-loader']
|
||||||
|
// },
|
||||||
|
{
|
||||||
|
test: /\.css$/,
|
||||||
|
use: [MiniCssExtractPlugin.loader, 'css-loader']
|
||||||
|
}, {
|
||||||
|
test: /\.styl$/,
|
||||||
|
use: [MiniCssExtractPlugin.loader, 'css-loader', 'stylus-loader'],
|
||||||
|
}, {
|
||||||
|
test: /\.(jpg|png|gif|svg|woff2?|ttf|eot|svg|otf)$/,
|
||||||
|
use: [{
|
||||||
|
loader: 'file-loader',
|
||||||
|
options: {
|
||||||
|
name: '[name].[ext]',
|
||||||
|
outputPath: './assets/',
|
||||||
|
},
|
||||||
|
}],
|
||||||
|
}]
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user