Skip to content

Commit 1bf6bae

Browse files
committed
chore: 🤖 release flow
1 parent fd13af7 commit 1bf6bae

File tree

6 files changed

+246
-70
lines changed

6 files changed

+246
-70
lines changed

documentation/docs/hyper-flow/download.mdx

Lines changed: 5 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -16,42 +16,15 @@ installation package for your operating system.
1616
For macOS, we provide a `.dmg` file that allows for easy installation. We also offer a `.zip` archive for manual
1717
installation. HyperFlow is optimized for both Intel and Apple Silicon architectures.
1818

19-
{/\* <div className="row">
20-
21-
<div className="col col--6">
22-
<LinkCard type="download" title="Download .dmg" description="Recommended for most users." to="#" />
23-
</div>
24-
<div className="col col--6">
25-
<LinkCard type="download" title="Download .zip" description="For manual installation." to="#" />
26-
</div>
27-
</div> */}
28-
29-
:::note Work in progress
30-
31-
We are working on a new version of HyperFlow that will be available soon.
32-
33-
:::
19+
[Download .dmg](https://github.com/BetterTyped/hyper-fetch/releases?q=hyper-flow&expanded=true)
3420

3521
---
3622

3723
## Windows
3824

3925
For Windows, we offer a straightforward `.exe` installer that will guide you through the setup process.
4026

41-
:::note Work in progress
42-
43-
We are working on a new version of HyperFlow that will be available soon.
44-
45-
:::
46-
47-
{/\*
48-
49-
<div className="row">
50-
<div className="col col--12">
51-
<LinkCard type="download" title="Download .exe" description="Installer for Windows." to="#" />
52-
</div>
53-
</div>
54-
*/}
27+
[Download](https://github.com/BetterTyped/hyper-fetch/releases?q=hyper-flow&expanded=true)
5528

5629
---
5730

@@ -60,23 +33,10 @@ We are working on a new version of HyperFlow that will be available soon.
6033
For Linux, we provide both `.deb` (for Debian/Ubuntu-based distributions) and `.rpm` (for Fedora/CentOS-based
6134
distributions) packages.
6235

63-
:::note Work in progress
64-
65-
We are working on a new version of HyperFlow that will be available soon.
36+
[Download .deb](https://github.com/BetterTyped/hyper-fetch/releases?q=hyper-flow&expanded=true)
37+
[Download .rpm](https://github.com/BetterTyped/hyper-fetch/releases?q=hyper-flow&expanded=true)
6638

67-
:::
68-
69-
{/\*
70-
71-
<div className="row">
72-
<div className="col col--6">
73-
<LinkCard type="download" title="Download .deb" description="For Debian/Ubuntu." to="#" />
74-
</div>
75-
<div className="col col--6">
76-
<LinkCard type="download" title="Download .rpm" description="For Fedora/CentOS." to="#" />
77-
</div>
78-
</div>
79-
*/}
39+
---
8040

8141
:::caution Alpha Version
8242

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@
2727
"lint": "yarn reset && nx run-many --target=lint --parallel=2 --skip-nx-cache",
2828
"typescheck": "yarn reset && nx run-many --target=typescheck --parallel=10 --skip-nx-cache",
2929
"release": "yarn reset && nx run-many --target=release --parallel=1 --skip-nx-cache",
30-
"nx:upgrade": "npx nx migrate latest"
30+
"nx:upgrade": "npx nx migrate latest",
31+
"update-version": "node ./scripts/update-package-version.js"
3132
},
3233
"dependencies": {
3334
"@nx/eslint-plugin": "21.2.2",
@@ -54,7 +55,6 @@
5455
"@mui/material": "^5.8.4",
5556
"@ngneat/falso": "^7.3.0",
5657
"@nx/storybook": "21.2.2",
57-
"@semantic-release/git": "^10.0.1",
5858
"@storybook/addon-essentials": "8.6.12",
5959
"@storybook/addon-interactions": "8.6.12",
6060
"@storybook/core-server": "8.6.12",

packages/hyper-flow/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,13 @@
1414
"start": "rimraf node_modules/.vite && yarn electron-forge start",
1515
"package:app": "yarn electron-forge package",
1616
"make:app": "yarn electron-forge make",
17-
"publish:app": "yarn electron-forge publish",
17+
"publish:app": "yarn update:version && yarn electron-forge publish",
1818
"release": "yarn semantic-release --extends ./release.config.js -t 'hyper-flow-v${version}'",
1919
"lint": "eslint . --fix",
2020
"format": "prettier --write .",
2121
"typescheck": "tsc --noEmit --emitDeclarationOnly false",
22-
"tests": "yarn lint-staged"
22+
"tests": "yarn lint-staged",
23+
"update:version": "node ../../scripts/update-package-version.js --prefix 'hyper-flow-v'"
2324
},
2425
"devDependencies": {
2526
"@electron-forge/cli": "^7.7.0",

packages/hyper-flow/release.config.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,6 @@ module.exports = {
4949
},
5050
],
5151
"@semantic-release/release-notes-generator",
52-
[
53-
"@semantic-release/git",
54-
{
55-
assets: ["package.json"],
56-
message: "🤖 chore: ${nextRelease.version} [skip ci]",
57-
},
58-
],
5952
"@semantic-release/github",
6053
],
6154
},

scripts/update-package-version.js

Lines changed: 236 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,236 @@
1+
#!/usr/bin/env node
2+
/* eslint-disable no-plusplus */
3+
/* eslint-disable no-console */
4+
/* eslint-disable @typescript-eslint/no-var-requires */
5+
6+
// ************************************************************
7+
// # Basic usage
8+
// node ./scripts/update-package-version.js
9+
// ************************************************************
10+
11+
// ************************************************************
12+
// # With options
13+
// node ./scripts/update-package-version.js --prefix "v" --dry-run
14+
// ************************************************************
15+
16+
const { execSync } = require("child_process");
17+
const fs = require("fs");
18+
const path = require("path");
19+
20+
/**
21+
* Compare two semantic versions
22+
* Returns: 1 if v1 > v2, -1 if v1 < v2, 0 if equal
23+
*/
24+
function compareVersions(v1, v2) {
25+
const parts1 = v1.split(".").map(Number);
26+
const parts2 = v2.split(".").map(Number);
27+
28+
// Ensure both arrays have same length by padding with 0s
29+
const maxLength = Math.max(parts1.length, parts2.length);
30+
while (parts1.length < maxLength) parts1.push(0);
31+
while (parts2.length < maxLength) parts2.push(0);
32+
33+
for (let i = 0; i < maxLength; i++) {
34+
if (parts1[i] > parts2[i]) return 1;
35+
if (parts1[i] < parts2[i]) return -1;
36+
}
37+
38+
return 0;
39+
}
40+
41+
/**
42+
* Extract version from git tag
43+
* @param {string} tag - Git tag (e.g., "v1.2.3", "release-2.0.1")
44+
* @param {string} prefix - Prefix to remove (e.g., "v", "release-")
45+
* @returns {string|null} - Extracted version or null if invalid
46+
*/
47+
function extractVersion(tag, prefix) {
48+
if (!tag.startsWith(prefix)) return null;
49+
50+
const version = tag.substring(prefix.length);
51+
52+
// Basic semver validation (major.minor.patch with optional pre-release)
53+
const semverRegex = /^\d+\.\d+\.\d+(?:-[a-zA-Z0-9-.]+)?$/;
54+
55+
if (!semverRegex.test(version)) return null;
56+
57+
return version;
58+
}
59+
60+
/**
61+
* Get all git tags with the specified prefix
62+
* @param {string} prefix - Tag prefix to filter by
63+
* @returns {string[]} - Array of version strings
64+
*/
65+
function getGitTags(prefix) {
66+
try {
67+
// Get all tags sorted by version (descending)
68+
const output = execSync("git tag --sort=-version:refname", {
69+
encoding: "utf8",
70+
stdio: ["pipe", "pipe", "pipe"],
71+
});
72+
73+
const tags = output
74+
.trim()
75+
.split("\n")
76+
.filter((tag) => tag.trim() !== "");
77+
78+
const versions = [];
79+
80+
tags.forEach((tag) => {
81+
const version = extractVersion(tag, prefix);
82+
if (version) {
83+
versions.push(version);
84+
}
85+
});
86+
87+
return versions;
88+
} catch (error) {
89+
console.error("Error getting git tags:", error.message);
90+
return [];
91+
}
92+
}
93+
94+
/**
95+
* Find the latest version from an array of version strings
96+
* @param {string[]} versions - Array of version strings
97+
* @returns {string|null} - Latest version or null if no versions
98+
*/
99+
function getLatestVersion(versions) {
100+
if (versions.length === 0) return null;
101+
102+
let latest = versions[0];
103+
104+
for (let i = 1; i < versions.length; i++) {
105+
if (compareVersions(versions[i], latest) > 0) {
106+
latest = versions[i];
107+
}
108+
}
109+
110+
return latest;
111+
}
112+
113+
/**
114+
* Update package.json version
115+
* @param {string} newVersion - New version to set
116+
* @param {string} packagePath - Path to package.json
117+
*/
118+
function updatePackageVersion(newVersion, packagePath) {
119+
try {
120+
const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
121+
const oldVersion = packageJson.version;
122+
123+
packageJson.version = newVersion;
124+
125+
fs.writeFileSync(packagePath, `${JSON.stringify(packageJson, null, 2)}\n`);
126+
127+
console.log(`✅ Updated package.json version: ${oldVersion}${newVersion}`);
128+
} catch (error) {
129+
console.error("Error updating package.json:", error.message);
130+
process.exit(1);
131+
}
132+
}
133+
134+
/**
135+
* Main function
136+
*/
137+
function main() {
138+
const args = process.argv.slice(2);
139+
140+
// Default configuration
141+
let prefix = "v";
142+
let packagePath = path.join(process.cwd(), "package.json");
143+
let dryRun = false;
144+
145+
// Parse command line arguments
146+
for (let i = 0; i < args.length; i++) {
147+
const arg = args[i];
148+
149+
if (arg === "--prefix" && i + 1 < args.length) {
150+
prefix = args[i + 1];
151+
i++;
152+
} else if (arg === "--package" && i + 1 < args.length) {
153+
packagePath = args[i + 1];
154+
i++;
155+
} else if (arg === "--dry-run") {
156+
dryRun = true;
157+
} else if (arg === "--help" || arg === "-h") {
158+
console.log(`
159+
Usage: node update-package-version.js [options]
160+
161+
Options:
162+
--prefix <prefix> Tag prefix to filter by (default: "v")
163+
--package <path> Path to package.json (default: "./package.json")
164+
--dry-run Show what would be updated without making changes
165+
--help, -h Show this help message
166+
167+
Examples:
168+
node update-package-version.js
169+
node update-package-version.js --prefix "release-"
170+
node update-package-version.js --prefix "v" --package "./packages/core/package.json"
171+
node update-package-version.js --dry-run
172+
`);
173+
return;
174+
}
175+
}
176+
177+
console.log(`🔍 Looking for git tags with prefix: "${prefix}"`);
178+
179+
// Check if package.json exists
180+
if (!fs.existsSync(packagePath)) {
181+
console.error(`❌ Package.json not found at: ${packagePath}`);
182+
process.exit(1);
183+
}
184+
185+
// Get git tags
186+
const versions = getGitTags(prefix);
187+
188+
if (versions.length === 0) {
189+
console.log(`❌ No git tags found with prefix "${prefix}"`);
190+
process.exit(1);
191+
}
192+
193+
console.log(
194+
`📋 Found ${versions.length} version tags:`,
195+
versions.slice(0, 10).join(", ") + (versions.length > 10 ? "..." : ""),
196+
);
197+
198+
// Get latest version
199+
const latestVersion = getLatestVersion(versions);
200+
201+
if (!latestVersion) {
202+
console.log("❌ Could not determine latest version");
203+
process.exit(1);
204+
}
205+
206+
console.log(`🚀 Latest version found: ${latestVersion}`);
207+
208+
// Read current package.json version
209+
try {
210+
const packageJson = JSON.parse(fs.readFileSync(packagePath, "utf8"));
211+
const currentVersion = packageJson.version;
212+
213+
console.log(`📦 Current package.json version: ${currentVersion}`);
214+
215+
if (currentVersion === latestVersion) {
216+
console.log("✅ Package.json is already up to date!");
217+
return;
218+
}
219+
220+
if (dryRun) {
221+
console.log(`🔍 [DRY RUN] Would update version: ${currentVersion}${latestVersion}`);
222+
return;
223+
}
224+
225+
// Update package.json
226+
updatePackageVersion(latestVersion, packagePath);
227+
} catch (error) {
228+
console.error("Error reading package.json:", error.message);
229+
process.exit(1);
230+
}
231+
}
232+
233+
// Run the script
234+
if (require.main === module) {
235+
main();
236+
}

yarn.lock

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8168,20 +8168,6 @@
81688168
resolved "https://registry.yarnpkg.com/@semantic-release/error/-/error-3.0.0.tgz#30a3b97bbb5844d695eb22f9d3aa40f6a92770c2"
81698169
integrity sha512-5hiM4Un+tpl4cKw3lV4UgzJj+SmfNIDCLLw0TepzQxz9ZGV5ixnqkzIVF+3tp0ZHgcMKE+VNGHJjEeyFG2dcSw==
81708170

8171-
"@semantic-release/git@^10.0.1":
8172-
version "10.0.1"
8173-
resolved "https://registry.yarnpkg.com/@semantic-release/git/-/git-10.0.1.tgz#c646e55d67fae623875bf3a06a634dd434904498"
8174-
integrity sha512-eWrx5KguUcU2wUPaO6sfvZI0wPafUKAMNC18aXY4EnNcrZL86dEmpNVnC9uMpGZkmZJ9EfCVJBQx4pV4EMGT1w==
8175-
dependencies:
8176-
"@semantic-release/error" "^3.0.0"
8177-
aggregate-error "^3.0.0"
8178-
debug "^4.0.0"
8179-
dir-glob "^3.0.0"
8180-
execa "^5.0.0"
8181-
lodash "^4.17.4"
8182-
micromatch "^4.0.0"
8183-
p-reduce "^2.0.0"
8184-
81858171
"@semantic-release/github@^8.0.0":
81868172
version "8.1.0"
81878173
resolved "https://registry.yarnpkg.com/@semantic-release/github/-/github-8.1.0.tgz#c31fc5852d32975648445804d1984cd96e72c4d0"

0 commit comments

Comments
 (0)