mirror of
https://github.com/antebudimir/eslint-plugin-vanilla-extract.git
synced 2025-12-31 08:53:33 +00:00
feat 🔨: add script for versioning updates
This commit is contained in:
parent
dea0a328cf
commit
f2ad87c882
3 changed files with 36 additions and 5 deletions
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@antebudimir/eslint-plugin-vanilla-extract",
|
"name": "@antebudimir/eslint-plugin-vanilla-extract",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"description": "ESLint plugin for enforcing CSS ordering in vanilla-extract styles",
|
"description": "ESLint plugin for enforcing CSS ordering in vanilla-extract styles",
|
||||||
"author": "Ante Budimir",
|
"author": "Ante Budimir",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|
@ -47,9 +47,7 @@
|
||||||
"prepublishOnly": "pnpm run lint && pnpm run build",
|
"prepublishOnly": "pnpm run lint && pnpm run build",
|
||||||
"publish": "pnpm publish --access public",
|
"publish": "pnpm publish --access public",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"version:major": "pnpm version major --no-git-tag-version",
|
"version:update": "node scripts/update-version.mjs"
|
||||||
"version:minor": "pnpm version minor --no-git-tag-version",
|
|
||||||
"version:patch": "pnpm version patch --no-git-tag-version"
|
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=18.18.0"
|
"node": ">=18.18.0"
|
||||||
|
|
|
||||||
33
scripts/update-version.mjs
Normal file
33
scripts/update-version.mjs
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
import { execSync } from 'child_process';
|
||||||
|
import { promises as fs } from 'fs';
|
||||||
|
import path from 'path';
|
||||||
|
import { argv, env } from 'process';
|
||||||
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
|
const __filename = fileURLToPath(import.meta.url);
|
||||||
|
const __dirname = path.dirname(__filename);
|
||||||
|
const packageJsonPath = path.resolve(__dirname, '../package.json');
|
||||||
|
const indexTsPath = path.resolve(__dirname, '../src/index.ts');
|
||||||
|
|
||||||
|
const versionType = argv[2] || env.VERSION_TYPE;
|
||||||
|
|
||||||
|
if (!['major', 'minor', 'patch'].includes(versionType)) {
|
||||||
|
console.error('Invalid version type. Use major, minor, or patch.');
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
execSync(`pnpm version ${versionType} --no-git-tag-version`, { stdio: 'inherit' });
|
||||||
|
|
||||||
|
const packageJson = JSON.parse(await fs.readFile(packageJsonPath, 'utf-8'));
|
||||||
|
const newVersion = packageJson.version;
|
||||||
|
|
||||||
|
// Read src/index.ts
|
||||||
|
let indexTsContent = await fs.readFile(indexTsPath, 'utf-8');
|
||||||
|
|
||||||
|
// Replace the version string in src/index.ts
|
||||||
|
indexTsContent = indexTsContent.replace(/version: '(\d+\.\d+\.\d+)'/, `version: '${newVersion}'`);
|
||||||
|
|
||||||
|
// Write the updated content back to src/index.ts
|
||||||
|
await fs.writeFile(indexTsPath, indexTsContent);
|
||||||
|
|
||||||
|
console.log(`Updated src/index.ts to version ${newVersion}`);
|
||||||
|
|
@ -5,7 +5,7 @@ import customOrderRule from './css-rules/custom-order/rule-definition.js';
|
||||||
export const vanillaExtract = {
|
export const vanillaExtract = {
|
||||||
meta: {
|
meta: {
|
||||||
name: '@antebudimir/eslint-plugin-vanilla-extract',
|
name: '@antebudimir/eslint-plugin-vanilla-extract',
|
||||||
version: '1.2.0',
|
version: '1.3.0',
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
'alphabetical-order': alphabeticalOrderRule,
|
'alphabetical-order': alphabeticalOrderRule,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue