chore(tauri-*,crates): now maintaining tauri and rust packages in another repo (#1533)
This commit is contained in:
@@ -3,42 +3,12 @@ import { join } from 'node:path'
|
||||
import { cwd } from 'node:process'
|
||||
|
||||
import { defineConfig } from 'bumpp'
|
||||
import { parse, stringify } from 'smol-toml'
|
||||
import { x } from 'tinyexec'
|
||||
|
||||
const androidVersionFile = join(cwd(), 'apps/stage-pocket/android/app-version.properties')
|
||||
|
||||
const androidVersionCodePattern = /^AIRI_VERSION_CODE=(\d+)$/m
|
||||
|
||||
async function syncCargoToml() {
|
||||
const cargoTomlFile = await readFile(join(cwd(), 'Cargo.toml'))
|
||||
const cargoToml = parse(cargoTomlFile.toString('utf-8')) as {
|
||||
workspace?: {
|
||||
package?: {
|
||||
version?: string
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof cargoToml !== 'object' || cargoToml === null) {
|
||||
throw new TypeError('Cargo.toml does not contain a valid object')
|
||||
}
|
||||
if (typeof cargoToml.workspace?.package?.version !== 'string') {
|
||||
throw new TypeError('Cargo.toml does not contain a valid version in workspace.package.version')
|
||||
}
|
||||
|
||||
const packageJSONFile = join(cwd(), 'package.json')
|
||||
const packageJSON = JSON.parse(await readFile(packageJSONFile, 'utf-8'))
|
||||
if (typeof packageJSON?.version !== 'string' || packageJSON?.version === null) {
|
||||
throw new TypeError('package.json does not contain a valid version')
|
||||
}
|
||||
|
||||
cargoToml.workspace.package.version = packageJSON.version
|
||||
console.info(`Bumping Cargo.toml version to ${cargoToml.workspace.package.version} (from package.json, ${packageJSON.version})`)
|
||||
|
||||
await writeFile(join(cwd(), 'Cargo.toml'), stringify(cargoToml))
|
||||
}
|
||||
|
||||
async function syncAndroidVersion(version: string) {
|
||||
const androidVersionContent = await readFile(androidVersionFile, 'utf-8')
|
||||
const currentVersionCodeMatch = androidVersionContent.match(androidVersionCodePattern)
|
||||
@@ -69,9 +39,6 @@ export default defineConfig({
|
||||
execute: async (operation) => {
|
||||
await x('pnpm', ['publish', '-r', '--access', 'public', '--no-git-checks', '--dry-run'])
|
||||
const nextVersion = operation.state.newVersion
|
||||
|
||||
await syncCargoToml()
|
||||
await syncAndroidVersion(nextVersion)
|
||||
await x('cargo', ['generate-lockfile'])
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user