add loader for js and ts files
This commit is contained in:
parent
01f31a6c05
commit
48e49e3f6a
4 changed files with 49 additions and 27 deletions
24
package.json
24
package.json
|
|
@ -68,25 +68,8 @@
|
||||||
"spectron": "11.0.0",
|
"spectron": "11.0.0",
|
||||||
"typescript": "~3.9.3",
|
"typescript": "~3.9.3",
|
||||||
"vue-cli-plugin-electron-builder": "~2.0.0-rc.6",
|
"vue-cli-plugin-electron-builder": "~2.0.0-rc.6",
|
||||||
"vue-jest": "^5.0.0-0"
|
"vue-jest": "^5.0.0-0",
|
||||||
},
|
"webpack-node-externals": "^3.0.0"
|
||||||
"vue": {
|
|
||||||
"lintOnSave": false,
|
|
||||||
"pluginOptions": {
|
|
||||||
"electronBuilder": {
|
|
||||||
"mainProcessFile": "./src/init.ts",
|
|
||||||
"rendererProcessFile": "./src/render/main.ts",
|
|
||||||
"preload": "./src/render/preload.ts",
|
|
||||||
"builderOptions": {
|
|
||||||
"appId": "com.crimata.ElectronUpdaterApp",
|
|
||||||
"artifactName": "${productName}-${version}.${ext}",
|
|
||||||
"publish": {
|
|
||||||
"provider": "generic",
|
|
||||||
"url": "https://gitlab.com/api/v4/projects/25637892/jobs/artifacts/main/raw/dist_electron?job=build"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
"gitHooks": {
|
"gitHooks": {
|
||||||
"pre-commit": "lint-staged"
|
"pre-commit": "lint-staged"
|
||||||
|
|
@ -103,6 +86,9 @@
|
||||||
"url": "https://gitlab.com/crimata/electron-app.git",
|
"url": "https://gitlab.com/crimata/electron-app.git",
|
||||||
"release": "latest"
|
"release": "latest"
|
||||||
},
|
},
|
||||||
|
"build": {
|
||||||
|
"asarUnpack": "**/*.node"
|
||||||
|
},
|
||||||
"iohook": {
|
"iohook": {
|
||||||
"targets": [
|
"targets": [
|
||||||
"node-88",
|
"node-88",
|
||||||
|
|
|
||||||
18
src/main.ts
18
src/main.ts
|
|
@ -16,7 +16,9 @@ import createWindow from "./window";
|
||||||
// Short cut functionality dependencies
|
// Short cut functionality dependencies
|
||||||
import { globalShortcut } from 'electron'
|
import { globalShortcut } from 'electron'
|
||||||
const nodeAbi = require('node-abi')
|
const nodeAbi = require('node-abi')
|
||||||
const ioHook = require('iohook');
|
// const ioHook = require('iohook');
|
||||||
|
// import ioHook from '../node_modules/iohook/builds/electron-v80-darwin-x64/build/Release/iohook.node'
|
||||||
|
// import ioHook from 'iohook'
|
||||||
|
|
||||||
// TODO: load from store
|
// TODO: load from store
|
||||||
const recordShortcut = 'CommandOrControl+S';
|
const recordShortcut = 'CommandOrControl+S';
|
||||||
|
|
@ -29,15 +31,15 @@ export default async function main() {
|
||||||
console.log('electron abi', nodeAbi.getAbi('1.4.10', 'electron'))
|
console.log('electron abi', nodeAbi.getAbi('1.4.10', 'electron'))
|
||||||
|
|
||||||
// listen for keyup event
|
// listen for keyup event
|
||||||
ioHook.on('keyup', (event: any) => {
|
// ioHook.on('keyup', (event: any) => {
|
||||||
// emit pause recording
|
// // emit pause recording
|
||||||
// send audio message
|
// // send audio message
|
||||||
console.log('KEYUP')
|
// console.log('KEYUP')
|
||||||
console.log(event);
|
// console.log(event);
|
||||||
});
|
// });
|
||||||
|
|
||||||
// start keyup hook; pass true for DEBUG mode.
|
// start keyup hook; pass true for DEBUG mode.
|
||||||
ioHook.start(true);
|
// ioHook.start(true);
|
||||||
|
|
||||||
globalShortcut.register(recordShortcut, () => {
|
globalShortcut.register(recordShortcut, () => {
|
||||||
// emit begin recording
|
// emit begin recording
|
||||||
|
|
|
||||||
29
vue.config.js
Normal file
29
vue.config.js
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
const path = require("path");
|
||||||
|
const nodeExternals = require('webpack-node-externals');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
lintOnSave: false,
|
||||||
|
pluginOptions: {
|
||||||
|
electronBuilder: {
|
||||||
|
|
||||||
|
mainProcessFile: "./src/init.ts",
|
||||||
|
rendererProcessFile: "./src/render/main.ts",
|
||||||
|
preload: "./src/render/preload.ts",
|
||||||
|
|
||||||
|
builderOptions: {
|
||||||
|
"appId": "com.crimata.ElectronUpdaterApp",
|
||||||
|
"artifactName": "${productName}-${version}.${ext}",
|
||||||
|
"publish": {
|
||||||
|
"provider": "generic",
|
||||||
|
"url": "https://gitlab.com/api/v4/projects/25637892/jobs/artifacts/main/raw/dist_electron?job=build"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
chainWebpackMainProcess: (config) => {
|
||||||
|
// Chain webpack config for electron main process only
|
||||||
|
config.externals([nodeExternals({})])
|
||||||
|
config.resolve.extensions.add('.ts')
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -13266,6 +13266,11 @@ webpack-merge@^4.2.2:
|
||||||
dependencies:
|
dependencies:
|
||||||
lodash "^4.17.15"
|
lodash "^4.17.15"
|
||||||
|
|
||||||
|
webpack-node-externals@^3.0.0:
|
||||||
|
version "3.0.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/webpack-node-externals/-/webpack-node-externals-3.0.0.tgz#1a3407c158d547a9feb4229a9e3385b7b60c9917"
|
||||||
|
integrity sha512-LnL6Z3GGDPht/AigwRh2dvL9PQPFQ8skEpVrWZXLWBYmqcaojHNN0onvHzie6rq7EWKrrBfPYqNEzTJgiwEQDQ==
|
||||||
|
|
||||||
webpack-sources@^1.1.0, webpack-sources@^1.3.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3:
|
webpack-sources@^1.1.0, webpack-sources@^1.3.0, webpack-sources@^1.4.0, webpack-sources@^1.4.1, webpack-sources@^1.4.3:
|
||||||
version "1.4.3"
|
version "1.4.3"
|
||||||
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933"
|
resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933"
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue