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

Sort only en locale file in the sort-locale script; Update docker and CI to use npm run install-all #8813

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
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"cpus": 4
},
"waitFor": "onCreateCommand",
"postCreateCommand": "npm install",
"postCreateCommand": "npm run install-all",
"postAttachCommand": {
"server": "npm run dev"
},
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
node-version: "20"

- name: Install dependencies 📦
run: npm install
run: npm run install-all

- name: Build ⚙️
run: npm run build
Expand Down
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ RUN npm install

COPY . .

RUN npm run setup

RUN npm run build


Expand Down
29 changes: 9 additions & 20 deletions scripts/sort-locales.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires
const fs = require("fs");
// eslint-disable-next-line @typescript-eslint/no-var-requires
const path = require("path");

const directory = "src/Locale";

fs.readdir(directory, (err, files) => {
if (err) throw err;
const file = "src/Locale/en.json";

files.forEach((file) => {
if (file.endsWith(".json")) {
const filePath = path.join(directory, file);
const data = JSON.parse(fs.readFileSync(filePath, "utf8"));
const data = JSON.parse(fs.readFileSync(file, "utf8"));

const sortedData = Object.keys(data)
.sort()
.reduce((acc, key) => {
acc[key] = data[key];
return acc;
}, {});
const sortedData = Object.keys(data)
.sort()
.reduce((acc, key) => {
acc[key] = data[key];
return acc;
}, {});

fs.writeFileSync(filePath, JSON.stringify(sortedData, null, 2) + "\n");
}
});
});
fs.writeFileSync(file, JSON.stringify(sortedData, null, 2) + "\n");
Loading