open-index/open-npm huggingface dataset:
npm package: @kcuf/react-hook-is-unmounted
Description: React hook - useIsUnmounted.
Author: Jianchun Wang
Latest version: 0.1.1

# @kcuf/react-hook-is-unmounted

## Usage

```tsx
import {
  ReactElement,
  useState,
  useEffect,
  useCallback
} from 'react';

// i would recommend placing all your data calls in a folder, one api per file
import dataSome, { // dataSomeList is some async method returning Promise<IDataSome>
  IDataSome
} from ':/data/some';
import dataOther, { // dataSomeList is some async method returning Promise<IDataSome>
  IDataOther
} from ':/data/other';

import useIsUnmounted from '@kcuf/react-hook-is-unmounted';

export default function SomeComponent(): ReactElement {
  const isUnmounted = useIsUnmounted();
  const [stateDataSome, setStateDataSome] = useState<IDataSome | null>(null);
  const [stateErrorSome, setStateErrorSome] = useState<Error | null>(null);
  const [stateDataOther, setStateDataOther] = useState<IDataOther | null>(null);
  const [stateErrorOther, setStateErrorOther] = useState<Error | null>(null);
  
  // use in effect directly
  useEffect(() => {
    dataSome().then(data => {
      if (isUnmounted()) {
        return;
      }
      
      setStateDataSome(data);
    }, (err: Error) => {
      if (isUnmounted()) {
        return;
      }
      
      setStateErrorSome(err);
    });
  }, [isUnmounted]);
  // or use as a callback
  const handleGetOther = useCallback(() => {
    dataOther().then(data => {
      if (isUnmounted()) {
        return;
      }
      
      setStateDataOther(data);
    }, (err: Error) => {
      if (isUnmounted()) {
        return;
      }
      
      setStateErrorOther(err);
    });
  }, [isUnmounted]);
  
  return stateDataSome || stateErrorSome ? <div>
    <ResultSome data={stateDataSome} error={stateErrorSome} />
    {stateDataOther || stateErrorOther ? <ResultOther data={stateDataOther} error={stateErrorOther} /> : null}
    <Button onClick={handleGetOther}>get other</Button>
  </div> : <Loading />;
};
```

## 参考

* [use-async-effect]
* [react-is-mounted-hook]

### 为什么不用 [use-async-effect]

[use-async-effect] 仅适用于 effect，且每个 effect 都会去创建对应的逻辑。这是我之前的选择，但当我期望创建一个事件处理函数，在事件处理函数中做异步操作的时候就发现完全不行。

### 为什么不用 [react-is-mounted-hook]

