fix(cli): Split metadata.json per major version. (#7276)

This commit is contained in:
Fabian-Lars 2023-06-22 15:43:47 +02:00 committed by GitHub
parent 0ef9c6b7ec
commit 38d0bed8eb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 12 deletions

View File

@ -87,7 +87,7 @@ jobs:
run: ./.scripts/ci/pack-cli.sh
- name: Get CLI version
run: echo "CLI_VERSION=$(cat tooling/cli/metadata.json | jq '."@tauri-apps/cli".version' -r)" >> $GITHUB_ENV
run: echo "CLI_VERSION=$(cat tooling/cli/metadata-v2.json | jq '."@tauri-apps/cli".version' -r)" >> $GITHUB_ENV
- name: Publish release
uses: softprops/action-gh-release@50195ba7f6f93d1ac97ba8332a178e008ad176aa

View File

@ -17,8 +17,8 @@ const { resolve } = require('path')
const packageNickname = process.argv[2]
const filePath =
packageNickname === '@tauri-apps/cli'
? `../../../tooling/cli/metadata.json`
: `../../tooling/cli/metadata.json`
? `../../../tooling/cli/metadata-v2.json`
: `../../tooling/cli/metadata-v2.json`
const bump = process.argv[3]
let index = null
@ -50,7 +50,9 @@ const inc = (version) => {
}
}
if (bump === 'premajor') {
const pre = JSON.parse(readFileSync(resolve(filePath, '../../../.changes/pre.json'), 'utf-8'))
const pre = JSON.parse(
readFileSync(resolve(filePath, '../../../.changes/pre.json'), 'utf-8')
)
return `${v.join('.')}-${pre.tag}.0`
}
return v.join('.')
@ -70,5 +72,5 @@ if (packageNickname === '@tauri-apps/cli') {
}
writeFileSync(filePath, JSON.stringify(metadata, null, 2) + '\n')
console.log(`wrote ${version} for ${packageNickname} into metadata.json`)
console.log(`wrote ${version} for ${packageNickname} into metadata-v2.json`)
console.dir(metadata)

View File

@ -0,0 +1,8 @@
{
"cli.js": {
"version": "2.0.0-alpha.10",
"node": ">= 10.0.0"
},
"tauri": "2.0.0-alpha.10",
"tauri-build": "2.0.0-alpha.6"
}

View File

@ -1,8 +1,8 @@
{
"cli.js": {
"version": "2.0.0-alpha.10",
"version": "1.4.0",
"node": ">= 10.0.0"
},
"tauri": "2.0.0-alpha.10",
"tauri-build": "2.0.0-alpha.6"
"tauri": "1.4.0",
"tauri-build": "1.4.0"
}

View File

@ -35,7 +35,8 @@ pub struct VersionMetadata {
}
fn version_metadata() -> Result<VersionMetadata> {
serde_json::from_str::<VersionMetadata>(include_str!("../../metadata.json")).map_err(Into::into)
serde_json::from_str::<VersionMetadata>(include_str!("../../metadata-v2.json"))
.map_err(Into::into)
}
#[cfg(not(debug_assertions))]
@ -46,7 +47,7 @@ pub(crate) fn cli_current_version() -> Result<String> {
#[cfg(not(debug_assertions))]
pub(crate) fn cli_upstream_version() -> Result<String> {
let upstream_metadata = match ureq::get(
"https://raw.githubusercontent.com/tauri-apps/tauri/dev/tooling/cli/metadata.json",
"https://raw.githubusercontent.com/tauri-apps/tauri/dev/tooling/cli/metadata-v2.json",
)
.timeout(std::time::Duration::from_secs(3))
.call()

View File

@ -156,7 +156,7 @@ pub fn command(mut options: Options) -> Result<()> {
options = options.load()?;
let template_target_path = PathBuf::from(&options.directory).join("src-tauri");
let metadata = serde_json::from_str::<VersionMetadata>(include_str!("../metadata.json"))?;
let metadata = serde_json::from_str::<VersionMetadata>(include_str!("../metadata-v2.json"))?;
if template_target_path.exists() && !options.force {
warn!(

View File

@ -201,7 +201,8 @@ pub fn plugin_name_data(data: &mut BTreeMap<&'static str, serde_json::Value>, pl
}
pub fn crates_metadata() -> Result<VersionMetadata> {
serde_json::from_str::<VersionMetadata>(include_str!("../../metadata.json")).map_err(Into::into)
serde_json::from_str::<VersionMetadata>(include_str!("../../metadata-v2.json"))
.map_err(Into::into)
}
pub fn generate_android_out_file(