@vrn-deco/boilerplate-preset-pip
v0.0.7
Published
boilerplate preset pip package installer
Downloads
15
Readme
@vrn-deco/boilerplate-preset-pip
English | 中文
This package is an implementation of @vrn-deco/boilerplate-protocol
v1 PresetRunner
to automate the installation of boilerplate
managed by pip
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-pip \
--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-pip \
--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-pip'
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)
}