Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
#### 1.0.0

##### Migrating from v0

The migration guide can be found [here](https://github.com/remoteoss/json-schema-form/blob/main/MIGRATING.md)

##### Bug Fixes

* Improve release scripts [#214](https://github.com/remoteoss/json-schema-form/pull/214))

#### 1.0.0-beta.12 (2025-07-16)

##### Chores
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@remoteoss/json-schema-form",
"type": "module",
"version": "1.0.0-beta.12",
"version": "1.0.0",
"packageManager": "[email protected]",
"description": "WIP V2 – Headless UI form powered by JSON Schemas",
"author": "Remote.com <[email protected]> (https://remote.com/)",
Expand Down
32 changes: 23 additions & 9 deletions scripts/release.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
const packageJsonPath = path.resolve(__dirname, '../package.json');
const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf8'));

const releaseTypes = ['dev', 'beta', 'official'];
const bumpTypes = ['patch', 'minor', 'major'];

async function checkGitBranchAndStatus() {
const releaseType = process.argv[2];
console.log(`Checking your branch for ${releaseType} release...`);
Expand Down Expand Up @@ -59,13 +62,15 @@ async function checkGitBranchAndStatus() {
async function getNewVersion() {
async function getVersionsFromGitTags() {
const result = await runExec(`git tag --list --sort=-version:refname`, { silent: true });
const tags = result.stdout.toString().trim().split('\n').filter(tag => tag.startsWith(tagPrefix));
const tags = result.stdout.toString().trim().split('\n').filter(tag => tag.startsWith('v'));
return tags
}

const releaseType = process.argv[2];
if (!['dev', 'beta', 'official'].includes(releaseType)) {
console.error('🟠 Invalid release type. Use dev, beta or official');
const bumpType = process.argv[3];

if (!releaseTypes.includes(releaseType)) {
console.error(`🟠 Invalid release type. Use ${releaseTypes.join(', ')}`);
process.exit(1);
}

Expand Down Expand Up @@ -93,12 +98,18 @@ async function getNewVersion() {
}

if (releaseType === 'official') {
if (!bumpTypes.includes(bumpType)) {
console.error(`🟠 Invalid bump type. Use ${bumpTypes.join(', ')}\ne.g. pnpm run release patch`);
process.exit(1);
}

// get latest official version from git tags
const tags = await getVersionsFromGitTags();
const latestOfficialTag = tags.find(tag => !tag.includes('-beta.') && !tag.includes('-dev.'));
// If no official version found, use v1.0.0 as the starting point
const latestOfficialVersion = latestOfficialTag ? latestOfficialTag.replace('v', '') : '1.0.0';
return semver.inc(latestOfficialVersion, 'prerelease', 'beta');
const latestOfficialVersion = latestOfficialTag ? latestOfficialTag.replace('v', '') : '0.0.0';

return semver.inc(latestOfficialVersion, bumpType);
}
}

Expand All @@ -121,12 +132,11 @@ async function updateChangelog() {

async function gitCommit({ newVersion, releaseType }) {
console.log('Committing published version...');
const prefix = `v1-${releaseType}`;

let cmd;
if (releaseType === 'beta') {
// For beta, we commit package.json changes and changelog
cmd = `git add package.json CHANGELOG.md && git commit -m "Release ${prefix} ${newVersion}" && git tag ${prefix}-${newVersion} && git push && git push origin --tags`;
if (releaseType === 'beta' || releaseType === 'official') {
// For beta and official releases, we commit package.json changes and changelog
cmd = `git add package.json CHANGELOG.md && git commit -m "Release ${newVersion}" && git tag ${newVersion} && git push && git push origin --tags`;
} else {
// For dev, we only create a tag
cmd = `git tag ${prefix}-${newVersion} && git push origin --tags`;
Expand Down Expand Up @@ -155,6 +165,10 @@ async function publish({ newVersion, releaseType, otp }) {
if (releaseType === 'beta') {
console.log(`✍️ REMINDER: Please publish the release on Github too as "pre-release".`);
}

if (releaseType === 'official') {
console.log(`✍️ REMINDER: Please publish the release on Github too.`);
}
console.log(`Install with: npm i @remoteoss/json-schema-form@${npmTag}`);
} catch {
console.log('🚨 Publish failed! Perhaps the OTP is wrong.');
Expand Down