Skip to content

Commit

Permalink
feat(captain): pilot desktop version
Browse files Browse the repository at this point in the history
  • Loading branch information
lokesh-coder committed Apr 26, 2021
1 parent a7769f8 commit 5ca0339
Show file tree
Hide file tree
Showing 4 changed files with 191 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/misc/captain/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
function pilot() {
const lesy = require("@lesy/compiler");
const path = require("path");

return lesy({
root: path.resolve(__dirname, "./"),
commands: [{ run: () => console.log("hello") }],
plugins: ["@lesy/lesy-plugin-pilot"],
}).parse(["pilot"]);
}

module.exports = pilot;
56 changes: 56 additions & 0 deletions packages/misc/captain/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
const { app, BrowserWindow } = require('electron')
const fixPath = require('fix-path');
const pilot = require('./index')

fixPath();
process.env.FORCE_COLOR = '3';

let splash;

function createWindow () {
listener=pilot();
const win = new BrowserWindow({
width: 1920,
height: 1080,
titleBarStyle: 'hidden',
show: false,
webPreferences: {
devTools:true,
webSecurity:false,
nodeIntegration:true,
contextIsolation:false,
}
})
splash = new BrowserWindow({width: 250, height: 250, transparent: true, frame: false, alwaysOnTop: true, center:true});
splash.loadFile(`${__dirname}/public/flashscreen.html`)

setTimeout(()=>{
splash.destroy();
win.show();
win.loadURL('http://localhost:8888/');
win.focus()
},3000)
}

app.whenReady().then(() => {
createWindow()

app.on('activate', () => {
if (BrowserWindow.getAllWindows().length === 0) {
createWindow()
}
})
})

app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();

}
})


app.requestSingleInstanceLock()
app.on('second-instance', (event, argv, cwd) => {
app.quit();
})
61 changes: 61 additions & 0 deletions packages/misc/captain/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"name": "@lesy/captain",
"version": "1.0.0-beta.15",
"description": "",
"author": {
"email": "mexican.dirtyfellow@gmail.com",
"name": "Lokesh Rajendran"
},
"keywords": [],
"main": "main.js",
"scripts": {
"clean": "rm -rf ./out",
"start": "electron-forge start",
"package": "electron-forge package",
"build": "electron-forge make"
},
"license": "MIT",
"private": true,
"bin": {
"lesy": ""
},
"dependencies": {
"fix-path": "^3.0.0",
"lesy": "^1.0.0-beta.15"
},
"devDependencies": {
"@electron-forge/cli": "^6.0.0-beta.54",
"@electron-forge/maker-deb": "^6.0.0-beta.54",
"@electron-forge/maker-rpm": "^6.0.0-beta.54",
"@electron-forge/maker-squirrel": "^6.0.0-beta.54",
"@electron-forge/maker-zip": "^6.0.0-beta.54",
"electron": "^12.0.5"
},
"config": {
"forge": {
"packagerConfig": {},
"makers": [
{
"name": "@electron-forge/maker-squirrel",
"config": {
"name": "electro"
}
},
{
"name": "@electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "@electron-forge/maker-deb",
"config": {}
},
{
"name": "@electron-forge/maker-rpm",
"config": {}
}
]
}
}
}
62 changes: 62 additions & 0 deletions packages/misc/captain/public/flashscreen.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Pilot</title>
<style>
body{
background-color: #BB5151;
text-align: center;
padding: 20px;
font-family: -apple-system, BlinkMacSystemFont,
“Segoe UI”, “Roboto”, “Oxygen”, “Ubuntu”, “Cantarell”,
“Fira Sans”, “Droid Sans”, “Helvetica Neue”,
sans-serif;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
}
body::after{
content: '';
background-color: transparent;
background-image: url("data:image/svg+xml,%3Csvg width='20' height='20' viewBox='0 0 20 20' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.05' fill-rule='evenodd'%3E%3Ccircle cx='3' cy='3' r='3'/%3E%3Ccircle cx='13' cy='13' r='3'/%3E%3C/g%3E%3C/svg%3E");
position: absolute;
left: 0;
top: 0;
width: 100%;
height: 100%;
z-index: -1;
}
h2{
font-size: 30px;
color:#fff;
font-weight: 700;
flex:1;
}
p{
color:#fff;
opacity: 0.5;
font-size: 14px;
}
</style>
</head>
<body>
<svg xmlns="http://www.w3.org/2000/svg" width="63" viewBox="0 0 512 512" fill="none">
<path fill-rule="evenodd" clip-rule="evenodd" d="M273.677 67.3797C278.298 75.5529 275.418 85.9243 267.245 90.5448C178.852 140.515 124.73 202.824 124.728 282.836C124.725 354.607 183.46 414.059 254.93 414.137C286.348 413.601 316.319 400.826 338.463 378.527C360.562 356.274 373.122 326.291 373.488 294.938C371.647 237.744 324.036 188.883 269.408 192.048C268.992 192.072 268.574 192.081 268.157 192.074C217.43 191.273 176.17 233.648 177.167 283.035C180.146 326.219 216.93 361.029 257.783 358.382C257.96 358.371 258.138 358.362 258.316 358.356C292.781 357.209 321.686 327.201 319.182 294.637C316.952 265.635 293.14 243.959 266.571 245.895C245.299 248.083 229.861 266.969 232.752 284.901C232.774 285.038 232.795 285.174 232.813 285.311C234.596 298.389 246.701 306.598 256.627 304.392C265.792 302.356 274.873 308.135 276.909 317.3C278.946 326.466 273.166 335.547 264.001 337.583C231.091 344.895 203.198 318.915 199.154 290.114C192.661 249.06 226.67 215.654 263.422 212.04C263.542 212.028 263.662 212.018 263.782 212.008C311.526 208.337 349.597 246.712 353.082 292.03C357.243 346.157 310.974 390.472 259.717 392.328C197.8 396.183 147.074 344.46 143.215 284.89C143.2 284.661 143.19 284.431 143.184 284.202C141.529 215.685 198.084 157.317 268.067 158.07C344.649 154.016 405.351 221.149 407.484 294.27C407.49 294.486 407.492 294.703 407.49 294.919C407.128 335.259 391.014 373.86 362.588 402.485C334.161 431.11 295.672 447.492 255.336 448.134C255.245 448.136 255.155 448.137 255.064 448.137C164.471 448.134 90.7245 373.143 90.7275 282.835C90.7309 184.511 158.048 113.219 250.512 60.947C258.685 56.3265 269.057 59.2065 273.677 67.3797Z" fill="#D38E8E"/>
</svg>
<h2>Captain</h2>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="40px" height="40px" viewBox="0 0 100 100" preserveAspectRatio="xMidYMid">
<circle cx="50" cy="50" r="30" stroke="#ffffff" stroke-width="10" fill="none"></circle>
<circle cx="50" cy="50" r="30" stroke="#bb5151" stroke-width="8" stroke-linecap="round" fill="none">
<animateTransform attributeName="transform" type="rotate" repeatCount="indefinite" dur="1s" values="0 50 50;180 50 50;720 50 50" keyTimes="0;0.5;1"></animateTransform>
<animate attributeName="stroke-dasharray" repeatCount="indefinite" dur="1s" values="18.84955592153876 169.64600329384882;94.2477796076938 94.24777960769377;18.84955592153876 169.64600329384882" keyTimes="0;0.5;1"></animate>
</circle>
</svg>


</body>
</html>

0 comments on commit 5ca0339

Please sign in to comment.