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
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"lint": "turbo run lint",
"test": "turbo run test",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"bump-version": "npx tsx scripts/bump-version.ts",
"publish-all": "pnpm --filter \"./packages/**\" -r publish --tag next",
"publish-preview": "pnpm --filter \"./packages/**\" -r publish --tag next --force --registry https://preview.registry.zenstack.dev/",
"unpublish-preview": "pnpm --filter \"./packages/**\" -r --shell-mode exec -- npm unpublish -f --registry https://preview.registry.zenstack.dev/ \"\\$PNPM_PACKAGE_NAME\""
Expand All @@ -20,13 +21,15 @@
"@eslint/js": "^9.29.0",
"@types/node": "^20.17.24",
"eslint": "~9.29.0",
"glob": "^11.0.2",
"prettier": "^3.5.3",
"tsup": "^8.5.0",
"tsx": "^4.20.3",
"turbo": "^2.5.4",
"typescript": "catalog:",
"typescript-eslint": "^8.34.1",
"vitest": "^3.2.4"
"vitest": "^3.2.4",
"yaml": "^2.8.0"
},
"pnpm": {
"onlyBuiltDependencies": [
Expand Down
2 changes: 1 addition & 1 deletion packages/language/src/generated/ast.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
* This file was generated by langium-cli 3.3.0.
* This file was generated by langium-cli 3.3.1.
* DO NOT EDIT MANUALLY!
******************************************************************************/

Expand Down
2 changes: 1 addition & 1 deletion packages/language/src/generated/grammar.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
* This file was generated by langium-cli 3.3.0.
* This file was generated by langium-cli 3.3.1.
* DO NOT EDIT MANUALLY!
******************************************************************************/

Expand Down
2 changes: 1 addition & 1 deletion packages/language/src/generated/module.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/******************************************************************************
* This file was generated by langium-cli 3.3.0.
* This file was generated by langium-cli 3.3.1.
* DO NOT EDIT MANUALLY!
******************************************************************************/

Expand Down
56 changes: 31 additions & 25 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

43 changes: 43 additions & 0 deletions scripts/bump-version.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import * as fs from 'node:fs';
import { glob } from 'glob';
import * as path from 'node:path';
import * as yaml from 'yaml';

function getWorkspacePackageJsonFiles(workspaceFile: string): string[] {
const workspaceYaml = fs.readFileSync(workspaceFile, 'utf8');
const workspace = yaml.parse(workspaceYaml) as { packages?: string[] };
if (!workspace.packages) throw new Error('No "packages" key found in pnpm-workspace.yaml');
const rootDir = path.dirname(workspaceFile);
const files = new Set<string>();
for (const pattern of workspace.packages) {
const matches = glob.sync(path.join(pattern, 'package.json'), {
cwd: rootDir,
absolute: true,
});
matches.forEach((f) => files.add(f));
}
return Array.from(files);
}

function incrementVersion(version: string): string {
const parts = version.split('.');
const last = parts.length - 1;
const lastNum = parseInt(parts[last], 10);
if (isNaN(lastNum)) throw new Error(`Invalid version: ${version}`);
parts[last] = (lastNum + 1).toString();
return parts.join('.');
}

const workspaceFile = path.resolve(__dirname, '../pnpm-workspace.yaml');
const packageFiles = getWorkspacePackageJsonFiles(workspaceFile);

for (const file of packageFiles) {
const content = fs.readFileSync(file, 'utf8');
const pkg = JSON.parse(content) as { version?: string };
if (pkg.version) {
const oldVersion = pkg.version;
pkg.version = incrementVersion(pkg.version);
fs.writeFileSync(file, JSON.stringify(pkg, null, 2) + '\n');
console.log(`Updated ${file}: ${oldVersion} -> ${pkg.version}`);
}
}