open-index/open-npm huggingface dataset:
npm package: @liuli-util/shell
Description: 在一个 cli 中包含所有常用的 unix\* 命令。
Latest version: 0.2.0

# @liuli-util/shell

## 简介

在一个 cli 中包含所有常用的 unix\* 命令。

## 使用

```shell
yarn add -D @liuli-util/shell
```

命令

- mkdir: 递归创建目录
- rm: 删除文件或目录
- cp: 复制任意文件或目录到指定目录中
- mv: 移动任意文件或目录到指定目录中
  > 当要移动的文件只有一个且目标文件不存在，将会重命名而非移动。

示例

```shell
mkdir dist/
rm dist/
cp README.md CNAME dist/
mv images/ dist/
```

## FAQ

### 为什么要重复造轮子？

因为目前已有工具都不能满足需求

- rimraf: 删除指定目录
- copyfiles: 复制文件
- shx: 使用 nodejs 实现 shell 命令

主要的不同点在于我们默认覆盖了一些系统命令而非重新创建一个命令，同时增强原生命令的功能。

| 对比             | @liuli-util/shell | shx     |
| ---------------- | ----------------- | ------- |
| 是否包含常用命令 | 是                | 是      |
| 是否覆盖系统命令 | 是                | 否      |
| 是否增强命令     | 是                | 否      |
| 底层依赖         | fs-extra          | shelljs |

### 为什么全局安装没有覆盖系统命令？

由于环境变量的加载顺序导致无法覆盖，你应该在项目级别使用它。

### cp/mv 命令的行为似乎有点奇怪？

1. 源文件只有一个
   1. 目标位置存在，则复制文件到目录下。例如 `cp public dist/` 则会将 public 复制到 dist/public
   2. 目标位置不存在，则将之复制并重命名到指定位置。例如 `cp public dist/static` 则会将 public 复制到 dist/static
2. 源文件有多个，则复制文件到目录下（如果不存在则自动创建）。例如 `cp public package.json dist/` 则会将 public,package.json 复制到 dist/ 目录
npm package: @liuli-util/string
Description: 字符串相关功能的函数库
Latest version: 3.5.0

# @liuli-util/string

> 字符串相关功能的函数库

查看文档网站 [@liuli-util/string](https://liuli-utils.rxliuli.com/@liuli-util/string)

## 安装

使用 yarn:

```sh
yarn add @liuli-util/string
```

或者使用 npm:

```sh
npm install @liuli-util/string
```
npm package: @liuli-util/vite-plugin-env-dts-gen
Description: > [中文](https://github.com/rxliuli/liuli-tools/tree/master/libs/vite-plugin-env-dts-gen/README.zh-CN.md)
Latest version: 0.3.0

# @liuli-util/vite-plugin-env-dts-gen

> [中文](https://github.com/rxliuli/liuli-tools/tree/master/libs/vite-plugin-env-dts-gen/README.zh-CN.md)

Scan environment variables to generate dts type definitions to avoid manually maintaining dts type definitions for environment variables.

## use

```sh
pnpm i -D @liuli-util/vite-plugin-env-dts-gen
```

Configure the plugin

```ts
//vite.config.ts
import { defineConfig } from 'vite'
import { envDtsGen } from '@liuli-util/vite-plugin-env-dts-gen'

export default defineConfig({
  plugins: [envDtsGen()],
})
```

> [Example](https://github.com/rxliuli/liuli-tools/tree/master/examples/vite-plugin-env-dts-gen-example)

## FAQ

### The default plugin has the following behavior

- When the `ImportMetaEnv` interface in `src/vite-env.d.ts` already contains fields, it will not be repeatedly added or replaced, but skipped. This behavior is mainly to allow users to customize environment variables
- never automatically clear an environment variable, even if it no longer exists in .env\*, for the same reason as above
- Forcibly generate an environment variable during build, even if there is no change, this behavior is to avoid building immediately after pulling the code for the first time
npm package: @liuli-util/vite-plugin-firefox-dist
Description: Converts a built Chrome extension into a Firefox extension, only allowing Firefox versions that support manifest v3. Refer to the [Firefox Manifest v3 Migration Guide](https://extensionworkshop.com/documentation/develop/manifest-v3-migration-guide/).
Latest version: 0.3.0

# @liuli-util/vite-plugin-dist-firefox

Converts a built Chrome extension into a Firefox extension, only allowing Firefox versions that support manifest v3. Refer to the [Firefox Manifest v3 Migration Guide](https://extensionworkshop.com/documentation/develop/manifest-v3-migration-guide/).

[Documentation](https://dev.rxliuli.com/en/dev/vite-plugin-dist-firefox)
npm package: @liuli-util/vite-plugin-node
Description: Everything you need to build a nodejs app/lib with vite, hopefully making building node apps as easy as building web apps with vite.
Latest version: 0.10.0

# @liuli-util/vite-plugin-node

Everything you need to build a nodejs app/lib with vite, hopefully making building node apps as easy as building web apps with vite.

[Documentation](https://dev.rxliuli.com/en/dev/vite-plugin-node)
npm package: @liuli-util/vite-plugin-svg-patch
Description: Proper inlining of svg into the bundle is a patch to the existing [vite issue (proposed late 2020)](https://github.com/vitejs/vite/issues/1204).
Latest version: 0.3.0

# @liuli-util/vite-plugin-svg-patch

Proper inlining of svg into the bundle is a patch to the existing [vite issue (proposed late 2020)](https://github.com/vitejs/vite/issues/1204).

## Use

```ts
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { svgPatch } from '@liuli-util/vite-plugin-svg-patch'

export default defineConfig({
  plugins: [vue(), svgPatch()],
})
```

## Limitations

Currently, there is no hook to handle image resources in `vue style/css` files that use `background-image: url("")`, probably a hook that can only be accessed internally by vite

> One idea is to use transformHook, but I don't want to deal with sourcemap or something like that for now, so I haven't tried it yet.