嗯，我一开始是用它，版本 `1.0.3`，但它连最基本的 `useCallback` 都没用，而且它的例子中 `useEffect` 的 `deps` 并没有把 `isMounted` 列入，而我在写代码的时候列入了，结果陷入了死循环。
虽然它有个 [PR](https://github.com/hupe1980/react-is-mounted-hook/pull/1) 在进行中，就是修复这个问题的，不过我等不了了。

### 为什么偏偏叫 isUnmounted 而不是 isMounted

个人觉得是这个 `hook` 着重点是判断组件被「卸载」，所以.. 而且这样有助于编写符合简单条件优先 `return` 原则的代码（如以上的例子）。

[use-async-effect]: https://www.npmjs.com/package/use-async-effect
[react-is-mounted-hook]: https://www.npmjs.com/package/react-is-mounted-hook
npm package: @kcuf/react-router-link-hijacker
Description: A much easier way to navigate around in react-router app.
Author: Jianchun Wang
Latest version: 0.2.1

# @kcuf/react-router-link-hijacker

## Why

[react-router](https://reactrouter.com) 提供了多种 [navigate](https://reactrouter.com/start/library/navigating) 的方案：

* `<Link>`
* `<NavLink>`
* `useNavigate`

然都不是很便利。

我们通常会使用封装的可接收 `href` 的 `Button` 或其他类似组件作为有样式的链接载体，或者在某些场景下，不便使用 `react-router`，比如封装可复用组件，需要避免依赖 `react-router`。 这么做的后果就是丢失了路由特性，变成了点击后直接刷新整个页面，造成了不好的用户体验。

如果使用 `react-router` 提供的组件，又需要适配样式，没有合适的方案的时候，在适配按钮的时候会比较麻烦，写过 `Button` 组件的都知道，小小基础组件，门道很多，开发体验会很差。

于是，很多时候就会用 `useNavigate`，多数人的做法直接使用非链接 DOM，这样会造成用户无法预知点击的后果，但若用链接，又需要阻止链接的默认行为，还要考虑不能忽略传入的 `onClick`，且写一处类似的功能加一处，开发体验仍然不好。

`useNavigate` 的另一个问题是不会判断当前路由，同一个链接点击多次，会在浏览器历史中添加多个重复项，导致退到真正的「上一个」路由，也要多次。

为了兼顾开发体验和用户体验，你需要这个组件。

## How to Use

### 引入组件

> 注意：全局只使用一次该组件。

```tsx
import ReactRouterClickHijacker from '@kcuf/react-router-link-hijacker';

// 在应用的 Router 顶层加上，that easy
<ReactRouterClickHijacker />
```

### 修改已有代码

* 清理使用 `<Link>`、`<NavLink>`，用纯 `a` 或其他组件
* 清理使用 `useNavigate` 的点击事件，并修改对应的 DOM，转换为链接

## FAQ

## ❓ 不期望被当成路由链接怎么办？

默认情况下，用户按住 `Meta` 键点击（Win `Ctrl`、Mac `Cmd`），并且以下链接不会被当成路由：

1. 外链
2. 带 `target` 属性（不论值）
3. 带 `download` 属性（下载链接）
4. 带 `data-route-not` 属性

以上情况，链接的行为如同原生。

## ❓ 如何 `replace` 而非 `push`？

加上 `data-route-replace` 属性。

## ❓ `NavLink` 的 `active` 状态怎么搞？

如果你用了 `NavLink`，且依赖其 `.active` 做样式，可以使用 `matchPath`。

```ts
const {
  pathname
} = useLocation();

const active = !!matchPath(SOME_PATH, pathname);
```
npm package: @kcuf/sandbox-escape
Description: Sandbox escape to get the real stuff.
Author: Jianchun Wang
Latest version: 0.0.1

# @kcuf/sandbox-escape

沙箱逃逸，凡需用的真正的 `window`、`document` 等全局对象，尽量通过此包获取，以期获得最佳的跨沙箱能力。
npm package: @kcuf/sls-logger-base
Description: Aliyun SLS logger without transport implementation.
Author: Jianchun Wang
Latest version: 0.0.5

# @kcuf/sls-logger-base

阿里云 SLS WebTracking 基础实现，将最终发送消息的方法抽象出去，使其能够很方便地应用于 Web、小程序、Node 等具体环境。

## Features

* ⏱️ 默认 5s 的静默时间，让行应用初始化期间的业务请求，提升业务性能
* 🗳️ 利用 POST 批量提交日志，避免同一时间内大量的网络请求
* 📌 支持设定 TOPIC 前缀
* 🧽 支持采样率
* 🎈 支持自定义忽略策略（可用于避免不合法的日志上报等）

## APIs

* `createLogger(sender: LogSender, options: CreateLoggerOptions): SlsLogger` 生成 sls 方法的工厂方法，该方法挂载 6 个快速方法
* `generateCreateLogger(sender: LogSender, options: GenerateCreateLoggerOptions): CreateLogger` 生成上边的方法的工厂方法

## 如何使用

业务代码不会直接用到这个包，因为它不会真正发送日志，只有设定 `sender(topic, body, headers)` 才行，可以用以下封入 `sender` 的包：

* Web 端：`@kcuf/sls-logger-web`
* Node 端：`@kcuf/sls-logger-node` TODO
* 小程序 端：`@kcuf/sls-logger-mp` TODO

业务代码最终使用的是 `createLogger` 的产物，即 `sls` 方法，你可以这样调用：

```ts
sls(topic);
sls(topic, payload);
sls(options, topic);
sls(options, topic, payload);
```

以上，`options` 可用于覆盖创建 `sls` 的时候的 `prefix`、`sampling` 等工厂默认的参数，也可以立即发送日志，默认所有的日志会在一定的时间内积压，以避免和业务逻辑竞争。

## 记录的数据

这是一个基础的库，不具有平台性或业务性，因此除了最基础的日志信息之外，不记录任何数据，以下是日志中的默认数据：

* `_TOPIC`：虽然有 `__topic__`，但这个值可能被系统篡改，因此会冗余一个 `_TOPIC`
* `_GROUP`：可用于对日志进行分类，取值 `DEBUG LOG INFO WARN ERROR FATAL`，默认 `LOG`（有需要可以自定义）

## FAQ

### 为什么调用 `sls(..)` 后要等一段时间才见发送日志？

1. 为了让行业务请求，加载完成后会有默认 5s 的静默时间，这段时间内，不会发送请求
2. 每条日志都不会立即发送，而是进入一个队列，并刷新等待时间（默认 200ms），等到空闲的时候才进行批量发送

### 有的日志很重要，不想因为静默时间或等待时间漏掉，需要立即上报，怎么办？

利用 `instant` 参数：

```ts
sls({
  instant: true
}, topic, payload);
```

### 不想全量，如何进行采样上报？

两个方式：

1. 在 `createLogger` 的时候设置采样率，这样它生的 `sls` 将全部采样
2. 调用 `sls` 的时候传入采样率，这样只会针对这一次调用进行采样

## 参考

* [Web Tracking](https://help.aliyun.com/document_detail/31752.html)
* [POST 发送日志参考文档](https://help.aliyun.com/document_detail/2771303.html)
npm package: @kcuf/sls-logger-web
Description: Aliyun SLS logger with fetch, can be used for web.
Author: Jianchun Wang
Latest version: 0.1.0

# @kcuf/sls-logger-web

基于 `@kcuf/sls-logger-base` 封装的 SLS 工厂方法包。

## Features

* 🚜 利用 `fetch` 发送日志，2000ms 的超时设定，静默失败
* ⏱️ 默认 5s 的静默时间，让行应用初始化期间的业务请求，提升业务性能
* 🗳️ 利用 POST 批量提交日志，避免同一时间内大量的网络请求
* 📌 支持设定 TOPIC 前缀
* 🧽 支持采样率
* 🎈 支持自定义忽略策略（可用于避免不合法的日志上报等）

## APIs

* `createLogger(options: CreateLoggerOptions): SlsLogger` 生成 sls 方法的工厂方法，该方法挂载 6 个快速方法
* `generateCreateLogger(options: GenerateCreateLoggerOptions): CreateLogger` 生成上边的方法的工厂方法

## 如何使用

业务代码使用 `createLogger` 的产物，即 `sls` 方法，你可以这样调用：

```ts
sls(topic);
sls(topic, payload);
sls(options, topic);
sls(options, topic, payload);
```

以上，`options` 可用于覆盖创建 `sls` 的时候的 `topicPrefix`、`sampling` 等工厂默认的参数，也可以立即发送日志，默认所有的日志会在一定的时间内积压，以避免和业务逻辑竞争。

更多内容见 `@kcuf/sls-logger-base` 的说明。

## 记录的数据

由于这是一个工厂包，不参与业务，因此不会增加记录的参数，可以在业务封装中使用 `defaultParams` 并入业务需要的基础数据，比如浏览器信息等：

```ts
export default createLogger({
  defaultParams() {
    return {
      // 基础参数最佳实践，推荐全大写
      UA: navigator.userAgent
    };
  }
});
```

## FAQ

### 为什么调用 `sls(..)` 后要等一段时间才见发送日志？

1. 为了让行业务请求，加载完成后会有默认 5s 的静默时间，这段时间内，不会发送请求
2. 每条日志都不会立即发送，而是进入一个队列，并刷新等待时间（默认 200ms），等到空闲的时候才进行批量发送

## 有的日志很重要，不想因为静默时间或等待时间漏掉，需要立即上报，怎么办？

利用 `instant` 参数：

```ts
sls({
  instant: true
}, topic, payload);
```

### 不想全量，如何进行采样上报？

#### 全量采样

在 `createLogger` 的时候设置采样率，这样它生的 `sls` 将全量采样：

```ts
export default createLogger({
  sampling: 0.6 // 全量日志默认 60% 的采样率
});
```

#### 单个采样

调用 `sls` 的时候传入采样率，这样只会针对这一次调用进行采样：

```ts
sls({
  sampling: 0.3 // 该日志 30% 采样率，覆盖全量采样率
}, topic, payload);
```

## 单测

这里的测试比较简单，更详细的测试在 `@kcuf/sls-logger-base`，100% 的覆盖率。
npm package: @kcuf/storage-factory
Description: A type safe storage factory utility.
Author: Jianchun Wang
Latest version: 0.2.1

# @kcuf/storage-factory

## Why

一般具体的业务对 storage 的态度是：只有一个，且类型明确。

## APIs

这是一个工厂方法，生产一个方法：

```ts
import storageFactory from '@kcuf/storage-factory';

interface IAccount {
  id: string;
  name: string;
  loggedTime: number;
}

const DEFAULT: IAccount = {
  id: '',
  name: '',
  loggedTime: -1
};

export default storageFactory<ISomeType>(SOME_KEY_CONST, DEFAULT); // 第三个参数可选，传 `true` 使用 `sessionStorage`
```

生产出的 `storage` 方法和给定的泛型 `T` 有关，因此你不会再写错：

```ts
import storage from 'your specific module or package'; // 假设你定义了一个模块或者写了一个包

storage(); // 返回 ISomeType

const {
  id
} = storage();

storage.update('id', '123');
storage.update({
  'id': '123',
  loggedTime: Date.now()
});

storage.update('id', 123); // 💥 值类型错误
storage.update('ID', '123'); // 💥 key 错误
storage.update({
  'id': 123, // 💥 值类型错误,
  loggedTIME: Date.now() // 💥 key 错误
});
```

你甚至可以对相同的 KEY 生成针对不同类型的方法，在保证类型不重叠的情况下，两者不会相互干扰。
npm package: @kcuf/stylelint-config
Description: Shareable stylelint config.
Author: Jianchun Wang
Latest version: 0.3.0

# @kcuf/stylelint-config

> The Kcuf shareable stylelint config.

* <https://stylelint.io/awesome-stylelint>

## 安装

```bash
pnpm add -D stylelint @kcuf/stylelint-config
```

## React 项目配置

`.stylelintrc` 内容:

```json
{
  "extends": "@kcuf/stylelint-config"
}
```

此配置适用于使用了 styled-components 或 emotion 的 React 项目（JS 或 TS）。

注意，如果项目还用了 Less/Sass，可以这么这样：

```json
{
  "extends": [
    "@kcuf/stylelint-config",
    "@kcuf/stylelint-config/config-less",
    "@kcuf/stylelint-config/config-scss"
  ]
}
```

之所以不在 `@kcuf/stylelint-config` 默认加上 Less/Sass，是希望项目的样式解决方案更纯粹一些。

## Vue 项目配置

`.stylelintrc` 内容（`index-vue` 默认带了 `config-scss`）:

```json
{
  "extends": "@kcuf/stylelint-config/index-vue"
}
```

## 使用

### Terminal

在 Terminal 下进行测试，查看效果：

```bash
npx stylelint ./path/to/some-css.css
npx stylelint ./path/to/some-less.less
```

### npm-scripts

添加 NPM Script：

```bash
npm pkg set scripts.lint:style="stylelint \"**/src/**/*.{css,less}\""
```

## 集成 `lint-staged`

在 `.lintstagedrc` 中添加，可视情况增减文件后缀：

```json
{
  "*.{css,less,ts,tsx}": "stylelint"
}
```
npm package: @kcuf/subscribable
Description: A subscribable class with generic.
Author: Jianchun Wang
Latest version: 0.1.2

# @kcuf/subscribable

> A fully typed sub-pub class.

## How to Use

1. Use as Object
2. Use as class Base

### Use as Object

```ts
const subscribable = new Subscribable<TNamedCallbacks>();

subscribable.on(...);

subscribable.emit(...);
```

### Use as class Base

```ts
class MyClass extends Subscribable<TNamedCallbacks> {
  fn() {
    this.emit(...);
  }
}

const myClass = new MyClass();

myClass.on(...);

myClass.offAll();
```

## APIs

### Generic

When using TS, you can reinforce the topic and callback relationship by providing `Subscribable` a generic type.

```ts
Subscribable<TNamedCallbacks>
```

> Just remember to use `type` instead of `interface`, or TS will complain about not satisfying constraints.

### `on`

Subscribe to a topic.

```ts
subscribable.on({...});

subscribable.on('topic', callback);
```

### `off`

NOT provided, use the return non-arguments function to unsubscribe. For example, in a React `useEffect`:

```ts
import {
  useEffect
} from 'react';

export default useEffectSubscribe(): void {
  ...
    
  useEffect(() => {
    return subscribable.on(...); // return off function `() => void`
  }, [...]);
}
```

### `offAll`

Useful when you want to do some cleanups before destroy the subscribable.

```ts
subscribable.offAll();
```

## Example

> The example uses `Subscribable` as an object, it is quite similar using it as base class.

```ts
interface IData {
  id: string;
  value: number;
}

type TNamedCallbacks = { // Use type instead of interface
  'login': (username: string) => void;
  'logout': (username: string) => void;
  'data-update': (data: IData) => void;
};

const subscribable = new Subscribable<TNamedCallbacks>();

// Works 👍
subscribable.on('login', (username: string): void => {
  console.info(username); // eslint-disable-line no-console
});

// Not work 💥 - arguments wrong
subscribable.on('login', (username: string, age: number): void => {
  console.info(username, age); // eslint-disable-line no-console
});

// Not work 💥 - topic wrong
subscribable.on('logon', (username: string): void => {
  console.info(username); // eslint-disable-line no-console
});

// Works 👍 - in batch mode
subscribable.on({
  login(username: string): void {
    console.info(username); // eslint-disable-line no-console
  },
  'data-update': (data: IData) => {
    console.info(data); // eslint-disable-line no-console
  }
});

// Works 👍
subscribable.emit('login', 'John Doe');
subscribable.emit('data-update', {
  id: '123',
  value: 42
});

// Not work 💥
subscribable.emit('logon', 'John Doe');
subscribable.emit('login', 'John Doe', 12);
subscribable.emit('data-update', {
  id: '123',
  value: true
});
```
npm package: @kcuf/ts-config
Description: Shareable tsconfig.
Author: Jianchun Wang
Latest version: 0.2.0

# @kcuf/ts-config

Shareable tsconfig for package development.

## Install

```bash
pnpm add -D @kcuf/ts-config
```

## Usage

In your `tsconfig.json`:

```json
{
  "extends": "@kcuf/ts-config/index.json",
  "include": [
    "src"
  ]
}
```

NOTE: `include/exclude/files` should always be set, see <https://www.typescriptlang.org/tsconfig#extends>.
npm package: @kcz/k-demo
Description: demo
Author: kcz
Latest version: 0.2.0

# template

## Project setup
```
yarn install
```

### Compiles and hot-reloads for development
```
yarn serve
```

### Compiles and minifies for production
```
yarn build
```

### Lints and fixes files
```
yarn lint
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
npm package: @kd-gen/request-provider
Description: @kd-gen/request-provider
Latest version: 1.0.0

# @kd-gen/request-provider

> @kd-gen/request-provider.

## Install

Using npm:

```bash
$ npm install --save @kd-gen/request-provider
```

or using yarn:

```bash
$ yarn add @kd-gen/request-provider
```
npm package: @kd-gen/table-render
Description: @kd-render/table
Latest version: 1.0.0

# @kd-gen-render/table

> @kd-gen-render/table.

## Install

Using npm:

```bash
$ npm install --save @kd-gen-render/table
```

or using yarn:

```bash
$ yarn add @kd-gen-render/table
```
npm package: @kd3n1z/rabbitmq-rpc
Description: Amqplib RPC wrapper
Author: Denis Komarkov
Latest version: 1.0.0

# rabbitmq-rpc

Amqplib RPC wrapper.

## Usage

Here's an example of how to use the RPC Server:

```js
import { createRPCServer } from './rabbitmq-rpc';

function fibonacci(n) {
    if (n == 0 || n == 1) {
        return n;
    } else {
        return fibonacci(n - 1) + fibonacci(n - 2);
    }
}

async function main() {
    const rpcServer = await createRPCServer('localhost:5672', 'rpc_queue', {
        logMessages: true,
        logErrors: true,
    });

    rpcServer.setHandler('fibonacci', fibonacci);

    rpcServer.start();
}

main();
```

Here's an example of how to use the RPC Client:

```js
import { createRPCClient } from './rabbitmq-rpc';

async function main() {
    const rpcClient = await createRPCClient('localhost:5672', 'rpc_queue', {
        logMessages: true,
        logErrors: true,
    });

    console.log(await rpcClient.call('fibonacci', 100));

    // OR

    const fibonacci = rpcClient.getFunction('fibonacci');

    console.log(await fibonacci(100));
}

main();
```

## License

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
npm package: @kdanmobile/kdan-ui
Description: React library library of foundational and advanced components by Kdan web design system
Author: Kdanmobile
Latest version: 1.4.2

<p align="center">
  <img src="https://www.kdanmobile.com/images/menu/kdanlogo_02.svg" height="100" alt="rts" />

<p align="center">
  <img src="https://uploaddeimagens.com.br/images/002/705/273/full/rts.png?1592061852" height="100" alt="rts" />

# Kdan UI Kit

[online preview](https://www.chromatic.com/builds?appId=5ffed3d9e0d3f0002185cee9)

---

## About

Kdan mobile UI Storybook with ReactJS and TypeScript.

凱鈿 UI Kit 目前適用於，官網、商城兩個平台。內容包含了 Web design system，UI component。這套系統不會是一成不變得，元件樣式和設計系統會依照公司成長和主流風格改變不斷的迭代下去。

---

## Installation

```bash
npm install @kdanmobile/kdan-ui styled-components
or
yarn add @kdanmobile/kdan-ui styled-components
```

---

## Quick Start

Watch

```bash
yarn storybook
```

Build

```bash
yarn build
```

Test

```bash
yarn test
```

---

## How to use

### import font style

in pages/\_app.js

```js
<!-- import fonts css -->
import '@kdanmobile/kdan-ui/dist/fonts/clear-sans.css';
```

### import component

```js
<!-- Normal -->
import { Example } from '@kdanmobile/kdan-ui';
```

```js
<!-- Code splitting -->
import Example from '@kdanmobile/kdan-ui/dist/Example';
```

### Override the component style

Because of the special needs of the project, we need to cover the component style.

---

## Deployment

Uses Chromatic, a free publishing service made by the Storybook maintainers. It allows us to deploy and host our Storybook safely and securely in the cloud.

Now that our project is hosted in a GitHub repository, we can use a continuous integration(CI) service to deploy our Storybook automatically.

```bash
git add .
```

```bash
git commit -m "GitHub action setup"
```

```bash
git push origin master
```

Once you’ve set up the GitHub action. Your Storybook will be deployed to Chromatic whenever you push code.

---

## Design System

- Typography
- Spacing
- Color
- Breakpoint

## UI Components

- Avatar
- Button
- Card
- Carousel
- Checkbox
- Collapse
- Dropdown
- Logo
- Navbar
- Select
- Tabs
- Textfield
- Typography

## Utils

- ClickAwayListener
- Portal
- Box
npm package: @kdaquila/free-test
Description: Free Test is a typescript testing library that offers maximum flexibility for those wishing to build their own custom testing system.
Author: kfd182@gmail.com
Latest version: 0.1.9

## Overview

Free-Test is a Typescript testing library that offers maximum flexibility for those wishing to build their own custom testing system for Typescript.

Want to customize the way test results are printed? No problem.

Want to customize the way tests are loaded? Go ahead!

Out-of-the-box, Free-Test provides building blocks for the following:

- Dynamically loading tests
- Running tests
- Printing the test results to the console

It also provides a `SimplePipelineRunner` which can run tests out-of-the-box with all the default building blocks.

## Library Design

#### Dependency Injection

The library uses the constructor dependency injection pattern. So you can start of using the `SimplePipelineRunner` class, but then customize it by passing different loaders, runners, or printers to its constructor.

#### Javascript Engine

Free-Test gives you complete freedom to run tests using your preferred Javascript engine, like node.js, ts-node, tsx, etc. No global namespace pollution issues or tricky engine configuation issues to worry about.

#### API-only

Free-Test is intentionally API-only, so there are no CLI commands. It's recommended to simply call your top-level test script using `npm run test`

### Getting Started Example

1. Setup a typescript project

   ```
   > npm init -y
   > npm install typescript tsx
   > npm install free-test
   ```

1. Write a minimal, top-level script using `buildDefaultPipeline()`

   ```
   // runTests.ts

   const pipeline = buildDefaultPipeline("./tests/**/*.test.ts")

   pipeline.run();
   ```

1. Write a test using `TestGroup` type

   ```
   // tests/simpleTest.test.ts

   import { expect } from "chai";
   import { TestGroup } from "@kdaquila/free-test";

   export const simpleTestGroup: TestGroup = {
      name: "Simple Test Group",
      tests: [{
         name: "Simple Test",
         test: () => {
            const a = 1;
            expect(a).to.equal(1);
         },
   }]};
   ```

1. Run the script with your preferred Javascript engine (node.js, ts-node, tsx, etc.). For example,

   ```
   > npx tsx runtests.ts
   ```

1. Update `package.json` so you run tests with `npm run test`. For example:

   ```
   // package.json

   "scripts": {
   "test": "tsx runTests.ts"
   },
   ```
npm package: @kdbvier119/pan-sdk
Description: 🛠 An SDK for building applications on top of Pancakeswap.
Author: kdbvier
Latest version: 1.0.0


> **Notice**
>
> Moved to https://github.com/pancakeswap/pancake-frontend/tree/develop/packages/swap-sdk

# Pancakeswap SDK

Forked from the [Uniswap SDK](https://github.com/Uniswap/uniswap-v2-sdk/commit/a88048e9c4198a5bdaea00883ca00c8c8e582605).

You can refer to the Uniswap SDK documentation [uniswap.org](https://docs.uniswap.org/sdk/2.0.0/).

## Running tests

To run the tests, follow these steps. You must have at least node v10 and [yarn](https://yarnpkg.com/) installed.

First clone the repository:

```sh
git clone https://github.com/pancakeswap/pancake-swap-sdk.git
```

Move into the pancakeswap-sdk working directory

```sh
cd pancakeswap-sdk/
```

Install dependencies

```sh
yarn install
```

Run tests

```sh
yarn test
```

You should see output like the following:

```sh
yarn run v1.22.4
$ tsdx test
 PASS  test/constants.test.ts
 PASS  test/pair.test.ts
 PASS  test/fraction.test.ts
 PASS  test/miscellaneous.test.ts
 PASS  test/entities.test.ts
 PASS  test/trade.test.ts

Test Suites: 1 skipped, 6 passed, 6 of 7 total
Tests:       3 skipped, 82 passed, 85 total
Snapshots:   0 total
Time:        5.091s
Ran all test suites.
✨  Done in 6.61s.
```
npm package: @kdbx/envmcp
Description: A lightweight way to use environment variables in your Cursor MCP server definitions.
Author: Ben Griffiths
Latest version: 0.2.3

# envmcp
[![npm version](https://img.shields.io/npm/v/envmcp.svg)](https://www.npmjs.com/package/envmcp)
[![total downloads](https://img.shields.io/npm/dt/envmcp.svg)](https://www.npmjs.com/package/envmcp)

Use environment variables in your Cursor MCP server definitions.

> **💡 Looking for more features?** Consider [mcpipe](https://github.com/griffithsbs/mcpipe) ([npm](https://www.npmjs.com/package/mcpipe)) which includes envmcp's functionality as well as debugging tools and other capabilities.

## Quick Start

```bash
# Use default ~/.env.mcp file
npx envmcp your-mcp-server $DATABASE_URL

# Specify custom env file
npx envmcp --env-file .env your-mcp-server $API_KEY $DATABASE_URL

# Short flag version
npx envmcp -e /path/to/secrets.env your-mcp-server $MY_SECRET
```

## Usage in MCP Clients

Prefix your server command with envmcp.

_Before (secrets exposed in config)_: 
```json
{
  "my_database": {
    "command": "my-mcp-server",
    "args": ["postgresql://user:password@hostname/db"]
  }
}
```
_After (secrets in ~/.env.mcp)_:
```json
{
  "my_database": {
    "command": "npx",
    "args": ["envmcp", "my-mcp-server", "$DATABASE_URL"]
  }
}
```

## How It Works

1. Looks for `.env.mcp` in current directory, then parent directories, finally `~/.env.mcp`
2. If `--env-file` is specified, uses that file instead
3. Loads environment variables from the file
4. Replaces `$VARIABLE_NAME` references in your command arguments
5. Executes the command with substituted values

## Installation

```bash
npm install -g envmcp
```

## Options

- `--env-file <path>`, `-e <path>`: Specify custom environment file path

## Environment File Format

```
DATABASE_URL=postgresql://user:password@localhost/db
API_KEY=your-secret-api-key
# This is a comment
QUOTED_VALUE="value with spaces"
```

See `sample.env.mcp` for more examples.

## License

MIT