npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

lq-design

v1.0.12

Published

技术栈:React + TypeScript + scss + Vite + tailwindcss + shadcn-ui

Downloads

765

Readme

组件库

技术栈:React + TypeScript + scss + Vite + tailwindcss + shadcn-ui

组件库使用说明

pnpm install lq-design

主入口文件引入css样式

后续考虑css分包处理,按需加载

//主入口文件
import "lq-design/es/src/index.css";

组件引入使用

import { Button } from 'lq-design';

export const Demo = () => {
  return (
    <div>
      <Button />
    </div>
  )
}

项目运行

node版本 v20.12.2

包管理工具 [email protected]

直接安装pnpm即可,版本号是以防后续出现版本问题方便追踪


# 依赖安装
pnpm install

# 启动本地开发服务,通过storybook预览组件
pnpm run dev

# 组件库描述文档打包
pnpm run build-storybook

# 组件库打包
pnpm run build

如何在前端项目中使用本地组件库项目

# 1. 将当前组件库代码链接到全局(无法使用npm link添加到pnpm项目中)
npm link

# 2. 在需要使用组件库的前端项目中使用以下命令进行安装, 完成后会被安装到node_modules
npm link lq-design

# 如果是pnpm包管理器,使用以下方式
# 1. 链接当前项目到全局node_module
pnpm link --global
# 2. 将全局中组件库链接到当前项目
pnpm link --global lq-design

本地开发预览方法、组件文档维护

  1. pnpm run dev 启动storybook文档
  2. 在src/stories下创建文件 [组件名].stories.ts
  3. 根据storybook文档语法引用组件,类似于以下代码
  4. storybook文档语法具体参照storybook官方文档 https://storybook.js.org/docs
import type { Meta, StoryObj } from '@storybook/react'
import { fn } from '@storybook/test'
import { Demo } from '@/components/Demo'

const meta = {
  title: 'Example/Demo',
  component: Demo,
  parameters: {
    layout: 'centered'
  },
  tags: ['autodocs'],
  argTypes: {
    color: {
      control: 'color'
    }
  },
  args: { title: 'demo', onClick: fn() }
} satisfies Meta<typeof Demo>

export default meta
type Story = StoryObj<typeof meta>

export const Primary: Story = {
  args: {
    title: 'demo',
    onClick: fn()
  }
}