(feat): update android version stuff to better fit obtainium's needs
This commit is contained in:
parent
167036533c
commit
ebd2a364a7
8 changed files with 90 additions and 9 deletions
|
|
@ -147,7 +147,7 @@ jobs:
|
|||
run: |
|
||||
VERSION="$(node -p "require('./package.json').version")"
|
||||
echo "version=$VERSION" >> "$FORGEJO_OUTPUT"
|
||||
echo "tag=${VERSION}-prod" >> "$FORGEJO_OUTPUT"
|
||||
echo "tag=$VERSION" >> "$FORGEJO_OUTPUT"
|
||||
|
||||
- name: Create release and upload files
|
||||
env:
|
||||
|
|
|
|||
3
.vscode/extensions.json
vendored
3
.vscode/extensions.json
vendored
|
|
@ -2,7 +2,6 @@
|
|||
"recommendations": [
|
||||
"tauri-apps.tauri-vscode",
|
||||
"rust-lang.rust-analyzer",
|
||||
"bradlc.vscode-tailwindcss",
|
||||
"antfu.vite"
|
||||
"bradlc.vscode-tailwindcss"
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
"dev:mobile:raw": "tauri android dev",
|
||||
"build:mobile:raw": "tauri android build",
|
||||
"dev:mobile": "if command -v nix >/dev/null 2>&1; then nix develop --command bun dev:mobile:raw; else bun dev:mobile:raw; fi",
|
||||
"build:mobile": "if command -v nix >/dev/null 2>&1; then nix develop --command bun build:mobile:raw; else bun build:mobile:raw; fi",
|
||||
"build:mobile": "bun run render-version.ts && if command -v nix >/dev/null 2>&1; then nix develop --command bun build:mobile:raw; else bun build:mobile:raw; fi && bun run render-version.ts --unrender",
|
||||
"dev:desktop:raw": "tauri dev",
|
||||
"build:desktop:raw": "tauri build",
|
||||
"dev:desktop": "if command -v nix >/dev/null 2>&1; then nix develop --command bun dev:desktop:raw; else bun dev:desktop:raw; fi",
|
||||
|
|
@ -46,6 +46,7 @@
|
|||
"react-dom": "^19.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2"
|
||||
"@tauri-apps/cli": "^2",
|
||||
"@types/node": "^25.9.1"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
75
apps/tauri/render-version.ts
Normal file
75
apps/tauri/render-version.ts
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
// Config
|
||||
const PLACEHOLDER_VERSION = "0.0.0";
|
||||
|
||||
const rootPackageJsonPath = path.resolve(__dirname, "../../package.json");
|
||||
const cargoTomlPath = path.resolve(__dirname, "./src-tauri/Cargo.toml");
|
||||
const tauriConfigPath = path.resolve(__dirname, "./src-tauri/tauri.conf.json");
|
||||
|
||||
// Args
|
||||
const isUnrender = process.argv.includes("--unrender");
|
||||
|
||||
// Version Source
|
||||
const packageJson = JSON.parse(
|
||||
fs.readFileSync(rootPackageJsonPath, "utf8")
|
||||
);
|
||||
|
||||
const packageVersion: string = packageJson.version;
|
||||
|
||||
if (!packageVersion && !isUnrender) {
|
||||
throw new Error("No version found in package.json");
|
||||
}
|
||||
|
||||
const targetVersion = isUnrender
|
||||
? PLACEHOLDER_VERSION
|
||||
: packageVersion;
|
||||
|
||||
// Helpers
|
||||
function updateCargoToml(content: string): string {
|
||||
const regex = /^version\s*=\s*".*"$/m;
|
||||
|
||||
if (!regex.test(content)) {
|
||||
throw new Error("Could not find version field in Cargo.toml");
|
||||
}
|
||||
|
||||
return content.replace(
|
||||
regex,
|
||||
`version = "${targetVersion}"`
|
||||
);
|
||||
}
|
||||
|
||||
function updateTauriConfig(content: string): string {
|
||||
const regex = /"version"\s*:\s*".*"/;
|
||||
|
||||
if (!regex.test(content)) {
|
||||
throw new Error("Could not find version field in tauri.conf.json");
|
||||
}
|
||||
|
||||
return content.replace(
|
||||
regex,
|
||||
`"version": "${targetVersion}"`
|
||||
);
|
||||
}
|
||||
|
||||
// Update Cargo.toml
|
||||
const cargoToml = fs.readFileSync(cargoTomlPath, "utf8");
|
||||
|
||||
const updatedCargoToml = updateCargoToml(cargoToml);
|
||||
|
||||
fs.writeFileSync(cargoTomlPath, updatedCargoToml, "utf8");
|
||||
|
||||
// Update tauri.conf.json
|
||||
const tauriConfig = fs.readFileSync(tauriConfigPath, "utf8");
|
||||
|
||||
const updatedTauriConfig = updateTauriConfig(tauriConfig);
|
||||
|
||||
fs.writeFileSync(tauriConfigPath, updatedTauriConfig, "utf8");
|
||||
|
||||
// Finished
|
||||
if (isUnrender) {
|
||||
console.log(`Unrendered versions back to ${PLACEHOLDER_VERSION}`);
|
||||
} else {
|
||||
console.log(`Rendered version ${targetVersion}`);
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "tensamin"
|
||||
version = "0.1.0"
|
||||
name = "Tensamin"
|
||||
version = "0.0.0"
|
||||
description = "Privacy focused messanger"
|
||||
authors = ["methanium"]
|
||||
edition = "2021"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Tensamin",
|
||||
"version": "0.1.0",
|
||||
"version": "0.0.0",
|
||||
"mainBinaryName": "tensamin",
|
||||
"identifier": "net.tensamin.client",
|
||||
"build": {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"types": ["node"],
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
|
|
@ -8,5 +9,5 @@
|
|||
"skipLibCheck": true,
|
||||
"noEmit": true
|
||||
},
|
||||
"include": ["src"]
|
||||
"include": ["src", "./render-version.ts"]
|
||||
}
|
||||
|
|
|
|||
5
bun.lock
5
bun.lock
|
|
@ -40,6 +40,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"@tauri-apps/cli": "^2",
|
||||
"@types/node": "^25.9.1",
|
||||
},
|
||||
},
|
||||
"apps/web": {
|
||||
|
|
@ -1661,6 +1662,8 @@
|
|||
|
||||
"@tailwindcss/oxide-wasm32-wasi/tslib": ["tslib@2.8.1", "", { "bundled": true }, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="],
|
||||
|
||||
"@tensamin/tauri/@types/node": ["@types/node@25.9.1", "", { "dependencies": { "undici-types": ">=7.24.0 <7.24.7" } }, "sha512-xfrlY7UD5rMJk3ZVJP8BNzS28J36YJg+xp+LPXV1TdWxr8uMH5A860QNxYDGQe/ylDSgjxE52Q9VnO7p75tJxg=="],
|
||||
|
||||
"@tensamin/ui/recharts": ["recharts@3.8.0", "", { "dependencies": { "@reduxjs/toolkit": "^1.9.0 || 2.x.x", "clsx": "^2.1.1", "decimal.js-light": "^2.5.1", "es-toolkit": "^1.39.3", "eventemitter3": "^5.0.1", "immer": "^10.1.1", "react-redux": "8.x.x || 9.x.x", "reselect": "5.1.1", "tiny-invariant": "^1.3.3", "use-sync-external-store": "^1.2.2", "victory-vendor": "^37.0.2" }, "peerDependencies": { "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0", "react-is": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" } }, "sha512-Z/m38DX3L73ExO4Tpc9/iZWHmHnlzWG4njQbxsF5aSjwqmHNDDIm0rdEBArkwsBvR8U6EirlEHiQNYWCVh9sGQ=="],
|
||||
|
||||
"@tensamin/ui/shadcn": ["shadcn@3.8.5", "", { "dependencies": { "@antfu/ni": "^25.0.0", "@babel/core": "^7.28.0", "@babel/parser": "^7.28.0", "@babel/plugin-transform-typescript": "^7.28.0", "@babel/preset-typescript": "^7.27.1", "@dotenvx/dotenvx": "^1.48.4", "@modelcontextprotocol/sdk": "^1.26.0", "@types/validate-npm-package-name": "^4.0.2", "browserslist": "^4.26.2", "commander": "^14.0.0", "cosmiconfig": "^9.0.0", "dedent": "^1.6.0", "deepmerge": "^4.3.1", "diff": "^8.0.2", "execa": "^9.6.0", "fast-glob": "^3.3.3", "fs-extra": "^11.3.1", "fuzzysort": "^3.1.0", "https-proxy-agent": "^7.0.6", "kleur": "^4.1.5", "msw": "^2.10.4", "node-fetch": "^3.3.2", "open": "^11.0.0", "ora": "^8.2.0", "postcss": "^8.5.6", "postcss-selector-parser": "^7.1.0", "prompts": "^2.4.2", "recast": "^0.23.11", "stringify-object": "^5.0.0", "tailwind-merge": "^3.0.1", "ts-morph": "^26.0.0", "tsconfig-paths": "^4.2.0", "validate-npm-package-name": "^7.0.1", "zod": "^3.24.1", "zod-to-json-schema": "^3.24.6" }, "bin": { "shadcn": "dist/index.js" } }, "sha512-jPRx44e+eyeV7xwY3BLJXcfrks00+M0h5BGB9l6DdcBW4BpAj4x3lVmVy0TXPEs2iHEisxejr62sZAAw6B1EVA=="],
|
||||
|
|
@ -1721,6 +1724,8 @@
|
|||
|
||||
"@modelcontextprotocol/sdk/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
||||
"@tensamin/tauri/@types/node/undici-types": ["undici-types@7.24.6", "", {}, "sha512-WRNW+sJgj5OBN4/0JpHFqtqzhpbnV0GuB+OozA9gCL7a993SmU+1JBZCzLNxYsbMfIeDL+lTsphD5jN5N+n0zg=="],
|
||||
|
||||
"@tensamin/ui/shadcn/zod": ["zod@3.25.76", "", {}, "sha512-gzUt/qt81nXsFGKIFcC3YnfEAx5NkunCfnDlvuBSSFS02bcXu4Lmea0AFIUwbLWxWPx3d9p8S5QoaujKcNQxcQ=="],
|
||||
|
||||
"ajv-formats/ajv/json-schema-traverse": ["json-schema-traverse@1.0.0", "", {}, "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug=="],
|
||||
|
|
|
|||
Loading…
Reference in a new issue