Skip to content

Commit

Permalink
feat: if both include and exclude are null, don't generate publish fi…
Browse files Browse the repository at this point in the history
…eld in JSR

This commit optimizes the generation of the 'publish' field in the
JSR configuration. Previously, the 'include' and 'exclude' fields
were always generated, even when they were null. Now, they are only
generated if they are not null, reducing unnecessary clutter in the
JSR configuration.
  • Loading branch information
ryoppippi committed Aug 10, 2024
1 parent 0b59d80 commit 4efd69b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,13 +219,17 @@ export function getExports(pkgJSON: PackageJson): Exports {
*/
export function genJsrFromPackageJson({ pkgJSON }: { pkgJSON: PackageJson }): JSRConfigurationFileSchema {
const { name, version } = pkgJSON;

const _include = getInclude(pkgJSON);
const _exclude = getExclude(pkgJSON);
const jsr = {
name: name as string,
version: version as string,
publish: {
include: getInclude(pkgJSON),
exclude: getExclude(pkgJSON),
},
// publish: {
// include: getInclude(pkgJSON),
// exclude: getExclude(pkgJSON),
// },
publish: _include != null || _exclude != null ? { include: _include, exclude: _exclude } : undefined,
exports: getExports(pkgJSON),
} as const satisfies JSRConfigurationFileSchema;

Expand Down

0 comments on commit 4efd69b

Please sign in to comment.