Skip to content

Commit 7b013ae

Browse files
committed
Merge branch 'main' of https://github.com/devtron-labs/devtron-fe-common-lib into chore/logs-virtualization-main
2 parents 386ef5f + 87d64f4 commit 7b013ae

347 files changed

Lines changed: 14015 additions & 9961 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.eslintignore

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ src/Common/DebouncedSearch/__tests__/DebouncedSearch.test.tsx
2323
src/Common/DevtronProgressing/DevtronProgressing.tsx
2424
src/Common/Dialogs/DialogForm.tsx
2525
src/Common/DraggableWrapper/DraggableButton.tsx
26-
src/Common/DraggableWrapper/DraggableWrapper.tsx
2726
src/Common/Drawer/Drawer.tsx
2827
src/Common/Grid/Grid.tsx
2928
src/Common/Helper.tsx
@@ -54,4 +53,3 @@ src/Common/Select/Select.tsx
5453
src/Common/ServerError.ts
5554
src/Common/TippyCustomized.tsx
5655
src/Common/ToastBody.tsx
57-
src/Common/Types.ts
Lines changed: 42 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,47 @@
11
name: Node.js Package
22

33
on:
4-
release:
5-
types: [created]
4+
release:
5+
types: [created]
66

77
jobs:
8-
build-and-publish:
9-
name: Build and Publish to NPM Registry
10-
11-
runs-on: ubuntu-latest
12-
13-
steps:
14-
- name: Checkout repository
15-
uses: actions/checkout@v4
16-
17-
- name: Use Node.js
18-
uses: actions/setup-node@v4
19-
with:
20-
node-version-file: '.nvmrc'
21-
cache: 'npm'
22-
registry-url: 'https://registry.npmjs.org/'
23-
24-
- name: Install dependencies
25-
run: npm ci
26-
27-
- name: Execute test cases
28-
run: npm test
29-
30-
- name: Build Lib
31-
run: npm run build-lib
32-
33-
- name: Publish to NPM Registry
34-
run: npm publish --access public
35-
env:
36-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
8+
build-and-publish:
9+
name: Build and Publish to NPM Registry
10+
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
17+
- name: Use Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version-file: '.nvmrc'
21+
cache: 'npm'
22+
registry-url: 'https://registry.npmjs.org/'
23+
24+
- name: Install dependencies
25+
run: npm ci
26+
27+
- name: Execute test cases
28+
run: npm test
29+
30+
- name: Build Lib
31+
run: npm run build-lib
32+
33+
- name: Publish to NPM Registry
34+
run: |
35+
VERSION=$(node -p "require('./package.json').version")
36+
37+
if [[ $VERSION == *"-beta."* ]]; then
38+
npm publish --access public --tag beta
39+
40+
elif [[ $VERSION == *"-"* ]]; then
41+
npm publish --access public --tag next
42+
43+
else
44+
npm publish --access public
45+
fi
46+
env:
47+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v22
1+
v24.14.1

