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

CMDCT-3657 - swap react-scripts to vite #11702

Merged
merged 2 commits into from
May 21, 2024
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
52 changes: 52 additions & 0 deletions services/ui-src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Medicaid Data Collection Tool" />
<meta name="theme-color" content="#ffffff" />
<title>Managed Care Reporting</title>
<script src="/env-config.js"></script>
<link rel="icon" href="/favicon.ico" />
<link rel="icon" type="image/png" href="/favicon-32x32.png" sizes="32x32" />
<link rel="icon" type="image/png" href="/favicon-16x16.png" sizes="16x16" />
<!-- Tealium Analytics Tag Manager -->
<script>
var tealiumEnvMap = {
"mdctmcr.cms.gov": "prod",
"mdctmcrval.cms.gov": "qa",
};
var tealiumEnv = tealiumEnvMap[window.location.hostname] || "dev";
var tealiumUrl = `https://tags.tiqcdn.com/utag/cmsgov/cms-general/${tealiumEnv}/utag.sync.js`;
document.write(`<script src="${tealiumUrl}" async><\/script>`);
</script>
</head>

<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<!-- Tealium Analytics Tag Manager -->
<script>
window.utag_cfg_ovrd = { noview: true };
</script>
<script>
(function (t, e, a, l, i, u, m) {
t = "cmsgov/cms-general";
e = tealiumEnv;
a = "/" + t + "/" + e + "/utag.js";
l = "//tags.tiqcdn.com/utag" + a;
i = document;
u = "script";
m = i.createElement(u);
m.src = l;
m.type = "text/java" + u;
m.async = true;
l = i.getElementsByTagName(u)[0];
l.parentNode.insertBefore(m, l);
})();
</script>
<div id="root"></div>
<script type="module" src="/src/index.tsx"></script>
</body>

</html>
10 changes: 7 additions & 3 deletions services/ui-src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
"version": "1.0.0",
"license": "CC0-1.0",
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"start": "vite",
"build": "tsc && vite build",
"preview": "vite preview",
"coverage": "jest --coverage",
"test": "jest --setupFiles dotenv/config",
"watchTest": "jest --setupFiles dotenv/config --watch",
Expand All @@ -19,6 +20,7 @@
"@emotion/react": "^11",
"@emotion/styled": "^11",
"@hookform/resolvers": "^2.8.4",
"@vitejs/plugin-react": "^4.2.1",
"aws-amplify": "^5.3.4",
"bootstrap": "^5.1.3",
"date-fns": "^2.26.0",
Expand All @@ -28,6 +30,7 @@
"framer-motion": "^4",
"history": "^5.3.0",
"html-react-parser": "^3.0.1",
"jest": "^27.4.3",
"launchdarkly-react-client-sdk": "^3.0.1",
"nth-check": "2.1.1",
"object-path": "^0.11.8",
Expand All @@ -39,9 +42,10 @@
"react-hook-form": "^7.20.5",
"react-icons": "^4.3.1",
"react-router-dom": "6.22.3",
"react-scripts": "^5.0.0",
"react-uuid": "^1.0.3",
"sass": "^1.37.5",
"vite": "^5.2.11",
"vite-tsconfig-paths": "^4.3.2",
"yup": "^0.32.11",
"zustand": "^4.4.6"
},
Expand Down
58 changes: 0 additions & 58 deletions services/ui-src/public/index.html

This file was deleted.

2 changes: 1 addition & 1 deletion services/ui-src/src/styles/index.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// necessary to render the UsaBanner correctly
$image-path: "~@cmsgov/design-system/dist/images";
@import "@cmsgov/design-system/dist/scss/index";
@import "@cmsgov/design-system/dist/css/index";

@mixin tabbed-focus {
box-shadow: 0 0 0 3px #fff,
Expand Down
2 changes: 1 addition & 1 deletion services/ui-src/src/utils/other/parsing.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { ReactElement } from "react";
import * as DOMPurify from "dompurify";
import DOMPurify from "dompurify";
import parse from "html-react-parser";
// components
import { Link as RouterLink } from "react-router-dom";
Expand Down
19 changes: 15 additions & 4 deletions services/ui-src/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
{
"compilerOptions": {
"incremental": true,
"target": "ES2020",
"lib": ["es6", "dom", "ES2021.String"],
"target": "ESNext",
"lib": [
"esnext",
"dom",
"dom.iterable",
"ES2021.String"
],
"types": [
"vite/client"
],
"jsx": "react-jsx",
"sourceMap": true,
"module": "esnext",
Expand All @@ -22,5 +30,8 @@
"isolatedModules": true,
"noEmit": true
},
"include": ["src", "tests"]
}
"include": [
"src",
"tests"
]
}
1 change: 1 addition & 0 deletions services/ui-src/vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference types="vite/client" />
18 changes: 18 additions & 0 deletions services/ui-src/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import viteTsconfigPaths from "vite-tsconfig-paths";

export default defineConfig({
base: "/",
plugins: [react(), viteTsconfigPaths()],
server: {
open: true,
port: 3000,
},
define: {
global: "globalThis",
},
build: {
outDir: "./build",
},
});
Loading