chore: prepare for release

This commit is contained in:
Krzysztof Moch
2025-06-30 18:49:11 +02:00
parent 2cc3430afb
commit 0f55a372bf
5 changed files with 33 additions and 75 deletions
-66
View File
@@ -1,66 +0,0 @@
// Run "npm publish" in cli via Bun
import { $ } from 'bun';
import path from 'path';
import { fileURLToPath } from 'url';
const args = process.argv.slice(2);
const noRelease = args.includes("--no-release");
const __dirname = path.dirname(fileURLToPath(import.meta.url));
const rootDir = path.join(__dirname, '..');
const DRY_RUN = args.includes("--dry-run");
const bumpVersion = (version) => {
const tagParts = version.split('-');
const versionParts = tagParts[1].split('.');
const newVersion = parseInt(versionParts[1]) + 1;
return `${tagParts[0]}-${versionParts[0]}.${newVersion}`;
}
const writeFile = async (path, content) => {
if (DRY_RUN) {
console.log(`DRY RUN: Would write to ${path}`);
console.log(content);
console.log('--------------------------------');
} else {
await Bun.write(path, content);
}
}
const runCommand = async (command) => {
if (DRY_RUN) {
console.log(`DRY RUN: Would run ${command}`);
return "";
} else {
return await $`${command}`.text();
}
}
const modifyPackage = async () => {
const packageJsonPath = path.join(rootDir, 'packages', 'react-native-video', 'package.json');
const packageJson = JSON.parse(await Bun.file(packageJsonPath).text());
// We need to modify the name of the package name to be exact as @ORGANIZATION/PACKAGE-NAME
const name = "@TheWidlarzGroup/react-native-video-v7";
const version = packageJson.version;
const newVersion = bumpVersion(version);
packageJson.name = name;
packageJson.version = newVersion;
await writeFile(packageJsonPath, JSON.stringify(packageJson, null, 2));
};
let publishCommand = `npm publish --tag dev`;
await modifyPackage();
if (!noRelease) {
await runCommand(publishCommand);
}
+22
View File
@@ -0,0 +1,22 @@
#!/bin/bash
set -e
echo "[React Native Video] Starting release process"
echo "[React Native Video] Options: $@"
echo "[React Native Video] Checking if we are in the correct directory"
if [ ! -d "packages/react-native-video" ]; then
echo "[React Native Video] Error: Not in the correct directory"
exit 1
fi
echo "[React Native Video] Publishing main package"
cd packages/react-native-video
bun run release $@
cd ../..
echo "[React Native Video] Making Github Release"
bun run release:github $@
echo "[React Native Video] Done"