1.3.4 • Published 2 months ago
@vrn-deco/boilerplate-preset-base v1.3.4
@vrn-deco/boilerplate-preset-base
English | 中文
This package is an implementation of @vrn-deco/boilerplate-protocol
v1 PresetRunner
to automate the installation of boilerplate
It only provides the most basic functionality, and you should usually choose an extension package based on it
How to use?
Support both command line and API calls
+-----------------+ +-------------------+
| | --> | API call |
| | +-------------------+
+--------------------------------+ | |
| @vrn-deco/boilerplate-protocol | --> | preset-packages |
+--------------------------------+ | |
| | +-------------------+
| | --> | command line call |
+-----------------+ +-------------------+
Command line call
npx @vrn-deco/boilerplate-preset-base \
--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 executemkdir -p
--boi-package-dir
: local path toboi-package
--name
: project name,PresetRunner
will modify the corresponding project file field according to the type ofboilerplate
, and ensure it is valid by itself--version
: the project version,PresetRunner
will modify the corresponding project file fields according to the type ofboilerplate
to ensure the validity by itself--author
: the author of the project,PresetRunner
will modify the corresponding project file fields according to the type ofboilerplate
to ensure the validity by itself
Add the environment variable LOGGER_LEVEL=verbose
to output debug logs:
export LOGGER_LEVEL=verbose; \
npx @vrn-deco/boilerplate-preset-base \
--target-dir="$(pwd)/my-app" \
--boi-package-dir="/xxx/boi-package" \
--name="my-app" \
--version="0.0.1" \
--author="cphayim"
API call
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 executemkdir -p
boiPackageDir
: local path toboi-package
name
: the project name,PresetRunner
will modify the corresponding project file field according to the type ofboilerplate
to ensure it is validversion
: the project version,PresetRunner
will modify the corresponding project file fields according to the type ofboilerplate
to ensure it is validauthor
: the author of the project,PresetRunner
will modify the corresponding project file fields according to the type ofboilerplate
to ensure the validity by itself
Example:
import { runner } from '@vrn-deco/boilerplate-preset-base'
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)
}