Skip to content

Commit

Permalink
Enhance Vite configuration and browser support script (#10040)
Browse files Browse the repository at this point in the history
  • Loading branch information
rithviknishad authored Jan 18, 2025
1 parent c5c52b6 commit b24e645
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 12 deletions.
28 changes: 18 additions & 10 deletions scripts/generate-supported-browsers.mjs
Original file line number Diff line number Diff line change
@@ -1,17 +1,25 @@
import { getUserAgentRegex } from 'browserslist-useragent-regexp';
import fs from 'fs';
import path from 'path';
import { fileURLToPath } from 'url';
import { getUserAgentRegex } from "browserslist-useragent-regexp";
import fs from "fs";
import path from "path";
import { fileURLToPath } from "url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

const regex = getUserAgentRegex({
ignoreMinor: true,
ignorePatch: true,
allowZeroSubversions: false,
allowHigherVersions: true,
ignoreMinor: true,
ignorePatch: true,
allowZeroSubversions: false,
allowHigherVersions: true,
});

const supportedBrowsersPath = path.resolve(__dirname, '../src/supportedBrowsers.ts');
fs.writeFileSync(supportedBrowsersPath, `export default ${regex};`);
const supportedBrowsersPath = path.resolve(
__dirname,
"../src/supportedBrowsers.ts",
);
fs.writeFileSync(
supportedBrowsersPath,
`/* eslint-disable */
export default ${regex};
`,
);
3 changes: 2 additions & 1 deletion scripts/setup-care-apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ const plugins = readAppsConfig();

// Generate pluginMap.ts
const pluginMapPath = path.join(__dirname, "..", "src", "pluginMap.ts");
const pluginMapContent = `// Use type assertion for the static import\n${plugins
const pluginMapContent = `/* eslint-disable */
// Use type assertion for the static import\n${plugins
.map(
(plugin) =>
`// @ts-expect-error Remote module will be available at runtime\nimport ${plugin.camelCaseName}Manifest from "${plugin.repo}/manifest";`,
Expand Down
7 changes: 6 additions & 1 deletion vite.config.mts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,12 @@ export default defineConfig(({ mode }) => {
],
}),
react(),
checker({ typescript: true }),
checker({
typescript: true,
eslint: {
lintCommand: "eslint ./src",
},
}),
treeShakeCareIcons({
iconWhitelist: ["default"],
}),
Expand Down

0 comments on commit b24e645

Please sign in to comment.