Skip to content

Commit

Permalink
feat: add allowDirty flag
Browse files Browse the repository at this point in the history
  • Loading branch information
sebbo2002 committed Apr 16, 2024
1 parent c83866f commit f22b39a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface PluginConfig {
cwd?: string;
pkgJsonPath?: string;
publishArgs?: string[];
allowDirty?: boolean;
}

export interface NormalizedPluginConfig {
Expand Down
11 changes: 8 additions & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,27 @@ export async function parseConfig (config: PluginConfig): Promise<NormalizedPlug
throw new Error('No name found in jsr.json or deno.json');
}

const publishArgs = config.publishArgs?.slice(0) || [];
if ((config.allowDirty === undefined || config.allowDirty) && !publishArgs.includes('--allow-dirty')) {
publishArgs.push('--allow-dirty');
}

return {
cwd,
name,
prepare: {
versionJsonPaths
},
publish: {
binFolder: getTemporeryBinFolder(),
binFolder: getTemporaryBinFolder(),
pkgJsonPath: pkgJsonPath,
publishArgs: config.publishArgs || []
publishArgs
}
};
}

let temporaryBinFolder: string | undefined;
export function getTemporeryBinFolder (): string {
export function getTemporaryBinFolder (): string {
if (temporaryBinFolder) {
return temporaryBinFolder;
}
Expand Down

0 comments on commit f22b39a

Please sign in to comment.