Skip to content

Commit

Permalink
Merge pull request #58 from melfore/55-chore-setup-husky-hooks
Browse files Browse the repository at this point in the history
chore setup husky hooks
  • Loading branch information
CrisGrud authored Feb 1, 2024
2 parents a8fdcd5 + 85a60c7 commit f9dc945
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 9 deletions.
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm test
16 changes: 16 additions & 0 deletions package-lock.json

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

8 changes: 5 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@
"preversion": "npm run lintify",
"version": "npm run prettify",
"upload": "npm run build && npm publish --access public",
"i18n:copy": "ts-node src/cli/i18n-copy/index.ts --from it --to fr"
"i18n:copy": "ts-node src/cli/i18n-copy/index.ts --from it --to fr",
"prepare": "husky"
},
"dependencies": {
"convict": "^6.2.4",
"convict-format-with-moment": "^6.2.0",
"validator": "^13.11.0",
"prettier": "^3.1.1"
"prettier": "^3.1.1",
"validator": "^13.11.0"
},
"devDependencies": {
"@types/convict": "^6.1.6",
Expand All @@ -54,6 +55,7 @@
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.6.0",
"eslint-plugin-prettier": "^5.1.1",
"husky": "^9.0.6",
"jest": "^29.7.0",
"nodemon": "^3.0.2",
"ts-jest": "^29.1.1",
Expand Down
11 changes: 5 additions & 6 deletions src/cli/i18n-msg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,12 @@ const allLanguagesReport = (data: Message[], languages: string[]) => {
});
};

const report = (data: Message[], languages: string[], uniqueCode: string[], uniqueOverrides: string[]) => {
const report = (data: Message[], languages: string[], uniqueCode: string[]) => {
let e = 0;
data.forEach((value) => {
let valueLanguages: string[] = [];
let valueLanguagesOverrites: string[] = [];
let uniqueOverrides: string[] = [];
const isUniqueCode = uniqueCode.includes(value.code);
//check duplicate Code
if (!isUniqueCode) {
Expand All @@ -219,7 +220,7 @@ const report = (data: Message[], languages: string[], uniqueCode: string[], uniq
if (!isUniqueOverrides) {
uniqueOverrides.push(i.customer);
} else {
console.log("\x1b[31m Duplicate Customer: \x1b[0m", i.customer);
console.log("\x1b[31m Duplicate Customer: \x1b[0m", i.customer, "\x1b[31m in Code: \x1b[0m", value.code);
e = 1;
}

Expand Down Expand Up @@ -271,9 +272,8 @@ const multiFileReport = (languages: string[], namespaces: MessagesNamespace[]) =
const uniqueLang = getAllLanguagesUnique(languages);
let numeError = 0;
const uniqueCode: string[] = [];
const uniqueOverrides: string[] = [];
for (const [, messages] of namespaces) {
const e = report(messages, uniqueLang, uniqueCode, uniqueOverrides);
const e = report(messages, uniqueLang, uniqueCode);
numeError = numeError + e;
}
console.log("All languages: ", uniqueLang);
Expand All @@ -282,11 +282,10 @@ const multiFileReport = (languages: string[], namespaces: MessagesNamespace[]) =

const singleFileReport = (message: Message[], languages: string[]) => {
const uniqueCode: string[] = [];
const uniqueOverrides: string[] = [];
console.log();
console.log("-----REPORT-------");
const uniqueLang = getAllLanguagesUnique(languages);
const e = report(message, uniqueLang, uniqueCode, uniqueOverrides);
const e = report(message, uniqueLang, uniqueCode);
console.log("All languages: ", uniqueLang);
return e !== 0 ? 1 : 0;
};
Expand Down

0 comments on commit f9dc945

Please sign in to comment.