Skip to content
Open
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
3 changes: 2 additions & 1 deletion bin/update-modules-translations.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { resolve } from "node:path";
import { glob } from "glob";
import { load } from "js-yaml";
import { parseArgs } from "node:util";
import { sep as filePathSeparator } from "path";

const BASE_URL = `https://static.zdassets.com/translations`;

Expand Down Expand Up @@ -67,7 +68,7 @@ async function getModules() {
for (const file of files) {
const content = await readFile(file);
const parsedContent = load(content);
const moduleName = file.split("/")[2];
const moduleName = file.split(filePathSeparator)[2];
result[moduleName] = parsedContent.packages[0];
}

Expand Down
14 changes: 12 additions & 2 deletions rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ import terser from "@rollup/plugin-terser";
import svgr from "@svgr/rollup";
import { generateImportMap } from "./generate-import-map.mjs";
import { defineConfig } from "rollup";
import { sep as filePathSeparator } from "path";

const fileNames = "[name]-bundle.js";
const isProduction = process.env.NODE_ENV === "production";
const TRANSLATION_FILE_REGEX =
/src\/modules\/(.+?)\/translations\/locales\/.+?\.json$/;
const TRANSLATION_FILE_REGEX = ( // IIFE
() => {
// escape the file path separator if it's a backslash (Windows)
const escapedSeparator = filePathSeparator.replace("\\", "\\\\");

return new RegExp(
["src", "modules", "(.+?)", "translations", "locales", ".+?\.json$"].join(escapedSeparator)
);
}
)();


export default defineConfig([
// Configuration for bundling the script.js file
Expand Down
Loading