Skip to content

Commit f94b1f4

Browse files
committed
fix: handle CRLF Cargo.lock in version sync
1 parent 13f7759 commit f94b1f4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/sync-tauri-version.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ if (currentCargoVersion !== version) {
7272
const cargoLockPath = join(root, 'src-tauri/Cargo.lock')
7373
const cargoLockSrc = readFileSync(cargoLockPath, 'utf-8')
7474
const cargoLockPackageRe =
75-
/(^\[\[package\]\]\n(?:(?!^\[\[package\]\]).)*?^name\s*=\s*"switchhosts"\s*$\n(?:(?!^\[\[package\]\]).)*?^version\s*=\s*")([^"]*)(")/ms
75+
/(^\[\[package\]\]\r?\n(?:(?!^\[\[package\]\]).)*?^name[ \t]*=[ \t]*"switchhosts"[ \t]*\r?\n(?:(?!^\[\[package\]\]).)*?^version[ \t]*=[ \t]*")([^"]*)(")/ms
7676
const cargoLockMatch = cargoLockSrc.match(cargoLockPackageRe)
7777
if (!cargoLockMatch) {
7878
throw new Error(`[sync-version] cannot find the switchhosts package entry in ${cargoLockPath}`)

0 commit comments

Comments
 (0)