Skip to content

Commit

Permalink
chore: verify versions (#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
aneojgurhem authored Feb 22, 2023
2 parents c1a1908 + 17442a8 commit 73fcd18
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions scripts/versions/_contants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export const csharpFiles = glob.sync(`**/*.csproj`);
export const pythonPattern = /version = "(?<version>.*)"/g;
export const pythonFiles = ["packages/python/pyproject.toml"];

export const jsPattern = /"version": "(?<version>.*)"/g;
export const jsFiles = ["packages/web/package.json", "packages/angular/projects/aneoconsultingfr/armonik.api.angular/package.json"];
export const jsPattern = /"version": "(?<version>.*)"/;
export const jsFiles = ["packages/angular/projects/aneoconsultingfr/armonik.api.angular/package.json", "packages/web/package.json"];
12 changes: 8 additions & 4 deletions scripts/versions/_readAndFind.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { resolve } from "pathe";
import consola from "consola";
import { promises as fsp } from "node:fs";
import fs from "node:fs";

export function _readAndFind(pattern: RegExp, versions: Map<string, string>) {
return async (file: string) => {
const data = await fsp.readFile(resolve(file), "utf8");
return (file: string) => {
const data = fs.readFileSync(resolve(file), {
encoding: "utf8",
flag: "r",
});

const version = pattern.exec(data)?.groups?.version;

Expand All @@ -14,6 +17,7 @@ export function _readAndFind(pattern: RegExp, versions: Map<string, string>) {
}

versions.set(file, version);
consola.trace(`Found ${file.split("/").pop()}@${version}`);
consola.log(`Found ${file.split("/").pop()}@${version}`);

};
}

0 comments on commit 73fcd18

Please sign in to comment.