Skip to content

Commit

Permalink
Revert "TaskID #223472 feat: Conversion CRA to Vite R&D"
Browse files Browse the repository at this point in the history
  • Loading branch information
gouravmore authored Aug 12, 2024
1 parent ddb6ad0 commit 614f37e
Show file tree
Hide file tree
Showing 23 changed files with 172 additions and 234 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/all-dev-rig.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: ALL rig dev Deployment
on:
push:
branches:
- all-1.2
- all-1.2.1

jobs:
deploy:
Expand Down Expand Up @@ -44,37 +44,37 @@ jobs:
- name: Build and Package Application
env:
SKIP_PREFLIGHT_CHECK: ${{ vars.SKIP_PREFLIGHT_CHECK }}
VITE_APP_MODE: ${{ vars.REACT_APP_MODE }}
VITE_APP_authToken: ${{ vars.REACT_APP_authToken }}
VITE_APP_PID: ${{ vars.REACT_APP_PID }}
VITE_APP_UID: ${{ vars.REACT_APP_UID }}
VITE_APP_ID: ${{ vars.REACT_APP_ID }}
VITE_APP_VER: ${{ vars.REACT_APP_VER }}
VITE_APP_TIMEDIFF: ${{ vars.REACT_APP_TIMEDIFF }}
VITE_APP_HOST: ${{ vars.REACT_APP_HOST }}
VITE_APP_ENDPOINT: ${{ vars.REACT_APP_ENDPOINT }}
VITE_APP_APISLUG: ${{ vars.REACT_APP_APISLUG }}
VITE_APP_CHANNEL: ${{ vars.REACT_APP_CHANNEL }}
VITE_APP_ENV: ${{ vars.REACT_APP_ENV }}
VITE_APP_BATCHSIZE: ${{ vars.REACT_APP_BATCHSIZE }}
VITE_APP_CONTENT_SIZE: ${{ vars.REACT_APP_CONTENT_SIZE }}
VITE_APP_LANGUAGE: ${{ vars.REACT_APP_LANGUAGE }}
VITE_APP_TELEMETRY_MODE: ${{ vars.REACT_APP_TELEMETRY_MODE }}
VITE_APP_VIRTUAL_ID_HOST: ${{ vars.REACT_APP_VIRTUAL_ID_HOST }}
VITE_APP_LEARNER_AI_ORCHESTRATION_HOST: ${{ vars.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST }}
VITE_APP_LEARNER_AI_APP_HOST: ${{ vars.REACT_APP_LEARNER_AI_APP_HOST }}
VITE_APP_CONTENT_SERVICE_APP_HOST: ${{ vars.REACT_APP_CONTENT_SERVICE_APP_HOST }}
VITE_APP_CAPTURE_AUDIO: ${{ vars.REACT_APP_CAPTURE_AUDIO }}
VITE_APP_AWS_S3_BUCKET_NAME: ${{ vars.REACT_APP_AWS_S3_BUCKET_NAME }}
VITE_APP_AWS_S3_BUCKET_URL: ${{ vars.REACT_APP_AWS_S3_BUCKET_URL }}
VITE_APP_AWS_S3_REGION: ${{ vars.REACT_APP_AWS_S3_REGION }}
VITE_APP_AWS_S3_BUCKET_CONTENT_URL: ${{ vars.REACT_APP_AWS_S3_BUCKET_CONTENT_URL }}
VITE_APP_MIN_DECIBELS: ${{ vars.REACT_APP_MIN_DECIBELS }}
VITE_APP_IS_AUDIOPREPROCESSING: ${{ vars.REACT_APP_IS_AUDIOPREPROCESSING }}
VITE_APP_POST_LEARNER_PROGRESS: ${{ vars.REACT_APP_POST_LEARNER_PROGRESS }}
VITE_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }}
VITE_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }}
VITE_APP_IS_APP_LANGUAGES: ${{ vars.REACT_APP_IS_APP_LANGUAGES }}
REACT_APP_MODE: ${{ vars.REACT_APP_MODE }}
REACT_APP_authToken: ${{ vars.REACT_APP_authToken }}
REACT_APP_PID: ${{ vars.REACT_APP_PID }}
REACT_APP_UID: ${{ vars.REACT_APP_UID }}
REACT_APP_ID: ${{ vars.REACT_APP_ID }}
REACT_APP_VER: ${{ vars.REACT_APP_VER }}
REACT_APP_TIMEDIFF: ${{ vars.REACT_APP_TIMEDIFF }}
REACT_APP_HOST: ${{ vars.REACT_APP_HOST }}
REACT_APP_ENDPOINT: ${{ vars.REACT_APP_ENDPOINT }}
REACT_APP_APISLUG: ${{ vars.REACT_APP_APISLUG }}
REACT_APP_CHANNEL: ${{ vars.REACT_APP_CHANNEL }}
REACT_APP_ENV: ${{ vars.REACT_APP_ENV }}
REACT_APP_BATCHSIZE: ${{ vars.REACT_APP_BATCHSIZE }}
REACT_APP_CONTENT_SIZE: ${{ vars.REACT_APP_CONTENT_SIZE }}
REACT_APP_LANGUAGE: ${{ vars.REACT_APP_LANGUAGE }}
REACT_APP_TELEMETRY_MODE: ${{ vars.REACT_APP_TELEMETRY_MODE }}
REACT_APP_VIRTUAL_ID_HOST: ${{ vars.REACT_APP_VIRTUAL_ID_HOST }}
REACT_APP_LEARNER_AI_ORCHESTRATION_HOST: ${{ vars.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST }}
REACT_APP_LEARNER_AI_APP_HOST: ${{ vars.REACT_APP_LEARNER_AI_APP_HOST }}
REACT_APP_CONTENT_SERVICE_APP_HOST: ${{ vars.REACT_APP_CONTENT_SERVICE_APP_HOST }}
REACT_APP_CAPTURE_AUDIO: ${{ vars.REACT_APP_CAPTURE_AUDIO }}
REACT_APP_AWS_S3_BUCKET_NAME: ${{ vars.REACT_APP_AWS_S3_BUCKET_NAME }}
REACT_APP_AWS_S3_BUCKET_URL: ${{ vars.REACT_APP_AWS_S3_BUCKET_URL }}
REACT_APP_AWS_S3_REGION: ${{ vars.REACT_APP_AWS_S3_REGION }}
REACT_APP_AWS_S3_BUCKET_CONTENT_URL: ${{ vars.REACT_APP_AWS_S3_BUCKET_CONTENT_URL }}
REACT_APP_MIN_DECIBELS: ${{ vars.REACT_APP_MIN_DECIBELS }}
REACT_APP_IS_AUDIOPREPROCESSING: ${{ vars.REACT_APP_IS_AUDIOPREPROCESSING }}
REACT_APP_POST_LEARNER_PROGRESS: ${{ vars.REACT_APP_POST_LEARNER_PROGRESS }}
REACT_APP_IS_APP_IFRAME: ${{ vars.REACT_APP_IS_APP_IFRAME }}
REACT_APP_IS_IN_APP_AUTHORISATION: ${{ vars.REACT_APP_IS_IN_APP_AUTHORISATION }}
REACT_APP_IS_APP_LANGUAGES: ${{ vars.REACT_APP_IS_APP_LANGUAGES }}
CI: false # Disabling CI to not treat warnings as errors
run: npm run build

