@doki-land/nifty 0.1.1 → 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/nifty.ts CHANGED
@@ -15,41 +15,41 @@ import { loadNiftyNative } from "./native.js";
15
15
  export type NiftyOpenOptions = NiftyConfig &
16
16
  LoadConfigOptions & {
17
17
  /** When `false`, skip loading `nifty.config.ts/js`. Inline options still apply. */
18
- config ? : false;
18
+ config?: false;
19
19
  };
20
20
 
21
- function resolveRoots(config : NiftyConfig, layout : ProjectLayout) : NiftyConfig {
21
+ function resolveRoots(config: NiftyConfig, layout: ProjectLayout): NiftyConfig {
22
22
  return {
23
23
  ...config,
24
- repoRoot : config.repoRoot ?? layout.root,
25
- cargoRoot :
24
+ repoRoot: config.repoRoot ?? layout.root,
25
+ cargoRoot:
26
26
  config.cargoRoot ??
27
27
  layout.cargoWorkspaceRoot ??
28
- (layout.cargoManifest ? layout.cargoManifest.replace( /[/\\]Cargo\.toml$/ , "") : undefined),
29
- npmRoot :
28
+ (layout.cargoManifest ? layout.cargoManifest.replace(/[/\\]Cargo\.toml$/, "") : undefined),
29
+ npmRoot:
30
30
  config.npmRoot ??
31
31
  layout.npmWorkspaceRoot ??
32
- (layout.packageManifest ? layout.packageManifest.replace( /[/\\]package\.json$/ , "") : undefined),
32
+ (layout.packageManifest ? layout.packageManifest.replace(/[/\\]package\.json$/, "") : undefined),
33
33
  };
34
34
  }
35
35
 
36
36
  /** Combined Nifty engine: gitmoji conventions + gix repository reads + GitHub API. */
37
37
  export class Nifty {
38
- readonly gitmoji : Gitmoji;
39
- readonly git : Git;
40
- readonly github : Github;
41
- readonly config : NiftyConfig;
42
- readonly layout : ProjectLayout;
43
- readonly configFile ? : string;
38
+ readonly gitmoji: Gitmoji;
39
+ readonly git: Git;
40
+ readonly github: Github;
41
+ readonly config: NiftyConfig;
42
+ readonly layout: ProjectLayout;
43
+ readonly configFile?: string;
44
44
 
45
45
  private constructor(
46
- gitmoji : Gitmoji,
47
- git : Git,
48
- github : Github,
49
- config : NiftyConfig,
50
- layout : ProjectLayout,
51
- configFile ? : string,
52
- ){
46
+ gitmoji: Gitmoji,
47
+ git: Git,
48
+ github: Github,
49
+ config: NiftyConfig,
50
+ layout: ProjectLayout,
51
+ configFile?: string,
52
+ ) {
53
53
  this.gitmoji = gitmoji;
54
54
  this.git = git;
55
55
  this.github = github;
@@ -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
- const { config : skipConfig, configFile, env, githubToken, authorMap, repoRoot, cargoRoot, npmRoot } = options;
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
  }
package/src/types.ts CHANGED
@@ -1,15 +1,15 @@
1
1
  /** GitHub author resolved from noreply email or `author-github.json`. */
2
2
  export type GithubAuthor = {
3
- id ? : bigint;
4
- login ? : string;
3
+ id?: bigint;
4
+ login?: string;
5
5
  };
6
6
 
7
7
  /** Nifty gitmoji-parsed commit subject. */
8
8
  export type ParsedSubject = {
9
- gitmoji ? : string;
10
- body : string;
9
+ gitmoji?: string;
10
+ body: string;
11
11
  /** `features` | `fixes` | `breaking` | `other` */
12
- section : string;
12
+ section: string;
13
13
  };
14
14
 
15
15
  /** Release note section keys (Nifty gitmoji grouping). */
@@ -17,24 +17,24 @@ export type ReleaseSection = "features" | "fixes" | "breaking" | "other";
17
17
 
18
18
  /** Semver tag with short hash. */
19
19
  export type TagInfo = {
20
- name : string;
21
- shortHash : string;
20
+ name: string;
21
+ shortHash: string;
22
22
  };
23
23
 
24
24
  /** Resolved release tag range. */
25
25
  export type RangeInfo = {
26
- version : string;
27
- fromRef ? : string;
28
- toRef : string;
26
+ version: string;
27
+ fromRef?: string;
28
+ toRef: string;
29
29
  };
30
30
 
31
31
  /** Commit from repository history with Nifty gitmoji fields. */
32
32
  export type CommitRecord = {
33
- hash : string;
34
- email : string;
35
- author : string;
36
- subject : string;
37
- body : string;
38
- gitmoji ? : string;
39
- section : ReleaseSection;
33
+ hash: string;
34
+ email: string;
35
+ author: string;
36
+ subject: string;
37
+ body: string;
38
+ gitmoji?: string;
39
+ section: ReleaseSection;
40
40
  };