# @vrn-deco/boilerplate-preset-npm

> boilerplate preset npm package installer

Latest version **1.1.5** (published 2024-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vrn-deco/boilerplate-preset-npm
pnpm add @vrn-deco/boilerplate-preset-npm
yarn add @vrn-deco/boilerplate-preset-npm
bun add @vrn-deco/boilerplate-preset-npm
```

Provides the command `boilerplate-preset-npm`.

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.5 |
| Published | 2024-03-19 |
| First published | 2022-02-10 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 5 |
| Unpacked size | 7.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Author | Cphayim |
| Maintainers | cphayim |

## Links

- npm: https://www.npmjs.com/package/@vrn-deco/boilerplate-preset-npm
- Repository: https://github.com/vrn-deco/boilerplate
- Homepage: https://github.com/vrn-deco/boilerplate#readme
- Issues: https://github.com/vrn-deco/boilerplate/issues
- npm.io page: https://npm.io/package/@vrn-deco/boilerplate-preset-npm

## Dependencies (5)

- [execa](https://npm.io/package/execa.md) ^6.1.0
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.0.0
- [@ombro/logger](https://npm.io/package/@ombro/logger.md) ^1.5.5
- [@vrn-deco/boilerplate-protocol](https://npm.io/package/@vrn-deco/boilerplate-protocol.md) 1.3.2
- [@vrn-deco/boilerplate-preset-base](https://npm.io/package/@vrn-deco/boilerplate-preset-base.md) 1.3.4

## Recent versions

- 1.1.5 (latest) — 2024-03-19
- 1.1.4 — 2024-02-27
- 1.1.3 — 2022-04-15
- 1.1.2 — 2022-04-01
- 1.1.1 — 2022-03-26
- 1.1.0 — 2022-03-23
- 1.0.5 — 2022-03-23
- 1.0.2 — 2022-03-07
- 1.0.1 — 2022-03-03
- 1.0.0 — 2022-02-14
- 0.0.3 — 2022-02-10

## README

# `@vrn-deco/boilerplate-preset-npm`

[![npm package](https://badgen.net/npm/v/@vrn-deco/boilerplate-preset-npm)](https://www.npmjs.com/package/@vrn-deco/boilerplate-preset-npm)

English | [中文](./README_zh.md)

This package is an implementation of `@vrn-deco/boilerplate-protocol` v1 `PresetRunner` to automate the installation of `boilerplate` managed by `npm`

## How to use?

Support both command line and API calls

```
                                       +-----------------+     +-------------------+
                                       |                 | --> |     API call      |
                                       |                 |     +-------------------+
+--------------------------------+     |                 |
| @vrn-deco/boilerplate-protocol | --> | preset-packages |
+--------------------------------+     |                 |
                                       |                 |     +-------------------+
                                       |                 | --> | command line call |
                                       +-----------------+     +-------------------+
```

### Command line call

```sh
npx @vrn-deco/boilerplate-preset-npm \
	--target-dir="$(pwd)/my-app" \
	--boi-package-dir="/xxx/boi-package" \
	--name="my-app" \
	--version="0.0.1" \
	--author="cphayim"
```

Parameters:

- `--target-dir`: The target directory, that is, where it needs to be installed, it can point to a non-existing directory, it will automatically execute `mkdir -p`
- `--boi-package-dir`: local path to `boi-package`
- `--name`: project name, `PresetRunner` will modify the corresponding project file field according to the type of `boilerplate`, and ensure it is valid by itself
- `--version`: the project version, `PresetRunner` will modify the corresponding project file fields according to the type of `boilerplate` to ensure the validity by itself
- `--author`: the author of the project, `PresetRunner` will modify the corresponding project file fields according to the type of `boilerplate` to ensure the validity by itself

Add the environment variable `LOGGER_LEVEL=verbose` to output debug logs:

```sh
export LOGGER_LEVEL=verbose; \
npx @vrn-deco/boilerplate-preset-npm \
	--target-dir="$(pwd)/my-app" \
	--boi-package-dir="/xxx/boi-package" \
	--name="my-app" \
	--version="0.0.1" \
	--author="cphayim"
```

### API call

```ts
type PresetRunner = (opts: Partial<PresetOptions>) => Promise<void>
```

`PresetOptions`：

- `targetDir`: The target directory, that is, where it needs to be installed, it can point to a non-existing directory, and it will automatically execute `mkdir -p`
- `boiPackageDir`: local path to `boi-package`
- `name`: the project name, `PresetRunner` will modify the corresponding project file field according to the type of `boilerplate` to ensure it is valid
- `version`: the project version, `PresetRunner` will modify the corresponding project file fields according to the type of `boilerplate` to ensure it is valid
- `author`: the author of the project, `PresetRunner` will modify the corresponding project file fields according to the type of `boilerplate` to ensure the validity by itself

Example:

```ts
import { runner } from '@vrn-deco/boilerplate-preset-npm'

try {
  await runner({
    targetDir: path.resolve(process.cwd(), 'my-app'),
    boiPackageDir: path.resolve('/xxx', 'boi-package'),
    name: 'my-app',
    version: '0.0.1',
    auhtor: 'Cphayim',
  })
} catch (err) {
  console.error(err)
}
```

---
_Source: https://npm.io/package/@vrn-deco/boilerplate-preset-npm · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
