How ecloudhub/spark works
Project type and purpose
• Spark is a React component library published as @ecloud-spark.
• It provides reusable UI components (buttons, menus, scroll‐triggered animations) and hooks (window size, media query, isomorphic layout effect).
• There’s also a Next.js–based “showcase” demo app that imports and demonstrates the components.
File structure
Top level:
• package.json, rollup.config.mjs → library build & publishing
• README.md → project overview
• / → standalone Next.js demo app
• src/ → raw component, hook, type source
Under src/:
• components/ → each component in its own folder (Button, MagneticButton, Menu, etc.)
• hooks/ → reusable React hooks
• config/ → configuration constants
• types/ → TypeScript interfaces for props
• index.ts → library entry point
Additional:
• tsconfig.json, .gitignore → standard config
README
• Confirms it’s a component library.
• Mentions dependencies (React, GSAP ScrollTrigger).
• Lists public API for components & hooks.
• Types (props definitions under types/)
• Config (variables.ts)
• Entry point (index.ts) → exports all components/hooks
Build & Publish Flow
• rollup.config.mjs reads index.ts → bundles for ESM & CJS → outputs to dist/ → package.json points to main/module → npm publish
• Next.js pages/_app, pages/index → import Spark components
• Local mock data (showcase/mock.ts)
• Uses global CSS (showcase/styles/globals.css)
• Any third‐party React app that installs ecloud-spark from NPM
• React (peerDep)
• GSAP ScrollTrigger plugin (peerDep)
Summary
[External Consumers]
↓
[Showcase App (Next.js)] → [Spark Library Package] → [External Dependencies]
↑
[Build & Publish Pipeline]
• Inside Spark Library, detail modules in a 2-column layout:
Components | Hooks
Types | Config
• This will capture all essential architectural elements of Spark tailored for both the library and its demo showcase.