prettier
files) for a project. Lint is a +check; Format returns a Changeset theconsumer can merge with its other formatters (e.g. gofmt).
Installation
dagger install github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4Entrypoint
Return Type
Prettier !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| source | Directory | - | Project source directory. Ignore patterns belong in the consuming project's root dagger.json customizations, not here. |
| image | String | - | Node container image. |
| version | String | - | prettier version (npm). |
| configPath | String | - | Default prettier config path, relative to the source root. |
| patterns | [String ! ] | - | Default file patterns to check/format. Defaults to YAML/JSON/Markdown. |
| cacheNamespace | String | - | Namespace prefix for the npm cache volume. Override to avoid collisions when multiple toolchains share an engine. |
Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
func (m *MyModule) Example() *dagger.Prettier {
return dag.
Prettier()
}@function
def example() -> dagger.Prettier:
return (
dag.prettier()
)@func()
example(): Prettier {
return dag
.prettier()
}Types
Prettier 🔗
Prettier checks and formats files with prettier. Create instances with [New].
source() 🔗
Project source directory.
Return Type
Directory ! Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
sourcefunc (m *MyModule) Example() *dagger.Directory {
return dag.
Prettier().
Source()
}@function
def example() -> dagger.Directory:
return (
dag.prettier()
.source()
)@func()
example(): Directory {
return dag
.prettier()
.source()
}image() 🔗
Node container image used to install and run prettier.
Return Type
String ! Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
imagefunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Prettier().
Image(ctx)
}@function
async def example() -> str:
return await (
dag.prettier()
.image()
)@func()
async example(): Promise<string> {
return dag
.prettier()
.image()
}version() 🔗
prettier version installed via npm.
Return Type
String ! Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
versionfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Prettier().
Version(ctx)
}@function
async def example() -> str:
return await (
dag.prettier()
.version()
)@func()
async example(): Promise<string> {
return dag
.prettier()
.version()
}configPath() 🔗
Default prettier config path, relative to the source root.
Return Type
String ! Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
config-pathfunc (m *MyModule) Example(ctx context.Context) string {
return dag.
Prettier().
ConfigPath(ctx)
}@function
async def example() -> str:
return await (
dag.prettier()
.config_path()
)@func()
async example(): Promise<string> {
return dag
.prettier()
.configPath()
}patterns() 🔗
Default file patterns to check/format.
Return Type
[String ! ] ! Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
patternsfunc (m *MyModule) Example(ctx context.Context) []string {
return dag.
Prettier().
Patterns(ctx)
}@function
async def example() -> List[str]:
return await (
dag.prettier()
.patterns()
)@func()
async example(): Promise<string[]> {
return dag
.prettier()
.patterns()
}base() 🔗
Base returns a Node container with prettier installed and an npm cache volume mounted. Source is not mounted.
Return Type
Container ! Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
basefunc (m *MyModule) Example() *dagger.Container {
return dag.
Prettier().
Base()
}@function
def example() -> dagger.Container:
return (
dag.prettier()
.base()
)@func()
example(): Container {
return dag
.prettier()
.base()
}format() 🔗
Format rewrites the configured patterns in place and returns a Changeset of the modifications, for the consumer to apply or merge with other formatters.
Return Type
Changeset !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| configPath | String | - | Prettier config path, relative to the source root. Defaults to the configured path. |
| patterns | [String ! ] | - | File patterns to format. Defaults to the configured patterns. |
Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
formatfunc (m *MyModule) Example() *dagger.Changeset {
return dag.
Prettier().
Format()
}@function
def example() -> dagger.Changeset:
return (
dag.prettier()
.format()
)@func()
example(): Changeset {
return dag
.prettier()
.format()
}lint() 🔗
Lint checks formatting of the configured patterns without modifying files.
Return Type
Void !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| configPath | String | - | Prettier config path, relative to the source root. Defaults to the configured path. |
| patterns | [String ! ] | - | File patterns to check. Defaults to the configured patterns. |
Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
lintfunc (m *MyModule) Example(ctx context.Context) {
return dag.
Prettier().
Lint(ctx)
}@function
async def example() -> None:
return await (
dag.prettier()
.lint()
)@func()
async example(): Promise<void> {
return dag
.prettier()
.lint()
}lintBase() 🔗
LintBase returns the prettier container with the project source mounted at /src. Exposed so consumers can wrap it (e.g. with a cache-bust) for benchmarks.
Return Type
Container ! Example
dagger -m github.com/MacroPower/x/toolchains/prettier@3f4ef26289cf6c0690d4ce596cd8832b729b8ad4 call \
lint-basefunc (m *MyModule) Example() *dagger.Container {
return dag.
Prettier().
LintBase()
}@function
def example() -> dagger.Container:
return (
dag.prettier()
.lint_base()
)@func()
example(): Container {
return dag
.prettier()
.lintBase()
}