cheat.sh
new_dir=${1:-hoge}
mkdir $new_dir
pushd $new_dir
npm init -y
npm i -D electron-prebuilt
cat << EOS > index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>sample</title>
</head>
<body>
<p>Hello World</p>
</body>
</html>
EOS
cat << EOS > index.js
'user strict';
const electron = require("electron");
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
let mainWindow;
app.on('window-all-closed', function() {
if (process.platform != 'darwin') {
app.quit();
}
});
app.on('ready', function() {
mainWindow = new BrowserWindow({width: 800, heigth: 600});
mainWindow.loadURL('file://' + __dirname + '/index.html');
mainWindow.on('closed', function() {
mainWindow = null;
});
});
EOS
popd
electron ./$new_dir
qiita.com