Fixing up the electron build
This commit is contained in:
parent
de586b699b
commit
cd6c3ff0cc
@ -25,7 +25,7 @@ app.on('ready', () => {
|
||||
app.win.webContents.removeAllListeners('devtools-reload-page')
|
||||
|
||||
app.win.loadURL(`file://${__dirname}/sources/index.html`)
|
||||
// app.inspect()
|
||||
app.inspect()
|
||||
|
||||
app.win.on('closed', () => {
|
||||
win = null
|
||||
|
1579
desktop/package-lock.json
generated
1579
desktop/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -4,20 +4,34 @@
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
"start": "electron .",
|
||||
"clean": "rm -r ~/Desktop/Ronin-darwin-x64/ ; rm -r ~/Desktop/Ronin-linux-x64/ ; rm -r ~/Desktop/Ronin-win32-x64/ ; echo 'cleaned build location'",
|
||||
"build_osx": "electron-packager . Ronin --platform=darwin --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.icns ; echo 'Built for OSX'",
|
||||
"build_linux": "electron-packager . Ronin --platform=linux --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.ico ; echo 'Built for LINUX'",
|
||||
"build_win": "electron-packager . Ronin --platform=win32 --arch=x64 --out ~/Desktop/ --overwrite --icon=icon.ico ; echo 'Built for WIN'",
|
||||
"fix": "standard --fix",
|
||||
"clean": "rm -r ~/Documents/Ronin-darwin-x64/ ; rm -r ~/Documents/Ronin-linux-x64/ ; rm -r ~/Documents/Ronin-win32-x64/ ; echo 'cleaned build location'",
|
||||
"build_osx": "electron-packager . Ronin --platform=darwin --arch=x64 --out ~/Documents/ --overwrite --icon=icon.icns ; echo 'Built for OSX'",
|
||||
"build_linux": "electron-packager . Ronin --platform=linux --arch=x64 --out ~/Documents/ --overwrite --icon=icon.ico ; echo 'Built for LINUX'",
|
||||
"build_win": "electron-packager . Ronin --platform=win32 --arch=x64 --out ~/Documents/ --overwrite --icon=icon.ico ; echo 'Built for WIN'",
|
||||
"build": "npm run clean ; npm run build_osx ; npm run build_linux ; npm run build_win",
|
||||
"push_osx": "~/butler push ~/Desktop/Ronin-darwin-x64/ hundredrabbits/ronin:osx-64",
|
||||
"push_linux": "~/butler push ~/Desktop/Ronin-linux-x64/ hundredrabbits/ronin:linux-64",
|
||||
"push_win": "~/butler push ~/Desktop/Ronin-win32-x64/ hundredrabbits/ronin:windows-64",
|
||||
"push_theme": "~/butler push ~/Github/HundredRabbits/Themes/themes/ hundredrabbits/ronin:themes",
|
||||
"push_status": "~/butler status hundredrabbits/ronin",
|
||||
"push": "npm run build ; npm run push_theme ; npm run push_osx ; npm run push_linux ; npm run push_win ; npm run clean ; npm run push_status"
|
||||
"push_osx": "~/Applications/butler push ~/Documents/Ronin-darwin-x64/ hundredrabbits/ronin:osx-64",
|
||||
"push_linux": "~/Applications/butler push ~/Documents/Ronin-linux-x64/ hundredrabbits/ronin:linux-64",
|
||||
"push_win": "~/Applications/butler push ~/Documents/Ronin-win32-x64/ hundredrabbits/ronin:windows-64",
|
||||
"status": "~/Applications/butler status hundredrabbits/ronin",
|
||||
"push": "npm run build ; npm run push_osx ; npm run push_linux ; npm run push_win ; npm run clean ; npm run status"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "^5.0.8",
|
||||
"electron-packager": "^13.1.1"
|
||||
"electron": "^7.0.0",
|
||||
"electron-packager": "^14.0.6"
|
||||
},
|
||||
"standard": {
|
||||
"globals": [
|
||||
"localStorage",
|
||||
"DOMParser",
|
||||
"onMessage",
|
||||
"postMessage",
|
||||
"FileReader",
|
||||
"performance",
|
||||
"Worker"
|
||||
],
|
||||
"ignore": [
|
||||
"/node_modules/*"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -2,13 +2,12 @@
|
||||
<head>
|
||||
<meta charset='UTF-8'>
|
||||
<script type="text/javascript" src="scripts/lib/theme.js"></script>
|
||||
<script type="text/javascript" src="scripts/lib/controller.js"></script>
|
||||
<script type="text/javascript" src="scripts/lib/acels.js"></script>
|
||||
<script type="text/javascript" src="scripts/lib/lisp.js"></script>
|
||||
<script type="text/javascript" src="scripts/lib/source.js"></script>
|
||||
<script type="text/javascript" src="scripts/ronin.js"></script>
|
||||
<script type="text/javascript" src="scripts/source.js"></script>
|
||||
<script type="text/javascript" src="scripts/docs.js"></script>
|
||||
<script type="text/javascript" src="scripts/commander.js"></script>
|
||||
<script type="text/javascript" src="scripts/surface.js"></script>
|
||||
<script type="text/javascript" src="scripts/lisp.js"></script>
|
||||
<script type="text/javascript" src="scripts/library.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="links/reset.css"/>
|
||||
<link rel="stylesheet" type="text/css" href="links/fonts.css"/>
|
||||
@ -18,46 +17,14 @@
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
const remote = require('electron').remote
|
||||
const {dialog,app} = require('electron').remote;
|
||||
const fs = require('fs')
|
||||
const ronin = new Ronin()
|
||||
ronin.controller = new Controller()
|
||||
ronin.controller.add("default","*","About",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Ronin'); },"CmdOrCtrl+,");
|
||||
ronin.controller.add("default","*","Fullscreen",() => { app.toggleFullscreen() },"CmdOrCtrl+Enter");
|
||||
ronin.controller.add("default","*","Hide",() => { app.toggleVisible() },"CmdOrCtrl+H");
|
||||
ronin.controller.add("default","*","Inspect",() => { app.inspect() },"CmdOrCtrl+.");
|
||||
ronin.controller.add("default","*","Reset",() => { ronin.reset(); ronin.theme.reset() },"CmdOrCtrl+Backspace");
|
||||
ronin.controller.add("default","*","Quit",() => { ronin.source.quit() },"CmdOrCtrl+Q");
|
||||
ronin.controller.add("default","File","New",() => { ronin.source.new() },"CmdOrCtrl+N")
|
||||
ronin.controller.add("default","File","Save",() => { ronin.source.save() },"CmdOrCtrl+S")
|
||||
ronin.controller.add("default","File","Save As",() => { ronin.source.saveAs() },"CmdOrCtrl+Shift+S")
|
||||
ronin.controller.add("default","File","Open",() => { ronin.source.open() },"CmdOrCtrl+O")
|
||||
ronin.controller.add("default","File","Revert",() => { ronin.source.revert() },"CmdOrCtrl+W")
|
||||
ronin.controller.addRole('default', 'Edit', 'undo')
|
||||
ronin.controller.addRole('default', 'Edit', 'redo')
|
||||
ronin.controller.addRole('default', 'Edit', 'cut')
|
||||
ronin.controller.addRole('default', 'Edit', 'copy')
|
||||
ronin.controller.addRole('default', 'Edit', 'paste')
|
||||
ronin.controller.addRole('default', 'Edit', 'delete')
|
||||
ronin.controller.addRole('default', 'Edit', 'selectall')
|
||||
ronin.controller.add("default","Edit","Re-Indent",() => { ronin.commander.reindent() },"CmdOrCtrl+Shift+I")
|
||||
ronin.controller.add("default","Edit","Clean",() => { ronin.commander.cleanup() },"Escape")
|
||||
ronin.controller.add("default","View","Zoom In",() => { ronin.modZoom(0.25) },"CmdOrCtrl+=")
|
||||
ronin.controller.add("default","View","Zoom Out",() => { ronin.modZoom(-0.25) },"CmdOrCtrl+-")
|
||||
ronin.controller.add("default","View","Zoom Reset",() => { ronin.modZoom(1,true) },"CmdOrCtrl+0")
|
||||
ronin.controller.add("default","View","Toggle Commander",() => { ronin.commander.toggle(); },"CmdOrCtrl+K");
|
||||
ronin.controller.add("default","View","Toggle Guides",() => { ronin.surface.toggleGuides(); },"CmdOrCtrl+Shift+H");
|
||||
ronin.controller.add("default","View","Expand Commander",() => { ronin.commander.toggle(true); },"CmdOrCtrl+Shift+K");
|
||||
ronin.controller.add("default","Project","Run",() => { ronin.commander.run(); },"CmdOrCtrl+R");
|
||||
ronin.controller.add("default","Project","Reload Run",() => { ronin.source.revert(); ronin.commander.run(); },"CmdOrCtrl+Shift+R");
|
||||
ronin.controller.add("default","Theme","Open Theme",() => { ronin.theme.open() },"CmdOrCtrl+Shift+O")
|
||||
ronin.controller.add("default","Theme","Reset Theme",() => { ronin.theme.reset() },"CmdOrCtrl+Shift+Backspace")
|
||||
ronin.controller.addSpacer('default', 'Theme', 'Download')
|
||||
ronin.controller.add("default","Theme","Download Themes..",() => { require('electron').shell.openExternal('https://github.com/hundredrabbits/Themes') })
|
||||
ronin.controller.commit()
|
||||
|
||||
ronin.install(document.body)
|
||||
window.addEventListener('load', () => { ronin.start() })
|
||||
|
||||
window.addEventListener('load', () => {
|
||||
ronin.start()
|
||||
ronin.acels.inject()
|
||||
})
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -8,36 +8,36 @@ function Acels () {
|
||||
host.addEventListener('keyup', this.onKeyUp, false)
|
||||
}
|
||||
|
||||
this.set = (type, name, key, downfn, upfn) => {
|
||||
if (this.all[key]) { console.warn('Acels', `Trying to overwrite ${this.all[key].name}, with ${name}.`) }
|
||||
this.all[key] = { type, name, downfn, upfn, key }
|
||||
this.set = (cat, name, accelerator, downfn, upfn) => {
|
||||
if (this.all[accelerator]) { console.warn('Acels', `Trying to overwrite ${this.all[accelerator].name}, with ${name}.`) }
|
||||
this.all[accelerator] = { cat, name, downfn, upfn, accelerator }
|
||||
}
|
||||
|
||||
this.get = (key) => {
|
||||
return this.all[key]
|
||||
this.get = (accelerator) => {
|
||||
return this.all[accelerator]
|
||||
}
|
||||
|
||||
this.sort = () => {
|
||||
const h = {}
|
||||
for (const item of Object.values(this.all)) {
|
||||
if (!h[item.type]) { h[item.type] = [] }
|
||||
h[item.type].push(item)
|
||||
if (!h[item.cat]) { h[item.cat] = [] }
|
||||
h[item.cat].push(item)
|
||||
}
|
||||
return h
|
||||
}
|
||||
|
||||
this.convert = (event) => {
|
||||
const key = event.key.substr(0, 1).toUpperCase() + event.key.substr(1)
|
||||
const accelerator = event.accelerator.substr(0, 1).toUpperCase() + event.accelerator.substr(1)
|
||||
if ((event.ctrlKey || event.metaKey) && event.shiftKey) {
|
||||
return `CmdOrCtrl+Shift+${key}`
|
||||
return `CmdOrCtrl+Shift+${accelerator}`
|
||||
}
|
||||
if (event.shiftKey) {
|
||||
return `Shift+${key}`
|
||||
return `Shift+${accelerator}`
|
||||
}
|
||||
if (event.ctrlKey || event.metaKey) {
|
||||
return `CmdOrCtrl+${key}`
|
||||
return `CmdOrCtrl+${accelerator}`
|
||||
}
|
||||
return key
|
||||
return accelerator
|
||||
}
|
||||
|
||||
this.onKeyDown = (e) => {
|
||||
@ -55,25 +55,44 @@ function Acels () {
|
||||
}
|
||||
|
||||
this.toMarkdown = () => {
|
||||
const types = this.sort()
|
||||
const cats = this.sort()
|
||||
let text = ''
|
||||
for (const type in types) {
|
||||
text += `\n### ${type}\n\n`
|
||||
for (const item of types[type]) {
|
||||
text += `- \`${item.key}\`: ${item.info}\n`
|
||||
for (const cat in cats) {
|
||||
text += `\n### ${cat}\n\n`
|
||||
for (const item of cats[cat]) {
|
||||
text += `- \`${item.accelerator}\`: ${item.info}\n`
|
||||
}
|
||||
}
|
||||
return text.trim()
|
||||
}
|
||||
|
||||
this.toString = () => {
|
||||
const types = this.sort()
|
||||
const cats = this.sort()
|
||||
let text = ''
|
||||
for (const type in types) {
|
||||
for (const item of types[type]) {
|
||||
text += `${type}: ${item.name} | ${item.key}\n`
|
||||
for (const cat in cats) {
|
||||
for (const item of cats[cat]) {
|
||||
text += `${cat}: ${item.name} | ${item.accelerator}\n`
|
||||
}
|
||||
}
|
||||
return text.trim()
|
||||
}
|
||||
|
||||
this.inject = () => {
|
||||
const injection = []
|
||||
const sorted = this.sort()
|
||||
for (const cat of Object.keys(sorted)) {
|
||||
const submenu = []
|
||||
for (const option of sorted[cat]) {
|
||||
if (option.role) {
|
||||
submenu.push({ role: option.role })
|
||||
} else if (option.type) {
|
||||
submenu.push({ type: option.type })
|
||||
} else {
|
||||
submenu.push({ label: option.name, accelerator: option.accelerator, click: option.downfn })
|
||||
}
|
||||
}
|
||||
injection.push({ label: cat, submenu: submenu })
|
||||
}
|
||||
require('electron').remote.app.injectMenu(injection)
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,10 @@
|
||||
/* global FileReader */
|
||||
/* global DOMParser */
|
||||
|
||||
function Theme (_default) {
|
||||
function Theme () {
|
||||
const themer = this
|
||||
|
||||
this.active = _default
|
||||
this.active = {}
|
||||
|
||||
this.el = document.createElement('style')
|
||||
this.el.type = 'text/css'
|
||||
@ -17,7 +17,8 @@ function Theme (_default) {
|
||||
this.callback = callback
|
||||
}
|
||||
|
||||
this.start = () => {
|
||||
this.start = (defaultTheme) => {
|
||||
this.active = defaultTheme
|
||||
console.log('Theme', 'Starting..')
|
||||
if (isJson(localStorage.theme)) {
|
||||
const storage = JSON.parse(localStorage.theme)
|
||||
@ -27,7 +28,7 @@ function Theme (_default) {
|
||||
return
|
||||
}
|
||||
}
|
||||
this.load(_default)
|
||||
this.load(this.active)
|
||||
}
|
||||
|
||||
this.load = (data) => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user