Skip to content

Commit a31afab

Browse files
committed
feat: remove unused react-datepicker dependency
- Remove react-datepicker from optionalDependencies - Remove @types/react-datepicker from devDependencies - Delete unused AbsoluteDatePicker component - Remove react-datepicker CSS mock from vitest setup - Clean up 148 lines of unused datepicker CSS styles The project has already switched to text-based date inputs, making the React-DatePicker dependency unnecessary. This reduces bundle size and removes unused code. Closes #67
1 parent 71870ca commit a31afab

File tree

10 files changed

+112
-392
lines changed

10 files changed

+112
-392
lines changed

package-lock.json

Lines changed: 10 additions & 51 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
"@types/lz-string": "^1.3.34",
135135
"@types/node": "^20.10.0",
136136
"@types/react": "^19.1.4",
137-
"@types/react-datepicker": "^6.2.0",
138137
"@types/react-dom": "^19.1.5",
139138
"@types/react-router-dom": "^5.3.3",
140139
"@types/react-syntax-highlighter": "^15.5.13",
@@ -179,8 +178,7 @@
179178
}
180179
},
181180
"optionalDependencies": {
182-
"lz-string": "^1.5.0",
183-
"react-datepicker": "^8.4.0"
181+
"lz-string": "^1.5.0"
184182
},
185183
"overrides": {
186184
"prismjs": "^1.30.0"

scripts/create-stackblitz-examples.js

Lines changed: 70 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,21 @@ const generateExamples = () => {
139139
const appContent = createExampleApp(component);
140140
writeFileSync(join(componentDir, 'App.tsx'), appContent);
141141

142-
// Create a simple index.html
142+
// Create main.tsx entry point
143+
const mainTsx = `import React from 'react';
144+
import ReactDOM from 'react-dom/client';
145+
import App from './App';
146+
import 'ag-grid-community/styles/ag-grid.css';
147+
import 'ag-grid-community/styles/ag-theme-quartz.css';
148+
149+
ReactDOM.createRoot(document.getElementById('root')!).render(
150+
<React.StrictMode>
151+
<App />
152+
</React.StrictMode>
153+
);`;
154+
writeFileSync(join(componentDir, 'main.tsx'), mainTsx);
155+
156+
// Create index.html
143157
const indexHtml = `<!DOCTYPE html>
144158
<html lang="en">
145159
<head>
@@ -149,11 +163,65 @@ const generateExamples = () => {
149163
</head>
150164
<body>
151165
<div id="root"></div>
152-
<script type="module" src="/src/main.tsx"></script>
166+
<script type="module" src="/main.tsx"></script>
153167
</body>
154168
</html>`;
155169

156170
writeFileSync(join(componentDir, 'index.html'), indexHtml);
171+
172+
// Create vite.config.ts
173+
const viteConfig = `import { defineConfig } from 'vite';
174+
import react from '@vitejs/plugin-react';
175+
176+
export default defineConfig({
177+
plugins: [react()],
178+
});`;
179+
180+
writeFileSync(join(componentDir, 'vite.config.ts'), viteConfig);
181+
182+
// Create tsconfig.json
183+
const tsConfig = {
184+
compilerOptions: {
185+
target: "ES2020",
186+
useDefineForClassFields: true,
187+
lib: ["ES2020", "DOM", "DOM.Iterable"],
188+
module: "ESNext",
189+
skipLibCheck: true,
190+
moduleResolution: "bundler",
191+
allowImportingTsExtensions: true,
192+
resolveJsonModule: true,
193+
isolatedModules: true,
194+
noEmit: true,
195+
jsx: "react-jsx",
196+
strict: true,
197+
noUnusedLocals: true,
198+
noUnusedParameters: true,
199+
noFallthroughCasesInSwitch: true
200+
},
201+
include: ["**/*.ts", "**/*.tsx"],
202+
references: [{ path: "./tsconfig.node.json" }]
203+
};
204+
205+
writeFileSync(join(componentDir, 'tsconfig.json'), JSON.stringify(tsConfig, null, 2));
206+
207+
// Create tsconfig.node.json
208+
const tsConfigNode = {
209+
compilerOptions: {
210+
composite: true,
211+
skipLibCheck: true,
212+
module: "ESNext",
213+
moduleResolution: "bundler",
214+
allowSyntheticDefaultImports: true
215+
},
216+
include: ["vite.config.ts"]
217+
};
218+
219+
writeFileSync(join(componentDir, 'tsconfig.node.json'), JSON.stringify(tsConfigNode, null, 2));
220+
221+
// Copy package.json to each example
222+
const examplePackageJson = JSON.parse(readFileSync(join(sharedDir, 'package.json'), 'utf8'));
223+
examplePackageJson.name = `${component.name.toLowerCase()}-example`;
224+
writeFileSync(join(componentDir, 'package.json'), JSON.stringify(examplePackageJson, null, 2));
157225
});
158226

159227
// Create manifest

0 commit comments

Comments
 (0)