Skip to content

Commit

Permalink
Merge pull request #625 from MohammedMaaz/feature/68-exclude-dev-depe…
Browse files Browse the repository at this point in the history
…ndencies-in-prod-build

Omit dev dependencies during Next JS build
  • Loading branch information
aakrem authored Sep 18, 2023
2 parents 0a013b6 + 9a4994d commit b1600da
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 63 deletions.
28 changes: 0 additions & 28 deletions .github/workflows/build.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Lint and Types
name: Lint and Build

on:
pull_request:
paths:
- "agenta-web/**"

jobs:
lint_and_types:
lint_and_build:
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand All @@ -18,13 +18,13 @@ jobs:
node-version: 20

- name: Install dependencies
run: npm ci
run: npm ci --omit=dev
working-directory: agenta-web

- name: Run Lint
run: npm run lint
working-directory: agenta-web

- name: Type Check
run: npm run types:check
- name: Run Build
run: npm run build
working-directory: agenta-web
4 changes: 0 additions & 4 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ jobs:
with:
node-version: 20

- name: Install dependencies
run: npm ci
working-directory: agenta-web

- name: Run Prettier
run: npx prettier --check .
working-directory: agenta-web
5 changes: 2 additions & 3 deletions agenta-web/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": ["next/core-web-vitals", "prettier"],
"extends": ["next/core-web-vitals"],
"rules": {
"react/no-unescaped-entities": 0,
"react-hooks/rules-of-hooks": 0
"react/no-unescaped-entities": 0
}
}
15 changes: 1 addition & 14 deletions agenta-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions agenta-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@types/js-beautify": "^1.14.0",
"@types/mdx": "^2.0.6",
"@types/react-dom": "18.2.1",
"@types/react-highlight-words": "^0.16.4",
"@types/react-syntax-highlighter": "^15.5.7",
"ag-grid-community": "^30.0.6",
"ag-grid-react": "^30.0.3",
Expand Down Expand Up @@ -55,9 +56,7 @@
"usehooks-ts": "^2.9.1"
},
"devDependencies": {
"@types/react-highlight-words": "^0.16.4",
"cypress": "^12.11.0",
"eslint-config-prettier": "^8.8.0",
"node-mocks-http": "^1.12.2",
"prettier": "^3.0.0"
}
Expand Down
2 changes: 1 addition & 1 deletion agenta-web/prod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ WORKDIR /app

# Install only production dependencies
COPY package.json package-lock.json* ./
RUN npm ci
RUN npm ci --omit=dev

# Copy only necessary files
COPY src ./src
Expand Down
4 changes: 2 additions & 2 deletions agenta-web/src/components/AppSelector/AppSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {CloseCircleFilled} from "@ant-design/icons"
import TipsAndFeatures from "./TipsAndFeatures"
import Welcome from "./Welcome"
import {isAppNameInputValid} from "@/lib/helpers/utils"
import {createAndStartTemplate, fetchApps, getTemplates} from "@/lib/services/api"
import {createAndStartTemplate, useApps, getTemplates} from "@/lib/services/api"
import AddNewAppModal from "./modals/AddNewAppModal"
import AddAppFromTemplatedModal from "./modals/AddAppFromTemplateModal"
import MaxAppModal from "./modals/MaxAppModal"
Expand Down Expand Up @@ -274,7 +274,7 @@ const AppSelector: React.FC = () => {
})
}

const {data, error, isLoading} = fetchApps()
const {data, error, isLoading} = useApps()
useEffect(() => {
setTimeout(() => {
if (data) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface Props {
setIsModalOpen: (value: boolean) => void
}

const testsetMusHaveNameModal: React.FC<Props> = ({isModalOpen, setIsModalOpen}) => {
const TestsetMusHaveNameModal: React.FC<Props> = ({isModalOpen, setIsModalOpen}) => {
const classes = useStyles()
const handleCloseModal = () => setIsModalOpen(false)

Expand All @@ -48,4 +48,4 @@ const testsetMusHaveNameModal: React.FC<Props> = ({isModalOpen, setIsModalOpen})
)
}

export default testsetMusHaveNameModal
export default TestsetMusHaveNameModal
2 changes: 1 addition & 1 deletion agenta-web/src/lib/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ export const updateEvaluationScenarioScore = async (
return response
}

export const fetchApps = () => {
export const useApps = () => {
const {data, error, isLoading} = useSWR(
`${process.env.NEXT_PUBLIC_AGENTA_API_URL}/api/app_variant/list_apps/`,
fetcher,
Expand Down
2 changes: 1 addition & 1 deletion agenta-web/src/pages/apps/[app_name]/testsets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const fetchData = async (url: string): Promise<any> => {
return response.data
}

export default function testsets() {
export default function Testsets() {
const classes = useStyles()
const router = useRouter()
const {app_name} = router.query
Expand Down

0 comments on commit b1600da

Please sign in to comment.