Skip to content

TagSpaces is an offline, open source, document manager with tagging support

fix run bs and package

sytolk04fba5cf4377
diff --git a/.erb/configs/webpack.config.base.ts b/.erb/configs/webpack.config.base.ts
index cdbefcf6f..f016fe473 100644
--- a/.erb/configs/webpack.config.base.ts
+++ b/.erb/configs/webpack.config.base.ts
@@ -18,12 +18,12 @@ const configuration: webpack.Configuration = {
// packages that is not included in the bundle
externals: [
...Object.keys(externals || {}),
- {
+ /*{
fsevents: "require('fsevents')",
},
{
fswin: "require('fswin')",
- },
+ },*/
/*{
fs: "require('fs')",
},
@@ -66,6 +66,7 @@ const configuration: webpack.Configuration = {
library: {
type: 'commonjs2',
},
+ // globalObject: 'this',
},
/**
diff --git a/.erb/configs/webpack.config.renderer.dev.dll.ts b/.erb/configs/webpack.config.renderer.dev.dll.ts
index 614b90f04..090f0e9fe 100644
--- a/.erb/configs/webpack.config.renderer.dev.dll.ts
+++ b/.erb/configs/webpack.config.renderer.dev.dll.ts
@@ -9,10 +9,12 @@ import baseConfig from './webpack.config.base';
import webpackPaths from './webpack.paths';
import { dependencies } from '../../package.json';
import checkNodeEnv from '../scripts/check-node-env';
+import { generateJWT } from '../../src/main/util';
checkNodeEnv('development');
const dist = webpackPaths.dllPath;
+generateJWT();
const configuration: webpack.Configuration = {
context: webpackPaths.rootPath,
diff --git a/.erb/configs/webpack.config.renderer.prod.ts b/.erb/configs/webpack.config.renderer.prod.ts
index 3dd6a831c..2311c0ebe 100644
--- a/.erb/configs/webpack.config.renderer.prod.ts
+++ b/.erb/configs/webpack.config.renderer.prod.ts
@@ -25,7 +25,7 @@ const configuration: webpack.Configuration = {
mode: 'production',
- target: 'electron-renderer',
+ target: ['web', 'electron-renderer'],
entry: [path.join(webpackPaths.srcRendererPath, 'index.tsx')],
diff --git a/package.json b/package.json
index d33f217b6..6e97c9113 100644
--- a/package.json
+++ b/package.json
@@ -58,7 +58,8 @@
"cordova-list-emulators": "cd cordova && cordova run --list --emulator && cd ..",
"cordova-remove-android": "cd cordova && cordova platform remove android && cd ..",
"cordova-remove-ios": "cd cordova && cordova platform remove ios && cd ..",
- "dev": "npm run prepare-node && npm run generate-extensions && shx mkdir -p public/modules/@tagspaces/extensions && shx cp -rL release/app/node_modules/@tagspaces/extensions/* public/modules/@tagspaces/extensions/ && npm run start",
+ "dev": "node -r ts-node/register ./.erb/scripts/link-modules.ts && npm run prepare-node && npm run generate-extensions && shx mkdir -p public/modules/@tagspaces/extensions && shx cp -rL release/app/node_modules/@tagspaces/extensions/* public/modules/@tagspaces/extensions/ && npm run start",
+ "start-main-debug": "npm run dev --inspect=5858 --remote-debugging-port=9223",
"dev-open-file": "git apply run-with-args.patch && npm run dev",
"generate-jwt": "node scripts/jwt_generate.js",
"generate-extensions": "node scripts/generateExtensionsConfig.js",
diff --git a/src/main/main.ts b/src/main/main.ts
index ce10ca44b..8f378ae6c 100644
--- a/src/main/main.ts
+++ b/src/main/main.ts
@@ -449,14 +449,16 @@ const createWindow = async (i18n) => {
height: mainWindowState.height,
//icon: getAssetPath('icon.png'),
webPreferences: {
+ //nodeIntegrationInSubFrames: true,
//webSecurity: app.isPackaged, // todo https://www.electronjs.org/docs/latest/tutorial/security#6-do-not-disable-websecurity
spellcheck: true,
//nodeIntegration: true,
webviewTag: true,
//contextIsolation: false,
- preload: app.isPackaged
- ? path.join(__dirname, 'preload.js')
- : path.join(__dirname, '../../.erb/dll/preload.js'),
+ preload:
+ app.isPackaged || !isDebug
+ ? path.join(__dirname, 'preload.js')
+ : path.join(__dirname, '../../.erb/dll/preload.js'),
},
});
diff --git a/src/main/mainEvents.ts b/src/main/mainEvents.ts
index dd4d71e5e..f6e985293 100644
--- a/src/main/mainEvents.ts
+++ b/src/main/mainEvents.ts
@@ -22,10 +22,10 @@ import {
} from '@tagspaces/tagspaces-common-node/io-node';
import fs from 'fs-extra';
import path from 'path';
-import chokidar, { FSWatcher } from 'chokidar';
+// import chokidar, { FSWatcher } from 'chokidar';
import { isWorkerAvailable, postRequest, readMacOSTags } from './util';
-let watcher: FSWatcher;
+//let watcher: FSWatcher;
export default function loadMainEvents() {
ipcMain.handle('isWorkerAvailable', async () => {
@@ -69,10 +69,10 @@ export default function loadMainEvents() {
const results = await readMacOSTags(filename);
return results;
});
- ipcMain.on('watchFolder', (event, locationPath, options) => {
+ /*ipcMain.on('watchFolder', (event, locationPath, options) => {
//const chokidar = require('chokidar');
watcher = chokidar.watch(locationPath, options);
- });
+ });*/
ipcMain.handle('postRequest', async (event, payload, endpoint) => {
const result = await postRequest(payload, endpoint);
return result;
diff --git a/src/main/preload.ts b/src/main/preload.ts
index 24cd1f244..c05db6a91 100644
--- a/src/main/preload.ts
+++ b/src/main/preload.ts
@@ -69,4 +69,9 @@ const electronHandler = {
};
contextBridge.exposeInMainWorld('electronIO', electronHandler);
+/*contextBridge.exposeInMainWorld('versions', {
+ node: () => process.versions.node,
+ chrome: () => process.versions.chrome,
+ electron: () => process.versions.electron
+})*/
export type ElectronHandler = typeof electronHandler;
diff --git a/src/renderer/hooks/CurrentLocationContextProvider.tsx b/src/renderer/hooks/CurrentLocationContextProvider.tsx
index f996899f3..779dff892 100644
--- a/src/renderer/hooks/CurrentLocationContextProvider.tsx
+++ b/src/renderer/hooks/CurrentLocationContextProvider.tsx
@@ -39,6 +39,7 @@ import { locationType } from '@tagspaces/tagspaces-common/misc';
import { getUuid } from '@tagspaces/tagspaces-common/utils-io';
import { useNotificationContext } from '-/hooks/useNotificationContext';
import { getPersistTagsInSidecarFile } from '-/reducers/settings';
+import AppConfig from '../AppConfig';
type CurrentLocationContextData = {
currentLocation: TS.Location;
@@ -160,7 +161,11 @@ export const CurrentLocationContextProvider = ({
locationPath = location.paths[0];
}
- if (locationPath && locationPath.startsWith('./')) {
+ if (
+ locationPath &&
+ locationPath.startsWith('.' + AppConfig.dirSeparator) &&
+ AppConfig.isElectron
+ ) {
// TODO test relative path (Directory Back) with other platforms
// relative paths
return window.electronIO.ipcRenderer.invoke('resolveRelativePaths');