Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add tag script #5588

Merged
merged 1 commit into from
Mar 25, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"lint-staged": "^15.2.2",
"lodash": "^4.17.21",
"npm-run-all": "^4.1.5",
"open": "^10.1.0",
"prettier": "^3.2.5",
"prettier-plugin-organize-imports": "^3.2.4",
"prettier-plugin-packagejson": "^2.4.12",
Expand Down
14 changes: 9 additions & 5 deletions packages/g6/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
"bugs": {
"url": "https://github.com/antvis/g6/issues"
},
"repository": "git@github.com/antvis/g6.git",
"repository": {
"type": "git",
"url": "https://github.com/antvis/g6"
},
"license": "MIT",
"author": "https://github.com/orgs/antvis/people",
"main": "lib/index.js",
Expand Down Expand Up @@ -44,6 +47,7 @@
"prepublishOnly": "npm run ci",
"size": "limit-size",
"start": "rimraf ./lib && tsc --module commonjs --outDir lib --watch",
"tag": "node ./scripts/tag.mjs",
"test": "npm run jest __tests__",
"test:integration": "npm run jest __tests__/integration",
"test:unit": "npm run jest __tests__/unit",
Expand Down Expand Up @@ -83,13 +87,13 @@
},
"limit-size": [
{
"path": "dist/g6.min.js",
"gzip": true,
"limit": "750 Kb",
"gzip": true
"path": "dist/g6.min.js"
},
{
"path": "dist/g6.min.js",
"limit": "2 Mb"
"limit": "2 Mb",
"path": "dist/g6.min.js"
}
]
}
22 changes: 22 additions & 0 deletions packages/g6/scripts/tag.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import chalk from 'chalk';
import { execFileSync } from 'child_process';
import { readFileSync } from 'fs';
import open from 'open';
import readline from 'readline';

const pkg = JSON.parse(readFileSync('./package.json', 'utf-8'));
const version = pkg.version;
const repository = pkg.repository.url;

console.log(chalk.yellow('The tag will be created with the version: '), chalk.bold(chalk.green(version)));

const rl = readline.createInterface({ input: process.stdin, output: process.stdout });

rl.question('Do you want to continue? (y/n): ', (answer) => {
if (answer === 'y') {
execFileSync('git', ['tag', version]);
execFileSync('git', ['push', 'origin', version]);
open(`${repository}/releases/new`);
}
rl.close();
});