@dovenv/core
v0.0.6
Published
Quickly and easily set up your environment for your code projects
Downloads
53
Maintainers
Readme
dovenv
Quickly and easily set up your environment for your code projects
Table of contents
🔑 Installation
npm install dovenv
# or pnpm
pnpm add dovenv
# or yarn
yarn add dovenv
Api documentation
Classes
Dovenv
Instance Dovenv
.
This is the "dovenv" class that builds the command line interface.
It is similar to the cli tool but for use in js
|ts
projects.
Provides tools for managing configurations, constants, and path transformations etc. Supports custom configurations and predefined commands. Features:
- Validate files or directories with custom rules.
- Manage workspace constants efficiently.
- Transform paths with configurable patterns.
- Extend or override default behaviors with custom configurations.
See
https://dovenv.pigeonposse.com/guide/core
Example
// Create an instance with custom configurations
const dovenv = new Dovenv({
config: {
check: {
pkg: { include: ['src/**'], ... }
},
}
});
// Run a predefined action
await dovenv.run(['check', '-k', 'pkg']);
Constructors
new Dovenv()
new Dovenv(params?: Params): Dovenv
Creates a new Dovenv
instance.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| params
? | Params
| Optional initialization parameters. |
Returns
Methods
run()
run(args: string[]): Promise<void>
Runs the build process with the given arguments.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| args
| string
[] | Arguments to pass to the run process. |
Returns
Promise
<void
>
Example
const dovenv = new Dovenv({
config: {
check: {
pkg: {...}
},
...
}
})
await dovenv.run(['check', '-k', 'pkg'])
Properties
| Property | Type |
| ------ | ------ |
| config
| undefined
| Config
|
Functions
defineConfig()
function defineConfig(...config: (Config | Config[])[]): Config
Defines and returns the given configuration object.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| ...config
| (Config
| Config
[])[] | The configuration object to define. |
Returns
- The defined configuration object.
See
https://dovenv.pigeonposse.com/guide/core
Examples
// Example 1: A single configuration object
export default defineConfig(config1);
// Example 2: Multiple configurations as arguments
export default defineConfig(config1, config2);
// Example 3: An array of configurations
export default defineConfig([config1, config2]);
run()
function run(args: string[]): Promise<void>
Runs the build process with the given arguments.
Parameters
| Parameter | Type | Description |
| ------ | ------ | ------ |
| args
| string
[] | Arguments to pass to the build process. |
Returns
Promise
<void
>
Example
import { run } from '@dovenv/core'
await run(['-c', 'my/config.js', 'check'])
Type Aliases
Config
type Config: {
check: CheckConfig;
const: ConstConfig;
custom: CustomConfig;
desc: string;
name: string;
template: TemplateConfig;
transform: TransformConfig;
};
Type declaration
| Name | Type | Description |
| ------ | ------ | ------ |
| check
? | CheckConfig
| Configuration for the check
command |
| const
? | ConstConfig
| Configuration for set the constants used in templates |
| custom
? | CustomConfig
| Configuration for create custom
commands |
| desc
? | string
| Description of the project |
| name
? | string
| Name of the project |
| template
? | TemplateConfig
| Configuration for the template
command |
| transform
? | TransformConfig
| Configuration for the transform
command |
Params
type Params: {
config: Config;
};
Type declaration
| Name | Type | Description |
| ------ | ------ | ------ |
| config
? | Config
| Configuration for dovenv See https://dovenv.pigeonposse.com/guide/core/config |
👨💻 Development
dovenv is an open-source project and its development is open to anyone who wants to participate.
☕ Donate
Help us to develop more interesting things.
📜 License
This software is licensed with GPL-3.0.
🐦 About us
PigeonPosse is a ✨ code development collective ✨ focused on creating practical and interesting tools that help developers and users enjoy a more agile and comfortable experience. Our projects cover various programming sectors and we do not have a thematic limitation in terms of projects.