Skip to content
Open
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
67 changes: 67 additions & 0 deletions automation/utils/bin/rui-release-info.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env ts-node
import { loadReleaseCandidates, loadAllPackages } from "../src/release-candidates";

async function main(): Promise<void> {
const args = process.argv.slice(2);
const command = args[0];

try {
if (command === "--candidates" || command === "-c") {
// List only packages with unreleased changes
const candidates = await loadReleaseCandidates();
console.log(JSON.stringify(candidates, null, 2));
} else if (command === "--all" || command === "-a") {
// List all packages (including those without changes)
const allPackages = await loadAllPackages();
console.log(JSON.stringify(allPackages, null, 2));
} else if (command === "--summary" || command === "-s") {
// Summary view
const candidates = await loadReleaseCandidates();
const summary = {
totalCandidates: candidates.length,
widgets: candidates.filter(c => c.packageType === "widget").length,
modules: candidates.filter(c => c.packageType === "module").length,
packages: candidates.map(c => ({
name: c.name,
packageType: c.packageType,
hasDependencies: c.hasDependencies,
version: c.currentVersion,
hasChanges: c.hasUnreleasedChanges,
dependentWidgetsWithChanges: c.hasDependencies
? c.dependentWidgets!.filter(w => w.hasUnreleasedChanges).length
: undefined
}))
};
console.log(JSON.stringify(summary, null, 2));
} else if (command === "--help" || command === "-h" || !command) {
printHelp();
} else {
console.error(`Unknown command: ${command}`);
console.error("Use --help for usage information");
process.exit(1);
}
} catch (error) {
console.error("Error:", error instanceof Error ? error.message : String(error));
process.exit(1);
}
}

function printHelp(): void {
console.log(`
rui-release-info - Query release candidates in the monorepo

Commands:
-c, --candidates List packages with unreleased changes (release candidates)
Returns detailed JSON with changelog entries

-a, --all List all packages (including those without changes)
Useful for seeing complete package structure

-s, --summary Show summary statistics and package list
Concise view with counts and basic info

-h, --help Show this help message
`);
}

main();
1 change: 1 addition & 0 deletions automation/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"rui-include-oss-in-artifact": "bin/rui-include-oss-in-artifact.ts",
"rui-prepare-release": "bin/rui-prepare-release.ts",
"rui-publish-marketplace": "bin/rui-publish-marketplace.ts",
"rui-release-info": "bin/rui-release-info.ts",
"rui-update-changelog-module": "bin/rui-update-changelog-module.ts",
"rui-update-changelog-widget": "bin/rui-update-changelog-widget.ts",
"rui-verify-package-format": "bin/rui-verify-package-format.ts"
Expand Down
2 changes: 2 additions & 0 deletions automation/utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export * from "./mpk";
export * from "./changelog-parser";
export * from "./monorepo";
export * from "./build-config";
export * from "./release-candidates";
export * from "./io/filesystem";
43 changes: 43 additions & 0 deletions automation/utils/src/io/filesystem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { access, readdir, readFile, writeFile } from "fs/promises";

/**
* Abstraction layer for filesystem operations
* Allows for testing and alternative implementations (e.g., MCP, in-memory)
*/
export interface FileSystem {
readFile(path: string): Promise<string>;
writeFile(path: string, content: string): Promise<void>;
exists(path: string): Promise<boolean>;
readdir(path: string): Promise<string[]>;
}

/**
* Default Node.js filesystem implementation
*/
export class NodeFileSystem implements FileSystem {
async readFile(path: string): Promise<string> {
return readFile(path, "utf-8");
}

async writeFile(path: string, content: string): Promise<void> {
await writeFile(path, content, "utf-8");
}

async exists(path: string): Promise<boolean> {
try {
await access(path);
return true;
} catch {
return false;
}
}

async readdir(path: string): Promise<string[]> {
return readdir(path);
}
}

/**
* Default filesystem instance for convenience
*/
export const defaultFS = new NodeFileSystem();
Loading
Loading