-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit a86eca8
Showing
17 changed files
with
13,031 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# NPM renames .gitignore to .npmignore | ||
# In order to prevent that, we remove the initial "." | ||
# And the CLI then renames it | ||
app | ||
node_modules | ||
build | ||
dist | ||
logs |
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { CapacitorConfig } from '@capacitor/cli'; | ||
|
||
const config: CapacitorConfig = { | ||
appId: 'io.ionic.starter', | ||
appName: 'point-of-sale', | ||
webDir: 'www', | ||
bundledWebRuntime: false | ||
}; | ||
|
||
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{ | ||
"appId": "com.pointofsale.app", | ||
"directories": { | ||
"buildResources": "resources" | ||
}, | ||
"files": [ | ||
"assets/**/*", | ||
"build/**/*", | ||
"capacitor.config.*", | ||
"app/**/*" | ||
], | ||
"publish": { | ||
"provider": "github" | ||
}, | ||
"nsis": { | ||
"allowElevation": true, | ||
"oneClick": false, | ||
"allowToChangeInstallationDirectory": true | ||
}, | ||
"win": { | ||
"target": "nsis", | ||
"icon": "assets/appIcon.ico" | ||
}, | ||
"mac": { | ||
"category": "your.app.category.type", | ||
"target": "dmg" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/* eslint-disable no-undef */ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
const cp = require('child_process'); | ||
const chokidar = require('chokidar'); | ||
const electron = require('electron'); | ||
|
||
let child = null; | ||
const npmCmd = process.platform === 'win32' ? 'npm.cmd' : 'npm'; | ||
const reloadWatcher = { | ||
debouncer: null, | ||
ready: false, | ||
watcher: null, | ||
restarting: false, | ||
}; | ||
|
||
///* | ||
function runBuild() { | ||
return new Promise((resolve, _reject) => { | ||
let tempChild = cp.spawn(npmCmd, ['run', 'build']); | ||
tempChild.once('exit', () => { | ||
resolve(); | ||
}); | ||
tempChild.stdout.pipe(process.stdout); | ||
}); | ||
} | ||
//*/ | ||
|
||
async function spawnElectron() { | ||
if (child !== null) { | ||
child.stdin.pause(); | ||
child.kill(); | ||
child = null; | ||
await runBuild(); | ||
} | ||
child = cp.spawn(electron, ['--inspect=5858', './']); | ||
child.on('exit', () => { | ||
if (!reloadWatcher.restarting) { | ||
process.exit(0); | ||
} | ||
}); | ||
child.stdout.pipe(process.stdout); | ||
} | ||
|
||
function setupReloadWatcher() { | ||
reloadWatcher.watcher = chokidar | ||
.watch('./src/**/*', { | ||
ignored: /[/\\]\./, | ||
persistent: true, | ||
}) | ||
.on('ready', () => { | ||
reloadWatcher.ready = true; | ||
}) | ||
.on('all', (_event, _path) => { | ||
if (reloadWatcher.ready) { | ||
clearTimeout(reloadWatcher.debouncer); | ||
reloadWatcher.debouncer = setTimeout(async () => { | ||
console.log('Restarting'); | ||
reloadWatcher.restarting = true; | ||
await spawnElectron(); | ||
reloadWatcher.restarting = false; | ||
reloadWatcher.ready = false; | ||
clearTimeout(reloadWatcher.debouncer); | ||
reloadWatcher.debouncer = null; | ||
reloadWatcher.watcher = null; | ||
setupReloadWatcher(); | ||
}, 500); | ||
} | ||
}); | ||
} | ||
|
||
(async () => { | ||
await runBuild(); | ||
await spawnElectron(); | ||
setupReloadWatcher(); | ||
})(); |
Oops, something went wrong.