Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
rouzwelt committed Feb 19, 2025
1 parent 0cacf81 commit b735034
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 37 deletions.
2 changes: 1 addition & 1 deletion tauri-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"format-bindings": "prettier --write src/lib/types",
"format-check": "prettier --list-different src",
"svelte-lint-format-check": "npm run check && npm run lint-check && npm run format-check",
"build-bindings": "npm run rm-temp && npm run build-wasm && node ./scripts/build.cjs && npm run format-bindings",
"build-bindings": "npm run rm-temp && npm run build-wasm && node ./scripts/build && npm run format-bindings",
"build-wasm": "cd src-tauri && cargo build --target wasm32-unknown-unknown --lib -r && cd ..",
"rm-temp": "rimraf ./temp"
},
Expand Down
26 changes: 0 additions & 26 deletions tauri-app/scripts/build.cjs

This file was deleted.

26 changes: 26 additions & 0 deletions tauri-app/scripts/build.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { execSync } from 'node:child_process';
import { mkdirSync, readFileSync, writeFileSync } from 'node:fs';

// create dirs
mkdirSync('./temp', { recursive: true });
mkdirSync('./src/lib/types', { recursive: true });

// generate bindings
execSync(
'wasm-bindgen --target nodejs ./src-tauri/target/wasm32-unknown-unknown/release/tauri_app.wasm --out-dir ./temp --out-name tauriBindings',
);

// prepare and move to src/lib/types as we only need the ts typings
let ts = readFileSync(`./temp/tauriBindings.d.ts`, {
encoding: 'utf-8',
});
ts = ts.replace(
`/* tslint:disable */
/* eslint-disable */`,
'',
);
ts = '/* this file is auto-generated, do not modify */\n' + ts;
writeFileSync('./src/lib/types/tauriBindings.ts', ts);

// remove temp dir
execSync('npm run rm-temp');
10 changes: 0 additions & 10 deletions typeshare.toml

This file was deleted.

0 comments on commit b735034

Please sign in to comment.