Skip to content

Commit

Permalink
Allow no optiopns to be provided, tweak arg names for esbuildOptionsFn
Browse files Browse the repository at this point in the history
  • Loading branch information
timriley committed Oct 11, 2023
1 parent 61be110 commit 7bf8c9e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions dist/hanami-assets.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ interface RunOptions {
argv?: string[];
esbuildOptionsFn?: EsbuildOptionsFn;
}
type EsbuildOptionsFn = (args: Args, options: Partial<BuildOptions>) => Partial<BuildOptions>;
export declare const run: (options: RunOptions) => Promise<BuildContext | void>;
type EsbuildOptionsFn = (args: Args, esbuildOptions: Partial<BuildOptions>) => Partial<BuildOptions>;
export declare const run: (options?: RunOptions) => Promise<BuildContext | void>;
export {};
2 changes: 1 addition & 1 deletion dist/hanami-assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import esbuild from "esbuild";
import { parseArgs } from "./args.js";
import { buildOptions, watchOptions } from "./esbuild.js";
export const run = async function (options) {
const { root = process.cwd(), argv = process.argv, esbuildOptionsFn = null, } = options;
const { root = process.cwd(), argv = process.argv, esbuildOptionsFn = null, } = options || {};
const args = parseArgs(argv);
// TODO: make nicer
let esbuildOptions = args.watch ? watchOptions(root, args) : buildOptions(root, args);
Expand Down
6 changes: 3 additions & 3 deletions src/hanami-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ interface RunOptions {
esbuildOptionsFn?: EsbuildOptionsFn
}

type EsbuildOptionsFn = (args: Args, options: Partial<BuildOptions>) => Partial<BuildOptions>;
type EsbuildOptionsFn = (args: Args, esbuildOptions: Partial<BuildOptions>) => Partial<BuildOptions>;

export const run = async function(options: RunOptions): Promise<BuildContext | void> {
export const run = async function(options?: RunOptions): Promise<BuildContext | void> {
const {
root = process.cwd(),
argv = process.argv,
esbuildOptionsFn = null,
} = options;
} = options || {};

const args = parseArgs(argv);

Expand Down

0 comments on commit 7bf8c9e

Please sign in to comment.