Skip to content

Commit aa28247

Browse files
authored
Merge pull request #14 from grimmerk/refactor2
Refactor2
2 parents c113530 + 12d8908 commit aa28247

28 files changed

Lines changed: 33 additions & 5481 deletions

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
desktop/electron/out
2+
3+
electron/embedded.provisionprofile

README.md

Lines changed: 31 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# SwitchV
22

3-
Use this to quickly open and switch VSCode projects.
3+
Use this to quickly open and switch VS Code projects.
44

55
## Features
66

7-
- use ~~command line~~ shortcut/tray menu to quickly launch a UI listing recent opened window with different project paths, then select one to open it in VSCode.
7+
- use ~~command line~~ shortcut/tray menu to quickly launch a UI listing recent opened window with different project paths, then select one to open it in VS Code.
88

99
## Dev and package Note
1010

@@ -16,16 +16,16 @@ Use this to quickly open and switch VSCode projects.
1616
- install [vsce](https://code.visualstudio.com/api/working-with-extensions/publishing-extension)
1717
- `yarn make` ~~`vsce package`~~,
1818
- `yarn load` (first time) & `yarn reload` ~~then `code --install-extension SwitchV-0.0.1.vsix`~~ to install.
19-
- server
20-
- `yarn install`
21-
- For the first time or every time db scheme changes, execute `yarn db:migrate` to generate SQLite DB file (`./prisma/dev.db`) and generate TypeScript interface. `yarn db:view` can be used to view DB data.
22-
- ~~To generate TypeScript DB interface via `yarn db:type`~~ (db:migrate will also automatically do this part, `yarn install` will also include generated types in node_modules/.prisma/index.d.ts)
23-
- F5 debug or `yarn start:debug`
24-
- build: `yarn make`.
25-
- desktop/electron
19+
- ~~server(moved into electron)~~
20+
- ~~`yarn install`~~
21+
- electron (desktop app)
2622
- `yarn install`
27-
- `yarn start` (not set VSCode debugging yet)
28-
- package as mac app: `yarn make`. It (Electron part) is about 196MB. Server vercel/pkg build is 119MB. Total it is 316MB. Try Tauri to reduce electron part?
23+
- DB setup
24+
- For the first time or every time db scheme changes, execute `yarn db:migrate` to generate SQLite DB file (`./prisma/dev.db`) and generate TypeScript interface. `yarn db:view` can be used to view DB data.
25+
- ~~To generate TypeScript DB interface via `yarn db:type`~~ (db:migrate will also automatically do this part, `yarn install` will also include generated types in node_modules/.prisma/index.d.ts)
26+
- `yarn start` (not set VS Code debugging yet)
27+
- ~~F5 debug or `yarn start:debug`~~ (need fix since we have embed the server into electron)
28+
- package as mac app: `yarn make`. It (Electron part) is about 196MB. ~~Server vercel/pkg build is 119MB. Total it is 316MB. Try Tauri to reduce electron part?~~
2929
- build mas build: `yarn make_mas`. Then execute `sh ./sign.sh`.
3030

3131

@@ -38,7 +38,7 @@ Use this to quickly open and switch VSCode projects.
3838

3939
## issues/todos
4040

41-
1. [fixed] after click one window item, show VSCode, first time "cmd+ctrl+j" trigger does not effect and always need the second time.
41+
1. [fixed] after click one window item, show VS Code, first time "cmd+ctrl+j" trigger does not effect and always need the second time.
4242

4343
2. [fixed] after using ctrl+w to close SwitchV, the window object will be destroyed and can not be used anymore (will throw exception)
4444

@@ -50,6 +50,13 @@ Use this to quickly open and switch VSCode projects.
5050

5151
6. ~~React App is called twice initially~~ (this is due to <React.StrictMode>). ref: https://github.com/facebook/react/issues/12856#issuecomment-390206425
5252

53+
54+
7. [solved] how to use vercel/pkg bundle deb.db in nestjs, instead of manual copy????
55+
1. Solved by using macOS application folder to store db file.
56+
2. Eventually, using `vercel/pkg` was also gave up and server is embedded into electron to make the final packaging working.
57+
8. [fixed] close the packaged app via cmd+q seems not close SwitchV-server-macos process? check by command: lsof -i:55688. Use ctrl+c to stop development (running via yarn start) is OK. (add close button on tray to help? I guess it is not helping).
58+
1. Solved by electron sending kill server process in the before-quick event handler. Another person suggests to add one more step to handle SIGINT signal on server side, ref https://stackoverflow.com/questions/71523442/child-process-doesnt-exit.
59+
5360
### debugger issue
5461

5562
**To debug main process**
@@ -105,20 +112,18 @@ The drawback is you will see two copy of SwitchV. And attaching render process t
105112
## notes about packaging a macOS app
106113

107114
steps:
108-
1. bundle server
109-
1. in server, execute `yarn build` to generate dist folder
110-
2. (first time) `yarn global add pkg`
111-
3. ~~add `"version": "0.0.1"` field in `generated server/node_modules/.prisma/client/package.json`~~
112-
4. ~~in server, `pkg --debug -t node16-macos-arm64 -o SwitchV-server-macos .`~~
113-
5. `yarn make`
114-
6. [optional] `DEBUG_PKG=1 ./SwitchV-server-macos` for debugging
115-
2. in electron, `yarn make` to generate out folder
116-
117-
two issues
118-
1. x TODO: how to use vercel/pkg bundle deb.db in nestjs, instead of manual copy???? (use macOS application folder to store db file)
119-
2. x TODO: close the packaged app via cmd+q seems not close SwitchV-server-macos process? check by command: lsof -i:55688. Use ctrl+c to stop development (running via yarn start) is OK. (add close button on tray to help? I guess it is not helping). Solved by electron send kill server process in the before-quick event handler. Another person suggests to add one more step to handle SIGINT signal on server side, ref https://stackoverflow.com/questions/71523442/child-process-doesnt-exit.
120-
121-
### server notes
115+
1. ~~bundle server~~
116+
1. ~~in server, execute `yarn build` to generate dist folder~~
117+
2. ~~(first time) `yarn global add pkg`~~
118+
3. ~~add `"version": "0.0.1"` field in `generated server/node_modules/.prisma/client/package.json`~~
119+
4. ~~in server, `pkg --debug -t node16-macos-arm64 -o SwitchV-server-macos .`~~
120+
5. ~~`yarn make`~~
121+
6. ~~[optional] `DEBUG_PKG=1 ./SwitchV-server-macos` for debugging~~
122+
2. Follow [Prepare provisioning profile](https://www.electronjs.org/) section on https://www.electronjs.org/ to get `yourapp.provisionprofile` and download it as `electron/embedded.provisionprofile`.
123+
3. in electron, `yarn make` to generate out folder
124+
125+
126+
### server packaging notes (we had use vercel/pkg to package server but we have decided to embed server to electron)
122127
ref:
123128
1. https://github.com/prisma/prisma/issues/8449
124129
2. https://github.com/vercel/pkg/issues/1508

server/.env

Lines changed: 0 additions & 7 deletions
This file was deleted.

server/.eslintrc.js

Lines changed: 0 additions & 25 deletions
This file was deleted.

server/.gitignore

Lines changed: 0 additions & 35 deletions
This file was deleted.

server/.prettierrc

Lines changed: 0 additions & 4 deletions
This file was deleted.

server/.vscode/launch.json

Lines changed: 0 additions & 20 deletions
This file was deleted.

server/README.md

Lines changed: 0 additions & 33 deletions
This file was deleted.

server/build.sh

Lines changed: 0 additions & 6 deletions
This file was deleted.

server/nest-cli.json

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)