@doki-land/nifty 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/github.ts CHANGED
@@ -3,7 +3,7 @@ import type { GithubAuthor } from "./types.js";
3
3
  const USER_AGENT = "nifty-github";
4
4
  const ACCEPT = "application/vnd.github+json";
5
5
 
6
- function parseUserJson(body: Record < string, unknown > , fallbackLogin?: string) : GithubAuthor {
6
+ function parseUserJson(body: Record<string, unknown>, fallbackLogin?: string): GithubAuthor {
7
7
  const id = typeof body.id === "number" ? BigInt(body.id) : undefined;
8
8
  const login = typeof body.login === "string" ? body.login : fallbackLogin;
9
9
  if (id === undefined && login === undefined) {
@@ -12,8 +12,8 @@ function parseUserJson(body: Record < string, unknown > , fallbackLogin?: string
12
12
  return { id, login };
13
13
  }
14
14
 
15
- async function getJson(url: string, token?: string) : Promise < Record < string, unknown>> {
16
- const headers: Record < string, string > = {
15
+ async function getJson(url: string, token?: string): Promise<Record<string, unknown>> {
16
+ const headers: Record<string, string> = {
17
17
  Accept: ACCEPT,
18
18
  "User-Agent": USER_AGENT,
19
19
  };
@@ -27,7 +27,7 @@ async function getJson(url: string, token?: string) : Promise < Record < string,
27
27
  if (!response.ok) {
28
28
  throw new Error(`GitHub API error: ${response.status} ${response.statusText}`);
29
29
  }
30
- return(await response.json())as Record < string, unknown > ;
30
+ return (await response.json()) as Record<string, unknown>;
31
31
  }
32
32
 
33
33
  function parseNoreplyEmail(email: string): GithubAuthor | undefined {
@@ -37,7 +37,7 @@ function parseNoreplyEmail(email: string): GithubAuthor | undefined {
37
37
  if (!lower.endsWith(suffix)) {
38
38
  return undefined;
39
39
  }
40
- const local = trimmed.slice(0, - suffix.length);
40
+ const local = trimmed.slice(0, -suffix.length);
41
41
  const plus = local.indexOf("+");
42
42
  if (plus >= 0) {
43
43
  const idPart = local.slice(0, plus);
@@ -53,14 +53,14 @@ function parseNoreplyEmail(email: string): GithubAuthor | undefined {
53
53
  return { login: local };
54
54
  }
55
55
 
56
- function loadAuthorMap(json: string): Map < string, GithubAuthor > {
57
- const map = new Map < string, GithubAuthor > ();
56
+ function loadAuthorMap(json: string): Map<string, GithubAuthor> {
57
+ const map = new Map<string, GithubAuthor>();
58
58
  if (!json.trim()) {
59
59
  return map;
60
60
  }
61
- const parsed = JSON.parse(json)as Record < string, { id?: number; login?: string }>;
62
- for (const[email, entry]of Object.entries(parsed)) {
63
- const author: GithubAuthor = { };
61
+ const parsed = JSON.parse(json) as Record<string, { id?: number; login?: string }>;
62
+ for (const [email, entry] of Object.entries(parsed)) {
63
+ const author: GithubAuthor = {};
64
64
  if (typeof entry.id === "number") {
65
65
  author.id = BigInt(entry.id);
66
66
  }
@@ -81,7 +81,7 @@ function mergeAuthors(existing: GithubAuthor, incoming: GithubAuthor): GithubAut
81
81
  };
82
82
  }
83
83
 
84
- async function enrichAuthor(author: GithubAuthor, token?: string, fetch = false) : Promise < GithubAuthor> {
84
+ async function enrichAuthor(author: GithubAuthor, token?: string, fetch = false): Promise<GithubAuthor> {
85
85
  if (!fetch && author.id !== undefined && author.login !== undefined) {
86
86
  return author;
87
87
  }
@@ -95,7 +95,7 @@ async function enrichAuthor(author: GithubAuthor, token?: string, fetch = false)
95
95
  return author;
96
96
  }
97
97
 
98
- async function userByLoginFetch(login: string, token?: string) : Promise < GithubAuthor> {
98
+ async function userByLoginFetch(login: string, token?: string): Promise<GithubAuthor> {
99
99
  const trimmed = login.trim();
100
100
  if (!trimmed) {
101
101
  throw new Error("login must not be empty");
@@ -104,7 +104,7 @@ async function userByLoginFetch(login: string, token?: string) : Promise < Githu
104
104
  return parseUserJson(body, trimmed);
105
105
  }
106
106
 
107
- async function searchUserByEmailFetch(email: string, token: string): Promise < GithubAuthor | undefined > {
107
+ async function searchUserByEmailFetch(email: string, token: string): Promise<GithubAuthor | undefined> {
108
108
  const trimmed = email.trim();
109
109
  const auth = token.trim();
110
110
  if (!trimmed) {
@@ -119,7 +119,7 @@ async function searchUserByEmailFetch(email: string, token: string): Promise < G
119
119
  if (!Array.isArray(items) || items.length === 0) {
120
120
  return undefined;
121
121
  }
122
- const first = items[0]as Record < string, unknown > ;
122
+ const first = items[0] as Record<string, unknown>;
123
123
  return parseUserJson(first);
124
124
  }
125
125
 
@@ -134,17 +134,17 @@ export type LookupUserOptions = {
134
134
  * Rust equivalent: `nifty-github` crate.
135
135
  */
136
136
  export class Github {
137
- constructor(private readonly token?: string) { }
137
+ constructor(private readonly token?: string) {}
138
138
 
139
- static open(token?: string) : Github {
139
+ static open(token?: string): Github {
140
140
  return new Github(token);
141
141
  }
142
142
 
143
- async userByLogin(login: string, token?: string) : Promise < GithubAuthor> {
143
+ async userByLogin(login: string, token?: string): Promise<GithubAuthor> {
144
144
  return userByLoginFetch(login, token ?? this.token);
145
145
  }
146
146
 
147
- async searchUserByEmail(email: string, token?: string) : Promise < GithubAuthor | undefined > {
147
+ async searchUserByEmail(email: string, token?: string): Promise<GithubAuthor | undefined> {
148
148
  const auth = token ?? this.token;
149
149
  if (!auth) {
150
150
  throw new Error("GitHub token is required for email search");
@@ -152,7 +152,7 @@ export class Github {
152
152
  return searchUserByEmailFetch(email, auth);
153
153
  }
154
154
 
155
- async lookupUserByEmail(email: string, options: LookupUserOptions = { }): Promise < GithubAuthor | undefined > {
155
+ async lookupUserByEmail(email: string, options: LookupUserOptions = {}): Promise<GithubAuthor | undefined> {
156
156
  const token = options.token ?? this.token;
157
157
  const fetch = options.fetch ?? false;
158
158
  const mapJson = options.authorMapJson ?? "{}";
@@ -179,6 +179,6 @@ export class Github {
179
179
  }
180
180
  }
181
181
 
182
- export function createGithub(token?: string) : Github {
182
+ export function createGithub(token?: string): Github {
183
183
  return Github.open(token);
184
184
  }
package/src/gitmoji.ts CHANGED
@@ -8,7 +8,7 @@ export class Gitmoji {
8
8
  constructor(
9
9
  private readonly wasm: GitmojiExports,
10
10
  private readonly defaultAuthorMapJson = "{}",
11
- ) { }
11
+ ) {}
12
12
 
13
13
  static open(authorMapJson = "{}"): Gitmoji {
14
14
  const native = loadNiftyNative();
@@ -39,7 +39,7 @@ export class Gitmoji {
39
39
  return this.wasm["leading-gitmoji"](subject);
40
40
  }
41
41
 
42
- sectionForGitmoji(gitmoji?: string) : ReleaseSection {
42
+ sectionForGitmoji(gitmoji?: string): ReleaseSection {
43
43
  return this.wasm["section-for-gitmoji"](gitmoji);
44
44
  }
45
45
 
package/src/native.ts CHANGED
@@ -28,7 +28,7 @@ export type GitmojiExports = {
28
28
  export type GitExports = {
29
29
  "discover-root": (startPath: string) => string;
30
30
  "list-version-tags": (repoRoot: string) => string[];
31
- "list-tag-infos": (repoRoot: string) => Array < { name: string; "short-hash": string }>;
31
+ "list-tag-infos": (repoRoot: string) => Array<{ name: string; "short-hash": string }>;
32
32
  "format-tag-list": (repoRoot: string) => string;
33
33
  "resolve-range": (
34
34
  repoRoot: string,
@@ -45,7 +45,7 @@ export type GitExports = {
45
45
  "parse-github-remote": (url: string) => string | undefined;
46
46
  };
47
47
 
48
- type NativeCommitRecord = Omit < CommitRecord, "section"> & { section: string };
48
+ type NativeCommitRecord = Omit<CommitRecord, "section"> & { section: string };
49
49
 
50
50
  export type PublishReport = {
51
51
  root: string;
@@ -167,7 +167,7 @@ export type LintRunOptions = {
167
167
  fromRef?: string;
168
168
  toRef?: string;
169
169
  subjects?: string[];
170
- rules?: Array < { id: string; enabled?: boolean; severity?: "error" | "warning" | "info" }>;
170
+ rules?: Array<{ id: string; enabled?: boolean; severity?: "error" | "warning" | "info" }>;
171
171
  scanCargo?: boolean;
172
172
  commitOnly?: boolean;
173
173
  };
@@ -275,7 +275,7 @@ type NativeBinding = {
275
275
  gitmojiCommitBullet: (body: string, email: string, authorName: string, authorMapJson: string) => string;
276
276
  gitDiscoverRoot: (startPath: string) => string;
277
277
  gitListVersionTags: (repoRoot: string) => string[];
278
- gitListTagInfos: (repoRoot: string) => Array < { name: string; shortHash: string }>;
278
+ gitListTagInfos: (repoRoot: string) => Array<{ name: string; shortHash: string }>;
279
279
  gitFormatTagList: (repoRoot: string) => string;
280
280
  gitResolveRange: (
281
281
  repoRoot: string,
@@ -328,7 +328,7 @@ type NativeBinding = {
328
328
  path: string;
329
329
  dryRun?: boolean | null;
330
330
  }) => {
331
- changes: Array < {
331
+ changes: Array<{
332
332
  oldOid: string;
333
333
  oldSubject: string;
334
334
  newSubject: string;
@@ -353,7 +353,7 @@ type NativeBinding = {
353
353
  path: string;
354
354
  dryRun?: boolean | null;
355
355
  }) => {
356
- changes: Array < {
356
+ changes: Array<{
357
357
  oldOid: string;
358
358
  oldSubject: string;
359
359
  newSubject: string;
@@ -413,12 +413,12 @@ type NativeBinding = {
413
413
  fromRef?: string | null;
414
414
  toRef?: string | null;
415
415
  subjects?: string[] | null;
416
- rules?: Array < { id: string; enabled?: boolean | null; severity?: string | null }> | null;
416
+ rules?: Array<{ id: string; enabled?: boolean | null; severity?: string | null }> | null;
417
417
  scanCargo?: boolean | null;
418
418
  commitOnly?: boolean | null;
419
419
  check?: boolean | null;
420
420
  }) => {
421
- diagnostics: Array < {
421
+ diagnostics: Array<{
422
422
  rule: string;
423
423
  severity: string;
424
424
  message: string;
@@ -435,12 +435,12 @@ type NativeBinding = {
435
435
  fromRef?: string | null;
436
436
  toRef?: string | null;
437
437
  subjects?: string[] | null;
438
- rules?: Array < { id: string; enabled?: boolean | null; severity?: string | null }> | null;
438
+ rules?: Array<{ id: string; enabled?: boolean | null; severity?: string | null }> | null;
439
439
  scanCargo?: boolean | null;
440
440
  commitOnly?: boolean | null;
441
441
  check?: boolean | null;
442
442
  }) => {
443
- diagnostics: Array < {
443
+ diagnostics: Array<{
444
444
  rule: string;
445
445
  severity: string;
446
446
  message: string;
@@ -468,7 +468,7 @@ type NativeBinding = {
468
468
  };
469
469
  };
470
470
 
471
- const PLATFORM_PACKAGES: Record < string, string > = {
471
+ const PLATFORM_PACKAGES: Record<string, string> = {
472
472
  "win32-x64": "@doki-land/nifty-win32-x64",
473
473
  "linux-x64": "@doki-land/nifty-linux-x64",
474
474
  "linux-arm64": "@doki-land/nifty-linux-arm64",
@@ -488,18 +488,18 @@ function mapAuthor(raw: GithubAuthor | null | undefined): GithubAuthor | undefin
488
488
 
489
489
  function mapLintOptions(options: LintRunOptions) {
490
490
  return {
491
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
492
- ...(options.fromRef !== undefined ? { fromRef: options.fromRef } : { }),
493
- ...(options.toRef !== undefined ? { toRef: options.toRef } : { }),
494
- ...(options.subjects !== undefined ? { subjects: options.subjects } : { }),
495
- ...(options.rules !== undefined ? { rules: options.rules } : { }),
496
- ...(options.scanCargo !== undefined ? { scanCargo: options.scanCargo } : { }),
497
- ...(options.commitOnly !== undefined ? { commitOnly: options.commitOnly } : { }),
491
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
492
+ ...(options.fromRef !== undefined ? { fromRef: options.fromRef } : {}),
493
+ ...(options.toRef !== undefined ? { toRef: options.toRef } : {}),
494
+ ...(options.subjects !== undefined ? { subjects: options.subjects } : {}),
495
+ ...(options.rules !== undefined ? { rules: options.rules } : {}),
496
+ ...(options.scanCargo !== undefined ? { scanCargo: options.scanCargo } : {}),
497
+ ...(options.commitOnly !== undefined ? { commitOnly: options.commitOnly } : {}),
498
498
  };
499
499
  }
500
500
 
501
501
  function mapLintReport(raw: {
502
- diagnostics: Array < {
502
+ diagnostics: Array<{
503
503
  rule: string;
504
504
  severity: string;
505
505
  message: string;
@@ -535,7 +535,7 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
535
535
  "format-subject": (gitmoji, body) => binding.gitmojiFormatSubject(gitmoji, body),
536
536
  "strip-gitmoji": (subject) => binding.gitmojiStripGitmoji(subject),
537
537
  "leading-gitmoji": (subject) => binding.gitmojiLeadingGitmoji(subject) ?? undefined,
538
- "section-for-gitmoji": (gitmoji) => binding.gitmojiSectionForGitmoji(gitmoji)as ReleaseSection,
538
+ "section-for-gitmoji": (gitmoji) => binding.gitmojiSectionForGitmoji(gitmoji) as ReleaseSection,
539
539
  "parse-noreply-email": (email) => mapAuthor(binding.gitmojiParseNoreplyEmail(email)),
540
540
  "resolve-github-author": (email, authorMapJson) =>
541
541
  mapAuthor(binding.gitmojiResolveGithubAuthor(email, authorMapJson)),
@@ -571,18 +571,18 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
571
571
  history: {
572
572
  "commit-export": (options) =>
573
573
  binding.gitToolsCommitExport({
574
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
574
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
575
575
  base: options.base,
576
- ...(options.ref !== undefined ? { ref: options.ref } : { }),
576
+ ...(options.ref !== undefined ? { ref: options.ref } : {}),
577
577
  path: options.path,
578
578
  }),
579
579
  "commit-apply": (options) => {
580
580
  const report = binding.gitToolsCommitApply({
581
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
581
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
582
582
  base: options.base,
583
- ...(options.ref !== undefined ? { ref: options.ref } : { }),
583
+ ...(options.ref !== undefined ? { ref: options.ref } : {}),
584
584
  path: options.path,
585
- ...(options.dryRun !== undefined ? { dryRun: options.dryRun } : { }),
585
+ ...(options.dryRun !== undefined ? { dryRun: options.dryRun } : {}),
586
586
  });
587
587
  return {
588
588
  changes: report.changes,
@@ -594,18 +594,18 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
594
594
  },
595
595
  "reword-export": (options) =>
596
596
  binding.gitToolsRewordExport({
597
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
597
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
598
598
  base: options.base,
599
- ...(options.ref !== undefined ? { ref: options.ref } : { }),
599
+ ...(options.ref !== undefined ? { ref: options.ref } : {}),
600
600
  path: options.path,
601
601
  }),
602
602
  "reword-rewrite": (options) => {
603
603
  const report = binding.gitToolsRewordRewrite({
604
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
604
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
605
605
  base: options.base,
606
- ...(options.ref !== undefined ? { ref: options.ref } : { }),
606
+ ...(options.ref !== undefined ? { ref: options.ref } : {}),
607
607
  path: options.path,
608
- ...(options.dryRun !== undefined ? { dryRun: options.dryRun } : { }),
608
+ ...(options.dryRun !== undefined ? { dryRun: options.dryRun } : {}),
609
609
  });
610
610
  return {
611
611
  changes: report.changes,
@@ -617,33 +617,33 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
617
617
  },
618
618
  "retime-range": (options) =>
619
619
  binding.gitToolsRetimeRange({
620
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
620
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
621
621
  commit: options.commit,
622
- ...(options.startDate !== undefined ? { startDate: options.startDate } : { }),
623
- ...(options.endDate !== undefined ? { endDate: options.endDate } : { }),
624
- ...(options.branch !== undefined ? { branch: options.branch } : { }),
625
- ...(options.tip !== undefined ? { tip: options.tip } : { }),
622
+ ...(options.startDate !== undefined ? { startDate: options.startDate } : {}),
623
+ ...(options.endDate !== undefined ? { endDate: options.endDate } : {}),
624
+ ...(options.branch !== undefined ? { branch: options.branch } : {}),
625
+ ...(options.tip !== undefined ? { tip: options.tip } : {}),
626
626
  }),
627
627
  "retime-root": (options) =>
628
628
  binding.gitToolsRetimeRoot({
629
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
630
- ...(options.startDate !== undefined ? { startDate: options.startDate } : { }),
631
- ...(options.endDate !== undefined ? { endDate: options.endDate } : { }),
632
- ...(options.branch !== undefined ? { branch: options.branch } : { }),
633
- ...(options.tip !== undefined ? { tip: options.tip } : { }),
634
- ...(options.message !== undefined ? { message: options.message } : { }),
629
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
630
+ ...(options.startDate !== undefined ? { startDate: options.startDate } : {}),
631
+ ...(options.endDate !== undefined ? { endDate: options.endDate } : {}),
632
+ ...(options.branch !== undefined ? { branch: options.branch } : {}),
633
+ ...(options.tip !== undefined ? { tip: options.tip } : {}),
634
+ ...(options.message !== undefined ? { message: options.message } : {}),
635
635
  }),
636
636
  "changelog-render": (options) => {
637
637
  const report = binding.gitToolsChangelogRender({
638
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
639
- ...(options.version !== undefined ? { version: options.version } : { }),
640
- ...(options.fromRef !== undefined ? { fromRef: options.fromRef } : { }),
641
- ...(options.toRef !== undefined ? { toRef: options.toRef } : { }),
642
- ...(options.write !== undefined ? { write: options.write } : { }),
643
- ...(options.tags !== undefined ? { tags: options.tags } : { }),
644
- ...(options.repo !== undefined ? { repo: options.repo } : { }),
645
- ...(options.authorMap !== undefined ? { authorMap: options.authorMap } : { }),
646
- ...(options.releasesDir !== undefined ? { releasesDir: options.releasesDir } : { }),
638
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
639
+ ...(options.version !== undefined ? { version: options.version } : {}),
640
+ ...(options.fromRef !== undefined ? { fromRef: options.fromRef } : {}),
641
+ ...(options.toRef !== undefined ? { toRef: options.toRef } : {}),
642
+ ...(options.write !== undefined ? { write: options.write } : {}),
643
+ ...(options.tags !== undefined ? { tags: options.tags } : {}),
644
+ ...(options.repo !== undefined ? { repo: options.repo } : {}),
645
+ ...(options.authorMap !== undefined ? { authorMap: options.authorMap } : {}),
646
+ ...(options.releasesDir !== undefined ? { releasesDir: options.releasesDir } : {}),
647
647
  });
648
648
  return {
649
649
  notes: report.notes,
@@ -657,14 +657,14 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
657
657
  },
658
658
  "changelog-lookup": (options) => {
659
659
  const author = binding.gitToolsChangelogLookup({
660
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
661
- ...(options.email !== undefined ? { email: options.email } : { }),
662
- ...(options.login !== undefined ? { login: options.login } : { }),
663
- ...(options.map !== undefined ? { map: options.map } : { }),
664
- ...(options.githubToken !== undefined ? { githubToken: options.githubToken } : { }),
665
- ...(options.fetch !== undefined ? { fetch: options.fetch } : { }),
660
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
661
+ ...(options.email !== undefined ? { email: options.email } : {}),
662
+ ...(options.login !== undefined ? { login: options.login } : {}),
663
+ ...(options.map !== undefined ? { map: options.map } : {}),
664
+ ...(options.githubToken !== undefined ? { githubToken: options.githubToken } : {}),
665
+ ...(options.fetch !== undefined ? { fetch: options.fetch } : {}),
666
666
  });
667
- return mapAuthor(author) ?? { };
667
+ return mapAuthor(author) ?? {};
668
668
  },
669
669
  },
670
670
  lint: {
@@ -674,56 +674,60 @@ function wrapBinding(binding: NativeBinding): NiftyNative {
674
674
  updater: {
675
675
  run: (options) => {
676
676
  binding.updaterRun({
677
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
678
- ...(options.interactive !== undefined ? { interactive: options.interactive } : { }),
677
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
678
+ ...(options.interactive !== undefined ? { interactive: options.interactive } : {}),
679
679
  });
680
680
  },
681
681
  },
682
682
  formatter: {
683
683
  run: (options) =>
684
684
  binding.formatterRun({
685
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
686
- ...(options.check !== undefined ? { check: options.check } : { }),
687
- ...(options.includes !== undefined ? { includes: options.includes } : { }),
688
- ...(options.excludes !== undefined ? { excludes: options.excludes } : { }),
689
- ...(options.rust !== undefined ? { rust: options.rust } : { }),
690
- ...(options.javascript !== undefined ? { javascript: options.javascript } : { }),
691
- ...(options.style !== undefined ? { style: options.style } : { }),
685
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
686
+ ...(options.check !== undefined ? { check: options.check } : {}),
687
+ ...(options.includes !== undefined ? { includes: options.includes } : {}),
688
+ ...(options.excludes !== undefined ? { excludes: options.excludes } : {}),
689
+ ...(options.rust !== undefined ? { rust: options.rust } : {}),
690
+ ...(options.javascript !== undefined ? { javascript: options.javascript } : {}),
691
+ ...(options.style !== undefined ? { style: options.style } : {}),
692
692
  }),
693
693
  },
694
694
  publisher: {
695
695
  "publish-workspace": (options) =>
696
696
  binding.publisherPublishWorkspace({
697
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
698
- ...(options.dryRun !== undefined ? { dryRun: options.dryRun } : { }),
699
- ...(options.refresh !== undefined ? { refresh: options.refresh } : { }),
700
- ...(options.placeholder !== undefined ? { placeholder: options.placeholder } : { }),
701
- ...(options.only !== undefined ? { only: options.only } : { }),
702
- ...(options.packages !== undefined ? { packages: options.packages } : { }),
703
- ...(options.tag !== undefined ? { tag: options.tag } : { }),
704
- ...(options.access !== undefined ? { access: options.access } : { }),
705
- ...(options.npm !== undefined ? { npm: options.npm } : { }),
706
- ...(options.otp !== undefined ? { otp: options.otp } : { }),
707
- ...(options.totpSecret !== undefined ? { totpSecret: options.totpSecret } : { }),
708
- ...(options.token !== undefined ? { token: options.token } : { }),
709
- ...(options.trustRepo !== undefined ? { trustRepo: options.trustRepo } : { }),
710
- ...(options.trustFile !== undefined ? { trustFile: options.trustFile } : { }),
711
- ...(options.trustEnvironment !== undefined ? { trustEnvironment: options.trustEnvironment } : { }),
697
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
698
+ ...(options.dryRun !== undefined ? { dryRun: options.dryRun } : {}),
699
+ ...(options.refresh !== undefined ? { refresh: options.refresh } : {}),
700
+ ...(options.placeholder !== undefined ? { placeholder: options.placeholder } : {}),
701
+ ...(options.only !== undefined ? { only: options.only } : {}),
702
+ ...(options.packages !== undefined ? { packages: options.packages } : {}),
703
+ ...(options.tag !== undefined ? { tag: options.tag } : {}),
704
+ ...(options.access !== undefined ? { access: options.access } : {}),
705
+ ...(options.npm !== undefined ? { npm: options.npm } : {}),
706
+ ...(options.otp !== undefined ? { otp: options.otp } : {}),
707
+ ...(options.totpSecret !== undefined ? { totpSecret: options.totpSecret } : {}),
708
+ ...(options.token !== undefined ? { token: options.token } : {}),
709
+ ...(options.trustRepo !== undefined ? { trustRepo: options.trustRepo } : {}),
710
+ ...(options.trustFile !== undefined ? { trustFile: options.trustFile } : {}),
711
+ ...(options.trustEnvironment !== undefined
712
+ ? { trustEnvironment: options.trustEnvironment }
713
+ : {}),
712
714
  }),
713
715
  "trust-workspace": (options) =>
714
716
  binding.publisherTrustWorkspace({
715
- ...(options.cwd !== undefined ? { cwd: options.cwd } : { }),
716
- ...(options.dryRun !== undefined ? { dryRun: options.dryRun } : { }),
717
- ...(options.refresh !== undefined ? { refresh: options.refresh } : { }),
718
- ...(options.only !== undefined ? { only: options.only } : { }),
719
- ...(options.packages !== undefined ? { packages: options.packages } : { }),
720
- ...(options.npm !== undefined ? { npm: options.npm } : { }),
721
- ...(options.otp !== undefined ? { otp: options.otp } : { }),
722
- ...(options.totpSecret !== undefined ? { totpSecret: options.totpSecret } : { }),
723
- ...(options.token !== undefined ? { token: options.token } : { }),
724
- ...(options.trustRepo !== undefined ? { trustRepo: options.trustRepo } : { }),
725
- ...(options.trustFile !== undefined ? { trustFile: options.trustFile } : { }),
726
- ...(options.trustEnvironment !== undefined ? { trustEnvironment: options.trustEnvironment } : { }),
717
+ ...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
718
+ ...(options.dryRun !== undefined ? { dryRun: options.dryRun } : {}),
719
+ ...(options.refresh !== undefined ? { refresh: options.refresh } : {}),
720
+ ...(options.only !== undefined ? { only: options.only } : {}),
721
+ ...(options.packages !== undefined ? { packages: options.packages } : {}),
722
+ ...(options.npm !== undefined ? { npm: options.npm } : {}),
723
+ ...(options.otp !== undefined ? { otp: options.otp } : {}),
724
+ ...(options.totpSecret !== undefined ? { totpSecret: options.totpSecret } : {}),
725
+ ...(options.token !== undefined ? { token: options.token } : {}),
726
+ ...(options.trustRepo !== undefined ? { trustRepo: options.trustRepo } : {}),
727
+ ...(options.trustFile !== undefined ? { trustFile: options.trustFile } : {}),
728
+ ...(options.trustEnvironment !== undefined
729
+ ? { trustEnvironment: options.trustEnvironment }
730
+ : {}),
727
731
  }),
728
732
  },
729
733
  };
package/src/nifty.ts CHANGED
@@ -58,20 +58,22 @@ export class Nifty {
58
58
  this.configFile = configFile;
59
59
  }
60
60
 
61
- static async open(options: NiftyOpenOptions = { }): Promise < Nifty> {
61
+ static async open(options: NiftyOpenOptions = {}): Promise<Nifty> {
62
62
  const cwd = options.cwd ?? process.cwd();
63
63
  const layout = detectProjectLayout(cwd);
64
64
  const { config: skipConfig, configFile, env, githubToken, authorMap, repoRoot, cargoRoot, npmRoot } = options;
65
65
  const loaded =
66
- skipConfig === false ? { config: { } as NiftyConfig }: await loadConfig({ cwd, configFile, env: { layout, ...env } });
66
+ skipConfig === false
67
+ ? { config: {} as NiftyConfig }
68
+ : await loadConfig({ cwd, configFile, env: { layout, ...env } });
67
69
  const merged = resolveRoots(
68
70
  {
69
71
  ...loaded.config,
70
- ...(githubToken !== undefined ? { githubToken } : { }),
71
- ...(authorMap !== undefined ? { authorMap } : { }),
72
- ...(repoRoot !== undefined ? { repoRoot } : { }),
73
- ...(cargoRoot !== undefined ? { cargoRoot } : { }),
74
- ...(npmRoot !== undefined ? { npmRoot } : { }),
72
+ ...(githubToken !== undefined ? { githubToken } : {}),
73
+ ...(authorMap !== undefined ? { authorMap } : {}),
74
+ ...(repoRoot !== undefined ? { repoRoot } : {}),
75
+ ...(cargoRoot !== undefined ? { cargoRoot } : {}),
76
+ ...(npmRoot !== undefined ? { npmRoot } : {}),
75
77
  },
76
78
  layout,
77
79
  );
@@ -89,6 +91,6 @@ export class Nifty {
89
91
  }
90
92
  }
91
93
 
92
- export async function createNifty(options: NiftyOpenOptions = { }): Promise < Nifty> {
94
+ export async function createNifty(options: NiftyOpenOptions = {}): Promise<Nifty> {
93
95
  return Nifty.open(options);
94
96
  }