Skip to content

Commit c6fa491

Browse files
committed
clipboard fix for standalone
1 parent fc1e15d commit c6fa491

File tree

2 files changed

+43
-6
lines changed

2 files changed

+43
-6
lines changed

.github/workflows/build.yml

+19-6
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,28 @@ jobs:
2727
- name: Build
2828
run: npm run build
2929

30+
- name: Patch
31+
run: patch -p1 < standalone.patch
32+
3033
- name: Run pkg
3134
run: |
35+
mkdir win macos linux
36+
mkdir win/ezshare linux/ezshare
37+
mv node_modules/clipboardy/fallbacks/windows/clipboard_x86_64.exe win/ezshare/clipboard.exe
38+
mv node_modules/clipboardy/fallbacks/linux/xsel linux/ezshare/clipboard
39+
rm -r node_modules/clipboardy/fallbacks
3240
pkg .
33-
mv ezshare-win.exe ezshare.exe
34-
zip ezshare-win.zip ezshare.exe
35-
mv ezshare-macos ezshare
36-
zip ezshare-macos.zip ezshare
37-
mv ezshare-linux ezshare
38-
zip ezshare-linux.zip ezshare
41+
mv ezshare-win.exe win/ezshare/ezshare.exe
42+
mv ezshare-linux linux/ezshare/ezshare
43+
mv ezshare-macos macos/ezshare
44+
cd win
45+
zip -r ../ezshare-win.zip ezshare
46+
cd ..
47+
cd macos
48+
zip ../ezshare-macos.zip ezshare
49+
cd ..
50+
cd linux
51+
zip -r ../ezshare-linux.zip ezshare
3952
4053
- name: Release
4154
uses: softprops/action-gh-release@v1

standalone.patch

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
--- a/node_modules/clipboardy/lib/linux.js
2+
+++ b/node_modules/clipboardy/lib/linux.js
3+
@@ -3,7 +3,7 @@
4+
const execa = require('execa');
5+
6+
const xsel = 'xsel';
7+
-const xselFallback = path.join(__dirname, '../fallbacks/linux/xsel');
8+
+const xselFallback = path.join(path.dirname(process.execPath), 'clipboard');
9+
10+
const copyArguments = ['--clipboard', '--input'];
11+
const pasteArguments = ['--clipboard', '--output'];
12+
--- a/node_modules/clipboardy/lib/windows.js
13+
+++ b/node_modules/clipboardy/lib/windows.js
14+
@@ -4,9 +4,7 @@
15+
const arch = require('arch');
16+
17+
// Binaries from: https://github.com/sindresorhus/win-clipboard
18+
-const windowBinaryPath = arch() === 'x64' ?
19+
- path.join(__dirname, '../fallbacks/windows/clipboard_x86_64.exe') :
20+
- path.join(__dirname, '../fallbacks/windows/clipboard_i686.exe');
21+
+const windowBinaryPath = path.join(path.dirname(process.execPath), 'clipboard.exe');
22+
23+
module.exports = {
24+
copy: async options => execa(windowBinaryPath, ['--copy'], options),

0 commit comments

Comments
 (0)