Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Dec 26, 2024
1 parent 3f0ad42 commit 3289480
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ class IntermediateRepresentationMigratorImpl implements IntermediateRepresentati
}: {
targetGenerator: GeneratorNameAndVersion;
}): string | undefined {
let lastIrVersion = this.migrations[0]!.laterVersion;
let lastIrVersion = this.migrations[0]?.laterVersion;
for (const migration of this.migrations) {
if (this.shouldRunMigration({ migration, targetGenerator })) {
lastIrVersion = migration.earlierVersion;
Expand Down
2 changes: 2 additions & 0 deletions packages/scripts/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ async function main() {
const outputPath = path.resolve(argv.output);
await mkdir(outputPath, { recursive: true });
await writeFile(path.join(outputPath, "versions.yml"), yaml.stringify(yaml.parse(versionsYml)));
// eslint-disable-next-line no-console
console.log(`Successfully wrote versions to ${path.join(outputPath, "versions.yml")}`);
}
)
.strict()
.help()
.parse();
} catch (error) {
// eslint-disable-next-line no-console
console.error("Error:", error);
process.exit(1);
}
Expand Down
9 changes: 5 additions & 4 deletions packages/scripts/src/convertChangelogToVersionsYml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ export function parseChangelog(changelogContent: string): ChangelogEntry[] {
for (const line of lines) {
const versionMatch = line.match(/## \[(\d+\.\d+\.\d+(?:-\w+)?)\] - (\d{4}-\d{2}-\d{2})/);
if (versionMatch && versionMatch[1] && versionMatch[2]) {
if (currentVersion) {
if (currentVersion && currentDate) {
if (currentChange) {
currentChanges.push(currentChange);
}
entries.push({
version: currentVersion,
date: currentDate!,
date: currentDate,
changes: currentChanges
});
}
Expand All @@ -60,13 +60,13 @@ export function parseChangelog(changelogContent: string): ChangelogEntry[] {
}
}

if (currentVersion) {
if (currentVersion && currentDate) {
if (currentChange) {
currentChanges.push(currentChange);
}
entries.push({
version: currentVersion,
date: currentDate!,
date: currentDate,
changes: currentChanges
});
}
Expand Down Expand Up @@ -165,6 +165,7 @@ export function formatOutput(newFormat: FormattedEntry[]): string {
}

export async function convertChangelogToVersions(inputPath: string, generatorName: string): Promise<string> {
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const absoluteInputPath = resolve(inputPath as any);
const inputContent = await readFile(absoluteInputPath, "utf8");
const entries = parseChangelog(inputContent);
Expand Down

0 comments on commit 3289480

Please sign in to comment.