Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: verify versions #182

Merged
merged 3 commits into from
Feb 22, 2023
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
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}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

C'est ok pour moi de le passer en log.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes!


};
}