squared-package

Integrate the squared package into TypeScript React/Next.js apps without a build step.

2|1|Updated Jan 7, 2021
One-click install
npx skills add https://github.com/lsst-sqre/squareone --skill squared-package
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: squared-package
Source: https://github.com/lsst-sqre/squareone/tree/main/.claude/skills/squared-package
Command: npx skills add https://github.com/lsst-sqre/squareone --skill squared-package

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires react, next.js, pnpm, vitest, storybook, @testing-library/react, and includes references (resource) components.

What problem does it solves? Developing and consuming a React component library often involves complex build steps, transpilation issues, and inconsistent styling. This skill provides the essential architectural knowledge for @lsst-sqre/squared, simplifying component development and integration with its unique "NO BUILD STEP" approach.

Core Features & Use Cases

  • NO BUILD STEP Architecture: Explains how the package exports TypeScript source directly, shifting transpilation to consuming applications for flexibility and speed.
  • CSS Modules & Design Tokens: Enforces CSS Modules-only styling with full integration of Rubin Observatory design tokens for consistent, performant UI.
  • Next.js Integration: Guides on configuring Next.js apps to correctly transpile and consume the squared package.
  • Use Case: When creating a new component for the squared library, use this skill to ensure it adheres to the NO BUILD STEP rule, uses CSS Modules with design tokens, and is correctly exported for consumption by other applications.

Quick Start

Configure your Next.js application to consume the @lsst-sqre/squared component library. Add transpilePackages: ['@lsst-sqre/squared'] to your next.config.js file.

Frequently Asked Questions about squared-package

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I set up a React component library without a build step?

A NO BUILD STEP architecture exports TypeScript source directly, shifting transpilation to consuming applications. Configure your Next.js app with `transpilePackages: ['@lsst-sqre/squared']` in next.config.js to consume the squared package, which points main/module/types to src/index.ts and uses CSS Modules for styling.

Can I use CSS Modules with a TypeScript React component library?

CSS Modules work with TypeScript React libraries when the package enforces CSS Modules-only styling and consuming apps handle transpilation. The squared package integrates Rubin Observatory design tokens via CSS Modules, requiring no additional build configuration beyond Next.js transpilation setup.

What configuration do I need to transpile TypeScript source in Next.js?

Add `transpilePackages: ['@lsst-sqre/squared']` to next.config.js to enable Next.js to transpile the squared package's TypeScript sources directly. This allows consuming applications to handle transpilation instead of the component library, eliminating the need for a build step.

How do I test React components from a source-based component library?

Use vitest and @testing-library/react to test components that export from TypeScript sources. The squared package provides testing infrastructure configured for CSS Modules and design tokens, enabling tests to run against the source directly without pre-compilation.

Does a NO BUILD STEP approach work with Next.js and CSS Modules?

Yes. The squared package combines NO BUILD STEP architecture with CSS Modules and design tokens, designed specifically for Next.js apps. Consuming applications must configure transpilation via next.config.js and handle CSS Module resolution to integrate the component library.

What are the constraints of exporting TypeScript source directly from a component library?

Direct TypeScript exports require consuming applications to handle transpilation and CSS Module resolution. The squared package enforces sideEffects: false, CSS Modules-only styling, and documented transpilation guidelines to ensure compatibility across different consuming environments.