Skip to content

Commit

Permalink
refactor(cli/migrate): use oxc kit to parse and migrate js/ts files (
Browse files Browse the repository at this point in the history
…#10198)

* refactor(cli/migrate): use `oxc` kit to parse and migrate js/ts files

closes #10192

* fix tests

* use majic-string to perserve formatting

* more comments

* Discard changes to package.json

* Update cli-migrate-enhancemnets.md

* Update cli-migrate-enhancemnets.md

* more context

* add missing quotes, rename getcurrent

* fix change file

---------

Co-authored-by: Lucas Nogueira <lucas@tauri.app>
  • Loading branch information
amrbashir and lucasfernog authored Jul 12, 2024
1 parent 2c076d6 commit c01e87a
Show file tree
Hide file tree
Showing 10 changed files with 692 additions and 70 deletions.
14 changes: 14 additions & 0 deletions .changes/cli-migrate-enhancemnets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
"tauri-cli": "patch:enhance"
"@tauri-apps/cli": "patch:enhance"
---

Enhance `tauri migrate` to also migrate variables like `appWindow`:
```ts
import { appWindow } from '@tauri-apps/api/window'
```
will become:
```ts
import { getCurrentWebviewWindow } from '@tauri-apps/api/webviewWindow'
const appWindow = getCurrentWebviewWindow()
```
6 changes: 6 additions & 0 deletions .changes/cli-migrate-fix-renamed-modules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"tauri-cli": "patch:bug"
"@tauri-apps/cli": "patch:bug"
---

Fix `tauri migrate` incorrectly migrating `@tauri-apps/api/tauri` module to just `core` and `@tauri-apps/api/window` to just `webviewWindow`.
2 changes: 1 addition & 1 deletion examples/api/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ license = "Apache-2.0 OR MIT"

[lib]
name = "api_lib"
crate-type = ["staticlib", "cdylib", "rlib"]
crate-type = ["staticlib", "cdylib", "lib"]

[build-dependencies]
tauri-build = { path = "../../../core/tauri-build", features = [
Expand Down
Loading

0 comments on commit c01e87a

Please sign in to comment.