@doki-land/nifty 0.0.0 → 0.0.1
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/Readme.md +30 -30
- package/cli/nifty.mjs +11 -11
- package/locales/en-US/cli.json +41 -0
- package/locales/locales.json +4 -0
- package/package.json +13 -6
- package/src/cli/authArgs.ts +52 -52
- package/src/cli/bump-cmd.ts +55 -0
- package/src/cli/bump.ts +237 -237
- package/src/cli/cli.ts +39 -0
- package/src/cli/context.ts +36 -26
- package/src/cli/index.ts +9 -8
- package/src/cli/install-native-cmd.ts +22 -0
- package/src/cli/install-native.ts +80 -0
- package/src/cli/lint-cmd.ts +33 -0
- package/src/cli/lint.ts +113 -109
- package/src/cli/main.ts +1 -64
- package/src/cli/options.ts +40 -0
- package/src/cli/publish-cmd.ts +34 -0
- package/src/cli/publish.ts +95 -85
- package/src/cli/resolveNpm.ts +16 -16
- package/src/cli/trust-cmd.ts +35 -0
- package/src/cli/trust.ts +83 -77
- package/src/cli/update-cmd.ts +20 -0
- package/src/cli/update.ts +185 -182
- package/src/cli/upload-cmd.ts +44 -0
- package/src/cli/upload.ts +313 -280
- package/src/cli/workspace.ts +124 -124
- package/src/config/defineConfig.ts +12 -12
- package/src/config/detectProject.ts +189 -189
- package/src/config/index.ts +25 -25
- package/src/config/loadConfig.ts +129 -129
- package/src/config/types.ts +43 -43
- package/src/git.ts +61 -61
- package/src/github.ts +184 -184
- package/src/gitmoji.ts +77 -77
- package/src/index.ts +36 -36
- package/src/native.ts +284 -277
- package/src/nifty.ts +95 -95
- package/src/types.ts +40 -40
package/src/native.ts
CHANGED
|
@@ -1,277 +1,284 @@
|
|
|
1
|
-
import { createRequire } from "node:module";
|
|
2
|
-
import type {
|
|
3
|
-
CommitRecord,
|
|
4
|
-
GithubAuthor,
|
|
5
|
-
ParsedSubject,
|
|
6
|
-
RangeInfo,
|
|
7
|
-
ReleaseSection,
|
|
8
|
-
TagInfo,
|
|
9
|
-
} from "./types.js";
|
|
10
|
-
|
|
11
|
-
export type GitmojiExports = {
|
|
12
|
-
"known-gitmojis": () => string[];
|
|
13
|
-
"validate-subject": (subject: string) => boolean;
|
|
14
|
-
"parse-subject": (subject: string) => ParsedSubject;
|
|
15
|
-
"format-subject": (gitmoji: string, body: string) => string;
|
|
16
|
-
"strip-gitmoji": (subject: string) => string;
|
|
17
|
-
"leading-gitmoji": (subject: string) => string | undefined;
|
|
18
|
-
"section-for-gitmoji": (gitmoji: string | undefined) => ReleaseSection;
|
|
19
|
-
"parse-noreply-email": (email: string) => GithubAuthor | undefined;
|
|
20
|
-
"resolve-github-author": (email: string, authorMapJson: string) => GithubAuthor | undefined;
|
|
21
|
-
"display-login": (author: GithubAuthor) => string;
|
|
22
|
-
"profile-url": (author: GithubAuthor) => string;
|
|
23
|
-
"avatar-url": (author: GithubAuthor) => string;
|
|
24
|
-
"author-mention": (email: string, authorName: string, authorMapJson: string) => string;
|
|
25
|
-
"commit-bullet": (body: string, email: string, authorName: string, authorMapJson: string) => string;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
export type GitExports = {
|
|
29
|
-
"discover-root": (startPath: string) => string;
|
|
30
|
-
"list-version-tags": (repoRoot: string) => string[];
|
|
31
|
-
"list-tag-infos": (repoRoot: string) => Array<{ name: string; "short-hash": string }>;
|
|
32
|
-
"format-tag-list": (repoRoot: string) => string;
|
|
33
|
-
"resolve-range": (
|
|
34
|
-
repoRoot: string,
|
|
35
|
-
version: string | undefined,
|
|
36
|
-
fromRef: string | undefined,
|
|
37
|
-
toRef: string | undefined,
|
|
38
|
-
) => { version: string; "from-ref"?: string; "to-ref": string };
|
|
39
|
-
"collect-commits": (
|
|
40
|
-
repoRoot: string,
|
|
41
|
-
fromRef: string | undefined,
|
|
42
|
-
toRef: string,
|
|
43
|
-
) => Array<{
|
|
44
|
-
hash: string;
|
|
45
|
-
email: string;
|
|
46
|
-
author: string;
|
|
47
|
-
subject: string;
|
|
48
|
-
body: string;
|
|
49
|
-
gitmoji?: string;
|
|
50
|
-
section: string;
|
|
51
|
-
}>;
|
|
52
|
-
"detect-github-repo": (repoRoot: string) => string | undefined;
|
|
53
|
-
"parse-github-remote": (url: string) => string | undefined;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export type PublishReport = {
|
|
57
|
-
root: string;
|
|
58
|
-
order: string[];
|
|
59
|
-
published: string[];
|
|
60
|
-
skipped: string[];
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
"
|
|
178
|
-
"
|
|
179
|
-
"parse-
|
|
180
|
-
"
|
|
181
|
-
|
|
182
|
-
"
|
|
183
|
-
"
|
|
184
|
-
"
|
|
185
|
-
"author
|
|
186
|
-
binding.
|
|
187
|
-
"
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
"
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
"
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
"
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
...(options.
|
|
220
|
-
...(options.
|
|
221
|
-
...(options.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
...(options.
|
|
226
|
-
...(options.
|
|
227
|
-
...(options.
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
...(options.
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import type {
|
|
3
|
+
CommitRecord,
|
|
4
|
+
GithubAuthor,
|
|
5
|
+
ParsedSubject,
|
|
6
|
+
RangeInfo,
|
|
7
|
+
ReleaseSection,
|
|
8
|
+
TagInfo,
|
|
9
|
+
} from "./types.js";
|
|
10
|
+
|
|
11
|
+
export type GitmojiExports = {
|
|
12
|
+
"known-gitmojis": () => string[];
|
|
13
|
+
"validate-subject": (subject: string) => boolean;
|
|
14
|
+
"parse-subject": (subject: string) => ParsedSubject;
|
|
15
|
+
"format-subject": (gitmoji: string, body: string) => string;
|
|
16
|
+
"strip-gitmoji": (subject: string) => string;
|
|
17
|
+
"leading-gitmoji": (subject: string) => string | undefined;
|
|
18
|
+
"section-for-gitmoji": (gitmoji: string | undefined) => ReleaseSection;
|
|
19
|
+
"parse-noreply-email": (email: string) => GithubAuthor | undefined;
|
|
20
|
+
"resolve-github-author": (email: string, authorMapJson: string) => GithubAuthor | undefined;
|
|
21
|
+
"display-login": (author: GithubAuthor) => string;
|
|
22
|
+
"profile-url": (author: GithubAuthor) => string;
|
|
23
|
+
"avatar-url": (author: GithubAuthor) => string;
|
|
24
|
+
"author-mention": (email: string, authorName: string, authorMapJson: string) => string;
|
|
25
|
+
"commit-bullet": (body: string, email: string, authorName: string, authorMapJson: string) => string;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type GitExports = {
|
|
29
|
+
"discover-root": (startPath: string) => string;
|
|
30
|
+
"list-version-tags": (repoRoot: string) => string[];
|
|
31
|
+
"list-tag-infos": (repoRoot: string) => Array<{ name: string; "short-hash": string }>;
|
|
32
|
+
"format-tag-list": (repoRoot: string) => string;
|
|
33
|
+
"resolve-range": (
|
|
34
|
+
repoRoot: string,
|
|
35
|
+
version: string | undefined,
|
|
36
|
+
fromRef: string | undefined,
|
|
37
|
+
toRef: string | undefined,
|
|
38
|
+
) => { version: string; "from-ref"?: string; "to-ref": string };
|
|
39
|
+
"collect-commits": (
|
|
40
|
+
repoRoot: string,
|
|
41
|
+
fromRef: string | undefined,
|
|
42
|
+
toRef: string,
|
|
43
|
+
) => Array<{
|
|
44
|
+
hash: string;
|
|
45
|
+
email: string;
|
|
46
|
+
author: string;
|
|
47
|
+
subject: string;
|
|
48
|
+
body: string;
|
|
49
|
+
gitmoji?: string;
|
|
50
|
+
section: string;
|
|
51
|
+
}>;
|
|
52
|
+
"detect-github-repo": (repoRoot: string) => string | undefined;
|
|
53
|
+
"parse-github-remote": (url: string) => string | undefined;
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export type PublishReport = {
|
|
57
|
+
root: string;
|
|
58
|
+
order: string[];
|
|
59
|
+
published: string[];
|
|
60
|
+
skipped: string[];
|
|
61
|
+
skippedVersions: string[];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type TrustReport = {
|
|
65
|
+
root: string;
|
|
66
|
+
configured: string[];
|
|
67
|
+
skipped: string[];
|
|
68
|
+
failed: string[];
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export type PublisherExports = {
|
|
72
|
+
"publish-workspace": (options: {
|
|
73
|
+
cwd?: string;
|
|
74
|
+
dryRun?: boolean;
|
|
75
|
+
refresh?: boolean;
|
|
76
|
+
tag?: string;
|
|
77
|
+
access?: string;
|
|
78
|
+
npm?: string;
|
|
79
|
+
otp?: string;
|
|
80
|
+
totpSecret?: string;
|
|
81
|
+
token?: string;
|
|
82
|
+
}) => PublishReport;
|
|
83
|
+
"trust-workspace": (options: {
|
|
84
|
+
cwd?: string;
|
|
85
|
+
dryRun?: boolean;
|
|
86
|
+
refresh?: boolean;
|
|
87
|
+
only?: string;
|
|
88
|
+
npm?: string;
|
|
89
|
+
otp?: string;
|
|
90
|
+
totpSecret?: string;
|
|
91
|
+
token?: string;
|
|
92
|
+
}) => TrustReport;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
export type NiftyNative = {
|
|
96
|
+
gitmoji: GitmojiExports;
|
|
97
|
+
git: GitExports;
|
|
98
|
+
publisher: PublisherExports;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
type NativeBinding = {
|
|
102
|
+
gitmojiKnownGitmojis: () => string[];
|
|
103
|
+
gitmojiValidateSubject: (subject: string) => boolean;
|
|
104
|
+
gitmojiParseSubject: (subject: string) => ParsedSubject;
|
|
105
|
+
gitmojiFormatSubject: (gitmoji: string, body: string) => string;
|
|
106
|
+
gitmojiStripGitmoji: (subject: string) => string;
|
|
107
|
+
gitmojiLeadingGitmoji: (subject: string) => string | null;
|
|
108
|
+
gitmojiSectionForGitmoji: (gitmoji?: string | null) => string;
|
|
109
|
+
gitmojiParseNoreplyEmail: (email: string) => GithubAuthor | null;
|
|
110
|
+
gitmojiResolveGithubAuthor: (email: string, authorMapJson: string) => GithubAuthor | null;
|
|
111
|
+
gitmojiDisplayLogin: (author: GithubAuthor) => string;
|
|
112
|
+
gitmojiProfileUrl: (author: GithubAuthor) => string;
|
|
113
|
+
gitmojiAvatarUrl: (author: GithubAuthor) => string;
|
|
114
|
+
gitmojiAuthorMention: (email: string, authorName: string, authorMapJson: string) => string;
|
|
115
|
+
gitmojiCommitBullet: (body: string, email: string, authorName: string, authorMapJson: string) => string;
|
|
116
|
+
gitDiscoverRoot: (startPath: string) => string;
|
|
117
|
+
gitListVersionTags: (repoRoot: string) => string[];
|
|
118
|
+
gitListTagInfos: (repoRoot: string) => Array<{ name: string; shortHash: string }>;
|
|
119
|
+
gitFormatTagList: (repoRoot: string) => string;
|
|
120
|
+
gitResolveRange: (
|
|
121
|
+
repoRoot: string,
|
|
122
|
+
version?: string | null,
|
|
123
|
+
fromRef?: string | null,
|
|
124
|
+
toRef?: string | null,
|
|
125
|
+
) => { version: string; fromRef?: string; toRef: string };
|
|
126
|
+
gitCollectCommits: (
|
|
127
|
+
repoRoot: string,
|
|
128
|
+
fromRef: string | null | undefined,
|
|
129
|
+
toRef: string,
|
|
130
|
+
) => CommitRecord[];
|
|
131
|
+
gitDetectGithubRepo: (repoRoot: string) => string | null;
|
|
132
|
+
gitParseGithubRemote: (url: string) => string | null;
|
|
133
|
+
publisherPublishWorkspace: (options: {
|
|
134
|
+
cwd?: string | null;
|
|
135
|
+
dryRun?: boolean | null;
|
|
136
|
+
refresh?: boolean | null;
|
|
137
|
+
tag?: string | null;
|
|
138
|
+
access?: string | null;
|
|
139
|
+
npm?: string | null;
|
|
140
|
+
otp?: string | null;
|
|
141
|
+
totpSecret?: string | null;
|
|
142
|
+
token?: string | null;
|
|
143
|
+
}) => PublishReport;
|
|
144
|
+
publisherTrustWorkspace: (options: {
|
|
145
|
+
cwd?: string | null;
|
|
146
|
+
dryRun?: boolean | null;
|
|
147
|
+
refresh?: boolean | null;
|
|
148
|
+
only?: string | null;
|
|
149
|
+
npm?: string | null;
|
|
150
|
+
otp?: string | null;
|
|
151
|
+
totpSecret?: string | null;
|
|
152
|
+
token?: string | null;
|
|
153
|
+
}) => TrustReport;
|
|
154
|
+
};
|
|
155
|
+
|
|
156
|
+
const PLATFORM_PACKAGES: Record<string, string> = {
|
|
157
|
+
"win32-x64": "@doki-land/nifty-win32-x64",
|
|
158
|
+
"linux-x64": "@doki-land/nifty-linux-x64",
|
|
159
|
+
"linux-arm64": "@doki-land/nifty-linux-arm64",
|
|
160
|
+
"darwin-x64": "@doki-land/nifty-darwin-x64",
|
|
161
|
+
"darwin-arm64": "@doki-land/nifty-darwin-arm64",
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
function mapAuthor(raw: GithubAuthor | null | undefined): GithubAuthor | undefined {
|
|
165
|
+
if (!raw) {
|
|
166
|
+
return undefined;
|
|
167
|
+
}
|
|
168
|
+
return {
|
|
169
|
+
id: raw.id !== undefined && raw.id !== null ? BigInt(raw.id) : undefined,
|
|
170
|
+
login: raw.login ?? undefined,
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
function wrapBinding(binding: NativeBinding): NiftyNative {
|
|
175
|
+
return {
|
|
176
|
+
gitmoji: {
|
|
177
|
+
"known-gitmojis": () => binding.gitmojiKnownGitmojis(),
|
|
178
|
+
"validate-subject": (subject) => binding.gitmojiValidateSubject(subject),
|
|
179
|
+
"parse-subject": (subject) => binding.gitmojiParseSubject(subject),
|
|
180
|
+
"format-subject": (gitmoji, body) => binding.gitmojiFormatSubject(gitmoji, body),
|
|
181
|
+
"strip-gitmoji": (subject) => binding.gitmojiStripGitmoji(subject),
|
|
182
|
+
"leading-gitmoji": (subject) => binding.gitmojiLeadingGitmoji(subject) ?? undefined,
|
|
183
|
+
"section-for-gitmoji": (gitmoji) => binding.gitmojiSectionForGitmoji(gitmoji) as ReleaseSection,
|
|
184
|
+
"parse-noreply-email": (email) => mapAuthor(binding.gitmojiParseNoreplyEmail(email)),
|
|
185
|
+
"resolve-github-author": (email, authorMapJson) =>
|
|
186
|
+
mapAuthor(binding.gitmojiResolveGithubAuthor(email, authorMapJson)),
|
|
187
|
+
"display-login": (author) => binding.gitmojiDisplayLogin(author),
|
|
188
|
+
"profile-url": (author) => binding.gitmojiProfileUrl(author),
|
|
189
|
+
"avatar-url": (author) => binding.gitmojiAvatarUrl(author),
|
|
190
|
+
"author-mention": (email, authorName, authorMapJson) =>
|
|
191
|
+
binding.gitmojiAuthorMention(email, authorName, authorMapJson),
|
|
192
|
+
"commit-bullet": (body, email, authorName, authorMapJson) =>
|
|
193
|
+
binding.gitmojiCommitBullet(body, email, authorName, authorMapJson),
|
|
194
|
+
},
|
|
195
|
+
git: {
|
|
196
|
+
"discover-root": (startPath) => binding.gitDiscoverRoot(startPath),
|
|
197
|
+
"list-version-tags": (repoRoot) => binding.gitListVersionTags(repoRoot),
|
|
198
|
+
"list-tag-infos": (repoRoot) =>
|
|
199
|
+
binding.gitListTagInfos(repoRoot).map((tag) => ({
|
|
200
|
+
name: tag.name,
|
|
201
|
+
"short-hash": tag.shortHash,
|
|
202
|
+
})),
|
|
203
|
+
"format-tag-list": (repoRoot) => binding.gitFormatTagList(repoRoot),
|
|
204
|
+
"resolve-range": (repoRoot, version, fromRef, toRef) => {
|
|
205
|
+
const range = binding.gitResolveRange(repoRoot, version, fromRef, toRef);
|
|
206
|
+
return {
|
|
207
|
+
version: range.version,
|
|
208
|
+
"from-ref": range.fromRef,
|
|
209
|
+
"to-ref": range.toRef,
|
|
210
|
+
};
|
|
211
|
+
},
|
|
212
|
+
"collect-commits": (repoRoot, fromRef, toRef) => binding.gitCollectCommits(repoRoot, fromRef, toRef),
|
|
213
|
+
"detect-github-repo": (repoRoot) => binding.gitDetectGithubRepo(repoRoot) ?? undefined,
|
|
214
|
+
"parse-github-remote": (url) => binding.gitParseGithubRemote(url) ?? undefined,
|
|
215
|
+
},
|
|
216
|
+
publisher: {
|
|
217
|
+
"publish-workspace": (options) =>
|
|
218
|
+
binding.publisherPublishWorkspace({
|
|
219
|
+
...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
|
|
220
|
+
...(options.dryRun !== undefined ? { dryRun: options.dryRun } : {}),
|
|
221
|
+
...(options.refresh !== undefined ? { refresh: options.refresh } : {}),
|
|
222
|
+
...(options.tag !== undefined ? { tag: options.tag } : {}),
|
|
223
|
+
...(options.access !== undefined ? { access: options.access } : {}),
|
|
224
|
+
...(options.npm !== undefined ? { npm: options.npm } : {}),
|
|
225
|
+
...(options.otp !== undefined ? { otp: options.otp } : {}),
|
|
226
|
+
...(options.totpSecret !== undefined ? { totpSecret: options.totpSecret } : {}),
|
|
227
|
+
...(options.token !== undefined ? { token: options.token } : {}),
|
|
228
|
+
}),
|
|
229
|
+
"trust-workspace": (options) =>
|
|
230
|
+
binding.publisherTrustWorkspace({
|
|
231
|
+
...(options.cwd !== undefined ? { cwd: options.cwd } : {}),
|
|
232
|
+
...(options.dryRun !== undefined ? { dryRun: options.dryRun } : {}),
|
|
233
|
+
...(options.refresh !== undefined ? { refresh: options.refresh } : {}),
|
|
234
|
+
...(options.only !== undefined ? { only: options.only } : {}),
|
|
235
|
+
...(options.npm !== undefined ? { npm: options.npm } : {}),
|
|
236
|
+
...(options.otp !== undefined ? { otp: options.otp } : {}),
|
|
237
|
+
...(options.totpSecret !== undefined ? { totpSecret: options.totpSecret } : {}),
|
|
238
|
+
...(options.token !== undefined ? { token: options.token } : {}),
|
|
239
|
+
}),
|
|
240
|
+
},
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
let cached: NiftyNative | undefined;
|
|
245
|
+
|
|
246
|
+
/** Load the platform-specific Node-API binary from `@doki-land/nifty-<platform>`. */
|
|
247
|
+
export function loadNiftyNative(): NiftyNative {
|
|
248
|
+
if (cached) {
|
|
249
|
+
return cached;
|
|
250
|
+
}
|
|
251
|
+
const key = `${process.platform}-${process.arch}`;
|
|
252
|
+
const pkg = PLATFORM_PACKAGES[key];
|
|
253
|
+
if (!pkg) {
|
|
254
|
+
throw new Error(`Unsupported platform for Nifty native bindings: ${key}`);
|
|
255
|
+
}
|
|
256
|
+
const require = createRequire(import.meta.url);
|
|
257
|
+
const binding = require(pkg).default as NativeBinding;
|
|
258
|
+
cached = wrapBinding(binding);
|
|
259
|
+
return cached;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export function mapTagInfo(raw: { name: string; "short-hash": string }): TagInfo {
|
|
263
|
+
return { name: raw.name, shortHash: raw["short-hash"] };
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export function mapRangeInfo(raw: { version: string; "from-ref"?: string; "to-ref": string }): RangeInfo {
|
|
267
|
+
return {
|
|
268
|
+
version: raw.version,
|
|
269
|
+
fromRef: raw["from-ref"],
|
|
270
|
+
toRef: raw["to-ref"],
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
export function mapCommitRecord(raw: CommitRecord): CommitRecord {
|
|
275
|
+
return {
|
|
276
|
+
hash: raw.hash,
|
|
277
|
+
email: raw.email,
|
|
278
|
+
author: raw.author,
|
|
279
|
+
subject: raw.subject,
|
|
280
|
+
body: raw.body,
|
|
281
|
+
gitmoji: raw.gitmoji,
|
|
282
|
+
section: raw.section as ReleaseSection,
|
|
283
|
+
};
|
|
284
|
+
}
|