Update dependencies
This commit is contained in:
parent
fb17d1b3f9
commit
a1f46f9904
3
.babelrc
3
.babelrc
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"presets": [
|
"presets": [
|
||||||
"inferno-app",
|
"inferno-app",
|
||||||
["env", {
|
["@babel/env", {
|
||||||
"targets": {
|
"targets": {
|
||||||
"browsers": [
|
"browsers": [
|
||||||
">1%",
|
">1%",
|
||||||
@ -13,7 +13,6 @@
|
|||||||
}]
|
}]
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"external-helpers",
|
|
||||||
["module-resolver", {
|
["module-resolver", {
|
||||||
"root": ["./src"],
|
"root": ["./src"],
|
||||||
"alias": {
|
"alias": {
|
||||||
|
11
.eslintrc
11
.eslintrc
@ -27,9 +27,6 @@
|
|||||||
"properties": "never"
|
"properties": "never"
|
||||||
}],
|
}],
|
||||||
"comma-dangle": ["error", "always-multiline"],
|
"comma-dangle": ["error", "always-multiline"],
|
||||||
"import/extensions": "on",
|
|
||||||
"import/no-extraneous-dependencies": "off",
|
|
||||||
"import/no-unresolved": [2, { "ignore": ["electron"] }],
|
|
||||||
"jsx-quotes": ["error", "prefer-double"],
|
"jsx-quotes": ["error", "prefer-double"],
|
||||||
"linebreak-style": "off",
|
"linebreak-style": "off",
|
||||||
"multiline-ternary": ["error", "always-multiline"],
|
"multiline-ternary": ["error", "always-multiline"],
|
||||||
@ -54,9 +51,6 @@
|
|||||||
"no-return-assign": "error",
|
"no-return-assign": "error",
|
||||||
"no-return-await": "error",
|
"no-return-await": "error",
|
||||||
"no-self-compare": "error",
|
"no-self-compare": "error",
|
||||||
"no-shadow": ["error", {
|
|
||||||
"builtinGlobals": true
|
|
||||||
}],
|
|
||||||
"no-unneeded-ternary": "error",
|
"no-unneeded-ternary": "error",
|
||||||
"no-unused-expressions": "error",
|
"no-unused-expressions": "error",
|
||||||
"no-use-before-define": "error",
|
"no-use-before-define": "error",
|
||||||
@ -82,10 +76,5 @@
|
|||||||
"require-await": "error",
|
"require-await": "error",
|
||||||
"sort-keys": ["error", "asc", {"caseSensitive": true, "natural": true}],
|
"sort-keys": ["error", "asc", {"caseSensitive": true, "natural": true}],
|
||||||
"yoda": ["error", "never"]
|
"yoda": ["error", "never"]
|
||||||
},
|
|
||||||
"settings": {
|
|
||||||
"import/resolver": {
|
|
||||||
"babel-module": {}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
61
package.json
61
package.json
@ -20,60 +20,64 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"better-sqlite3": "^4.1.1",
|
"better-sqlite3": "^5.3.0",
|
||||||
"electron-log": "^2.2.14",
|
"electron-log": "^2.2.14",
|
||||||
"esm": "^3.0.40",
|
"esm": "^3.0.40",
|
||||||
"exiftool-vendored": "^4.25.0",
|
"exiftool-vendored": "^7.5.0",
|
||||||
"inferno": "^5.0.6",
|
"inferno": "^7.0.5",
|
||||||
"inferno-bootstrap": "^5.0.2",
|
"inferno-bootstrap": "^7.2.0",
|
||||||
"inferno-dev-utils": "^5.3.0",
|
"inferno-dev-utils": "^6.0.4",
|
||||||
"inferno-router": "^5.0.6",
|
"inferno-router": "^7.0.5",
|
||||||
"lodash-es": "^4.17.10",
|
"lodash-es": "^4.17.10",
|
||||||
"ws": "^5.2.0"
|
"ws": "^6.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.0.0-beta.49",
|
"@babel/core": "^7.0.0-beta.49",
|
||||||
"@babel/preset-env": "^7.0.0-beta.49",
|
"@babel/preset-env": "^7.0.0-beta.49",
|
||||||
"babel-eslint": "^8.2.2",
|
"babel-eslint": "^10.0.1",
|
||||||
"babel-jest": "^23.0.1",
|
"babel-jest": "^23.0.1",
|
||||||
"babel-plugin-external-helpers": "^6.22.0",
|
"babel-plugin-external-helpers": "^6.22.0",
|
||||||
"babel-plugin-module-resolver": "^3.1.1",
|
"babel-plugin-module-resolver": "^3.1.1",
|
||||||
"babel-preset-inferno-app": "^7.1.0",
|
"babel-preset-inferno-app": "^8.0.3",
|
||||||
"babel-runtime": "^6.26.0",
|
"babel-runtime": "^6.26.0",
|
||||||
"bootstrap": "^4",
|
"bootstrap": "^4",
|
||||||
"electron": "^2.0.2",
|
"electron": "^4.0.1",
|
||||||
"electron-builder": "^20.15.1",
|
"electron-builder": "^20.15.1",
|
||||||
"electron-devtools-installer": "^2.2.4",
|
"electron-devtools-installer": "^2.2.4",
|
||||||
"eslint": "^4.19.1",
|
"eslint": "^5.12.0",
|
||||||
"eslint-config-happiness": "^10.2.1",
|
"eslint-config-happiness": "^10.2.1",
|
||||||
"eslint-config-inferno-app": "^6.2.0",
|
"eslint-config-inferno-app": "^7.0.2",
|
||||||
"eslint-import-resolver-babel-module": "^4.0.0",
|
"eslint-plugin-import": "^2.14.0",
|
||||||
"eslint-plugin-import": "^2.12.0",
|
|
||||||
"eslint-plugin-inferno": "^7.8.0",
|
"eslint-plugin-inferno": "^7.8.0",
|
||||||
"eslint-plugin-jsx-a11y": "6.0.3",
|
"eslint-plugin-jsx-a11y": "6.1.2",
|
||||||
"eslint-plugin-node": "^6.0.1",
|
"eslint-plugin-node": "^8.0.1",
|
||||||
"eslint-plugin-promise": "^3.8.0",
|
"eslint-plugin-promise": "^4.0.1",
|
||||||
"eslint-plugin-standard": "^3.0.1",
|
"eslint-plugin-standard": "^4.0.0",
|
||||||
"husky": "^0.14.3",
|
"husky": "^1.3.1",
|
||||||
"inferno-devtools": "^5.0.6",
|
"inferno-devtools": "^7.0.5",
|
||||||
"jest": "^23.0.1",
|
"jest": "^23.0.1",
|
||||||
"jquery": "^3.3.1",
|
"jquery": "^3.3.1",
|
||||||
"raf": "^3.4.0",
|
"raf": "^3.4.0",
|
||||||
"rollup": "^0.59.4",
|
"rollup": "^1.1.0",
|
||||||
"rollup-plugin-alias": "^1.4.0",
|
"rollup-plugin-alias": "^1.4.0",
|
||||||
"rollup-plugin-babel": "^3.0.4",
|
"rollup-plugin-babel": "^4.3.0",
|
||||||
"rollup-plugin-commonjs": "^9.1.3",
|
"rollup-plugin-commonjs": "^9.1.3",
|
||||||
"rollup-plugin-copy": "^0.2.3",
|
"rollup-plugin-copy": "^0.2.3",
|
||||||
"rollup-plugin-filesize": "^1.5.0",
|
"rollup-plugin-filesize": "^6.0.0",
|
||||||
"rollup-plugin-livereload": "^0.6.0",
|
"rollup-plugin-livereload": "^0.6.0",
|
||||||
"rollup-plugin-node-resolve": "^3.3.0",
|
"rollup-plugin-node-resolve": "^4.0.0",
|
||||||
"rollup-plugin-replace": "^2.0.0",
|
"rollup-plugin-replace": "^2.0.0",
|
||||||
"rollup-plugin-serve": "^0.4.2",
|
"rollup-plugin-serve": "^1.0.0",
|
||||||
"rollup-plugin-terser": "^1.0.1",
|
"rollup-plugin-terser": "^4.0.2",
|
||||||
"rollup-plugin-uglify": "^4.0.0",
|
"rollup-plugin-uglify": "^6.0.1",
|
||||||
"rollup-plugin-visualizer": "^0.6.0"
|
"rollup-plugin-visualizer": "^0.9.2"
|
||||||
},
|
},
|
||||||
"homepage": "/",
|
"homepage": "/",
|
||||||
|
"husky": {
|
||||||
|
"hooks": {
|
||||||
|
"pre-commit": "yarn lint"
|
||||||
|
}
|
||||||
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "set NODE_ENV=production && rollup --config rollup.prod.js",
|
"build": "set NODE_ENV=production && rollup --config rollup.prod.js",
|
||||||
"dist": "yarn run build && build",
|
"dist": "yarn run build && build",
|
||||||
@ -84,7 +88,6 @@
|
|||||||
"lint": "eslint src/**/*.js",
|
"lint": "eslint src/**/*.js",
|
||||||
"pack": "build --dir",
|
"pack": "build --dir",
|
||||||
"postinstall": "electron-builder install-app-deps",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"precommit": "yarn lint",
|
|
||||||
"test": "node scripts/test.js --env=jsdom"
|
"test": "node scripts/test.js --env=jsdom"
|
||||||
},
|
},
|
||||||
"main": "src/electron/index.js",
|
"main": "src/electron/index.js",
|
||||||
|
@ -3,14 +3,14 @@
|
|||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||||
<link rel="shortcut icon" href="./favicon.ico" />
|
<link rel="shortcut icon" href="/favicon.ico" />
|
||||||
<link rel="stylesheet" href="./css/bootstrap.css" />
|
<link rel="stylesheet" href="/css/bootstrap.css" />
|
||||||
<link rel="stylesheet" href="./css/app.css" />
|
<link rel="stylesheet" href="/css/app.css" />
|
||||||
<title>Inferno App</title>
|
<title>Inferno App</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<film-exif id="app"></film-exif>
|
<film-exif id="app"></film-exif>
|
||||||
<script src="./bundle.js"></script>
|
<script src="/bundle.js"></script>
|
||||||
<noscript>
|
<noscript>
|
||||||
You need to enable JavaScript to run this app.
|
You need to enable JavaScript to run this app.
|
||||||
</noscript>
|
</noscript>
|
||||||
|
@ -17,13 +17,14 @@ export default {
|
|||||||
'public/css/bootstrap.css': 'build/css/bootstrap.css',
|
'public/css/bootstrap.css': 'build/css/bootstrap.css',
|
||||||
'public/css/app.css': 'build/css/app.css',
|
'public/css/app.css': 'build/css/app.css',
|
||||||
}),
|
}),
|
||||||
resolve({
|
resolve(),
|
||||||
jsnext: true,
|
commonjs({
|
||||||
browser: true,
|
include: 'node_modules/**',
|
||||||
|
exclude: 'src/**',
|
||||||
}),
|
}),
|
||||||
babel({
|
babel({
|
||||||
exclude: 'node_modules/**',
|
exclude: 'node_modules/**',
|
||||||
|
runtimeHelpers: true,
|
||||||
}),
|
}),
|
||||||
commonjs(),
|
|
||||||
],
|
],
|
||||||
};
|
};
|
||||||
|
@ -19,10 +19,11 @@ export default {
|
|||||||
...baseConfig.plugins,
|
...baseConfig.plugins,
|
||||||
filesize(),
|
filesize(),
|
||||||
serve({
|
serve({
|
||||||
contentBase: ['./public', './build'],
|
contentBase: ['build', 'public'],
|
||||||
host: 'localhost',
|
host: 'localhost',
|
||||||
headers: {
|
headers: {
|
||||||
'Access-Control-Allow-Origin': '*',
|
'Access-Control-Allow-Origin': '*',
|
||||||
|
'Content-Security-Policy': "default-src 'none'; script-src 'self' localhost:35729 localhost:65432; connect-src 'self' ws://localhost:35729 ws://localhost:65432; img-src 'self' data://*; style-src 'self';",
|
||||||
},
|
},
|
||||||
historyApiFallback: true,
|
historyApiFallback: true,
|
||||||
port: 3000,
|
port: 3000,
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import AnimateModal from 'inferno-bootstrap/dist/Modal/AnimateModal';
|
|
||||||
import Modal from 'inferno-bootstrap/dist/Modal/Modal';
|
import Modal from 'inferno-bootstrap/dist/Modal/Modal';
|
||||||
import ModalBody from 'inferno-bootstrap/dist/Modal/ModalBody';
|
import ModalBody from 'inferno-bootstrap/dist/Modal/ModalBody';
|
||||||
import ModalFooter from 'inferno-bootstrap/dist/Modal/ModalFooter';
|
import ModalFooter from 'inferno-bootstrap/dist/Modal/ModalFooter';
|
||||||
import ModalHeader from 'inferno-bootstrap/dist/Modal/ModalHeader';
|
import ModalHeader from 'inferno-bootstrap/dist/Modal/ModalHeader';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
AnimateModal,
|
Modal,
|
||||||
Modal,
|
ModalBody,
|
||||||
ModalBody,
|
ModalFooter,
|
||||||
ModalFooter,
|
ModalHeader,
|
||||||
ModalHeader,
|
|
||||||
};
|
};
|
||||||
|
60
src/components/DOMForm.js
Normal file
60
src/components/DOMForm.js
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
import { linkEvent } from 'inferno';
|
||||||
|
|
||||||
|
function handleChange (props, event) {
|
||||||
|
const formElement = event.target.closest('form');
|
||||||
|
const rawFormData = new FormData(formElement);
|
||||||
|
|
||||||
|
if (props.onChange !== undefined) {
|
||||||
|
const modified = props.onChange(rawFormData);
|
||||||
|
|
||||||
|
if (modified !== undefined) {
|
||||||
|
// Update form
|
||||||
|
modified.forEach((value, key) => {
|
||||||
|
const element = formElement.elements[key];
|
||||||
|
element.value = value;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleSubmit (props, event) {
|
||||||
|
// Don't want to actually reload the page!
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Parsers are formatters or maskers
|
||||||
|
const parsers = {};
|
||||||
|
|
||||||
|
const form = event.target.closest('form');
|
||||||
|
const data = new FormData(form);
|
||||||
|
|
||||||
|
data.forEach((value, name) => {
|
||||||
|
const parserName = form.elements[name].dataset.parse;
|
||||||
|
|
||||||
|
if (parserName !== undefined && parsers[parserName] !== undefined) {
|
||||||
|
const parser = parsers[parserName];
|
||||||
|
const parsedValue = parser(data.get(name));
|
||||||
|
data.set(name, parsedValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (props.onSubmit) {
|
||||||
|
props.onSubmit(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function DOMForm (props) {
|
||||||
|
const passProps = {...props};
|
||||||
|
const children = passProps.children;
|
||||||
|
delete passProps.onChange;
|
||||||
|
delete passProps.onSubmit;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form
|
||||||
|
onInput={linkEvent(props, handleChange)}
|
||||||
|
onSubmit={linkEvent(props, handleSubmit)}
|
||||||
|
{...passProps}
|
||||||
|
>
|
||||||
|
{children}
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
export * from '//components/Bootstrap';
|
export * from '//components/Bootstrap';
|
||||||
|
export * from '//components/DOMForm';
|
||||||
export * from '//components/Form';
|
export * from '//components/Form';
|
||||||
export * from '//components/Loader';
|
export * from '//components/Loader';
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
const {spawn} = require('child_process');
|
const { spawn } = require('child_process');
|
||||||
const log = require('electron-log');
|
const log = require('electron-log');
|
||||||
const net = require('net');
|
const net = require('net');
|
||||||
const port = process.env.PORT ? (process.env.PORT - 100) : 3000;
|
const port = process.env.PORT ? (process.env.PORT - 100) : 3000;
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
import { linkEvent, Component } from 'inferno';
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
Button,
|
Button,
|
||||||
Card,
|
Card,
|
||||||
@ -11,6 +9,7 @@ import {
|
|||||||
Form,
|
Form,
|
||||||
Row,
|
Row,
|
||||||
} from '//components/Bootstrap';
|
} from '//components/Bootstrap';
|
||||||
|
import { DOMForm } from '//components';
|
||||||
|
|
||||||
import { FormBlock } from '//components/Form';
|
import { FormBlock } from '//components/Form';
|
||||||
|
|
||||||
@ -25,89 +24,80 @@ import { FormBlock } from '//components/Form';
|
|||||||
* Flash Model
|
* Flash Model
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export class CameraAddView extends Component {
|
function logFormData (formData) {
|
||||||
constructor (props) {
|
const data = {};
|
||||||
super(props);
|
formData.forEach((value, key) => {
|
||||||
|
data[key] = value;
|
||||||
this.state = {
|
});
|
||||||
form: {
|
console.log(data);
|
||||||
valid: {},
|
}
|
||||||
values: {},
|
|
||||||
},
|
function handleFormChange (formData) {
|
||||||
};
|
// logFormData(formData);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFormChange (instance, e) {
|
function handleSave (formData) {
|
||||||
instance.setState({
|
logFormData(formData);
|
||||||
form: {
|
}
|
||||||
...instance.state.form,
|
|
||||||
values: {
|
export function CameraAddView (props) {
|
||||||
...instance.state.form.values,
|
return (
|
||||||
[e.target.id]: e.target.value,
|
<Row className="full-height">
|
||||||
},
|
<Col sm={12} md={8} lg={4} className="abs-center">
|
||||||
},
|
<DOMForm
|
||||||
});
|
onChange={handleFormChange}
|
||||||
}
|
onSubmit={handleSave}
|
||||||
|
>
|
||||||
render () {
|
<Card>
|
||||||
return (
|
<CardHeader>
|
||||||
<Row className="full-height">
|
<CardTitle>Add a Camera</CardTitle>
|
||||||
<Col sm={12} md={8} lg={4} className="abs-center">
|
</CardHeader>
|
||||||
<Form onKeyDown={ linkEvent(this, this.handleFormChange) }>
|
<CardBody>
|
||||||
<Card>
|
<Row className="align-items-baseline">
|
||||||
<CardHeader>
|
<FormBlock
|
||||||
<CardTitle>Add a Camera</CardTitle>
|
label="Brand"
|
||||||
</CardHeader>
|
name="brand"
|
||||||
<CardBody>
|
required
|
||||||
<Row className="align-items-baseline">
|
/>
|
||||||
<FormBlock
|
<FormBlock
|
||||||
label="Brand"
|
label="Model"
|
||||||
name="brand"
|
name="model"
|
||||||
required
|
required
|
||||||
value={this.state.form.values['brand']}
|
/>
|
||||||
/>
|
<FormBlock
|
||||||
<FormBlock
|
label="Serial"
|
||||||
label="Model"
|
name="serial"
|
||||||
name="model"
|
required
|
||||||
required
|
/>
|
||||||
value={this.state.form.values['model']}
|
<FormBlock
|
||||||
/>
|
label="Film Format"
|
||||||
<FormBlock
|
name="film-format"
|
||||||
label="Serial"
|
>
|
||||||
name="serial"
|
<select
|
||||||
required
|
className="custom-select"
|
||||||
value={this.state.form.values['serial']}
|
id="film-format"
|
||||||
/>
|
name="film-format"
|
||||||
<FormBlock
|
>
|
||||||
label="Film Format"
|
<option value=""> </option>
|
||||||
name="film-format"
|
<option value="110">110</option>
|
||||||
value={this.state.form.values['film-format']}
|
<option value="120">120</option>
|
||||||
>
|
<option value="127">127</option>
|
||||||
<select
|
<option value="135">135</option>
|
||||||
className="custom-select"
|
<option value="220">220</option>
|
||||||
id="film-format"
|
</select>
|
||||||
name="film-format"
|
</FormBlock>
|
||||||
>
|
</Row>
|
||||||
<option value="110">110</option>
|
</CardBody>
|
||||||
<option value="120">120</option>
|
<CardFooter>
|
||||||
<option value="127">127</option>
|
<Row>
|
||||||
<option value="135">135</option>
|
<Col xs={12}>
|
||||||
<option value="220">220</option>
|
<Button color="primary" type="submit">Save</Button>
|
||||||
</select>
|
</Col>
|
||||||
</FormBlock>
|
</Row>
|
||||||
</Row>
|
</CardFooter>
|
||||||
</CardBody>
|
</Card>
|
||||||
<CardFooter>
|
</DOMForm>
|
||||||
<Row>
|
</Col>
|
||||||
<Col xs={12}>
|
</Row>
|
||||||
<Button color="primary" type="submit">Save</Button>
|
);
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
</CardFooter>
|
|
||||||
</Card>
|
|
||||||
</Form>
|
|
||||||
</Col>
|
|
||||||
</Row>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user