🐛 fix: prepare scripts for package api
Signed-off-by: Pauline <git@ethanlibs.co>
This commit is contained in:
parent
aeefb368b6
commit
574d783821
9 changed files with 144 additions and 185 deletions
14
.github/actions/setup-system/action.yml
vendored
14
.github/actions/setup-system/action.yml
vendored
|
|
@ -64,10 +64,10 @@ runs:
|
|||
with:
|
||||
token: ${{ github.token }}
|
||||
|
||||
# - name: Setup Shared Libraries
|
||||
# shell: bash
|
||||
# env:
|
||||
# TARGET_TRIPLE: ${{ inputs.triple }}
|
||||
# GITHUB_TOKEN: ${{ inputs.token }}
|
||||
# NODE_ENV: debug
|
||||
# run: pnpm prepare
|
||||
- name: Setup Shared Libraries
|
||||
shell: bash
|
||||
env:
|
||||
TARGET_TRIPLE: ${{ inputs.triple }}
|
||||
GITHUB_TOKEN: ${{ inputs.token }}
|
||||
NODE_ENV: debug
|
||||
run: pnpm prep
|
||||
|
|
|
|||
|
|
@ -21,9 +21,6 @@
|
|||
"@iconify-json/logos": "^1.1.44",
|
||||
"@leeoniya/ufuzzy": "^1.0.14",
|
||||
"@onelauncher/client": "workspace:*",
|
||||
"@rspc/client": "^0.2.3",
|
||||
"@rspc/solid-query": "^0.2.3",
|
||||
"@rspc/tauri": "^0.2.0",
|
||||
"@solid-primitives/refs": "^1.0.8",
|
||||
"@solidjs/router": "^0.14.1",
|
||||
"@tanstack/solid-query": "^5.51.21",
|
||||
|
|
|
|||
|
|
@ -64,10 +64,5 @@
|
|||
"typescript": "^5.5.4",
|
||||
"vite": "^5.3.5",
|
||||
"vitest": "^2.0.5"
|
||||
},
|
||||
"pnpm": {
|
||||
"patchDependencies": {
|
||||
"@rspc/tauri@0.2.0": "packages/patches/@rspc__tauri@0.2.0.patch"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,9 +16,6 @@
|
|||
"types": "./src/index.ts",
|
||||
"scripts": {},
|
||||
"dependencies": {
|
||||
"@rspc/client": "^0.2.3",
|
||||
"@rspc/solid-query": "^0.2.3",
|
||||
"@rspc/tauri": "^0.2.0",
|
||||
"@solid-primitives/deep": "^0.2.9",
|
||||
"@tanstack/solid-query": "^5.51.21",
|
||||
"fast-equals": "^5.0.1",
|
||||
|
|
|
|||
|
|
@ -1,90 +0,0 @@
|
|||
diff --git a/dist/index.js b/dist/index.js
|
||||
index 9c147bac563ff3f42130b6bbcaa39be46a5a2df2..1e14b7ecdd5e812c1c3c02ffecdda0f8fe7c8e4e 100644
|
||||
--- a/dist/index.js
|
||||
+++ b/dist/index.js
|
||||
@@ -39,7 +39,7 @@ var TauriTransport = (_class = class {
|
||||
resolve = res;
|
||||
});
|
||||
this.requestMap.set(id, resolve);
|
||||
- await _window.appWindow.emit("plugin:rspc:transport", {
|
||||
+ await _window.getCurrent.call(void 0, ).emit("plugin:rspc:transport", {
|
||||
id,
|
||||
method: operation,
|
||||
params: {
|
||||
diff --git a/dist/index.js.map b/dist/index.js.map
|
||||
index e81a18ddd3c2b9e0062ffe1fb3232bd075288310..dbc9a1a1f37c670c6b1c642da3a2d327938c6ba1 100644
|
||||
--- a/dist/index.js.map
|
||||
+++ b/dist/index.js.map
|
||||
@@ -1 +1 @@
|
||||
-{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAAA,SAAS,UAAoC,iBAAiB;AAC9D,SAAS,cAA0B;AACnC,SAAS,iBAAiB;AAEnB,IAAM,iBAAN,MAA0C;AAAA,EACvC,aAAa,oBAAI,IAAiC;AAAA,EAClD;AAAA,EACR;AAAA,EAEA,cAAc;AACZ,SAAK,WAAW,OAAO,8BAA8B,CAAC,UAAU;AAVpE;AAWM,YAAM,EAAE,IAAI,OAAO,IAAI,MAAM;AAC7B,UAAI,OAAO,SAAS,SAAS;AAC3B,YAAI,KAAK;AACP,eAAK,2BAA2B,IAAI,OAAO,IAAI;AAAA,MACnD,WAAW,OAAO,SAAS,YAAY;AACrC,YAAI,KAAK,WAAW,IAAI,EAAE,GAAG;AAC3B,qBAAK,WAAW,IAAI,EAAE,MAAtB,mBAA0B,EAAE,MAAM,YAAY,QAAQ,OAAO,KAAK;AAClE,eAAK,WAAW,OAAO,EAAE;AAAA,QAC3B;AAAA,MACF,WAAW,OAAO,SAAS,SAAS;AAClC,cAAM,EAAE,SAAS,KAAK,IAAI,OAAO;AACjC,YAAI,KAAK,WAAW,IAAI,EAAE,GAAG;AAC3B,qBAAK,WAAW,IAAI,EAAE,MAAtB,mBAA0B,EAAE,MAAM,SAAS,SAAS,KAAK;AACzD,eAAK,WAAW,OAAO,EAAE;AAAA,QAC3B;AAAA,MACF,OAAO;AACL,gBAAQ,MAAM,qCAAqC,OAAO,IAAI,GAAG;AAAA,MACnE;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,UACJ,WACA,KACA,OACc;AACd,QAAI,CAAC,KAAK,UAAU;AAClB,YAAM,KAAK;AAAA,IACb;AAEA,UAAM,KAAK,SAAS;AACpB,QAAI;AACJ,UAAM,UAAU,IAAI,QAAQ,CAAC,QAAQ;AACnC,gBAAU;AAAA,IACZ,CAAC;AAGD,SAAK,WAAW,IAAI,IAAI,OAAO;AAE/B,UAAM,UAAU,KAAK,yBAAyB;AAAA,MAC5C;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ;AAAA,QACN,MAAM;AAAA,QACN;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,OAAQ,MAAM;AACpB,QAAI,KAAK,SAAS,SAAS;AACzB,YAAM,EAAE,MAAM,QAAQ,IAAI;AAC1B,YAAM,IAAI,UAAU,MAAM,OAAO;AAAA,IACnC,WAAW,KAAK,SAAS,YAAY;AACnC,aAAO,KAAK;AAAA,IACd,OAAO;AACL,YAAM,IAAI;AAAA,QACR,oDAAoD,6BAAM,IAAI;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import { randomId, OperationType, Transport, RSPCError } from \"@rspc/client\";\nimport { listen, UnlistenFn } from \"@tauri-apps/api/event\";\nimport { appWindow } from \"@tauri-apps/api/window\";\n\nexport class TauriTransport implements Transport {\n private requestMap = new Map<string, (data: any) => void>();\n private listener?: Promise<UnlistenFn>;\n clientSubscriptionCallback?: (id: string, value: any) => void;\n\n constructor() {\n this.listener = listen(\"plugin:rspc:transport:resp\", (event) => {\n const { id, result } = event.payload as any;\n if (result.type === \"event\") {\n if (this.clientSubscriptionCallback)\n this.clientSubscriptionCallback(id, result.data);\n } else if (result.type === \"response\") {\n if (this.requestMap.has(id)) {\n this.requestMap.get(id)?.({ type: \"response\", result: result.data });\n this.requestMap.delete(id);\n }\n } else if (result.type === \"error\") {\n const { message, code } = result.data;\n if (this.requestMap.has(id)) {\n this.requestMap.get(id)?.({ type: \"error\", message, code });\n this.requestMap.delete(id);\n }\n } else {\n console.error(`Received event of unknown method '${result.type}'`);\n }\n });\n }\n\n async doRequest(\n operation: OperationType,\n key: string,\n input: any\n ): Promise<any> {\n if (!this.listener) {\n await this.listener;\n }\n\n const id = randomId();\n let resolve: (data: any) => void;\n const promise = new Promise((res) => {\n resolve = res;\n });\n\n // @ts-ignore\n this.requestMap.set(id, resolve);\n\n await appWindow.emit(\"plugin:rspc:transport\", {\n id,\n method: operation,\n params: {\n path: key,\n input,\n },\n });\n\n const body = (await promise) as any;\n if (body.type === \"error\") {\n const { code, message } = body;\n throw new RSPCError(code, message);\n } else if (body.type === \"response\") {\n return body.result;\n } else {\n throw new Error(\n `RSPC Tauri doRequest received invalid body type '${body?.type}'`\n );\n }\n }\n}\n"]}
|
||||
\ No newline at end of file
|
||||
+{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";AAAA,SAAS,UAAoC,iBAAiB;AAC9D,SAAS,cAA0B;AACnC,SAAS,kBAAkB;AAEpB,IAAM,iBAAN,MAA0C;AAAA,EACvC,aAAa,oBAAI,IAAiC;AAAA,EAClD;AAAA,EACR;AAAA,EAEA,cAAc;AACZ,SAAK,WAAW,OAAO,8BAA8B,CAAC,UAAU;AAVpE;AAWM,YAAM,EAAE,IAAI,OAAO,IAAI,MAAM;AAC7B,UAAI,OAAO,SAAS,SAAS;AAC3B,YAAI,KAAK;AACP,eAAK,2BAA2B,IAAI,OAAO,IAAI;AAAA,MACnD,WAAW,OAAO,SAAS,YAAY;AACrC,YAAI,KAAK,WAAW,IAAI,EAAE,GAAG;AAC3B,qBAAK,WAAW,IAAI,EAAE,MAAtB,mBAA0B,EAAE,MAAM,YAAY,QAAQ,OAAO,KAAK;AAClE,eAAK,WAAW,OAAO,EAAE;AAAA,QAC3B;AAAA,MACF,WAAW,OAAO,SAAS,SAAS;AAClC,cAAM,EAAE,SAAS,KAAK,IAAI,OAAO;AACjC,YAAI,KAAK,WAAW,IAAI,EAAE,GAAG;AAC3B,qBAAK,WAAW,IAAI,EAAE,MAAtB,mBAA0B,EAAE,MAAM,SAAS,SAAS,KAAK;AACzD,eAAK,WAAW,OAAO,EAAE;AAAA,QAC3B;AAAA,MACF,OAAO;AACL,gBAAQ,MAAM,qCAAqC,OAAO,IAAI,GAAG;AAAA,MACnE;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,UACJ,WACA,KACA,OACc;AACd,QAAI,CAAC,KAAK,UAAU;AAClB,YAAM,KAAK;AAAA,IACb;AAEA,UAAM,KAAK,SAAS;AACpB,QAAI;AACJ,UAAM,UAAU,IAAI,QAAQ,CAAC,QAAQ;AACnC,gBAAU;AAAA,IACZ,CAAC;AAGD,SAAK,WAAW,IAAI,IAAI,OAAO;AAE/B,UAAM,WAAW,EAAE,KAAK,yBAAyB;AAAA,MAC/C;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ;AAAA,QACN,MAAM;AAAA,QACN;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,OAAQ,MAAM;AACpB,QAAI,KAAK,SAAS,SAAS;AACzB,YAAM,EAAE,MAAM,QAAQ,IAAI;AAC1B,YAAM,IAAI,UAAU,MAAM,OAAO;AAAA,IACnC,WAAW,KAAK,SAAS,YAAY;AACnC,aAAO,KAAK;AAAA,IACd,OAAO;AACL,YAAM,IAAI;AAAA,QACR,oDAAoD,6BAAM,IAAI;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF","sourcesContent":["import { randomId, OperationType, Transport, RSPCError } from \"@rspc/client\";\nimport { listen, UnlistenFn } from \"@tauri-apps/api/event\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nexport class TauriTransport implements Transport {\n private requestMap = new Map<string, (data: any) => void>();\n private listener?: Promise<UnlistenFn>;\n clientSubscriptionCallback?: (id: string, value: any) => void;\n\n constructor() {\n this.listener = listen(\"plugin:rspc:transport:resp\", (event) => {\n const { id, result } = event.payload as any;\n if (result.type === \"event\") {\n if (this.clientSubscriptionCallback)\n this.clientSubscriptionCallback(id, result.data);\n } else if (result.type === \"response\") {\n if (this.requestMap.has(id)) {\n this.requestMap.get(id)?.({ type: \"response\", result: result.data });\n this.requestMap.delete(id);\n }\n } else if (result.type === \"error\") {\n const { message, code } = result.data;\n if (this.requestMap.has(id)) {\n this.requestMap.get(id)?.({ type: \"error\", message, code });\n this.requestMap.delete(id);\n }\n } else {\n console.error(`Received event of unknown method '${result.type}'`);\n }\n });\n }\n\n async doRequest(\n operation: OperationType,\n key: string,\n input: any\n ): Promise<any> {\n if (!this.listener) {\n await this.listener;\n }\n\n const id = randomId();\n let resolve: (data: any) => void;\n const promise = new Promise((res) => {\n resolve = res;\n });\n\n // @ts-ignore\n this.requestMap.set(id, resolve);\n\n await getCurrent().emit(\"plugin:rspc:transport\", {\n id,\n method: operation,\n params: {\n path: key,\n input,\n },\n });\n\n const body = (await promise) as any;\n if (body.type === \"error\") {\n const { code, message } = body;\n throw new RSPCError(code, message);\n } else if (body.type === \"response\") {\n return body.result;\n } else {\n throw new Error(\n `RSPC Tauri doRequest received invalid body type '${body?.type}'`\n );\n }\n }\n}\n"]}
|
||||
\ No newline at end of file
|
||||
diff --git a/dist/index.mjs b/dist/index.mjs
|
||||
index bba6888c0dd213cb086fad7d7548afb43fb8494c..7b01ceaee03edeb751f3e1d772b666a791242105 100644
|
||||
--- a/dist/index.mjs
|
||||
+++ b/dist/index.mjs
|
||||
@@ -1,7 +1,7 @@
|
||||
// src/index.ts
|
||||
import { randomId, RSPCError } from "@rspc/client";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
-import { appWindow } from "@tauri-apps/api/window";
|
||||
+import { getCurrent } from "@tauri-apps/api/window";
|
||||
var TauriTransport = class {
|
||||
requestMap = /* @__PURE__ */ new Map();
|
||||
listener;
|
||||
@@ -39,7 +39,7 @@ var TauriTransport = class {
|
||||
resolve = res;
|
||||
});
|
||||
this.requestMap.set(id, resolve);
|
||||
- await appWindow.emit("plugin:rspc:transport", {
|
||||
+ await getCurrent().emit("plugin:rspc:transport", {
|
||||
id,
|
||||
method: operation,
|
||||
params: {
|
||||
diff --git a/dist/index.mjs.map b/dist/index.mjs.map
|
||||
index c83073015352b197d4d4a7ee6239c180c89f31db..8d27d5faa80fc5815477e54a832c88f5da9967b4 100644
|
||||
--- a/dist/index.mjs.map
|
||||
+++ b/dist/index.mjs.map
|
||||
@@ -1 +1 @@
|
||||
-{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { randomId, OperationType, Transport, RSPCError } from \"@rspc/client\";\nimport { listen, UnlistenFn } from \"@tauri-apps/api/event\";\nimport { appWindow } from \"@tauri-apps/api/window\";\n\nexport class TauriTransport implements Transport {\n private requestMap = new Map<string, (data: any) => void>();\n private listener?: Promise<UnlistenFn>;\n clientSubscriptionCallback?: (id: string, value: any) => void;\n\n constructor() {\n this.listener = listen(\"plugin:rspc:transport:resp\", (event) => {\n const { id, result } = event.payload as any;\n if (result.type === \"event\") {\n if (this.clientSubscriptionCallback)\n this.clientSubscriptionCallback(id, result.data);\n } else if (result.type === \"response\") {\n if (this.requestMap.has(id)) {\n this.requestMap.get(id)?.({ type: \"response\", result: result.data });\n this.requestMap.delete(id);\n }\n } else if (result.type === \"error\") {\n const { message, code } = result.data;\n if (this.requestMap.has(id)) {\n this.requestMap.get(id)?.({ type: \"error\", message, code });\n this.requestMap.delete(id);\n }\n } else {\n console.error(`Received event of unknown method '${result.type}'`);\n }\n });\n }\n\n async doRequest(\n operation: OperationType,\n key: string,\n input: any\n ): Promise<any> {\n if (!this.listener) {\n await this.listener;\n }\n\n const id = randomId();\n let resolve: (data: any) => void;\n const promise = new Promise((res) => {\n resolve = res;\n });\n\n // @ts-ignore\n this.requestMap.set(id, resolve);\n\n await appWindow.emit(\"plugin:rspc:transport\", {\n id,\n method: operation,\n params: {\n path: key,\n input,\n },\n });\n\n const body = (await promise) as any;\n if (body.type === \"error\") {\n const { code, message } = body;\n throw new RSPCError(code, message);\n } else if (body.type === \"response\") {\n return body.result;\n } else {\n throw new Error(\n `RSPC Tauri doRequest received invalid body type '${body?.type}'`\n );\n }\n }\n}\n"],"mappings":";AAAA,SAAS,UAAoC,iBAAiB;AAC9D,SAAS,cAA0B;AACnC,SAAS,iBAAiB;AAEnB,IAAM,iBAAN,MAA0C;AAAA,EACvC,aAAa,oBAAI,IAAiC;AAAA,EAClD;AAAA,EACR;AAAA,EAEA,cAAc;AACZ,SAAK,WAAW,OAAO,8BAA8B,CAAC,UAAU;AAVpE;AAWM,YAAM,EAAE,IAAI,OAAO,IAAI,MAAM;AAC7B,UAAI,OAAO,SAAS,SAAS;AAC3B,YAAI,KAAK;AACP,eAAK,2BAA2B,IAAI,OAAO,IAAI;AAAA,MACnD,WAAW,OAAO,SAAS,YAAY;AACrC,YAAI,KAAK,WAAW,IAAI,EAAE,GAAG;AAC3B,qBAAK,WAAW,IAAI,EAAE,MAAtB,mBAA0B,EAAE,MAAM,YAAY,QAAQ,OAAO,KAAK;AAClE,eAAK,WAAW,OAAO,EAAE;AAAA,QAC3B;AAAA,MACF,WAAW,OAAO,SAAS,SAAS;AAClC,cAAM,EAAE,SAAS,KAAK,IAAI,OAAO;AACjC,YAAI,KAAK,WAAW,IAAI,EAAE,GAAG;AAC3B,qBAAK,WAAW,IAAI,EAAE,MAAtB,mBAA0B,EAAE,MAAM,SAAS,SAAS,KAAK;AACzD,eAAK,WAAW,OAAO,EAAE;AAAA,QAC3B;AAAA,MACF,OAAO;AACL,gBAAQ,MAAM,qCAAqC,OAAO,IAAI,GAAG;AAAA,MACnE;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,UACJ,WACA,KACA,OACc;AACd,QAAI,CAAC,KAAK,UAAU;AAClB,YAAM,KAAK;AAAA,IACb;AAEA,UAAM,KAAK,SAAS;AACpB,QAAI;AACJ,UAAM,UAAU,IAAI,QAAQ,CAAC,QAAQ;AACnC,gBAAU;AAAA,IACZ,CAAC;AAGD,SAAK,WAAW,IAAI,IAAI,OAAO;AAE/B,UAAM,UAAU,KAAK,yBAAyB;AAAA,MAC5C;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ;AAAA,QACN,MAAM;AAAA,QACN;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,OAAQ,MAAM;AACpB,QAAI,KAAK,SAAS,SAAS;AACzB,YAAM,EAAE,MAAM,QAAQ,IAAI;AAC1B,YAAM,IAAI,UAAU,MAAM,OAAO;AAAA,IACnC,WAAW,KAAK,SAAS,YAAY;AACnC,aAAO,KAAK;AAAA,IACd,OAAO;AACL,YAAM,IAAI;AAAA,QACR,oDAAoD,6BAAM,IAAI;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
||||
\ No newline at end of file
|
||||
+{"version":3,"sources":["../src/index.ts"],"sourcesContent":["import { randomId, OperationType, Transport, RSPCError } from \"@rspc/client\";\nimport { listen, UnlistenFn } from \"@tauri-apps/api/event\";\nimport { getCurrent } from \"@tauri-apps/api/window\";\n\nexport class TauriTransport implements Transport {\n private requestMap = new Map<string, (data: any) => void>();\n private listener?: Promise<UnlistenFn>;\n clientSubscriptionCallback?: (id: string, value: any) => void;\n\n constructor() {\n this.listener = listen(\"plugin:rspc:transport:resp\", (event) => {\n const { id, result } = event.payload as any;\n if (result.type === \"event\") {\n if (this.clientSubscriptionCallback)\n this.clientSubscriptionCallback(id, result.data);\n } else if (result.type === \"response\") {\n if (this.requestMap.has(id)) {\n this.requestMap.get(id)?.({ type: \"response\", result: result.data });\n this.requestMap.delete(id);\n }\n } else if (result.type === \"error\") {\n const { message, code } = result.data;\n if (this.requestMap.has(id)) {\n this.requestMap.get(id)?.({ type: \"error\", message, code });\n this.requestMap.delete(id);\n }\n } else {\n console.error(`Received event of unknown method '${result.type}'`);\n }\n });\n }\n\n async doRequest(\n operation: OperationType,\n key: string,\n input: any\n ): Promise<any> {\n if (!this.listener) {\n await this.listener;\n }\n\n const id = randomId();\n let resolve: (data: any) => void;\n const promise = new Promise((res) => {\n resolve = res;\n });\n\n // @ts-ignore\n this.requestMap.set(id, resolve);\n\n await getCurrent().emit(\"plugin:rspc:transport\", {\n id,\n method: operation,\n params: {\n path: key,\n input,\n },\n });\n\n const body = (await promise) as any;\n if (body.type === \"error\") {\n const { code, message } = body;\n throw new RSPCError(code, message);\n } else if (body.type === \"response\") {\n return body.result;\n } else {\n throw new Error(\n `RSPC Tauri doRequest received invalid body type '${body?.type}'`\n );\n }\n }\n}\n"],"mappings":";AAAA,SAAS,UAAoC,iBAAiB;AAC9D,SAAS,cAA0B;AACnC,SAAS,kBAAkB;AAEpB,IAAM,iBAAN,MAA0C;AAAA,EACvC,aAAa,oBAAI,IAAiC;AAAA,EAClD;AAAA,EACR;AAAA,EAEA,cAAc;AACZ,SAAK,WAAW,OAAO,8BAA8B,CAAC,UAAU;AAVpE;AAWM,YAAM,EAAE,IAAI,OAAO,IAAI,MAAM;AAC7B,UAAI,OAAO,SAAS,SAAS;AAC3B,YAAI,KAAK;AACP,eAAK,2BAA2B,IAAI,OAAO,IAAI;AAAA,MACnD,WAAW,OAAO,SAAS,YAAY;AACrC,YAAI,KAAK,WAAW,IAAI,EAAE,GAAG;AAC3B,qBAAK,WAAW,IAAI,EAAE,MAAtB,mBAA0B,EAAE,MAAM,YAAY,QAAQ,OAAO,KAAK;AAClE,eAAK,WAAW,OAAO,EAAE;AAAA,QAC3B;AAAA,MACF,WAAW,OAAO,SAAS,SAAS;AAClC,cAAM,EAAE,SAAS,KAAK,IAAI,OAAO;AACjC,YAAI,KAAK,WAAW,IAAI,EAAE,GAAG;AAC3B,qBAAK,WAAW,IAAI,EAAE,MAAtB,mBAA0B,EAAE,MAAM,SAAS,SAAS,KAAK;AACzD,eAAK,WAAW,OAAO,EAAE;AAAA,QAC3B;AAAA,MACF,OAAO;AACL,gBAAQ,MAAM,qCAAqC,OAAO,IAAI,GAAG;AAAA,MACnE;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,UACJ,WACA,KACA,OACc;AACd,QAAI,CAAC,KAAK,UAAU;AAClB,YAAM,KAAK;AAAA,IACb;AAEA,UAAM,KAAK,SAAS;AACpB,QAAI;AACJ,UAAM,UAAU,IAAI,QAAQ,CAAC,QAAQ;AACnC,gBAAU;AAAA,IACZ,CAAC;AAGD,SAAK,WAAW,IAAI,IAAI,OAAO;AAE/B,UAAM,WAAW,EAAE,KAAK,yBAAyB;AAAA,MAC/C;AAAA,MACA,QAAQ;AAAA,MACR,QAAQ;AAAA,QACN,MAAM;AAAA,QACN;AAAA,MACF;AAAA,IACF,CAAC;AAED,UAAM,OAAQ,MAAM;AACpB,QAAI,KAAK,SAAS,SAAS;AACzB,YAAM,EAAE,MAAM,QAAQ,IAAI;AAC1B,YAAM,IAAI,UAAU,MAAM,OAAO;AAAA,IACnC,WAAW,KAAK,SAAS,YAAY;AACnC,aAAO,KAAK;AAAA,IACd,OAAO;AACL,YAAM,IAAI;AAAA,QACR,oDAAoD,6BAAM,IAAI;AAAA,MAChE;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
||||
\ No newline at end of file
|
||||
diff --git a/package.json b/package.json
|
||||
index 270887cf93791db63c8b60ed44db12ccd2393f65..9be62429b39828236ddf5e5da7ae1b0697cc591a 100644
|
||||
--- a/package.json
|
||||
+++ b/package.json
|
||||
@@ -17,6 +17,11 @@
|
||||
"files": [
|
||||
"dist"
|
||||
],
|
||||
+ "scripts": {
|
||||
+ "dev": "tsup --watch",
|
||||
+ "build": "tsup",
|
||||
+ "prepare": "tsup"
|
||||
+ },
|
||||
"tsup": {
|
||||
"entry": [
|
||||
"src/index.ts"
|
||||
@@ -33,18 +38,14 @@
|
||||
"sourcemap": true
|
||||
},
|
||||
"dependencies": {
|
||||
- "@rspc/client": "0.2.0"
|
||||
+ "@rspc/client": "workspace:*"
|
||||
},
|
||||
"devDependencies": {
|
||||
- "@tauri-apps/api": "^1.5.3",
|
||||
+ "@tauri-apps/api": "next",
|
||||
"tsup": "^8.0.2",
|
||||
"typescript": "^5.4.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tauri-apps/api": "^1.2.0"
|
||||
- },
|
||||
- "scripts": {
|
||||
- "dev": "tsup --watch",
|
||||
- "build": "tsup"
|
||||
}
|
||||
}
|
||||
|
|
@ -4,8 +4,10 @@ import { setTimeout } from 'node:timers/promises';
|
|||
import pathe from 'pathe';
|
||||
import { execa } from 'execa';
|
||||
import { awaitLock, checkEnvironment } from './utils';
|
||||
import { patchTauri } from './utils/patch';
|
||||
|
||||
const { __dirname, __root } = checkEnvironment(import.meta);
|
||||
const env = checkEnvironment(import.meta);
|
||||
const { __dirname, __root, __exit } = env;
|
||||
const [_, __, ...args] = process.argv;
|
||||
const __distribution = pathe.join(__root, 'packages', 'distribution');
|
||||
const __desktop = pathe.join(__root, 'apps', 'desktop');
|
||||
|
|
@ -36,7 +38,7 @@ const store = { code: 0 };
|
|||
try {
|
||||
switch (args[0]) {
|
||||
case 'dev': {
|
||||
__cleanup.push(...([]));
|
||||
__cleanup.push(...(await patchTauri(env, targets, bundles, args)));
|
||||
switch (process.platform) {
|
||||
case 'linux':
|
||||
case 'darwin':
|
||||
|
|
@ -52,7 +54,7 @@ try {
|
|||
process.env.NODE_OPTIONS = `--max_old_space_size=4096 ${process.env.NODE_OPTIONS ?? ''}`;
|
||||
|
||||
process.env.GENERATE_SOURCEMAP = 'false';
|
||||
__cleanup.push(...([]));
|
||||
__cleanup.push(...(await patchTauri(env, targets, bundles, args)));
|
||||
|
||||
if (process.platform === 'darwin') {
|
||||
process.env.BACKGROUND_FILE = pathe.resolve(__distribution, 'macos', 'dmg.png');
|
||||
|
|
@ -95,5 +97,5 @@ catch (error: any) {
|
|||
}
|
||||
finally {
|
||||
cleanup();
|
||||
process.exit(store.code);
|
||||
__exit(store.code);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@ import fs from 'node:fs/promises';
|
|||
import { dirname, join, resolve } from 'pathe';
|
||||
import { execa } from 'execa';
|
||||
|
||||
export type CheckedEnvironment = ReturnType<typeof checkEnvironment>;
|
||||
|
||||
export function checkEnvironment(meta: ImportMeta) {
|
||||
if (/^(?:msys|mingw|cygwin)$/i.test(process.env.OSTYPE ?? '')) {
|
||||
console.error('bash for windows is not supported. please use powershell or cmd');
|
||||
|
|
|
|||
|
|
@ -1,9 +1,131 @@
|
|||
// import process from 'node:process';
|
||||
// import pathe from 'pathe';
|
||||
import process from 'node:process';
|
||||
import fs from 'node:fs/promises';
|
||||
import { type } from 'node:os';
|
||||
import { join } from 'pathe';
|
||||
import { execa } from 'execa';
|
||||
import semver from 'semver';
|
||||
import type { CheckedEnvironment } from '.';
|
||||
|
||||
// export async function tauriUpdateKey(): Promise<string | undefined> {
|
||||
// if (process.env.TAURI_SIGNING_PRIVATE_KEY)
|
||||
// return;
|
||||
export async function tauriUpdateKey(env: CheckedEnvironment): Promise<string | undefined> {
|
||||
if (process.env.TAURI_SIGNING_PRIVATE_KEY)
|
||||
return;
|
||||
|
||||
// const privateKeyPath = pathe.join();
|
||||
// }
|
||||
const privateKeyPath = join(env.__root, '.keys', 'tauri.key');
|
||||
const publicKeyPath = join(env.__root, '.keys', 'tauri.key.pub');
|
||||
const readKeys = () => Promise.all([
|
||||
fs.readFile(publicKeyPath, 'utf-8'),
|
||||
fs.readFile(privateKeyPath, 'utf-8'),
|
||||
]);
|
||||
|
||||
const keys = { privateKey: '', publicKey: '' };
|
||||
try {
|
||||
[keys.publicKey, keys.privateKey] = await readKeys();
|
||||
if (keys.privateKey === '' || keys.publicKey === '')
|
||||
throw new Error(`empty keys`);
|
||||
}
|
||||
catch (error) {
|
||||
if (env.__debug) {
|
||||
console.warn(`failed to read updater keys`);
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
const quote = type() === 'Windows_NT' ? '"' : '\'';
|
||||
await execa`pnpm desktop tauri signer generate --ci -w ${quote}${privateKeyPath}${quote}`;
|
||||
[keys.publicKey, keys.privateKey] = await readKeys();
|
||||
if (keys.privateKey === '' || keys.publicKey === '')
|
||||
throw new Error(`empty keys`);
|
||||
}
|
||||
|
||||
process.env.TAURI_SIGNING_PRIVATE_KEY = keys.privateKey;
|
||||
process.env.TAURI_SIGNING_PRIVATE_KEY_PASSWORD = '';
|
||||
return keys.publicKey;
|
||||
}
|
||||
|
||||
export async function patchTauri(
|
||||
env: CheckedEnvironment,
|
||||
targets: string[],
|
||||
bundles: string[],
|
||||
args: string[],
|
||||
): Promise<string[]> {
|
||||
if (args.findIndex(a => ['-c', '--config'].includes(a)) !== -1)
|
||||
throw new Error('custom tauri build configuration is not supported!');
|
||||
|
||||
const osType = type();
|
||||
const tauriPatch: {
|
||||
build: {
|
||||
features: string[];
|
||||
};
|
||||
bundle: {
|
||||
macOS: { minimumSystemVersion: string };
|
||||
};
|
||||
plugins: {
|
||||
updater: { pubkey?: string };
|
||||
};
|
||||
} = {
|
||||
build: {
|
||||
features: [],
|
||||
},
|
||||
bundle: {
|
||||
macOS: { minimumSystemVersion: '' },
|
||||
},
|
||||
plugins: {
|
||||
updater: {},
|
||||
},
|
||||
};
|
||||
|
||||
const tauriRoot = join(env.__root, 'apps', 'desktop');
|
||||
const tauriConfig = JSON.parse(await fs.readFile(join(tauriRoot, 'tauri.conf.json'), 'utf-8'));
|
||||
if (bundles.length === 0) {
|
||||
const defaultBundles = tauriConfig?.bundle?.targets;
|
||||
if (Array.isArray(defaultBundles))
|
||||
bundles.push(...defaultBundles);
|
||||
if (bundles.length === 0)
|
||||
bundles.push('all');
|
||||
}
|
||||
|
||||
switch (args[0]) {
|
||||
case 'dev':
|
||||
tauriPatch.build.features.push('devtools');
|
||||
break;
|
||||
case 'build':
|
||||
if (tauriConfig.plugins?.updater?.active) {
|
||||
const pubKey = await tauriUpdateKey(env);
|
||||
if (pubKey != null)
|
||||
tauriPatch.plugins.updater.pubkey = pubKey;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (osType === 'Darwin') {
|
||||
const macOSStore = {
|
||||
defaultArm64: '11.0',
|
||||
minimumVersion: tauriConfig?.bundle?.macOS?.minimumSystemVersion,
|
||||
};
|
||||
|
||||
if (
|
||||
(targets.includes('aarch64-apple-darwin')
|
||||
|| (targets.length === 0 && process.arch === 'arm64'))
|
||||
&& (macOSStore.minimumVersion == null || semver.lt(
|
||||
semver.coerce(macOSStore.minimumVersion) as semver.SemVer,
|
||||
semver.coerce(macOSStore.defaultArm64) as semver.SemVer,
|
||||
))
|
||||
) {
|
||||
macOSStore.minimumVersion = macOSStore.defaultArm64;
|
||||
console.log(`aarch64-apple-darwin target: setting minimum system version to ${macOSStore.minimumVersion}`);
|
||||
}
|
||||
|
||||
if (macOSStore.minimumVersion) {
|
||||
process.env.MACOSX_DEPLOYMENT_TARGET = macOSStore.minimumVersion;
|
||||
tauriPatch.bundle.macOS.minimumSystemVersion = macOSStore.minimumVersion;
|
||||
}
|
||||
else {
|
||||
throw new Error('no minimum macOS version found!');
|
||||
}
|
||||
}
|
||||
|
||||
const tauriPatchC = join(tauriRoot, 'tauri.conf.patch.json');
|
||||
await fs.writeFile(tauriPatchC, JSON.stringify(tauriPatch, null, 2));
|
||||
|
||||
args.splice(1, 0, '-c', tauriPatchC);
|
||||
return [tauriPatchC];
|
||||
}
|
||||
|
|
|
|||
66
pnpm-lock.yaml
generated
66
pnpm-lock.yaml
generated
|
|
@ -125,15 +125,6 @@ importers:
|
|||
'@onelauncher/client':
|
||||
specifier: workspace:*
|
||||
version: link:../../packages/client
|
||||
'@rspc/client':
|
||||
specifier: ^0.2.3
|
||||
version: 0.2.3
|
||||
'@rspc/solid-query':
|
||||
specifier: ^0.2.3
|
||||
version: 0.2.3(@tanstack/solid-query@5.51.21(solid-js@1.8.19))(solid-js@1.8.19)
|
||||
'@rspc/tauri':
|
||||
specifier: ^0.2.0
|
||||
version: 0.2.0(@tauri-apps/api@2.0.0-rc.0)
|
||||
'@solid-primitives/refs':
|
||||
specifier: ^1.0.8
|
||||
version: 1.0.8(solid-js@1.8.19)
|
||||
|
|
@ -221,15 +212,6 @@ importers:
|
|||
|
||||
packages/client:
|
||||
dependencies:
|
||||
'@rspc/client':
|
||||
specifier: ^0.2.3
|
||||
version: 0.2.3
|
||||
'@rspc/solid-query':
|
||||
specifier: ^0.2.3
|
||||
version: 0.2.3(@tanstack/solid-query@5.51.21(solid-js@1.8.19))(solid-js@1.8.19)
|
||||
'@rspc/tauri':
|
||||
specifier: ^0.2.0
|
||||
version: 0.2.0(@tauri-apps/api@2.0.0-rc.0)
|
||||
'@solid-primitives/deep':
|
||||
specifier: ^0.2.9
|
||||
version: 0.2.9(solid-js@1.8.19)
|
||||
|
|
@ -1299,28 +1281,6 @@ packages:
|
|||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@rspc/client@0.2.0':
|
||||
resolution: {integrity: sha512-IIOfAk4g+bzbfr3cmvm42EocsjtzMO9CRCc95ZMx9mFh5ixHzP4Na1lun+KipGzsFV1QsmV6uYSBg/4Kpnu9iA==}
|
||||
|
||||
'@rspc/client@0.2.3':
|
||||
resolution: {integrity: sha512-1TfoETE2Tt6vHCwcsu1YVNqStq7z0p6mgsMZxardNwMRBDGnpRMdOxU8Aj0ZmIRGEw1R38SXXlxqk5XeHs+mqQ==}
|
||||
|
||||
'@rspc/query-core@0.2.3':
|
||||
resolution: {integrity: sha512-IvaWGlQNw5gVVTKPz5nhmtzFXA9MpJI7fWZsDSI8o4Z/5zpF1lrUcZIrDloqO1iQPJ76EgmtntUwa52VqvcqrA==}
|
||||
peerDependencies:
|
||||
'@rspc/client': 0.2.3
|
||||
|
||||
'@rspc/solid-query@0.2.3':
|
||||
resolution: {integrity: sha512-S+UFwTf5BTeJgWLmiifQLDfVauIGRlTbk7tipd4knuDxrUXPTIyUHVUrPlZMdPTU+HLF4UZBe726jdhh6Q+Mug==}
|
||||
peerDependencies:
|
||||
'@tanstack/solid-query': ^5.0.0
|
||||
solid-js: ^1.0.0
|
||||
|
||||
'@rspc/tauri@0.2.0':
|
||||
resolution: {integrity: sha512-YULpKSCV/YZLtDRs/poiq3PVW54vMJjIbFZ8PgG+sdyZcujRudpza7xaLrfAHfbo61XdQYz/HP5j/9s5uqXQrA==}
|
||||
peerDependencies:
|
||||
'@tauri-apps/api': ^1.2.0
|
||||
|
||||
'@sec-ant/readable-stream@0.4.1':
|
||||
resolution: {integrity: sha512-831qok9r2t8AlxLko40y2ebgSDhenenCatLVeW/uBtnHPyhHOvG0C7TvfgecV+wHzIm5KUICgzmVpWS+IMEAeg==}
|
||||
|
||||
|
|
@ -1402,9 +1362,6 @@ packages:
|
|||
peerDependencies:
|
||||
eslint: '>=8.40.0'
|
||||
|
||||
'@tanstack/query-core@5.51.1':
|
||||
resolution: {integrity: sha512-fJBMQMpo8/KSsWW5ratJR5+IFr7YNJ3K2kfP9l5XObYHsgfVy1w3FJUWU4FT2fj7+JMaEg33zOcNDBo0LMwHnw==}
|
||||
|
||||
'@tanstack/query-core@5.51.21':
|
||||
resolution: {integrity: sha512-POQxm42IUp6n89kKWF4IZi18v3fxQWFRolvBA6phNVmA8psdfB1MvDnGacCJdS+EOX12w/CyHM62z//rHmYmvw==}
|
||||
|
||||
|
|
@ -5273,27 +5230,6 @@ snapshots:
|
|||
'@rollup/rollup-win32-x64-msvc@4.20.0':
|
||||
optional: true
|
||||
|
||||
'@rspc/client@0.2.0': {}
|
||||
|
||||
'@rspc/client@0.2.3': {}
|
||||
|
||||
'@rspc/query-core@0.2.3(@rspc/client@0.2.3)':
|
||||
dependencies:
|
||||
'@rspc/client': 0.2.3
|
||||
'@tanstack/query-core': 5.51.1
|
||||
|
||||
'@rspc/solid-query@0.2.3(@tanstack/solid-query@5.51.21(solid-js@1.8.19))(solid-js@1.8.19)':
|
||||
dependencies:
|
||||
'@rspc/client': 0.2.3
|
||||
'@rspc/query-core': 0.2.3(@rspc/client@0.2.3)
|
||||
'@tanstack/solid-query': 5.51.21(solid-js@1.8.19)
|
||||
solid-js: 1.8.19
|
||||
|
||||
'@rspc/tauri@0.2.0(@tauri-apps/api@2.0.0-rc.0)':
|
||||
dependencies:
|
||||
'@rspc/client': 0.2.0
|
||||
'@tauri-apps/api': 2.0.0-rc.0
|
||||
|
||||
'@sec-ant/readable-stream@0.4.1': {}
|
||||
|
||||
'@sindresorhus/merge-streams@4.0.0': {}
|
||||
|
|
@ -5384,8 +5320,6 @@ snapshots:
|
|||
- supports-color
|
||||
- typescript
|
||||
|
||||
'@tanstack/query-core@5.51.1': {}
|
||||
|
||||
'@tanstack/query-core@5.51.21': {}
|
||||
|
||||
'@tanstack/solid-query@5.51.21(solid-js@1.8.19)':
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue