OYMRAJJVTJQZSOXGYWMLRE6OFCLGKFHAPCSSMG5ESQGL6JLUJ35AC
/* eslint-disable node/no-unpublished-import */
import commonjs from '@rollup/plugin-commonjs'
import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import ts from '@rollup/plugin-typescript'
import babel from '@rollup/plugin-babel'
import builtins from 'builtin-modules'
//import sourcemaps from 'rollup-plugin-sourcemaps'
import jsonfile from '@rollup/plugin-json'
import alias from '@rollup/plugin-alias'
import { Plugin, RollupOptions, OutputOptions } from 'rollup'
if (!process.env.NODE_ENV || process.env.NODE_ENV == '') {
throw Error('"process.env.NODE_ENV" needs to be set when bundling with Rollup.')
}
function configurePlugins(rootDir: string): Plugin[] {
if (process.env.NODE_ENV === 'production') {
return [
//sourcemaps(),
alias({
entries: [],
}),
resolve({
rootDir,
extensions: ['.mjs', '.js', '.json', '.jsx', '.node'],
}),
commonjs({
sourceMap: true,
}),
jsonfile({}),
ts(),
babel({
sourcemap: true,
babelHelpers: 'bundled',
plugins: [
'babel-plugin-inferno',
[
'transform-inline-environment-variables',
{
include: ['NODE_ENV'],
},
],
'transform-remove-undefined',
'transform-inline-consecutive-adds',
'transform-property-literals',
'transform-regexp-constructors',
'minify-guarded-expressions',
[
'minify-dead-code-elimination',
{
keepFnName: true,
/* eslint unicorn/prevent-abbreviations: "off" */
keepFnArgs: true,
keepClassName: true,
tdz: true,
},
],
],
configFile: false,
babelrc: false,
}),
terser({
toplevel: true,
ecma: 2020,
parse: {
shebang: true,
},
output: {
comments: false,
shebang: true,
//preamble: formatLicense(),
},
}),
]
} else {
return [
//sourcemaps(),
alias({
entries: [
{
find: 'inferno',
replacement: __dirname + '/node_modules/inferno/dist/index.dev.esm.js',
},
],
}),
resolve({
rootDir,
extensions: ['.mjs', '.js', '.json', '.jsx', '.node'],
}),
commonjs({
sourceMap: true,
}),
jsonfile({}),
ts(),
babel({
sourcemap: true,
babelHelpers: 'bundled',
plugins: [
'babel-plugin-inferno',
['transform-inline-environment-variables', { include: ['NODE_ENV'] }],
'transform-inline-consecutive-adds',
[
'minify-dead-code-elimination',
{
keepFnName: true,
/* eslint unicorn/prevent-abbreviations: "off" */
keepFnArgs: true,
keepClassName: true,
tdz: true,
},
],
],
configFile: false,
babelrc: false,
}),
terser({
ecma: 2020,
keep_classnames: true,
//keep_fnames: true,
toplevel: true,
parse: {
shebang: true,
},
compress: {
/* eslint unicorn/prevent-abbreviations: "off" */
defaults: false,
arrows: true,
evaluate: true,
properties: true,
computed_props: true,
dead_code: true,
},
output: {
comments: 'some',
shebang: true,
beautify: true,
semicolons: false,
keep_quoted_props: true,
indent_level: 2,
max_line_len: 100,
},
}),
]
}
}
function outputBundle(filename: string): OutputOptions {
return {
file: filename,
format: 'es',
sourcemap: true,
}
}
const bundles: RollupOptions[] = [
{
input: 'packages/basic/src/main.ts',
external: builtins.concat('electron'),
plugins: configurePlugins('packages/basic'),
output: {
...outputBundle('packages/dist/main.js'),
format: 'cjs',
},
},
]
export default bundles
/@electron/get/1.13.1:
resolution: {integrity: sha512-U5vkXDZ9DwXtkPqlB45tfYnnYBN8PePp1z/XDCupnSpdrxT8/ThCv9WCwPLf9oqiSGZTkH6dx2jDUPuoXpjkcA==}
engines: {node: '>=8.6'}
dependencies:
debug: 4.3.3
env-paths: 2.2.1
fs-extra: 8.1.0
got: 9.6.0
progress: 2.0.3
semver: 6.3.0
sumchecker: 3.0.1
optionalDependencies:
global-agent: 3.0.0
global-tunnel-ng: 2.7.1
transitivePeerDependencies:
- supports-color
dev: false
/@sindresorhus/is/0.14.0:
resolution: {integrity: sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==}
engines: {node: '>=6'}
dev: false
/@szmarczak/http-timer/1.1.2:
resolution: {integrity: sha512-XIB2XbzHTN6ieIjfIMV9hlVcfPU26s2vafYWQcZHWXHOxiaRZYEDKEwdl129Zyg50+foYV2jCgtrqSA6qNuNSA==}
engines: {node: '>=6'}
dependencies:
defer-to-connect: 1.1.3
dev: false
/cacheable-request/6.1.0:
resolution: {integrity: sha512-Oj3cAGPCqOZX7Rz64Uny2GYAZNliQSqfbePrgAQ1wKAihYmCUnraBtJtKcGR4xz7wF+LoJC+ssFZvv5BgF9Igg==}
engines: {node: '>=8'}
dependencies:
clone-response: 1.0.2
get-stream: 5.2.0
http-cache-semantics: 4.1.0
keyv: 3.1.0
lowercase-keys: 2.0.0
normalize-url: 4.5.1
responselike: 1.0.2
dev: false
/electron/16.0.2:
resolution: {integrity: sha512-kT746yVMztrP4BbT3nrFNcUcfgFu2yelUw6TWBVTy0pju+fBISaqcvoiMrq+8U0vRpoXSu2MJYygOf4T0Det7g==}
engines: {node: '>= 8.6'}
hasBin: true
requiresBuild: true
dependencies:
'@electron/get': 1.13.1
'@types/node': 14.17.34
extract-zip: 1.7.0
transitivePeerDependencies:
- supports-color
dev: false
/encodeurl/1.0.2:
resolution: {integrity: sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=}
engines: {node: '>= 0.8'}
dev: false
optional: true
/get-stream/4.1.0:
resolution: {integrity: sha512-GMat4EJ5161kIy2HevLlr4luNjBgvmj413KaQA7jt4V8B4RDsfpHk7WQ9GVqfYyyx8OS/L66Kox+rJRNklLK7w==}
engines: {node: '>=6'}
dependencies:
pump: 3.0.0
dev: false
/get-stream/5.2.0:
resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==}
engines: {node: '>=8'}
dependencies:
pump: 3.0.0
dev: false
/global-agent/3.0.0:
resolution: {integrity: sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==}
engines: {node: '>=10.0'}
requiresBuild: true
dependencies:
boolean: 3.1.4
es6-error: 4.1.1
matcher: 3.0.0
roarr: 2.15.4
semver: 7.3.5
serialize-error: 7.0.1
dev: false
optional: true
/global-tunnel-ng/2.7.1:
resolution: {integrity: sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg==}
engines: {node: '>=0.10'}
requiresBuild: true
dependencies:
encodeurl: 1.0.2
lodash: 4.17.21
npm-conf: 1.1.3
tunnel: 0.0.6
dev: false
optional: true
/got/9.6.0:
resolution: {integrity: sha512-R7eWptXuGYxwijs0eV+v3o6+XH1IqVK8dJOEecQfTmkncw9AV4dcw/Dhxi8MdlqPthxxpZyizMzyg8RTmEsG+Q==}
engines: {node: '>=8.6'}
dependencies:
'@sindresorhus/is': 0.14.0
'@szmarczak/http-timer': 1.1.2
cacheable-request: 6.1.0
decompress-response: 3.3.0
duplexer3: 0.1.4
get-stream: 4.1.0
lowercase-keys: 1.0.1
mimic-response: 1.0.1
p-cancelable: 1.1.0
to-readable-stream: 1.0.0
url-parse-lax: 3.0.0
dev: false
/rollup-plugin-sourcemaps/0.6.3_6a81cd64d5101efbbdec0e3858b03196:
resolution: {integrity: sha512-paFu+nT1xvuO1tPFYXGe+XnQvg4Hjqv/eIhG8i5EspfYYPBKL57X7iVbfv55aNVASg3dzWvES9dmWsL2KhfByw==}
engines: {node: '>=10.0.0'}
peerDependencies:
'@types/node': '>=10.0.0'
rollup: '>=0.31.2'
peerDependenciesMeta:
'@types/node':
optional: true
/roarr/2.15.4:
resolution: {integrity: sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==}
engines: {node: '>=8.0'}
'@rollup/pluginutils': 3.1.0_rollup@2.60.1
'@types/node': 16.11.10
rollup: 2.60.1
source-map-resolve: 0.6.0
dev: true
boolean: 3.1.4
detect-node: 2.1.0
globalthis: 1.0.2
json-stringify-safe: 5.0.1
semver-compare: 1.0.0
sprintf-js: 1.1.2
dev: false
optional: true
{
"description": "Manages packaging the distibuted packages.",
"private": true,
"author": "James Adam Armstrong",
"license": "ISC",
"scripts": {},
"dependencies": {
"electron": "^16.0.2"
},
"engines": {
"node": ">=16.9.0 <17"
},
"type": "commonjs",
"main": "main.js"
}
/*
ISC License (ISC)
Copyright 2021 James Adam Armstrong
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above copyright
notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
import { app, BrowserWindow } from 'electron'
import path from 'path'
import fs from 'fs'
interface Setup {
title: string
icon: string
index: string
}
const defaultSetup: Readonly<Setup> = {
title: 'LOL Calculator',
icon: 'icon.png',
index: 'index.html',
}
function load(name: string): Readonly<Setup> {
try {
const raw = fs.readFileSync(path.join(__dirname, name))
const data = JSON.parse(raw.toString())
if (typeof data === 'object') {
const setup = { ...defaultSetup }
for (const key in defaultSetup) {
const value = data[key]
if (typeof value === 'string') {
setup[key] = value
}
}
return setup
} else {
return defaultSetup
}
} catch (_error) {
return defaultSetup
}
}
function createWindow(name?: string): void {
const { title, icon, index } = name ? load(name) : defaultSetup
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
icon,
title,
webPreferences: {
// preload: path.join(__dirname, 'preload.js'),
devTools: process.env.NODE_ENV != 'production',
},
})
mainWindow.menuBarVisible = false
mainWindow.loadFile(index).then(() => mainWindow.maximize())
}
app.whenReady().then(() => {
createWindow()
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (process.platform === 'darwin') {
app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
}
})
// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})
{
"description": "Basic calculator for League of Legends.",
"private": true,
"author": "James Adam Armstrong",
"license": "ISC",
"scripts": {},
"dependencies": {
"electron": "^16.0.2"
},
"engines": {
"node": ">=16.9.0 <17"
}
}