Conversation
This commit addresses multiple critical bugs and modernizes the build toolchain: Bug Fixes: - Fix critical bug where max() was exported from min module (dataProcessing/index.js) - Fix NaN errors in SparklinesBars by adding proper data validation - Fix comparison operator in SparklinesReferenceLine (use === instead of ==) - Fix .babelrc syntax error (remove trailing comma) - Remove unnecessary empty constructor in Sparklines component - Update export syntax in dataProcessing/index.js to standard ES6 Dependency Updates: - Upgrade Babel from v6 to v7 (@babel/core, @babel/preset-env, @babel/preset-react) - Upgrade Webpack from v3 to v5 with updated configuration syntax - Upgrade React dev dependencies from v15 to v16 - Upgrade Mocha from v3 to v10 - Upgrade Enzyme from v2 to v3 with React 16 adapter - Update prop-types to v15.8.1 - Update peer dependencies to require React >= 16.8.0 Build Configuration: - Update webpack.config.js to Webpack 5 syntax (loaders → rules) - Update demo webpack config for Webpack 5 and webpack-dev-server 5 - Update .babelrc to use @babel/preset-* packages - Update npm scripts to use @babel/register - Replace deprecated 'prepublish' with 'prepare' script CI/Testing: - Update .travis.yml to test on Node 18 and 20 - Add Enzyme setup file for tests - Configure webpack serve instead of webpack-dev-server Note: Tests require further investigation due to Enzyme compatibility issues with modern Node.js/cheerio versions. Build compiles successfully.
This commit modernizes the entire build and test infrastructure: Build System Migration (Babel → esbuild): - Remove all Babel dependencies (babel-core, babel-preset-*, babel-loader) - Remove Webpack and webpack-dev-server - Add esbuild for ultra-fast builds - Create build.js for library compilation - Create build-demo.js for demo development server - Remove .babelrc (no longer needed) - Add tsconfig.json for JSX configuration Testing Migration (Mocha/Chai → Vitest): - Replace Mocha + Chai with Vitest - Replace Enzyme with @testing-library/react - Update all test files to use Vitest's expect API - Create vitest.config.js with jsdom environment - Update test setup files for Vitest - Migrate all assertions from Chai to Vitest format - .to.be.null → .toBeNull() - .to.eq() → .toBe() - .to.eql() → .toEqual() - .to.have.length() → .toHaveLength() Test Files Updated: - __tests__/Sparklines.js - Updated to use @testing-library/react + vitest - __tests__/dataToPoints.js - Migrated assertions to vitest - __tests__/mean.js - Migrated assertions to vitest - __tests__/median.js - Migrated assertions to vitest - __tests__/graphical-tests.js - Updated to use renderToStaticMarkup Package Cleanup: - Removed 402 packages from previous commit - Added only 3 packages (esbuild) - Further reduced to 84 total packages with vitest - Net reduction of ~400 dependencies! Performance Improvements: - Build time significantly faster with esbuild - Test execution much faster with vitest - Native JSX support without transpilation config Test Results: ✓ 4 test files passing ✓ 16 tests passing - All component tests working - All data processing tests working All tests pass successfully!
These files are no longer needed after migration to esbuild: - webpack.config.js (replaced by build.js) - demo/webpack.config.js (replaced by build-demo.js) - wallaby.conf.js (referenced Babel + Mocha, now use Vitest) All builds and tests continue to pass with esbuild + Vitest.
, borisyankov#122, borisyankov#130 - PR borisyankov#46: Add gap support for null/NaN/Infinity values in data - Modified dataToPoints to mark invalid values with valid flag - Created segmentPoints utility to split data into valid segments - Updated SparklinesLine, SparklinesCurve, and SparklinesBars to handle gaps - Added comprehensive tests for gap handling - PR borisyankov#113: Add fillInvert style option to SparklinesLine - Allows inverting the fill direction for line charts - PR borisyankov#119: Add SparklinesInteractiveLayer component - New component for interactive hover/click with visual feedback - Shows active point with circle and vertical line - PR borisyankov#122: Remove empty onMouseMove handler from SparklinesLine - Made tooltips conditional on onMouseMove presence - PR borisyankov#130: Update README with improved code examples - Use proper JSX syntax highlighting - Wrap examples in function components All tests passing (25 tests across 5 test files)
- Document gap support for null/NaN/Infinity values - Add section for fillInvert style option (PR borisyankov#113) - Add section for SparklinesInteractiveLayer component (PR borisyankov#119) - Standardize all code examples with proper JSX syntax and function wrappers - Improve formatting with bold property names
- Remove .travis.yml configuration - Add GitHub Actions workflow (.github/workflows/ci.yml) - Tests on Node.js 18, 20, and 22 - Runs tests and build steps - Uses npm cache for faster builds - Update README badge from Travis CI to GitHub Actions The new workflow provides the same coverage as Travis CI with support for the latest Node.js LTS version (22).
- Update .github/workflows/ci.yml to include publish job - Triggers on version tags (v*.*.*) - Runs after tests pass - Publishes to npm using NPM_TOKEN secret - Uses Node.js 20 for publishing - Add PUBLISHING.md with comprehensive release guide - Prerequisites and NPM_TOKEN setup - Step-by-step release process - Versioning guidelines (semver) - Troubleshooting common issues - Update README.md with Development section - Testing, building, and demo instructions - Reference to PUBLISHING.md - Add License section Releases are now fully automated: tag a version and push, GitHub Actions handles testing and publishing to npm.
- Update GitHub Actions workflow to test on Node.js 24 - Test matrix now includes: 18, 20, 22, 24 - Remove PUBLISHING.md file - Simplify publishing instructions in README.md - Inline release instructions instead of external doc - Keep essential npm version and push commands All tests passing on current Node.js version (25 tests).
- Create index.d.ts with full type definitions for all components - Define interfaces for all component props - Add Point and SparklineStyle interfaces - Include proper React.Component types - Update package.json with "types" field pointing to index.d.ts - Add "files" field to ensure types are included in npm package - Add "typescript" and "types" to keywords - Update README with TypeScript support section All components now have full TypeScript support: - Sparklines (main container) - SparklinesLine (with fillInvert support) - SparklinesCurve (with divisor prop) - SparklinesBars - SparklinesSpots - SparklinesReferenceLine (with ReferenceLineType union) - SparklinesNormalBand - SparklinesText - SparklinesInteractiveLayer (new component) Types validated with TypeScript compiler. No additional @types packages needed.
- Uncomment build/ in .gitignore to prevent tracking build artifacts - Remove build/index.js and build/index.js.map from git tracking - Build files are still generated locally and included in npm package - Build folder should be created during npm prepare/compile step This ensures build artifacts are not committed to the repository while still being available in published npm packages.
- Remove src/ from the files array in package.json - Only include build/ and index.d.ts in published package - package.json and README.md are automatically included by npm - Source files not needed in production package This reduces package size and only ships production-ready files.
… to Vite ## Major Changes ### TypeScript Migration - Converted all source files from .js to .ts/.tsx (19 files) - Converted all test files from .js/.jsx to .ts/.tsx (5 files) - Added comprehensive type definitions throughout codebase - Created types.ts with Point interface - All components now have proper TypeScript interfaces ### Build System Migration (esbuild → Vite) - Replaced esbuild with Vite for library bundling - Created vite.config.ts with library mode configuration - Generates both ESM (.mjs) and CJS (.js) outputs - Automatic TypeScript declaration generation via vite-plugin-dts - Updated package.json with proper exports field ### Configuration Updates - Updated tsconfig.json for strict TypeScript compilation - Added tsconfig.node.json for Vite config - Updated vitest.config to TypeScript with React plugin - Removed esbuild files (build.js, build-demo.js, index.js) - Removed manual index.d.ts (now auto-generated by Vite) ### Package.json Updates - Changed to "type": "module" - Added proper exports field with types/import/require - Updated main, module, and types fields - Changed build script from esbuild to "tsc && vite build" - Removed esbuild and prop-types dependencies - Added Vite, TypeScript, and @vitejs/plugin-react ### GitHub Actions - Updated CI workflow to use "npm run build" instead of "npm run compile" ## Bundle Output - ESM: build/index.mjs (11.87 KB, 3.51 KB gzipped) - CJS: build/index.js (7.31 KB, 2.80 KB gzipped) - Full TypeScript declarations with source maps ## Testing - All 25 tests passing - Test files now written in TypeScript - Vitest configured with React plugin for TSX support This is a complete TypeScript rewrite with modern build tooling.
- Add 'exports: named' to Rollup output config - Resolves warning about mixed default and named exports - Maintains backwards compatibility for both import patterns - Build completes cleanly with no warnings
- Disable JavaScript/TypeScript sourcemaps (sourcemap: false) - Disable TypeScript declaration maps (declarationMap: false) - Reduces package size from 129KB to 42KB (67% reduction) - Saves 87KB by removing unnecessary .map files - All tests passing, functionality unchanged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.