CLAUDE.md

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
# CLAUDE.md
2+
3+
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4+
5+
## Overview
6+
7+
`@devtron-labs/devtron-fe-common-lib` is a React component and utility library for the Devtron platform. It is built with Vite and published to npm as an ES module.
8+
9+
## Commands
10+
11+
```bash
12+
# Type-check + lint (strict, max-warnings=0)
13+
npm run lint
14+
15+
# Auto-fix lint issues
16+
npm run lint-fix
17+
18+
# Build with source maps (development/local linking)
19+
npm run build
20+
21+
# Watch mode rebuild with source maps
22+
npm run build-watch
23+
24+
# Build without source maps (CI/CD, publishing)
25+
npm run build-lib
26+
27+
# Vite dev server
28+
npm run dev
29+
30+
# Generate icon/illustration components from SVGs
31+
npm run generate-icon
32+
npm run generate-illustration
33+
```
34+
35+
There are no tests currently (`npm test` is a no-op).
36+
37+
## Architecture
38+
39+
### Entry & Exports
40+
41+
`src/index.ts` re-exports everything from four top-level modules:
42+
43+
- **`src/Common/`** — Legacy utilities, hooks, and components (BreadCrumb, SearchBar, Checkbox, etc.)
44+
- **`src/Shared/`** — Primary reusable code: 100+ UI components, hooks, providers, services, API utilities, types, helpers, constants, validations
45+
- **`src/Pages/`** — Full-page components (Applications, BulkEdit, GlobalConfigurations, ResourceBrowser)
46+
- **`src/Pages-Devtron-2.0/`** — New Devtron 2.0 features (ApplicationManagement, Navigation, SecurityCenter, etc.)
47+
48+
### Component Structure Convention
49+
50+
Components follow a consistent directory layout:
51+
52+
```
53+
ComponentName/
54+
├── ComponentName.component.tsx # Main component (forwardRef + React.memo typical)
55+
├── types.ts # TypeScript interfaces/types
56+
├── constants.ts # Component-level constants
57+
├── utils.ts # Helper functions
58+
├── component.scss # Scoped SCSS styles
59+
└── index.ts # Barrel export
60+
```
61+
62+
### Key Architectural Patterns
63+
64+
**State management**: React Context API only — `MainContextProvider`, `ThemeProvider`, `UserEmailProvider`. No Redux/Zustand.
65+
66+
**API layer**: TanStack Query (React Query v4) via `CoreAPI` class. API queuing handled via `APIQueuing`. Custom query hooks live in `Shared/API/reactQueryHooks.ts`.
67+
68+
**Styling**: SCSS with BEM naming. CSS is injected into JS chunks via `vite-plugin-lib-inject-css`. No CSS modules.
69+
70+
**SVG icons**: Imported as React components via `vite-plugin-svgr`. Two icon generations: `src/Assets/Icon/` and `src/Assets/IconV2/`. Do **not** use `IconBase` or `IllustrationBase` directly — use the `Icon` and `Illustration` wrapper components.
71+
72+
**Toasts**: Do **not** import from `react-toastify` directly — use `ToastManager` from the library.
73+
74+
**Forms**: Dynamic forms use `@rjsf` (React JSON Schema Form). Custom form hooks in `Shared/Hooks/`.
75+
76+
**Router**: React Router v6 (`useBlocker` etc.). The `usePrompt` hook handles navigation blocking.
77+
78+
### TypeScript & Path Aliases
79+
80+
`tsconfig.json` configures path aliases used throughout the codebase:
81+
82+
| Alias | Maps to |
83+
| -------------------- | ------------------------- |
84+
| `@Icons/*` | `src/Assets/Icon/*` |
85+
| `@IconsV2/*` | `src/Assets/IconV2/*` |
86+
| `@Common/*` | `src/Common/*` |
87+
| `@Shared/*` | `src/Shared/*` |
88+
| `@Pages/*` | `src/Pages/*` |
89+
| `@PagesDevtron2.0/*` | `src/Pages-Devtron-2.0/*` |
90+
91+
Strict mode is **off** in tsconfig. Target is ES2020, module is ESNext.
92+
93+
### Build Output
94+
95+
Vite splits the bundle into named chunks: `@vendor`, `@code-editor`, `@framer-motion`, `@moment`, `@react-select`, `@react-virtualized-sticky-tree`, `@common-rjsf`, `@src-assets-*`. Output is ES modules only, landing in `dist/`. Type declarations are generated via `vite-plugin-dts` at `dist/index.d.ts`.
96+
97+
## Code Style
98+
99+
- **Prettier**: No semicolons, single quotes, 120-char print width, 4-space tabs, trailing commas everywhere.
100+
- **ESLint**: Airbnb + TypeScript + Prettier. Import order enforced by `eslint-plugin-simple-import-sort`.
101+
- **Pre-commit**: `lint-staged` runs ESLint on staged `.{js,jsx,ts,tsx}` files via Husky.
102+
- JSX only in `.tsx` files (not `.jsx`).
103+
- `no-console` is a warning (not error).
104+
105+
## CI/CD
106+
107+
- **PRs**: Node version from `.nvmrc`, `npm ci`, `npm run lint`, `npm run build-lib`.
108+
- **Releases**: Triggered by GitHub release creation, runs `npm test` + `npm run build-lib` + `npm publish --access public` using `NPM_TOKEN` secret.

0 commit comments

Comments
 (0)