@doki-land/nifty 0.1.0 → 0.1.2

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/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,60 +674,56 @@ 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
712
- ? { trustEnvironment: options.trustEnvironment }
713
- : {}),
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 } : { }),
714
712
  }),
715
713
  "trust-workspace": (options) =>
716
714
  binding.publisherTrustWorkspace({
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
- : {}),
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 } : { }),
731
727
  }),
732
728
  },
733
729
  };
package/src/nifty.ts CHANGED
@@ -58,22 +58,20 @@ 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
67
- ? { config: {} as NiftyConfig }
68
- : await loadConfig({ cwd, configFile, env: { layout, ...env } });
66
+ skipConfig === false ? { config: { } as NiftyConfig }: await loadConfig({ cwd, configFile, env: { layout, ...env } });
69
67
  const merged = resolveRoots(
70
68
  {
71
69
  ...loaded.config,
72
- ...(githubToken !== undefined ? { githubToken } : {}),
73
- ...(authorMap !== undefined ? { authorMap } : {}),
74
- ...(repoRoot !== undefined ? { repoRoot } : {}),
75
- ...(cargoRoot !== undefined ? { cargoRoot } : {}),
76
- ...(npmRoot !== undefined ? { npmRoot } : {}),
70
+ ...(githubToken !== undefined ? { githubToken } : { }),
71
+ ...(authorMap !== undefined ? { authorMap } : { }),
72
+ ...(repoRoot !== undefined ? { repoRoot } : { }),
73
+ ...(cargoRoot !== undefined ? { cargoRoot } : { }),
74
+ ...(npmRoot !== undefined ? { npmRoot } : { }),
77
75
  },
78
76
  layout,
79
77
  );
@@ -91,6 +89,6 @@ export class Nifty {
91
89
  }
92
90
  }
93
91
 
94
- export async function createNifty(options: NiftyOpenOptions = {}): Promise<Nifty> {
92
+ export async function createNifty(options: NiftyOpenOptions = { }): Promise < Nifty> {
95
93
  return Nifty.open(options);
96
94
  }