task_registry.ts

view source

Declarations
#

11 declarations

BuiltinTaskEntry
#

task_registry.ts view source

BuiltinTaskEntry import type {BuiltinTaskEntry} from '@fuzdev/gro/task_registry.js';

A builtin task with the summary gro lists it by.

inheritance

summary

type string

gen_task_registry
#

task_registry.ts view source

(fs_paths: FsPaths): GenConfig import {gen_task_registry} from '@fuzdev/gro/task_registry.js';

Creates the genfile config that types a project's tasks for invoke_task. Export it as gen from a genfile like src/gro_tasks.gen.ts, export const gen = gen_task_registry(create_fs_paths(fs));, which writes src/gro_tasks.ts augmenting ProjectTasks with every task file under src/, keyed by its path relative to the project root. In gro dev it regenerates when a task file is added or changed; gro dev ignores deletes, so run gro gen after removing a task.

fs_paths

searches the project's src/, its project the root the tasks are keyed relative to

type FsPaths

returns

GenConfig

ProjectTasks
#

task_registry.ts view source

ProjectTasks import type {ProjectTasks} from '@fuzdev/gro/task_registry.js';

The project's own tasks by normalized path, empty until augmented by a generated file. Create a genfile like src/gro_tasks.gen.ts exporting gen_task_registry(create_fs_paths(fs)) as gen to type the project's task paths and args for invoke_task.

task_registry_find
#

task_registry.ts view source

(fs_paths: FsPaths, dir: PathId, search_filters: PathFilter[], root?: PathId): Promise<TaskRegistryEntry[]> import {task_registry_find} from '@fuzdev/gro/task_registry.js';

Finds the task files under dir, named by their paths relative to root, the names invoke_task and gro task give them, sorted by name.

fs_paths

searches dir

type FsPaths

dir

the directory to search, absolute or relative to the project of fs_paths

type PathId

search_filters

the filters each file and directory must pass, given paths relative to root, or to dir for the paths outside root

type PathFilter[]

root?

the project root the names and filtered paths are relative to, defaults to the project of fs_paths

type PathId
optional default fs_paths.project.path

returns

Promise<TaskRegistryEntry[]>

task_registry_find_builtins
#

task_registry.ts view source

(src_lib: FsReadDir): Promise<BuiltinTaskEntry[]> import {task_registry_find_builtins} from '@fuzdev/gro/task_registry.js';

Finds Gro's builtin tasks, the *.task.ts files directly in src_lib, importing each to read its summary.

src_lib

Gro's src/lib/

returns

Promise<BuiltinTaskEntry[]>

task_registry_render_builtins
#

task_registry.ts view source

(entries: BuiltinTaskEntry[], output_dir: PathId, origin_path: string): string import {task_registry_render_builtins} from '@fuzdev/gro/task_registry.js';

Renders the GroBuiltinTasks interface for Gro's own tasks and their summaries, so listing them imports no task module.

entries

output_dir

type PathId

origin_path

type string

returns

string

task_registry_render_project
#

TaskArgsInput
#

task_registry.ts view source

TaskArgsInput<TName>

type TaskRegistry[TName] extends { Args: infer TSchema extends AnySchema; } ? InferInput<TSchema> extends infer TInput ? TInput extends unknown ? [keyof TInput] extends [never] ? Record<string, never> : TInput : never : never : Args

import type {TaskArgsInput} from '@fuzdev/gro/task_registry.js';

The input type of the task's Args schema, so defaulted args are optional, or loose Args for a task module without an Args export. A member of the input with no keys becomes Record<string, never>, so an arg-less task refuses every arg, and a union keeps each option's keys.

generics

TaskArgsInput<TName extends TaskName>
TName
constraint TaskName

TaskName
#

task_registry.ts view source

TaskName

type "run" | "build" | "changeset" | "check" | "clean" | "commit" | "deploy" | "dev" | "format" | "gen" | "lint" | "publish" | "reinstall" | "release" | "sync" | "test" | "typecheck" | "upgrade" | "fixture/clean.task.ts" | "fixture/no_args.task.ts" | "fixture/required_args.task.ts" | "fixture/union_args.task.ts"

import type {TaskName} from '@fuzdev/gro/task_registry.js';

A builtin name or project task path in TaskRegistry, the literals invoke_task checks.

TaskRegistry
#

task_registry.ts view source

TaskRegistry

type GroBuiltinTasks & ProjectTasks

import type {TaskRegistry} from '@fuzdev/gro/task_registry.js';

Every task invoke_task types, mapped to its module's type: Gro's builtins by name and the project's tasks by path relative to the project root. Names never contain a / or end in a task suffix and paths always do, so nothing shadows.

build

type typeof import("build.task.ts", { with: { "resolution-mode": "import" } })

changeset

type typeof import("changeset.task.ts", { with: { "resolution-mode": "import" } })

check

type typeof import("check.task.ts", { with: { "resolution-mode": "import" } })

clean

type typeof import("clean.task.ts", { with: { "resolution-mode": "import" } })

commit

type typeof import("commit.task.ts", { with: { "resolution-mode": "import" } })

deploy

type typeof import("deploy.task.ts", { with: { "resolution-mode": "import" } })

dev

type typeof import("dev.task.ts", { with: { "resolution-mode": "import" } })

format

type typeof import("format.task.ts", { with: { "resolution-mode": "import" } })

gen

type typeof import("gen.task.ts", { with: { "resolution-mode": "import" } })

lint

type typeof import("lint.task.ts", { with: { "resolution-mode": "import" } })

publish

type typeof import("publish.task.ts", { with: { "resolution-mode": "import" } })

reinstall

type typeof import("reinstall.task.ts", { with: { "resolution-mode": "import" } })

release

type typeof import("release.task.ts", { with: { "resolution-mode": "import" } })

run

type typeof import("run.task.ts", { with: { "resolution-mode": "import" } })

sync

type typeof import("sync.task.ts", { with: { "resolution-mode": "import" } })

test

type typeof import("test.task.ts", { with: { "resolution-mode": "import" } })

typecheck

type typeof import("typecheck.task.ts", { with: { "resolution-mode": "import" } })

upgrade

type typeof import("upgrade.task.ts", { with: { "resolution-mode": "import" } })

fixture/clean.task.ts

type typeof import("src/test/fixtures/task_registry/clean_override.task_fixture.ts", { with: { "resolution-mode": "import" } })

fixture/no_args.task.ts

type typeof import("src/test/fixtures/task_registry/no_args.task_fixture.ts", { with: { "resolution-mode": "import" } })

fixture/required_args.task.ts

type typeof import("src/test/fixtures/task_registry/required_args.task_fixture.ts", { with: { "resolution-mode": "import" } })

fixture/union_args.task.ts

type typeof import("src/test/fixtures/task_registry/union_args.task_fixture.ts", { with: { "resolution-mode": "import" } })

TaskRegistryEntry
#

task_registry.ts view source

TaskRegistryEntry import type {TaskRegistryEntry} from '@fuzdev/gro/task_registry.js';

name

The builtin name, or the project task's path relative to the project root.

type string

id

type PathId

Depends on
#

Imported by
#