Expand Down
4 changes: 3 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
# .husky/pre-commit
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx lint-staged
3 changes: 1 addition & 2 deletions eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
"plugin:import/errors",
"plugin:react/recommended",
"plugin:jsx-a11y/recommended",
"prettier",
"react-app"
"prettier"
],
"plugins": ["react", "import", "jsx-a11y", "prettier"],
"rules": {
Expand Down
23 changes: 10 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"react-infinite-scroll-component": "^6.1.0",
"react-redux": "^9.1.0",
"react-router-dom": "^6.0.2",
"react-scripts": "5.0.1",
"react-virtualized": "^9.22.3",
"react-virtualized-auto-sizer": "^1.0.6",
"react-window": "^1.8.6",
Expand All @@ -42,12 +43,14 @@
"sass": "^1.44.0",
"split-graphemes": "^0.5.0",
"use-sound": "^4.0.1",
"web-vitals": "^2.1.4"
"web-vitals": "^2.1.4",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-jsx-a11y": "^6.7.1",
"eslint-plugin-react": "^7.33.1"
},
"scripts": {
"start": "vite",
"build": "vite build",
"serve": "vite preview",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"prettier:cli": "prettier \"src/**/*.js\" \"**/*.json\"",
Expand Down Expand Up @@ -84,22 +87,16 @@
]
},
"devDependencies": {
"@mui/styles": "^5.15.10",
"@vitejs/plugin-react": "^4.3.1",
"eslint": "^7.32.0",
"prettier": "^2.3.2",
"eslint-config-prettier": "^8.3.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jsx-a11y": "^6.9.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.35.0",
"husky": "^9.0.11",
"lint-staged": "^11.0.0",
"prettier": "^2.3.2",
"react": "^18.2.0",
"vite": "^5.3.4"
"@mui/styles": "^5.15.10"
},
"lint-staged": {
"lint-staged": {
"src/**/*.{js,jsx}": [
"npx eslint --fix",
"npx prettier --write"
Expand Down
5 changes: 2 additions & 3 deletions index.html → public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
content="Base React App structure for Devigital Systems Projects"
/>
<!-- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" /> -->
<link rel="manifest" href="/manifest.json" />
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
Expand All @@ -26,7 +26,6 @@
<title>EkStep</title>
</head>
<body>
<div id="root">
<script type="module" src="/src/index.jsx"></script>
<div id="root" />
</body>
</html>
21 changes: 10 additions & 11 deletions src/App.jsx → src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ import { AppContent } from './views';
import theme from './assets/styles/theme';
import { initialize } from './services/telementryService';
import { startEvent } from './services/callTelemetryIntract';
import '../src/index.css';
// import '@project-sunbird/telemetry-sdk/index.js';
import '@project-sunbird/telemetry-sdk/index.js';

const App = () => {
const ranonce = useRef(false);
Expand All @@ -25,27 +24,27 @@ const App = () => {

await initialize({
context: {
mode: import.meta.env.VITE_APP_MODE, // To identify preview used by the user to play/edit/preview
mode: process.env.REACT_APP_MODE, // To identify preview used by the user to play/edit/preview
authToken: '', // Auth key to make api calls
did: did, // Unique id to identify the device or browser
uid: 'anonymous',
channel: import.meta.env.VITE_APP_CHANNEL, // Unique id of the channel(Channel ID)
env: import.meta.env.VITE_APP_ENV,
channel: process.env.REACT_APP_CHANNEL, // Unique id of the channel(Channel ID)
env: process.env.REACT_APP_ENV,

pdata: {
// optional
id: import.meta.env.VITE_APP_ID, // Producer ID. For ex: For sunbird it would be "portal" or "genie"
ver: import.meta.env.VITE_APP_VER, // Version of the App
pid: import.meta.env.VITE_APP_PID, // Optional. In case the component is distributed, then which instance of that component
id: process.env.REACT_APP_ID, // Producer ID. For ex: For sunbird it would be "portal" or "genie"
ver: process.env.REACT_APP_VER, // Version of the App
pid: process.env.REACT_APP_PID, // Optional. In case the component is distributed, then which instance of that component
},
tags: [
// Defines the tags data
'',
],
timeDiff: 0, // Defines the time difference// Defines the object roll up data
host: import.meta.env.VITE_APP_HOST, // Defines the from which domain content should be load
endpoint: import.meta.env.VITE_APP_ENDPOINT,
apislug: import.meta.env.VITE_APP_APISLUG,
host: process.env.REACT_APP_HOST, // Defines the from which domain content should be load
endpoint: process.env.REACT_APP_ENDPOINT,
apislug: process.env.REACT_APP_APISLUG,
},
config: {},
// tslint:disable-next-line:max-line-length
Expand Down
14 changes: 7 additions & 7 deletions src/components/Assesment/Assesment.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ export const ProfileHeader = ({

const handleProfileBack = () => {
try {
if (import.meta.env.VITE_APP_IS_APP_IFRAME === "true") {
if (process.env.REACT_APP_IS_APP_IFRAME === "true") {
window.parent.postMessage({ type: "restore-iframe-content" });
navigate("/");
} else {
Expand Down Expand Up @@ -519,7 +519,7 @@ export const ProfileHeader = ({
</Box>
</Box>
</Box>
{import.meta.env.VITE_APP_IS_IN_APP_AUTHORISATION === "true" && (
{process.env.REACT_APP_IS_IN_APP_AUTHORISATION === "true" && (
<CustomTooltip title="Logout">
<Box>
<CustomIconButton onClick={handleLogout}>
Expand Down Expand Up @@ -568,10 +568,10 @@ const Assesment = ({ discoverStart }) => {
(async () => {
setLocalData("profileName", username);
const usernameDetails = await axios.post(
`${import.meta.env.VITE_APP_VIRTUAL_ID_HOST}/${config.URLS.GET_VIRTUAL_ID}?username=${username}`
`${process.env.REACT_APP_VIRTUAL_ID_HOST}/${config.URLS.GET_VIRTUAL_ID}?username=${username}`
);
const getMilestoneDetails = await axios.get(
`${import.meta.env.VITE_APP_LEARNER_AI_APP_HOST}/${config.URLS.GET_MILESTONE}/${usernameDetails?.data?.result?.virtualID}?language=${lang}`
`${process.env.REACT_APP_LEARNER_AI_APP_HOST}/${config.URLS.GET_MILESTONE}/${usernameDetails?.data?.result?.virtualID}?language=${lang}`
);

localStorage.setItem(
Expand All @@ -594,7 +594,7 @@ const Assesment = ({ discoverStart }) => {

localStorage.setItem("lang", lang || "ta");
const getPointersDetails = await axios.get(
`${import.meta.env.VITE_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${usernameDetails?.data?.result?.virtualID}/${session_id}?language=${lang}`
`${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${usernameDetails?.data?.result?.virtualID}/${session_id}?language=${lang}`
);
setPoints(getPointersDetails?.data?.result?.totalLanguagePoints || 0);

Expand All @@ -605,7 +605,7 @@ const Assesment = ({ discoverStart }) => {
const virtualId = getLocalData("virtualId");
const language = lang;
const getMilestoneDetails = await axios.get(
`${import.meta.env.VITE_APP_LEARNER_AI_APP_HOST}/${config.URLS.GET_MILESTONE}/${virtualId}?language=${language}`
`${process.env.REACT_APP_LEARNER_AI_APP_HOST}/${config.URLS.GET_MILESTONE}/${virtualId}?language=${language}`
);
localStorage.setItem(
"getMilestone",
Expand All @@ -625,7 +625,7 @@ const Assesment = ({ discoverStart }) => {

if (virtualId) {
const getPointersDetails = await axios.get(
`${import.meta.env.VITE_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${virtualId}/${sessionId}?language=${lang}`
`${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${virtualId}/${sessionId}?language=${lang}`
);
setPoints(getPointersDetails?.data?.result?.totalLanguagePoints || 0);
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/AssesmentEnd/AssesmentEnd.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const AssesmentEnd = () => {
const previous_level = getLocalData("previous_level");
setPreviousLevel(previous_level?.replace("m", ""));
const getMilestoneDetails = await axios.get(
`${import.meta.env.VITE_APP_LEARNER_AI_APP_HOST}/${config.URLS.GET_MILESTONE}/${virtualId}?language=${lang}`
`${process.env.REACT_APP_LEARNER_AI_APP_HOST}/${config.URLS.GET_MILESTONE}/${virtualId}?language=${lang}`
);
const { data } = getMilestoneDetails;
setLevel(data.data.milestone_level);
Expand All @@ -45,7 +45,7 @@ const AssesmentEnd = () => {
localStorage.setItem("sessionId", sessionId)
}
const getPointersDetails = await axios.get(
`${import.meta.env.VITE_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${virtualId}/${sessionId}?language=${lang}`
`${process.env.REACT_APP_LEARNER_AI_ORCHESTRATION_HOST}/${config.URLS.GET_POINTER}/${virtualId}/${sessionId}?language=${lang}`
);
setPoints(getPointersDetails?.data?.result?.totalLanguagePoints || 0);
})();
Expand Down
4 changes: 2 additions & 2 deletions src/components/DiscoverEnd/DiscoverEnd.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const SpeakSentenceComponent = () => {
const virtualId = getLocalData("virtualId");
const lang = getLocalData("lang");
const getMilestoneDetails = await axios.get(
`${import.meta.env.VITE_APP_LEARNER_AI_APP_HOST}/${config.URLS.GET_MILESTONE}/${virtualId}?language=${lang}`
`${process.env.REACT_APP_LEARNER_AI_APP_HOST}/${config.URLS.GET_MILESTONE}/${virtualId}?language=${lang}`
);
const { data } = getMilestoneDetails;
setLevel(data.data.milestone_level);
Expand All @@ -54,7 +54,7 @@ const SpeakSentenceComponent = () => {

const handleProfileBack = () => {
try {
if (import.meta.env.VITE_APP_IS_APP_IFRAME === 'true') {
if (process.env.REACT_APP_IS_APP_IFRAME === 'true') {
navigate("/")
} else {
navigate("/discover-start")
Expand Down
Loading

0 comments on commit 614f37e

Please sign in to comment.