Delete scripts
Browse fileshttps://lerobot-robot-learning-tutorial.hf.space
- scripts/release.mjs +0 -95
scripts/release.mjs
DELETED
|
@@ -1,95 +0,0 @@
|
|
| 1 |
-
#!/usr/bin/env node
|
| 2 |
-
|
| 3 |
-
/**
|
| 4 |
-
* Release script for Research Article Template
|
| 5 |
-
* Handles semantic versioning and changelog updates
|
| 6 |
-
*/
|
| 7 |
-
|
| 8 |
-
import { execSync } from 'child_process';
|
| 9 |
-
import { readFileSync, writeFileSync } from 'fs';
|
| 10 |
-
import { join } from 'path';
|
| 11 |
-
|
| 12 |
-
const PACKAGE_JSON_PATH = join(process.cwd(), 'app', 'package.json');
|
| 13 |
-
const CHANGELOG_PATH = join(process.cwd(), 'CHANGELOG.md');
|
| 14 |
-
|
| 15 |
-
function getCurrentVersion() {
|
| 16 |
-
const packageJson = JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf8'));
|
| 17 |
-
return packageJson.version;
|
| 18 |
-
}
|
| 19 |
-
|
| 20 |
-
function updateVersion(newVersion) {
|
| 21 |
-
const packageJson = JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf8'));
|
| 22 |
-
packageJson.version = newVersion;
|
| 23 |
-
writeFileSync(PACKAGE_JSON_PATH, JSON.stringify(packageJson, null, 2) + '\n');
|
| 24 |
-
console.log(`β
Updated package.json to version ${newVersion}`);
|
| 25 |
-
}
|
| 26 |
-
|
| 27 |
-
function updateChangelog(newVersion) {
|
| 28 |
-
const changelog = readFileSync(CHANGELOG_PATH, 'utf8');
|
| 29 |
-
const today = new Date().toISOString().split('T')[0];
|
| 30 |
-
|
| 31 |
-
const updatedChangelog = changelog.replace(
|
| 32 |
-
'## [Unreleased]',
|
| 33 |
-
`## [Unreleased]\n\n## [${newVersion}] - ${today}`
|
| 34 |
-
);
|
| 35 |
-
|
| 36 |
-
writeFileSync(CHANGELOG_PATH, updatedChangelog);
|
| 37 |
-
console.log(`β
Updated CHANGELOG.md with version ${newVersion}`);
|
| 38 |
-
}
|
| 39 |
-
|
| 40 |
-
function createGitTag(version) {
|
| 41 |
-
try {
|
| 42 |
-
execSync(`git tag -a v${version} -m "Release version ${version}"`, { stdio: 'inherit' });
|
| 43 |
-
console.log(`β
Created git tag v${version}`);
|
| 44 |
-
} catch (error) {
|
| 45 |
-
console.error(`β Failed to create git tag: ${error.message}`);
|
| 46 |
-
}
|
| 47 |
-
}
|
| 48 |
-
|
| 49 |
-
function main() {
|
| 50 |
-
const args = process.argv.slice(2);
|
| 51 |
-
const versionType = args[0]; // 'major', 'minor', 'patch'
|
| 52 |
-
|
| 53 |
-
if (!['major', 'minor', 'patch'].includes(versionType)) {
|
| 54 |
-
console.error('β Please specify version type: major, minor, or patch');
|
| 55 |
-
console.log('Usage: node scripts/release.mjs [major|minor|patch]');
|
| 56 |
-
process.exit(1);
|
| 57 |
-
}
|
| 58 |
-
|
| 59 |
-
const currentVersion = getCurrentVersion();
|
| 60 |
-
const [major, minor, patch] = currentVersion.split('.').map(Number);
|
| 61 |
-
|
| 62 |
-
let newVersion;
|
| 63 |
-
switch (versionType) {
|
| 64 |
-
case 'major':
|
| 65 |
-
newVersion = `${major + 1}.0.0`;
|
| 66 |
-
break;
|
| 67 |
-
case 'minor':
|
| 68 |
-
newVersion = `${major}.${minor + 1}.0`;
|
| 69 |
-
break;
|
| 70 |
-
case 'patch':
|
| 71 |
-
newVersion = `${major}.${minor}.${patch + 1}`;
|
| 72 |
-
break;
|
| 73 |
-
}
|
| 74 |
-
|
| 75 |
-
console.log(`π Releasing version ${newVersion} (from ${currentVersion})`);
|
| 76 |
-
|
| 77 |
-
// Update files
|
| 78 |
-
updateVersion(newVersion);
|
| 79 |
-
updateChangelog(newVersion);
|
| 80 |
-
|
| 81 |
-
// Create git tag
|
| 82 |
-
createGitTag(newVersion);
|
| 83 |
-
|
| 84 |
-
console.log(`\nπ Release ${newVersion} prepared!`);
|
| 85 |
-
console.log('\nNext steps:');
|
| 86 |
-
console.log('1. Review the changes:');
|
| 87 |
-
console.log(' git diff');
|
| 88 |
-
console.log('2. Commit the changes:');
|
| 89 |
-
console.log(` git add . && git commit -m "chore: release version ${newVersion}"`);
|
| 90 |
-
console.log('3. Push the changes and tags:');
|
| 91 |
-
console.log(` git push && git push --tags`);
|
| 92 |
-
console.log('4. Create a release on Hugging Face Spaces');
|
| 93 |
-
}
|
| 94 |
-
|
| 95 |
-
main();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|