From: riqo Date: Mon, 2 Aug 2021 13:51:17 +0000 (-0500) Subject: add loader for js and ts files X-Git-Url: https://andrewgundersen.net/repos?a=commitdiff_plain;h=48e49e3f6a57a823f8ec8c5c1631aaee5ced2763;p=mime-chat add loader for js and ts files --- diff --git a/package.json b/package.json index c3c9b93..1498116 100644 --- a/package.json +++ b/package.json @@ -68,25 +68,8 @@ "spectron": "11.0.0", "typescript": "~3.9.3", "vue-cli-plugin-electron-builder": "~2.0.0-rc.6", - "vue-jest": "^5.0.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" - } - } - } - } + "vue-jest": "^5.0.0-0", + "webpack-node-externals": "^3.0.0" }, "gitHooks": { "pre-commit": "lint-staged" @@ -103,6 +86,9 @@ "url": "https://gitlab.com/crimata/electron-app.git", "release": "latest" }, + "build": { + "asarUnpack": "**/*.node" + }, "iohook": { "targets": [ "node-88", diff --git a/src/main.ts b/src/main.ts index 5ec81bc..ca37a2d 100644 --- a/src/main.ts +++ b/src/main.ts @@ -16,7 +16,9 @@ import createWindow from "./window"; // Short cut functionality dependencies import { globalShortcut } from 'electron' 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 const recordShortcut = 'CommandOrControl+S'; @@ -29,15 +31,15 @@ export default async function main() { console.log('electron abi', nodeAbi.getAbi('1.4.10', 'electron')) // listen for keyup event - ioHook.on('keyup', (event: any) => { - // emit pause recording - // send audio message - console.log('KEYUP') - console.log(event); - }); + // ioHook.on('keyup', (event: any) => { + // // emit pause recording + // // send audio message + // console.log('KEYUP') + // console.log(event); + // }); // start keyup hook; pass true for DEBUG mode. - ioHook.start(true); + // ioHook.start(true); globalShortcut.register(recordShortcut, () => { // emit begin recording diff --git a/vue.config.js b/vue.config.js new file mode 100644 index 0000000..aaf58ce --- /dev/null +++ b/vue.config.js @@ -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') + }, + } + } +}; diff --git a/yarn.lock b/yarn.lock index 6e89160..34596d0 100644 --- a/yarn.lock +++ b/yarn.lock @@ -13266,6 +13266,11 @@ webpack-merge@^4.2.2: dependencies: 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: version "1.4.3" resolved "https://registry.yarnpkg.com/webpack-sources/-/webpack-sources-1.4.3.tgz#eedd8ec0b928fbf1cbfe994e22d2d890f330a933"