open-index/open-npm huggingface dataset:
npm package: @nlib/changelog
Description: A command to generate CHANGELOG.md from commit history
Author: Kei Ito
Latest version: 0.3.2

# @nlib/changelog

A command to generate CHANGELOG.md from commit history.

[![Test](https://github.com/nlibjs/changelog/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/changelog/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/nlibjs/changelog/branch/master/graph/badge.svg)](https://codecov.io/gh/nlibjs/changelog)

## Install

```
npm install --save-dev @nlib/changelog
```

## Usage

Add the [npm-version](https://docs.npmjs.com/cli/commands/npm-version) scripts to your package.json.

```json
{
  "scripts": {
    "version": "npx @nlib/changelog --output CHANGELOG.md && git add CHANGELOG.md"
  }
}
```
npm package: @nlib/cleanup-package-json
Description: [![Test](https://github.com/nlibjs/cleanup-package-json/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/cleanup-package-json/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/nlibjs/cleanup-package-json/branch/main/graph/badge
Author: Kei Ito
Latest version: 0.3.2

# cleanup-package-json

[![Test](https://github.com/nlibjs/cleanup-package-json/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/cleanup-package-json/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/nlibjs/cleanup-package-json/branch/main/graph/badge.svg?token=YJG86MybgN)](https://codecov.io/gh/nlibjs/cleanup-package-json)

A command line tool to cleanup package.json before publish. It will keep the fields listed in the [documentation](https://docs.npmjs.com/configuring-npm/package-json.html) and remove the rest.

## Usage

```
npx @nlib/cleanup-package-json --file package.json
```

## LICENSE

The cleanup-package-json project is licensed under the terms of the Apache 2.0 License.
npm package: @nlib/eslint-config
Description: [![Test](https://github.com/nlibjs/eslint-config/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/eslint-config/actions/workflows/test.yml)
Author: Kei Ito
Latest version: 3.20.5

# @nlib/eslint-config

[![Test](https://github.com/nlibjs/eslint-config/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/eslint-config/actions/workflows/test.yml)

## Installation and Usage

```
npm install --save-dev @nlib/eslint-config
```

You should then add `@nlib/eslint-config` to the `extends` property.

```json
{
  "extends": ["@nlib/eslint-config"]
}
```
npm package: @nlib/eslint-plugin
Description: [![Test](https://github.com/nlibjs/eslint-plugin/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/eslint-plugin/actions/workflows/test.yml)
Author: Kei Ito
Latest version: 1.1.2

# @nlib/eslint-plugin

[![Test](https://github.com/nlibjs/eslint-plugin/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/eslint-plugin/actions/workflows/test.yml)

## Installation and Usage

See https://github.com/nlibjs/eslint-config .
npm package: @nlib/esmify
Description: [![Test](https://github.com/nlibjs/esmify/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/esmify/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/nlibjs/esmify/branch/master/graph/badge.svg)](https://codecov.io/gh/nlibjs/esmi
Author: Kei Ito
Latest version: 0.3.3

# @nlib/esmify

[![Test](https://github.com/nlibjs/esmify/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/esmify/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/nlibjs/esmify/branch/master/graph/badge.svg)](https://codecov.io/gh/nlibjs/esmify)

A command line tool converts tsc output to ESM modules.

## What does it do?

Assume you have file1.js and file2.js.

```javascript
// file1.js
import {v2} from './file2';
const f2 = import('./file2');

// file2.js
import {external} from '../extenal/file';
import {v1} from './file1';
const f1 = import('./file1');
```

esmify disambiguates import sources in the code.

```javascript
// file1.js
import {v2} from './file2.js';
const f2 = import('./file2.js');

// file2.js
import {external} from '../extenal/file.js';
import {v1} from './file1.js';
const f1 = import('./file1.js');
```

## Usage

```
Usage: @nlib/esmify [options] <patterns...>

Arguments:
  patterns         File patterns passed to fast-glob

Options:
  --cwd <cwd>      A path to the directory passed to fast-glob.
  --keepSourceMap  If it exists, esmify won't remove sourcemaps.
  --noMjs          If it exists, esmify won't change *.js to *.mjs.
  -V, --version    output the version number
  -h, --help       display help for command
```
npm package: @nlib/githooks
Description: A command to enable/disable git hooks scripts in `repository/.githooks`.
Author: Kei Ito
Latest version: 0.2.2

# @nlib/githooks

A command to enable/disable git hooks scripts in `repository/.githooks`.

[![Test](https://github.com/nlibjs/githooks/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/githooks/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/nlibjs/githooks/branch/master/graph/badge.svg)](https://codecov.io/gh/nlibjs/githooks)

## Usage

Install `@nlib/githooks` with `--save-dev` flag.

```
npm install --save-dev @nlib/githooks
```

That's all. If `@nlib/githooks` is installed as the direct devDependency
(listed in the package.json), it configures git hooks automatically.

Then, your scripts in `.githooks` are now recognized by git.

*Note: Don't forget to run `chmod +x .githooks/your-script`.*

## How it works

This package sets the `core.hooksPath` configuration to `.githooks`:

```sh
git config --local core.hooksPath .githooks
```

> Q. Why do I need this package?
> Can't I just add `git config --local core.hooksPath .githooks` to the
> `postinstall` script in `package.json`?

A. You could do that. However, if you're the author of a package, the
`postinstall` script would also run for anyone who installs your package.
This means your `git hooks` configuration would be applied to their repository
as well, which may not be what you want.
By using this package as a devDependency, you ensure that the configuration is
applied only in your own project and not propagated to others who install your
package.

## Uninstalling

`<0.1.x` reverts the installation on uninstalling of this package. But [uninstall lifecycle scripts were removed](https://docs.npmjs.com/cli/v7/using-npm/scripts#a-note-on-a-lack-of-npm-uninstall-scripts) in npm@7, `>0.1.x` do nothing on uninstalling of this package.

If you want to revert the configuration, please follow the steps below.

1. Run `git config --local --unset core.hooksPath`
2. Delete the `.githooks`
npm package: @nlib/indexen
Description: [![Test](https://github.com/nlibjs/indexen/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/indexen/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/nlibjs/indexen/branch/master/graph/badge.svg)](https://codecov.io/gh/nlibjs/i
Author: Kei Ito
Latest version: 0.2.9

# @nlib/indexen

[![Test](https://github.com/nlibjs/indexen/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/indexen/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/nlibjs/indexen/branch/master/graph/badge.svg)](https://codecov.io/gh/nlibjs/indexen)

A command line tool to generate index files.

## Usage

```
Usage: npx @nlib/indexen [options] <patterns...>

Arguments:
  patterns                     Patterns of files to be included. It will be passed to fast-glob.

Options:
  -o, --output <path>          A path where the result is written to.
  -e, --exclude <patterns...>  Patterns of files to be excluded. It will be passed to fast-glob.
  --noext                      It true, the output will be [export * from "./a"] not [export * from
                               "./a.js"].
  -V, --version                output the version number
  -h, --help                   display help for command
```

Assume you have files below:

```
src/file1.ts
src/file1.test.ts
src/file2.ts
src/dir1/file3.ts
src/dir1/file4.ts
src/dir2/file5.ts
src/file6.private.ts
```

Then execute `@nlib/indexen`:

```
npx @nlib/indexen --output src/index.ts "src/**"
```

`@nlib/indexen` generates `src/index.ts`:

```typescript
// Generated by @nlib/indexen
export * from 'src/file1.ts';
export * from 'src/file2.ts';
export * from 'src/dir1/file3.ts';
export * from 'src/dir1/file4.ts';
export * from 'src/dir2/file5.ts';
```
npm package: @nlib/lint-commit
Description: [![Test](https://github.com/nlibjs/lint-commit/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/lint-commit/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/nlibjs/lint-commit/branch/master/graph/badge.svg)](https://codecov.io
Author: Kei Ito
Latest version: 1.0.1

# @nlib/lint-commit

[![Test](https://github.com/nlibjs/lint-commit/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/lint-commit/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/nlibjs/lint-commit/branch/master/graph/badge.svg)](https://codecov.io/gh/nlibjs/lint-commit)

Lint your commit messages.

## Message Format

```
CommitMessage = Type ["(" Scope ")"] ": " Subject [EOL Body]
Type          = DefaultTypes (or your configuration)
DefaultTypes  = "build" | "chore" | "ci" | "docs" | "feat" | "fix" | "perf" |
                "refactor" | "revert" | "style" | "test" | "deps" | "breaking"
Scope         = DefaultScope (or your configuration)
DefaultScope  = /^[\w-]+$/
Subject       = /^\S[^\r\n]*$/ (or your configuration)
EOL           = /\r\n|\r|\n/
Body          = <Arbitrary string>
```

## Usage

Then, set `@nlib/lint-commit` to `commit-msg` hook.

```sh
#!/bin/sh
npx @nlib/lint-commit --input $1
```

[husky]: https://www.npmjs.com/package/husky
npm package: @nlib/negotiate
Description: [![.github/workflows/test.yml](https://github.com/nlibjs/negotiate/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/negotiate/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/nlibjs/negotiate/branch/master/graph/badge.svg)](ht
Author: Kei Ito
Latest version: 0.1.4

# @nlib/negotiate

[![.github/workflows/test.yml](https://github.com/nlibjs/negotiate/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/negotiate/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/nlibjs/negotiate/branch/master/graph/badge.svg)](https://codecov.io/gh/nlibjs/negotiate)

Utilities for content negotiation described in [Section 5.3 of RFC 7231].

[Section 5.3 of RFC 7231]: https://www.rfc-editor.org/rfc/rfc7231.html#section-5.3

## negotiate

```typescript
const supported = ['text/html', 'image/webp'];
const accept = 'text/html,image/avif,image/webp,image/apng,*/*;q=0.8';
negotiate(supported, accept); // → 'text/html'
negotiate([], accept); // → null
```

## parseAcceptStatements

```typescript
const generator = parseAcceptStatements('v1,v2;q=0.9,v3;q=0.8')
generator.next().value; // → {value: 'v1', q: 1}
generator.next().value; // → {value: 'v2', q: 0.9}
generator.next().value; // → {value: 'v3', q: 0.8}
generator.next(); // → {value: undefined, done: true}
```

## parseNegotiationItem

```typescript
parseNegotiationItem('text/html;charset=utf-8;foo=1')
// → {value: 'text/html', parameters: {charset: 'utf-8', foo: '1'}}
```
npm package: @nlib/tsm
Description: Thin .ts/.mts loader & test runner
Author: Kei Ito
Latest version: 1.1.0

# @nlib/tsm

Thin .mts loader and test runner

[![.github/workflows/test.yml](https://github.com/nlibjs/tsm/actions/workflows/test.yml/badge.svg)](https://github.com/nlibjs/tsm/actions/workflows/test.yml)
[![codecov](https://codecov.io/gh/nlibjs/tsm/graph/badge.svg?token=5fr51K5wli)](https://codecov.io/gh/nlibjs/tsm)

## Install

```
npm install @nlib/tsm
```

## Usage: Run \*.ts/\*.mts file

```
node --import=@nlib/tsm path/to/your/script.mts
```

`@nlib/tsm` exports `register.mjs` which [registers](https://nodejs.org/api/module.html#moduleregisterspecifier-parenturl-options) `loader.mjs`. `loader.mjs` is a [loader](https://nodejs.org/api/esm.html#loaders) to customize the default module resolution. It exports the [`load`](https://nodejs.org/api/esm.html#loadurl-context-nextload) function that loads modules with [esbuild](https://esbuild.github.io/).

## Usage: Run test files

Node.js added the stable [`node:test`](https://nodejs.org/api/test.html) in v20. We can run tests with `node --test`. It searches for test files when a directory is specified as arguments. But it doesn't search for `*.mts` (even with the `--experimental-loader` option). So, you must pass the files one by one to run it.

The `tsm-test` will search for the test files for you and pass them to `node --test`.

```sh
npx tsm-test src
```