Skip to content

Commit b2ce812

Browse files
committed
create template
0 parents  commit b2ce812

24 files changed

+7990
-0
lines changed

.babelrc.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
const stages = require('./babelStages');
2+
module.exports = {
3+
presets: [
4+
[
5+
'@babel/preset-env',
6+
{
7+
targets: {
8+
esmodules: true
9+
}
10+
}
11+
],
12+
'@babel/preset-react'
13+
],
14+
plugins: [
15+
...stages.Stage1,
16+
...stages.Stage2,
17+
...stages.Stage3,
18+
]
19+
};

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/dist/*

.eslintrc.js

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
module.exports = {
2+
parser: 'babel-eslint',
3+
parserOptions: {
4+
ecmaVersion: 2017,
5+
ecmaFeatures: {
6+
experimentalObjectRestSpread: true,
7+
experimentalDecorators: true,
8+
jsx: true
9+
},
10+
sourceType: 'module'
11+
},
12+
env: {
13+
browser: true,
14+
node: true,
15+
es6: true
16+
},
17+
ecmaFeatures: {
18+
jsx: true
19+
},
20+
rules: {
21+
strict: [2, 'never'],
22+
'prettier/prettier': 'warn',
23+
},
24+
plugins: [
25+
'flowtype',
26+
'babel',
27+
'prettier',
28+
'html'
29+
],
30+
extends: [
31+
"plugin:flowtype/recommended"
32+
],
33+
};

.gitignore

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
8+
# Runtime data
9+
pids
10+
*.pid
11+
*.seed
12+
*.pid.lock
13+
14+
# Directory for instrumented libs generated by jscoverage/JSCover
15+
lib-cov
16+
17+
# Coverage directory used by tools like istanbul
18+
coverage
19+
20+
# nyc test coverage
21+
.nyc_output
22+
23+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
24+
.grunt
25+
26+
# Bower dependency directory (https://bower.io/)
27+
bower_components
28+
29+
# node-waf configuration
30+
.lock-wscript
31+
32+
# Compiled binary addons (https://nodejs.org/api/addons.html)
33+
build/Release
34+
35+
# Dependency directories
36+
node_modules/*
37+
jspm_packages/
38+
39+
40+
# Typescript v1 declaration files
41+
typings/
42+
43+
# Optional npm cache directory
44+
.npm
45+
46+
# Optional eslint cache
47+
.eslintcache
48+
49+
# Optional REPL history
50+
.node_repl_history
51+
52+
# Output of 'npm pack'
53+
*.tgz
54+
55+
# Yarn Integrity file
56+
.yarn-integrity
57+
58+
# dotenv environment variables file
59+
.env
60+
61+
# next.js build output
62+
.next
63+
dist/
64+
libs/
65+
66+
user-config.js

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"tabWidth": 4
4+
}

.vscode/arduino.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"board": "esp8266:esp8266:huzzah",
3+
"configuration": "xtal=80,vt=flash,exception=disabled,eesz=4M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200",
4+
"port": "COM3"
5+
}

.vscode/c_cpp_properties.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "Win32",
5+
"includePath": [
6+
"C:\\Users\\Igor\\AppData\\Local\\Arduino15\\packages\\esp8266\\tools\\**",
7+
"C:\\Users\\Igor\\AppData\\Local\\Arduino15\\packages\\esp8266\\hardware\\esp8266\\2.5.0\\**"
8+
],
9+
"forcedInclude": []
10+
}
11+
]
12+
}

babelStages.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
module.exports = {
2+
Stage1: [
3+
'@babel/plugin-proposal-export-default-from',
4+
'@babel/plugin-proposal-logical-assignment-operators',
5+
['@babel/plugin-proposal-optional-chaining', { loose: false }],
6+
['@babel/plugin-proposal-pipeline-operator', { proposal: 'minimal' }],
7+
[
8+
'@babel/plugin-proposal-nullish-coalescing-operator',
9+
{ loose: false }
10+
],
11+
'@babel/plugin-proposal-do-expressions'
12+
],
13+
Stage2: [
14+
['@babel/plugin-proposal-decorators', { legacy: true }],
15+
'@babel/plugin-proposal-function-sent',
16+
'@babel/plugin-proposal-export-namespace-from',
17+
'@babel/plugin-proposal-numeric-separator',
18+
'@babel/plugin-proposal-throw-expressions'
19+
],
20+
Stage3: [
21+
'@babel/plugin-syntax-dynamic-import',
22+
'@babel/plugin-syntax-import-meta',
23+
['@babel/plugin-proposal-class-properties', { loose: true }],
24+
'@babel/plugin-proposal-json-strings'
25+
]
26+
};

jsconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES6",
4+
"module": "commonjs",
5+
"experimentalDecorators": true,
6+
//"checkJs": true,
7+
"allowSyntheticDefaultImports": true,
8+
"jsx": "react",
9+
},
10+
"exclude": [
11+
"node_modules",
12+
"**/node_modules/*"
13+
]
14+
}

package.json

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"name": "dji-log-parser-js",
3+
"version": "0.0.1",
4+
"description": "",
5+
"main": "index.js",
6+
"scripts": {
7+
"build-prod": "webpack --mode production --config webpack.config.prod.babel.js",
8+
"test-prod": "set NODE_ENV=production && yarn build-prod && babel-node server.js",
9+
"build-dev": "webpack --mode development --config webpack.config.dev.babel.js",
10+
"build-server": "webpack --mode development --config webpack.config.server.babel.js",
11+
"test": "set NODE_ENV=development && yarn build-dev && babel-node server.js",
12+
"test2": "set NODE_ENV=development && yarn build-dev && yarn build-server && nodemon ./dist/bundle.server.js"
13+
},
14+
"author": "Igor Kilipenko <igorkili@mail.ru>",
15+
"license": "ISC",
16+
"devDependencies": {
17+
"@babel/cli": "^7.4.4",
18+
"@babel/core": "^7.4.5",
19+
"@babel/node": "^7.4.5",
20+
"@babel/plugin-proposal-class-properties": "^7.4.4",
21+
"@babel/plugin-proposal-decorators": "^7.4.4",
22+
"@babel/plugin-proposal-do-expressions": "^7.2.0",
23+
"@babel/plugin-proposal-export-default-from": "^7.2.0",
24+
"@babel/plugin-proposal-export-namespace-from": "^7.2.0",
25+
"@babel/plugin-proposal-function-sent": "^7.2.0",
26+
"@babel/plugin-proposal-json-strings": "^7.2.0",
27+
"@babel/plugin-proposal-logical-assignment-operators": "^7.2.0",
28+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.4.4",
29+
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
30+
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
31+
"@babel/plugin-proposal-optional-chaining": "^7.2.0",
32+
"@babel/plugin-proposal-pipeline-operator": "^7.3.2",
33+
"@babel/plugin-proposal-throw-expressions": "^7.2.0",
34+
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
35+
"@babel/plugin-syntax-import-meta": "^7.2.0",
36+
"@babel/preset-env": "^7.4.5",
37+
"@babel/preset-react": "^7.0.0",
38+
"@babel/preset-stage-0": "^7.0.0",
39+
"@babel/register": "^7.4.4",
40+
"@svgr/webpack": "^4.2.0",
41+
"autoprefixer": "^9.5.1",
42+
"babel-eslint": "^10.0.1",
43+
"babel-loader": "^8.0.6",
44+
"clean-webpack-plugin": "^2.0.2",
45+
"eslint": "^5.16.0",
46+
"eslint-plugin-babel": "^5.3.0",
47+
"eslint-plugin-html": "^5.0.5",
48+
"eslint-plugin-import": "^2.17.2",
49+
"eslint-plugin-prettier": "^3.1.0",
50+
"file-loader": "^3.0.1",
51+
"html-webpack-plugin": "^3.2.0",
52+
"precss": "^4.0.0",
53+
"prettier": "^1.17.1",
54+
"react-hot-loader": "^4.8.7",
55+
"url-loader": "^1.1.2",
56+
"webpack": "^4.32.1",
57+
"webpack-cli": "^3.3.2",
58+
"webpack-dev-middleware": "^3.7.0",
59+
"webpack-hot-middleware": "^2.25.0",
60+
"webpack-merge": "^4.2.1"
61+
},
62+
"dependencies": {
63+
"@babel/polyfill": "^7.4.4",
64+
"@material-ui/core": "^4.0.0",
65+
"@material-ui/icons": "^4.0.0",
66+
"express": "^4.17.0",
67+
"react": "^16.8.6",
68+
"react-dom": "^16.8.6",
69+
"react-helmet": "^5.2.1",
70+
"cors": "^2.8.5",
71+
"react-router-dom": "^5.0.0"
72+
}
73+
}

server.js

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
import express from 'express';
2+
import path from 'path';
3+
import cors from 'cors';
4+
5+
const PORT = 7705;
6+
const PUBLIC_PATH = __dirname + '/dist';
7+
8+
const app = express();
9+
10+
app.use(cors());
11+
const isDevelopment =
12+
process.env.NODE_ENV && process.env.NODE_ENV.trim() !== 'production';
13+
14+
console.log('WEBPACK_MODE :' + process.env.NODE_ENV);
15+
console.log(typeof process.env.NODE_ENV);
16+
console.log('isDevelopment :' + isDevelopment);
17+
18+
if (isDevelopment) {
19+
const webpack = require('webpack');
20+
const webpackConfig = require('./webpack.config.dev.babel');
21+
webpackConfig.mode = 'development';
22+
const compiler = webpack(webpackConfig);
23+
console.log(webpackConfig.output);
24+
console.log(webpackConfig.entry);
25+
app.use(
26+
require('webpack-dev-middleware')(compiler, {
27+
contentBase: './dist',
28+
host: 'loclahost',
29+
hot: true,
30+
stats: {
31+
colors: true
32+
},
33+
publicPath: webpackConfig.output.publicPath
34+
})
35+
);
36+
app.use(
37+
require('webpack-hot-middleware')(compiler, {
38+
publicPath: webpackConfig.output.publicPath,
39+
//path: '/__webpack_hmr',
40+
})
41+
);
42+
app.use('*', (req, res, next) => {
43+
const filename = path.resolve(compiler.outputPath, 'index.html');
44+
compiler.outputFileSystem.readFile(filename, (err, result) => {
45+
if (err) {
46+
return next(err);
47+
}
48+
res.set('content-type', 'text/html');
49+
res.send(result);
50+
res.end();
51+
});
52+
});
53+
} else {
54+
app.use(express.static(PUBLIC_PATH));
55+
}
56+
57+
//app.use(express.static(PUBLIC_PATH));
58+
59+
app.all('*', function(req, res) {
60+
res.sendFile(path.resolve(PUBLIC_PATH, 'index.html'));
61+
});
62+
63+
app.listen(PORT, function() {
64+
console.log('Listening on port ' + PORT + '...');
65+
});

src/client/components/HideOnScroll.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
import { withStyles } from '@material-ui/core/styles';
4+
import useScrollTrigger from '@material-ui/core/useScrollTrigger';
5+
import Slide from '@material-ui/core/Slide';
6+
7+
const styles = theme => ({
8+
9+
})
10+
11+
const HideOnScroll = props => {
12+
const { children } = props;
13+
const trigger = useScrollTrigger();
14+
15+
return (
16+
<Slide appear={false} direction="down" in={!trigger}>
17+
{children}
18+
</Slide>
19+
);
20+
};
21+
22+
HideOnScroll.propTypes = {
23+
children: PropTypes.node.isRequired
24+
}
25+
26+
export default withStyles(styles, { withTheme: true })(HideOnScroll);
27+

src/client/components/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import HideOnScroll from './HideOnScroll';
2+
3+
4+
export {
5+
HideOnScroll
6+
}

src/client/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<html>
2+
<head> </head>
3+
4+
<body>
5+
<div id="app">
6+
<div
7+
style="position: absolute;width:300px;height:200px;top:50%;left:50%;margin:-100px 0 0 -150px;"
8+
>
9+
<h2>DJI LOG PARSER</h2>
10+
<p>Loading....</p>
11+
</div>
12+
</div>
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)