Skip to content

Commit 20962ed

Browse files
committed
adds core tagging script
1 parent 05f9512 commit 20962ed

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

packages/core/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@
3434
"version:patch": "npm version patch",
3535
"version:minor": "npm version minor",
3636
"version:major": "npm version major",
37-
"publish:npm": "npm run build && cd out && npm publish"
37+
"publish:npm": "npm run build && cd out && npm publish",
38+
"publish:tag": "node ../../scripts/publish-tag.js ."
3839
},
3940
"license": "MIT",
4041
"repository": {

scripts/publish-tag.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const { execSync } = require('child_process');
2+
const path = require('path');
3+
const fs = require('fs');
4+
5+
// Determine which package to tag based on current directory or argument
6+
const packagePath = process.argv[2] || process.cwd();
7+
const pkgJsonPath = path.join(packagePath, 'package.json');
8+
9+
if (!fs.existsSync(pkgJsonPath)) {
10+
console.error('package.json not found at:', pkgJsonPath);
11+
process.exit(1);
12+
}
13+
14+
const { version } = JSON.parse(fs.readFileSync(pkgJsonPath, 'utf8'));
15+
16+
// Always use "core-v" prefix for core package
17+
const tag = `core-v${version}`;
18+
19+
try {
20+
execSync(`git tag ${tag}`, { stdio: 'inherit' });
21+
execSync('git push --tags', { stdio: 'inherit' });
22+
console.log(`✓ Tagged and pushed ${tag}`);
23+
} catch (error) {
24+
console.error('Failed to tag and push');
25+
process.exit(1);
26+
}

0 commit comments

Comments
 (0)