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

@snipaste-cli/core

v0.0.6

Published

Fronted fragment cli

Downloads

21

Readme

前端快速生成代码片段

usage

安装

npm add @snipaste-cli/core -D

前提

  • node=^16.17
  • typescript=^5.0
  • antd=^5.5
  • @ant-design/icons=^5.1

下载代码块

// 默认把antdPro的模板下载到~/templates目录下
npx sc antdPro

// 指定生成路径,eg: 在 ~/a/v/d下生成
npx sc antdPro -des a/v/d

img.png

可用的模板名

如果不指定模板将下载全部模板

  • antdPro
  • globalStyles

安装依赖

如果要运行antdPro的代码,需要安装以下依赖

// 根据项目选择安装, 已安装的忽略
npm add antd @ant-design/icons @dnd-kit/core @dnd-kit/modifiers @dnd-kit/sortable @dnd-kit/utilities ahooks lodash-es

// 也可以下载时指定 "--install" 参数自动下载,支持 npm | yarn | pnpm
npx sc antdPro -i // antd @ant-design/icons 需要自行安装

预览antdPro

将下载到模板复制到项目目录中(比如 src/components),引用'ConfigurableTable'组件就能看到效果

import React from 'react';
import ConfigurableTable from './components/table/ConfigurableTable';

function App() {
  return <div className="app">
    <ConfigurableTable />
  </div>
}

export default App;

在线demo

命令参数

sc

// 下载模板
npx sc antdPro

// 指定存放路径, 默认 templates
-des, --destination [path]

// 是否自动安装依赖,默认 false
-i, --install

// 如果自动安装依赖,选择包管理工具,npm、yarn(未测试)或pnpm
-pt, --pkg-tool [npm|yarn|pnpm]

add

add c

新增一个组件

// 基本用法
npx sc add c CompA --frame react
将生成:
 src/components/CompA/index.tsx
 src/components/CompA/style.css

// 指定框架,目前只有vue3和react(默认)
--frame [react|vue3]

// 指定目录
npx sc add c a/b/c/CompA // 将在src/a/b/c 下生成
add d

新增一个指令(vue3 only)

// 基本用法
npx sc add d DireA // 将生成:  src/directive/DireA.js

// 指定目录
npx sc add d a/b/DireA // 将在src/a/b 下生成
其它命令
// 查看版本
npx sc -V

// 查看帮助信息
npx sc -h

npx sc add -h

npx sc add c -h
...