interface JsrConfig {
    copyPackageFiles?: string[];
    copyRootFiles?: string[];
    dryRun?: boolean;
    enableDenoDirectives?: boolean;
    exclude?: string[];
    finalize?: (ctx: BuildHookContext) => MaybePromise<void>;
    finalizeDenoJson?: (ctx: BuildHookContext, jsr: any) => void;
    includePackage?: (pkg: WorkspacePackage) => boolean;
    outputDir?: string;
    sourceDir?: string;
    transformAst?: (ast: SourceFile) => boolean;
    transformCode?: (path: string, code: string) => string;
}

Properties

copyPackageFiles?: string[]

files to copy from the package root directory to the package build directory

['README.md']
copyRootFiles?: string[]

files to copy from the workspace root directory to the package build directory

['LICENSE']
dryRun?: boolean

whether to run deno publish --dry-run after generating the workspace to make sure everything is ok

true
enableDenoDirectives?: boolean

whether to enable pre-processor directives when processing typescript files. this is useful to provide deno-specific typings for stuff.

note: this is run before the transformCode hook, but after the transformAst hook

supported directives:

<deno-insert>: inserts the given code at transform time. example:

// <deno-insert>
// declare type SharedWorker = never
// </deno-insert>

transforms to:

declare type SharedWorker = never

<deno-remove>: remove the given code at transform time. example:

// <deno-remove>
if (self instanceof SharedWorkerGlobalScope) {
// do something
}
// </deno-remove>

transforms to: (nothing)

<deno-tsignore>: insert a // @ts-ignore comment when building for deno at the given position example:

// <deno-tsignore>
const foo: string = 123

transforms to:

// @ts-ignore
const foo = 123
false
exclude?: string[]

globs to exclude from publishing

finalize?: (ctx: BuildHookContext) => MaybePromise<void>

hook to run after the build is done, time to do any final modifications to the package contents

finalizeDenoJson?: (ctx: BuildHookContext, jsr: any) => void

hook to run after the deno.json file is generated but before it is written to disk

includePackage?: (pkg: WorkspacePackage) => boolean

custom predicate for including packages

outputDir?: string

jsr build output dir (relative to workspace root)

"dist"
sourceDir?: string

source dir (relative to package root) anything outside this dir will be copied as-is

"" (i.e. the package root itself)
transformAst?: (ast: SourceFile) => boolean

hook that will be run on each file as it is being processed, allowing you to change ast as you wish

transformCode?: (path: string, code: string) => string

similar to transformAst, but for the code itself (runs after transformAst)