Parcel was convenient, but rollup is more versatile, without the esotaric webpack configuration

This commit is contained in:
Timothy Warren 2018-06-01 16:01:29 -04:00
parent 747c7ee810
commit 9a7eccb55e
10 changed files with 605 additions and 1962 deletions

View File

@ -1,5 +1,6 @@
{
"presets": [
"inferno-app",
["env", {
"targets": {
"browsers": [
@ -7,11 +8,12 @@
"not ie 11",
"not op_mini all"
]
}
}],
"inferno-app"
},
"modules": false
}]
],
"plugins": [
"external-helpers",
["module-resolver", {
"root": ["./src"],
"alias": {

View File

@ -5,7 +5,11 @@
"version": "0.5.0",
"private": true,
"build": {
"appId": "net.timshomepage.film-exif"
"asar": true,
"appId": "net.timshomepage.film-exif",
"mac": {
"category": "public.app-category.photography"
}
},
"dependencies": {
"electron-log": "^2.2.14",
@ -15,7 +19,7 @@
"inferno-bootstrap": "^5.0.2",
"inferno-dev-utils": "^5.3.0",
"inferno-router": "^5.0.6",
"lodash": "^4.17.10",
"lodash-es": "^4.17.10",
"ws": "^5.2.0"
},
"devDependencies": {
@ -23,6 +27,7 @@
"@babel/preset-env": "^7.0.0-beta.49",
"babel-eslint": "^8.2.2",
"babel-jest": "^23.0.1",
"babel-plugin-external-helpers": "^6.22.0",
"babel-plugin-module-resolver": "^3.1.1",
"babel-preset-inferno-app": "^7.1.0",
"babel-runtime": "^6.26.0",
@ -39,20 +44,31 @@
"eslint-plugin-node": "^6.0.1",
"eslint-plugin-promise": "^3.8.0",
"eslint-plugin-standard": "^3.0.1",
"extract-text-webpack-plugin": "3.0.2",
"husky": "^0.14.3",
"jest": "^23.0.1",
"jquery": "^3.3.1",
"parcel-bundler": "^1.7.1",
"raf": "^3.4.0"
"raf": "^3.4.0",
"rollup": "^0.59.4",
"rollup-plugin-alias": "^1.4.0",
"rollup-plugin-babel": "^3.0.4",
"rollup-plugin-commonjs": "^9.1.3",
"rollup-plugin-cpy": "^1.0.0",
"rollup-plugin-filesize": "^1.5.0",
"rollup-plugin-livereload": "^0.6.0",
"rollup-plugin-node-resolve": "^3.3.0",
"rollup-plugin-replace": "^2.0.0",
"rollup-plugin-serve": "^0.4.2",
"rollup-plugin-terser": "^1.0.1",
"rollup-plugin-uglify": "^4.0.0",
"rollup-plugin-visualizer": "^0.6.0"
},
"scripts": {
"build": "parcel build index.html --out-dir build/app --detailed-report",
"build": "rollup --config rollup.prod.js",
"dist": "yarn run build && build",
"electron-start": "node src/electron/wait-inferno",
"electron": "electron .",
"fix": "eslint --fix src/**/*.js",
"inferno-start": "parcel index.html -p 3000",
"inferno-start": "rollup --config rollup.dev.js --watch",
"lint": "eslint src/**/*.js",
"pack": "build --dir",
"postinstall": "electron-builder install-app-deps",
@ -60,11 +76,7 @@
"react-start": "npm run inferno-start",
"test": "node scripts/test.js --env=jsdom"
},
"homepage": "./",
"main": "src/electron/index.js",
"mac": {
"category": "public.app-category.photography"
},
"jest": {
"collectCoverageFrom": [
"src/**/*.{js,jsx,mjs}"

View File

@ -3,13 +3,14 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="stylesheet" href="%PUBLIC_URL%/css/bootstrap.css" />
<link rel="stylesheet" href="%PUBLIC_URL%/css/app.css" />
<link rel="shortcut icon" href="./favicon.ico" />
<link rel="stylesheet" href="./css/bootstrap.css" />
<link rel="stylesheet" href="./css/app.css" />
<title>Inferno App</title>
</head>
<body>
<film-exif id="app"></film-exif>
<script type="module" src="./bundle.js"></script>
<noscript>
You need to enable JavaScript to run this app.
</noscript>

34
rollup.config.js Normal file
View File

@ -0,0 +1,34 @@
import babel from 'rollup-plugin-babel';
import copy from 'rollup-plugin-cpy';
import commonjs from 'rollup-plugin-commonjs';
import replace from 'rollup-plugin-replace';
import resolve from 'rollup-plugin-node-resolve';
export default {
input: 'src/index.js',
output: {
file: 'build/bundle.js',
format: 'es',
sourcemap: true,
},
plugins: [
copy([{
dest: 'build/',
files: ['public/index.html', 'public/favicon.ico'],
}, {
dest: 'build/css/',
files: ['public/css/bootstrap.css', 'public/css/app.css'],
}]),
replace({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
}),
resolve({
jsnext: true,
browser: true,
}),
babel({
exclude: 'node_modules/**',
}),
commonjs(),
],
};

30
rollup.dev.js Normal file
View File

@ -0,0 +1,30 @@
import baseConfig from './rollup.config';
import alias from 'rollup-plugin-alias';
import filesize from 'rollup-plugin-filesize';
import livereload from 'rollup-plugin-livereload';
import serve from 'rollup-plugin-serve';
// Force the appropriate environment
process.env.NODE_ENV = 'development';
export default {
...baseConfig,
plugins: [
alias({
'inferno': `${__dirname}/node_modules/inferno/dist/index.dev.esm.js`,
}),
...baseConfig.plugins,
filesize(),
serve({
contentBase: ['./public', './build'],
host: 'localhost',
headers: {
'Access-Control-Allow-Origin': '*',
},
historyApiFallback: true,
port: 3000,
}),
livereload(),
],
};

15
rollup.prod.js Normal file
View File

@ -0,0 +1,15 @@
import baseConfig from './rollup.config';
import filesize from 'rollup-plugin-filesize';
import { terser } from 'rollup-plugin-terser';
// Force the appropriate environment
process.env.NODE_ENV = 'production';
export default {
...baseConfig,
plugins: [
...baseConfig.plugins,
terser(),
filesize(),
],
};

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash-es';
import { JSONMessage } from '//helpers/web-socket';
export class WSCache {

View File

@ -22,3 +22,4 @@ export const Loader = (props) => {
</section>
);
};
Loader.displayName = 'Loader';

View File

@ -1,4 +1,4 @@
import * as _ from 'lodash';
import _ from 'lodash-es';
import { Component } from 'inferno';
import {
Button,
@ -24,6 +24,9 @@ export class HomeView extends Component {
_.bindAll(this, [
'bindEvents',
'handleDrop',
'showErrorDialog',
'showOpenDialog',
'showSaveDialog',
'toggleErrorModal',
]);
}

2431
yarn.lock

File diff suppressed because it is too large Load Diff