# @snipaste-cli/core

> Fronted fragment cli

Latest version **0.0.6** (published 2023-10-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @snipaste-cli/core
pnpm add @snipaste-cli/core
yarn add @snipaste-cli/core
bun add @snipaste-cli/core
```

Provides the command `sc`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.6 |
| Published | 2023-10-11 |
| First published | 2023-10-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 8 |
| Unpacked size | 92.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | madao2019 |
| Keywords | node, cli, vue3, react |

## Links

- npm: https://www.npmjs.com/package/@snipaste-cli/core
- Homepage: https://github.com/lycHub/snipaste-cli/tree/main/packages/core#readme
- npm.io page: https://npm.io/package/@snipaste-cli/core

## Dependencies (8)

- [ora](https://npm.io/package/ora.md) ^7.0.1
- [chalk](https://npm.io/package/chalk.md) ^5.3.0
- [execa](https://npm.io/package/execa.md) ^8.0.1
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.1.1
- [commander](https://npm.io/package/commander.md) ^11.0.0
- [lodash-es](https://npm.io/package/lodash-es.md) ^4.17.21
- [art-template](https://npm.io/package/art-template.md) ^4.13.2
- [@inquirer/prompts](https://npm.io/package/@inquirer/prompts.md) ^3.1.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.0.6 (latest) — 2023-10-11
- 0.0.5 — 2023-10-09
- 0.0.4 — 2023-10-08
- 0.0.3 — 2023-10-03
- 0.0.2 — 2023-10-03
- 0.0.1 — 2023-10-03

## README

## 前端快速生成代码片段

### usage
#### 安装
```text
npm add @snipaste-cli/core -D
```

#### 前提
- node=^16.17
- typescript=^5.0
- antd=^5.5
- @ant-design/icons=^5.1

#### 下载代码块
```text
// 默认把antdPro的模板下载到~/templates目录下
npx sc antdPro

// 指定生成路径,eg: 在 ~/a/v/d下生成
npx sc antdPro -des a/v/d
```

![img.png](https://github.com/lycHub/snipaste-cli/blob/main/packages/core/img.png)

#### 可用的模板名
> 如果不指定模板将下载全部模板
- antdPro
- globalStyles


#### 安装依赖
> 如果要运行antdPro的代码，需要安装以下依赖
```text
// 根据项目选择安装, 已安装的忽略
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'组件就能看到效果
```tsx
import React from 'react';
import ConfigurableTable from './components/table/ConfigurableTable';

function App() {
  return <div className="app">
    <ConfigurableTable />
  </div>
}

export default App;
```

#### [在线demo](https://stackblitz.com/edit/vitejs-vite-3oygwe?file=src%2FApp.tsx)

### 命令参数
#### sc
```text
// 下载模板
npx sc antdPro

// 指定存放路径, 默认 templates
-des, --destination [path]

// 是否自动安装依赖，默认 false
-i, --install

// 如果自动安装依赖，选择包管理工具，npm、yarn(未测试)或pnpm
-pt, --pkg-tool [npm|yarn|pnpm]
```

#### add

##### add c
新增一个组件
```text
// 基本用法
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)
```text
// 基本用法
npx sc add d DireA // 将生成:  src/directive/DireA.js

// 指定目录
npx sc add d a/b/DireA // 将在src/a/b 下生成
```

##### 其它命令
```text
// 查看版本
npx sc -V

// 查看帮助信息
npx sc -h

npx sc add -h

npx sc add c -h
...

```

---
_Source: https://npm.io/package/@snipaste-cli/core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
