@funish/basis 0.1.2 → 0.2.0
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 +131 -427
- package/dist/THIRD-PARTY-LICENSES.md +276 -0
- package/dist/_chunks/config.mjs +1 -0
- package/dist/_chunks/libs/common.d.mts +6970 -0
- package/dist/_chunks/libs/common.mjs +1 -0
- package/dist/_chunks/types.d.mts +194 -0
- package/dist/cli.d.mts +1 -1
- package/dist/cli.mjs +8 -1
- package/dist/commands/add.d.mts +2 -0
- package/dist/commands/add.mjs +1 -0
- package/dist/commands/audit.d.mts +2 -0
- package/dist/commands/audit.mjs +1 -0
- package/dist/commands/build.d.mts +2 -0
- package/dist/commands/build.mjs +1 -0
- package/dist/commands/check.d.mts +2 -0
- package/dist/commands/check.mjs +1 -0
- package/dist/commands/dlx.d.mts +2 -0
- package/dist/commands/dlx.mjs +1 -0
- package/dist/commands/fmt.d.mts +2 -0
- package/dist/commands/fmt.mjs +1 -0
- package/dist/commands/git.d.mts +2 -0
- package/dist/commands/git.mjs +1 -0
- package/dist/commands/init.d.mts +2 -0
- package/dist/commands/init.mjs +1 -0
- package/dist/commands/lint.d.mts +2 -0
- package/dist/commands/lint.mjs +1 -0
- package/dist/commands/publish.d.mts +2 -0
- package/dist/commands/publish.mjs +1 -0
- package/dist/commands/remove.d.mts +2 -0
- package/dist/commands/remove.mjs +1 -0
- package/dist/commands/run.d.mts +2 -0
- package/dist/commands/run.mjs +1 -0
- package/dist/commands/version.d.mts +2 -0
- package/dist/commands/version.mjs +1 -0
- package/dist/config.d.mts +24 -1
- package/dist/config.mjs +1 -1
- package/dist/index.d.mts +2 -178
- package/dist/index.mjs +1 -1
- package/package.json +65 -53
- package/LICENSE +0 -21
- package/dist/chunks/add.cjs +0 -1
- package/dist/chunks/add.mjs +0 -1
- package/dist/chunks/config.cjs +0 -1
- package/dist/chunks/config.mjs +0 -1
- package/dist/chunks/git.cjs +0 -1
- package/dist/chunks/git.mjs +0 -1
- package/dist/chunks/init.cjs +0 -1
- package/dist/chunks/init.mjs +0 -1
- package/dist/chunks/install.cjs +0 -1
- package/dist/chunks/install.mjs +0 -1
- package/dist/chunks/lint.cjs +0 -1
- package/dist/chunks/lint.mjs +0 -1
- package/dist/chunks/publish.cjs +0 -1
- package/dist/chunks/publish.mjs +0 -1
- package/dist/chunks/remove.cjs +0 -1
- package/dist/chunks/remove.mjs +0 -1
- package/dist/chunks/run.cjs +0 -1
- package/dist/chunks/run.mjs +0 -1
- package/dist/chunks/version.cjs +0 -1
- package/dist/chunks/version.mjs +0 -1
- package/dist/cli.cjs +0 -2
- package/dist/cli.d.cts +0 -1
- package/dist/cli.d.ts +0 -1
- package/dist/config.cjs +0 -1
- package/dist/config.d.cts +0 -1
- package/dist/config.d.ts +0 -1
- package/dist/index.cjs +0 -1
- package/dist/index.d.cts +0 -178
- package/dist/index.d.ts +0 -178
- package/dist/shared/basis.1-2-e6uu.cjs +0 -8
- package/dist/shared/basis.4m3-erzm.mjs +0 -1
- package/dist/shared/basis.BDhrNAQD.mjs +0 -10
- package/dist/shared/basis.Bqr6BGbD.cjs +0 -1
- package/dist/shared/basis.BrlVPuDi.mjs +0 -1
- package/dist/shared/basis.Bz4YLlJG.cjs +0 -1
- package/dist/shared/basis.C4FYR2wo.mjs +0 -8
- package/dist/shared/basis.CGkMo_WB.cjs +0 -3
- package/dist/shared/basis.CYJFGkEy.mjs +0 -1
- package/dist/shared/basis.Cc1QkX4i.mjs +0 -3
- package/dist/shared/basis.D3fInv-P.cjs +0 -1
- package/dist/shared/basis.DoHZYvYm.d.cts +0 -275
- package/dist/shared/basis.DoHZYvYm.d.mts +0 -275
- package/dist/shared/basis.DoHZYvYm.d.ts +0 -275
- package/dist/shared/basis.DuZo2uz1.cjs +0 -10
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
interface BasisConfig {
|
|
2
|
-
lint?: LintConfig;
|
|
3
|
-
git?: GitConfig;
|
|
4
|
-
version?: VersionConfig;
|
|
5
|
-
publish?: PublishConfig;
|
|
6
|
-
}
|
|
7
|
-
interface LintConfig {
|
|
8
|
-
staged?: Record<string, string>;
|
|
9
|
-
project?: Record<string, string>;
|
|
10
|
-
dependencies?: {
|
|
11
|
-
checkOutdated?: boolean;
|
|
12
|
-
checkSecurity?: boolean;
|
|
13
|
-
allowedLicenses?: string[];
|
|
14
|
-
blockedPackages?: string[];
|
|
15
|
-
};
|
|
16
|
-
structure?: {
|
|
17
|
-
requiredFiles?: string[];
|
|
18
|
-
requiredDirs?: string[];
|
|
19
|
-
naming?: Array<{
|
|
20
|
-
path: string;
|
|
21
|
-
files?: string;
|
|
22
|
-
directories?: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
}>;
|
|
25
|
-
};
|
|
26
|
-
docs?: {
|
|
27
|
-
checkReadme?: boolean;
|
|
28
|
-
checkChangelog?: boolean;
|
|
29
|
-
};
|
|
30
|
-
fix?: {
|
|
31
|
-
/** Enable automatic fixing for all supported issues */
|
|
32
|
-
autoFix?: boolean;
|
|
33
|
-
/** Dependency fix options */
|
|
34
|
-
dependencies?: {
|
|
35
|
-
/** Automatically remove blocked packages */
|
|
36
|
-
removeBlocked?: boolean;
|
|
37
|
-
/** Automatically update outdated dependencies */
|
|
38
|
-
updateOutdated?: boolean;
|
|
39
|
-
/** Attempt to fix security vulnerabilities */
|
|
40
|
-
fixSecurity?: boolean;
|
|
41
|
-
/** Ask for confirmation before making changes */
|
|
42
|
-
interactive?: boolean;
|
|
43
|
-
};
|
|
44
|
-
/** Structure fix options */
|
|
45
|
-
structure?: {
|
|
46
|
-
/** Automatically create missing required files */
|
|
47
|
-
createMissingFiles?: boolean;
|
|
48
|
-
/** Automatically create missing required directories */
|
|
49
|
-
createMissingDirs?: boolean;
|
|
50
|
-
/** Generate file templates for missing files */
|
|
51
|
-
generateTemplates?: boolean;
|
|
52
|
-
};
|
|
53
|
-
/** Documentation fix options */
|
|
54
|
-
docs?: {
|
|
55
|
-
/** Generate README.md template if missing */
|
|
56
|
-
generateReadme?: boolean;
|
|
57
|
-
/** Generate CHANGELOG.md template if missing */
|
|
58
|
-
generateChangelog?: boolean;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
interface GitConfig {
|
|
63
|
-
hooks?: Partial<Record<ValidGitHook, string>>;
|
|
64
|
-
config?: {
|
|
65
|
-
core?: {
|
|
66
|
-
editor?: string;
|
|
67
|
-
autocrlf?: boolean | "input";
|
|
68
|
-
eol?: "lf" | "crlf" | "native";
|
|
69
|
-
ignorecase?: boolean;
|
|
70
|
-
filemode?: boolean;
|
|
71
|
-
bare?: boolean;
|
|
72
|
-
logallrefupdates?: boolean;
|
|
73
|
-
repositoryformatversion?: number;
|
|
74
|
-
sharedrepository?: boolean | "group" | "all" | "world" | "everybody";
|
|
75
|
-
worktree?: string;
|
|
76
|
-
precomposeunicode?: boolean;
|
|
77
|
-
protecthfs?: boolean;
|
|
78
|
-
protectntfs?: boolean;
|
|
79
|
-
};
|
|
80
|
-
user?: {
|
|
81
|
-
name?: string;
|
|
82
|
-
email?: string;
|
|
83
|
-
signingkey?: string;
|
|
84
|
-
};
|
|
85
|
-
init?: {
|
|
86
|
-
defaultBranch?: string;
|
|
87
|
-
};
|
|
88
|
-
branch?: {
|
|
89
|
-
autosetupmerge?: boolean | "always";
|
|
90
|
-
autosetuprebase?: "never" | "local" | "remote" | "always";
|
|
91
|
-
};
|
|
92
|
-
push?: {
|
|
93
|
-
default?: "nothing" | "current" | "upstream" | "simple" | "matching";
|
|
94
|
-
followTags?: boolean;
|
|
95
|
-
autoSetupRemote?: boolean;
|
|
96
|
-
};
|
|
97
|
-
pull?: {
|
|
98
|
-
rebase?: boolean | "preserve" | "merges" | "interactive";
|
|
99
|
-
ff?: boolean | "only";
|
|
100
|
-
};
|
|
101
|
-
merge?: {
|
|
102
|
-
tool?: string;
|
|
103
|
-
conflictstyle?: "merge" | "diff3";
|
|
104
|
-
ff?: boolean | "only";
|
|
105
|
-
log?: boolean | number;
|
|
106
|
-
};
|
|
107
|
-
rebase?: {
|
|
108
|
-
autoSquash?: boolean;
|
|
109
|
-
autoStash?: boolean;
|
|
110
|
-
updateRefs?: boolean;
|
|
111
|
-
};
|
|
112
|
-
fetch?: {
|
|
113
|
-
prune?: boolean;
|
|
114
|
-
pruneTags?: boolean;
|
|
115
|
-
fsckobjects?: boolean;
|
|
116
|
-
};
|
|
117
|
-
remote?: {
|
|
118
|
-
[remoteName: string]: {
|
|
119
|
-
url?: string;
|
|
120
|
-
fetch?: string;
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
diff?: {
|
|
124
|
-
tool?: string;
|
|
125
|
-
algorithm?: "myers" | "minimal" | "patience" | "histogram";
|
|
126
|
-
renames?: boolean | "copy" | "copies";
|
|
127
|
-
mnemonicprefix?: boolean;
|
|
128
|
-
};
|
|
129
|
-
status?: {
|
|
130
|
-
showUntrackedFiles?: "no" | "normal" | "all";
|
|
131
|
-
branch?: boolean;
|
|
132
|
-
short?: boolean;
|
|
133
|
-
};
|
|
134
|
-
commit?: {
|
|
135
|
-
cleanup?: "strip" | "whitespace" | "verbatim" | "scissors" | "default";
|
|
136
|
-
gpgsign?: boolean;
|
|
137
|
-
template?: string;
|
|
138
|
-
verbose?: boolean;
|
|
139
|
-
};
|
|
140
|
-
log?: {
|
|
141
|
-
abbrevCommit?: boolean;
|
|
142
|
-
decorate?: boolean | "short" | "full" | "auto" | "no";
|
|
143
|
-
showSignature?: boolean;
|
|
144
|
-
};
|
|
145
|
-
transfer?: {
|
|
146
|
-
fsckobjects?: boolean;
|
|
147
|
-
};
|
|
148
|
-
receive?: {
|
|
149
|
-
fsckObjects?: boolean;
|
|
150
|
-
};
|
|
151
|
-
gc?: {
|
|
152
|
-
auto?: number;
|
|
153
|
-
autopacklimit?: number;
|
|
154
|
-
autodetach?: boolean;
|
|
155
|
-
};
|
|
156
|
-
alias?: {
|
|
157
|
-
[aliasName: string]: string;
|
|
158
|
-
};
|
|
159
|
-
url?: {
|
|
160
|
-
[pattern: string]: {
|
|
161
|
-
insteadOf?: string;
|
|
162
|
-
pushInsteadOf?: string;
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
commitMsg?: CommitMsgConfig;
|
|
167
|
-
autoSetup?: boolean;
|
|
168
|
-
autoInitGit?: boolean;
|
|
169
|
-
skipGitCheck?: boolean;
|
|
170
|
-
force?: boolean;
|
|
171
|
-
}
|
|
172
|
-
interface CommitMsgConfig {
|
|
173
|
-
types?: string[];
|
|
174
|
-
maxLength?: number;
|
|
175
|
-
minLength?: number;
|
|
176
|
-
scopeRequired?: boolean;
|
|
177
|
-
allowedScopes?: string[];
|
|
178
|
-
}
|
|
179
|
-
interface CommitMessage {
|
|
180
|
-
type: string;
|
|
181
|
-
scope?: string;
|
|
182
|
-
description: string;
|
|
183
|
-
body?: string;
|
|
184
|
-
footer?: string;
|
|
185
|
-
isBreaking: boolean;
|
|
186
|
-
}
|
|
187
|
-
declare const VALID_GIT_HOOKS: readonly ["applypatch-msg", "pre-applypatch", "post-applypatch", "pre-commit", "pre-merge-commit", "prepare-commit-msg", "commit-msg", "post-commit", "pre-rebase", "post-checkout", "post-merge", "pre-push", "pre-receive", "update", "proc-receive", "post-receive", "post-update", "reference-transaction", "push-to-checkout", "pre-auto-gc", "post-rewrite", "sendemail-validate", "fsmonitor-watchman", "p4-changelist", "p4-prepare-changelist", "p4-post-changelist", "p4-pre-submit", "post-index-change"];
|
|
188
|
-
type ValidGitHook = (typeof VALID_GIT_HOOKS)[number];
|
|
189
|
-
type GitConfigValue = string | number | boolean;
|
|
190
|
-
type GitConfigSection = Record<string, GitConfigValue>;
|
|
191
|
-
type GitConfigData = Record<string, GitConfigSection>;
|
|
192
|
-
interface VersionConfig {
|
|
193
|
-
/** Git tag prefix */
|
|
194
|
-
tagPrefix?: string;
|
|
195
|
-
/** Auto commit version changes */
|
|
196
|
-
autoCommit?: boolean;
|
|
197
|
-
/** Auto create git tag */
|
|
198
|
-
autoTag?: boolean;
|
|
199
|
-
/** Auto push changes to remote */
|
|
200
|
-
autoPush?: boolean;
|
|
201
|
-
/** Prerelease identifier (alpha, beta, rc) */
|
|
202
|
-
prereleaseId?: string;
|
|
203
|
-
/** Commit message template */
|
|
204
|
-
commitMessage?: string;
|
|
205
|
-
}
|
|
206
|
-
interface PublishConfig {
|
|
207
|
-
/** NPM registry URL */
|
|
208
|
-
registry?: string;
|
|
209
|
-
/** Package access level */
|
|
210
|
-
access?: "public" | "private";
|
|
211
|
-
/** Default publish tag (for non-stable releases) */
|
|
212
|
-
defaultTag?: string;
|
|
213
|
-
/** Stable release tag */
|
|
214
|
-
stableTag?: string;
|
|
215
|
-
/** Build command before publish */
|
|
216
|
-
buildCommand?: string;
|
|
217
|
-
/** Test command before publish */
|
|
218
|
-
testCommand?: string;
|
|
219
|
-
/** Check git working directory is clean */
|
|
220
|
-
checkGitClean?: boolean;
|
|
221
|
-
/** Run tests before publish */
|
|
222
|
-
checkTests?: boolean;
|
|
223
|
-
/** Auto push git changes after publish */
|
|
224
|
-
autoGitPush?: boolean;
|
|
225
|
-
/** Create git tag after publish */
|
|
226
|
-
createGitTag?: boolean;
|
|
227
|
-
}
|
|
228
|
-
interface InitOptions {
|
|
229
|
-
force?: boolean;
|
|
230
|
-
skipGitCheck?: boolean;
|
|
231
|
-
skipInstall?: boolean;
|
|
232
|
-
}
|
|
233
|
-
interface VersionOptions {
|
|
234
|
-
version?: string;
|
|
235
|
-
preid?: string;
|
|
236
|
-
prerelease?: boolean;
|
|
237
|
-
major?: boolean;
|
|
238
|
-
minor?: boolean;
|
|
239
|
-
patch?: boolean;
|
|
240
|
-
tag?: string;
|
|
241
|
-
message?: string;
|
|
242
|
-
}
|
|
243
|
-
interface PublishOptions {
|
|
244
|
-
tag?: string;
|
|
245
|
-
stable?: boolean;
|
|
246
|
-
latest?: boolean;
|
|
247
|
-
dryRun?: boolean;
|
|
248
|
-
access?: "public" | "private";
|
|
249
|
-
registry?: string;
|
|
250
|
-
skipBuild?: boolean;
|
|
251
|
-
skipTests?: boolean;
|
|
252
|
-
}
|
|
253
|
-
interface VersionUpdateResult {
|
|
254
|
-
oldVersion: string;
|
|
255
|
-
newVersion: string;
|
|
256
|
-
tagName?: string;
|
|
257
|
-
}
|
|
258
|
-
interface PublishResult {
|
|
259
|
-
packageName: string;
|
|
260
|
-
version: string;
|
|
261
|
-
publishTag: string;
|
|
262
|
-
dryRun: boolean;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Define a Basis configuration
|
|
267
|
-
*/
|
|
268
|
-
declare function defineBasisConfig(config: BasisConfig): BasisConfig;
|
|
269
|
-
/**
|
|
270
|
-
* Default configuration
|
|
271
|
-
*/
|
|
272
|
-
declare const defaultConfig: BasisConfig;
|
|
273
|
-
|
|
274
|
-
export { defineBasisConfig as d, defaultConfig as e, VALID_GIT_HOOKS as g };
|
|
275
|
-
export type { BasisConfig as B, CommitMessage as C, GitConfig as G, InitOptions as I, LintConfig as L, PublishOptions as P, VersionOptions as V, VersionUpdateResult as a, PublishResult as b, GitConfigData as c, CommitMsgConfig as f, ValidGitHook as h, GitConfigValue as i, GitConfigSection as j, VersionConfig as k, PublishConfig as l };
|
|
@@ -1,275 +0,0 @@
|
|
|
1
|
-
interface BasisConfig {
|
|
2
|
-
lint?: LintConfig;
|
|
3
|
-
git?: GitConfig;
|
|
4
|
-
version?: VersionConfig;
|
|
5
|
-
publish?: PublishConfig;
|
|
6
|
-
}
|
|
7
|
-
interface LintConfig {
|
|
8
|
-
staged?: Record<string, string>;
|
|
9
|
-
project?: Record<string, string>;
|
|
10
|
-
dependencies?: {
|
|
11
|
-
checkOutdated?: boolean;
|
|
12
|
-
checkSecurity?: boolean;
|
|
13
|
-
allowedLicenses?: string[];
|
|
14
|
-
blockedPackages?: string[];
|
|
15
|
-
};
|
|
16
|
-
structure?: {
|
|
17
|
-
requiredFiles?: string[];
|
|
18
|
-
requiredDirs?: string[];
|
|
19
|
-
naming?: Array<{
|
|
20
|
-
path: string;
|
|
21
|
-
files?: string;
|
|
22
|
-
directories?: string;
|
|
23
|
-
description?: string;
|
|
24
|
-
}>;
|
|
25
|
-
};
|
|
26
|
-
docs?: {
|
|
27
|
-
checkReadme?: boolean;
|
|
28
|
-
checkChangelog?: boolean;
|
|
29
|
-
};
|
|
30
|
-
fix?: {
|
|
31
|
-
/** Enable automatic fixing for all supported issues */
|
|
32
|
-
autoFix?: boolean;
|
|
33
|
-
/** Dependency fix options */
|
|
34
|
-
dependencies?: {
|
|
35
|
-
/** Automatically remove blocked packages */
|
|
36
|
-
removeBlocked?: boolean;
|
|
37
|
-
/** Automatically update outdated dependencies */
|
|
38
|
-
updateOutdated?: boolean;
|
|
39
|
-
/** Attempt to fix security vulnerabilities */
|
|
40
|
-
fixSecurity?: boolean;
|
|
41
|
-
/** Ask for confirmation before making changes */
|
|
42
|
-
interactive?: boolean;
|
|
43
|
-
};
|
|
44
|
-
/** Structure fix options */
|
|
45
|
-
structure?: {
|
|
46
|
-
/** Automatically create missing required files */
|
|
47
|
-
createMissingFiles?: boolean;
|
|
48
|
-
/** Automatically create missing required directories */
|
|
49
|
-
createMissingDirs?: boolean;
|
|
50
|
-
/** Generate file templates for missing files */
|
|
51
|
-
generateTemplates?: boolean;
|
|
52
|
-
};
|
|
53
|
-
/** Documentation fix options */
|
|
54
|
-
docs?: {
|
|
55
|
-
/** Generate README.md template if missing */
|
|
56
|
-
generateReadme?: boolean;
|
|
57
|
-
/** Generate CHANGELOG.md template if missing */
|
|
58
|
-
generateChangelog?: boolean;
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
interface GitConfig {
|
|
63
|
-
hooks?: Partial<Record<ValidGitHook, string>>;
|
|
64
|
-
config?: {
|
|
65
|
-
core?: {
|
|
66
|
-
editor?: string;
|
|
67
|
-
autocrlf?: boolean | "input";
|
|
68
|
-
eol?: "lf" | "crlf" | "native";
|
|
69
|
-
ignorecase?: boolean;
|
|
70
|
-
filemode?: boolean;
|
|
71
|
-
bare?: boolean;
|
|
72
|
-
logallrefupdates?: boolean;
|
|
73
|
-
repositoryformatversion?: number;
|
|
74
|
-
sharedrepository?: boolean | "group" | "all" | "world" | "everybody";
|
|
75
|
-
worktree?: string;
|
|
76
|
-
precomposeunicode?: boolean;
|
|
77
|
-
protecthfs?: boolean;
|
|
78
|
-
protectntfs?: boolean;
|
|
79
|
-
};
|
|
80
|
-
user?: {
|
|
81
|
-
name?: string;
|
|
82
|
-
email?: string;
|
|
83
|
-
signingkey?: string;
|
|
84
|
-
};
|
|
85
|
-
init?: {
|
|
86
|
-
defaultBranch?: string;
|
|
87
|
-
};
|
|
88
|
-
branch?: {
|
|
89
|
-
autosetupmerge?: boolean | "always";
|
|
90
|
-
autosetuprebase?: "never" | "local" | "remote" | "always";
|
|
91
|
-
};
|
|
92
|
-
push?: {
|
|
93
|
-
default?: "nothing" | "current" | "upstream" | "simple" | "matching";
|
|
94
|
-
followTags?: boolean;
|
|
95
|
-
autoSetupRemote?: boolean;
|
|
96
|
-
};
|
|
97
|
-
pull?: {
|
|
98
|
-
rebase?: boolean | "preserve" | "merges" | "interactive";
|
|
99
|
-
ff?: boolean | "only";
|
|
100
|
-
};
|
|
101
|
-
merge?: {
|
|
102
|
-
tool?: string;
|
|
103
|
-
conflictstyle?: "merge" | "diff3";
|
|
104
|
-
ff?: boolean | "only";
|
|
105
|
-
log?: boolean | number;
|
|
106
|
-
};
|
|
107
|
-
rebase?: {
|
|
108
|
-
autoSquash?: boolean;
|
|
109
|
-
autoStash?: boolean;
|
|
110
|
-
updateRefs?: boolean;
|
|
111
|
-
};
|
|
112
|
-
fetch?: {
|
|
113
|
-
prune?: boolean;
|
|
114
|
-
pruneTags?: boolean;
|
|
115
|
-
fsckobjects?: boolean;
|
|
116
|
-
};
|
|
117
|
-
remote?: {
|
|
118
|
-
[remoteName: string]: {
|
|
119
|
-
url?: string;
|
|
120
|
-
fetch?: string;
|
|
121
|
-
};
|
|
122
|
-
};
|
|
123
|
-
diff?: {
|
|
124
|
-
tool?: string;
|
|
125
|
-
algorithm?: "myers" | "minimal" | "patience" | "histogram";
|
|
126
|
-
renames?: boolean | "copy" | "copies";
|
|
127
|
-
mnemonicprefix?: boolean;
|
|
128
|
-
};
|
|
129
|
-
status?: {
|
|
130
|
-
showUntrackedFiles?: "no" | "normal" | "all";
|
|
131
|
-
branch?: boolean;
|
|
132
|
-
short?: boolean;
|
|
133
|
-
};
|
|
134
|
-
commit?: {
|
|
135
|
-
cleanup?: "strip" | "whitespace" | "verbatim" | "scissors" | "default";
|
|
136
|
-
gpgsign?: boolean;
|
|
137
|
-
template?: string;
|
|
138
|
-
verbose?: boolean;
|
|
139
|
-
};
|
|
140
|
-
log?: {
|
|
141
|
-
abbrevCommit?: boolean;
|
|
142
|
-
decorate?: boolean | "short" | "full" | "auto" | "no";
|
|
143
|
-
showSignature?: boolean;
|
|
144
|
-
};
|
|
145
|
-
transfer?: {
|
|
146
|
-
fsckobjects?: boolean;
|
|
147
|
-
};
|
|
148
|
-
receive?: {
|
|
149
|
-
fsckObjects?: boolean;
|
|
150
|
-
};
|
|
151
|
-
gc?: {
|
|
152
|
-
auto?: number;
|
|
153
|
-
autopacklimit?: number;
|
|
154
|
-
autodetach?: boolean;
|
|
155
|
-
};
|
|
156
|
-
alias?: {
|
|
157
|
-
[aliasName: string]: string;
|
|
158
|
-
};
|
|
159
|
-
url?: {
|
|
160
|
-
[pattern: string]: {
|
|
161
|
-
insteadOf?: string;
|
|
162
|
-
pushInsteadOf?: string;
|
|
163
|
-
};
|
|
164
|
-
};
|
|
165
|
-
};
|
|
166
|
-
commitMsg?: CommitMsgConfig;
|
|
167
|
-
autoSetup?: boolean;
|
|
168
|
-
autoInitGit?: boolean;
|
|
169
|
-
skipGitCheck?: boolean;
|
|
170
|
-
force?: boolean;
|
|
171
|
-
}
|
|
172
|
-
interface CommitMsgConfig {
|
|
173
|
-
types?: string[];
|
|
174
|
-
maxLength?: number;
|
|
175
|
-
minLength?: number;
|
|
176
|
-
scopeRequired?: boolean;
|
|
177
|
-
allowedScopes?: string[];
|
|
178
|
-
}
|
|
179
|
-
interface CommitMessage {
|
|
180
|
-
type: string;
|
|
181
|
-
scope?: string;
|
|
182
|
-
description: string;
|
|
183
|
-
body?: string;
|
|
184
|
-
footer?: string;
|
|
185
|
-
isBreaking: boolean;
|
|
186
|
-
}
|
|
187
|
-
declare const VALID_GIT_HOOKS: readonly ["applypatch-msg", "pre-applypatch", "post-applypatch", "pre-commit", "pre-merge-commit", "prepare-commit-msg", "commit-msg", "post-commit", "pre-rebase", "post-checkout", "post-merge", "pre-push", "pre-receive", "update", "proc-receive", "post-receive", "post-update", "reference-transaction", "push-to-checkout", "pre-auto-gc", "post-rewrite", "sendemail-validate", "fsmonitor-watchman", "p4-changelist", "p4-prepare-changelist", "p4-post-changelist", "p4-pre-submit", "post-index-change"];
|
|
188
|
-
type ValidGitHook = (typeof VALID_GIT_HOOKS)[number];
|
|
189
|
-
type GitConfigValue = string | number | boolean;
|
|
190
|
-
type GitConfigSection = Record<string, GitConfigValue>;
|
|
191
|
-
type GitConfigData = Record<string, GitConfigSection>;
|
|
192
|
-
interface VersionConfig {
|
|
193
|
-
/** Git tag prefix */
|
|
194
|
-
tagPrefix?: string;
|
|
195
|
-
/** Auto commit version changes */
|
|
196
|
-
autoCommit?: boolean;
|
|
197
|
-
/** Auto create git tag */
|
|
198
|
-
autoTag?: boolean;
|
|
199
|
-
/** Auto push changes to remote */
|
|
200
|
-
autoPush?: boolean;
|
|
201
|
-
/** Prerelease identifier (alpha, beta, rc) */
|
|
202
|
-
prereleaseId?: string;
|
|
203
|
-
/** Commit message template */
|
|
204
|
-
commitMessage?: string;
|
|
205
|
-
}
|
|
206
|
-
interface PublishConfig {
|
|
207
|
-
/** NPM registry URL */
|
|
208
|
-
registry?: string;
|
|
209
|
-
/** Package access level */
|
|
210
|
-
access?: "public" | "private";
|
|
211
|
-
/** Default publish tag (for non-stable releases) */
|
|
212
|
-
defaultTag?: string;
|
|
213
|
-
/** Stable release tag */
|
|
214
|
-
stableTag?: string;
|
|
215
|
-
/** Build command before publish */
|
|
216
|
-
buildCommand?: string;
|
|
217
|
-
/** Test command before publish */
|
|
218
|
-
testCommand?: string;
|
|
219
|
-
/** Check git working directory is clean */
|
|
220
|
-
checkGitClean?: boolean;
|
|
221
|
-
/** Run tests before publish */
|
|
222
|
-
checkTests?: boolean;
|
|
223
|
-
/** Auto push git changes after publish */
|
|
224
|
-
autoGitPush?: boolean;
|
|
225
|
-
/** Create git tag after publish */
|
|
226
|
-
createGitTag?: boolean;
|
|
227
|
-
}
|
|
228
|
-
interface InitOptions {
|
|
229
|
-
force?: boolean;
|
|
230
|
-
skipGitCheck?: boolean;
|
|
231
|
-
skipInstall?: boolean;
|
|
232
|
-
}
|
|
233
|
-
interface VersionOptions {
|
|
234
|
-
version?: string;
|
|
235
|
-
preid?: string;
|
|
236
|
-
prerelease?: boolean;
|
|
237
|
-
major?: boolean;
|
|
238
|
-
minor?: boolean;
|
|
239
|
-
patch?: boolean;
|
|
240
|
-
tag?: string;
|
|
241
|
-
message?: string;
|
|
242
|
-
}
|
|
243
|
-
interface PublishOptions {
|
|
244
|
-
tag?: string;
|
|
245
|
-
stable?: boolean;
|
|
246
|
-
latest?: boolean;
|
|
247
|
-
dryRun?: boolean;
|
|
248
|
-
access?: "public" | "private";
|
|
249
|
-
registry?: string;
|
|
250
|
-
skipBuild?: boolean;
|
|
251
|
-
skipTests?: boolean;
|
|
252
|
-
}
|
|
253
|
-
interface VersionUpdateResult {
|
|
254
|
-
oldVersion: string;
|
|
255
|
-
newVersion: string;
|
|
256
|
-
tagName?: string;
|
|
257
|
-
}
|
|
258
|
-
interface PublishResult {
|
|
259
|
-
packageName: string;
|
|
260
|
-
version: string;
|
|
261
|
-
publishTag: string;
|
|
262
|
-
dryRun: boolean;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
/**
|
|
266
|
-
* Define a Basis configuration
|
|
267
|
-
*/
|
|
268
|
-
declare function defineBasisConfig(config: BasisConfig): BasisConfig;
|
|
269
|
-
/**
|
|
270
|
-
* Default configuration
|
|
271
|
-
*/
|
|
272
|
-
declare const defaultConfig: BasisConfig;
|
|
273
|
-
|
|
274
|
-
export { defineBasisConfig as d, defaultConfig as e, VALID_GIT_HOOKS as g };
|
|
275
|
-
export type { BasisConfig as B, CommitMessage as C, GitConfig as G, InitOptions as I, LintConfig as L, PublishOptions as P, VersionOptions as V, VersionUpdateResult as a, PublishResult as b, GitConfigData as c, CommitMsgConfig as f, ValidGitHook as h, GitConfigValue as i, GitConfigSection as j, VersionConfig as k, PublishConfig as l };
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";const node_child_process=require("node:child_process"),promises=require("node:fs/promises"),update=require("c12/update"),consola=require("consola"),defu=require("defu"),C=require("ini"),pathe=require("pathe"),utils=require("./basis.D3fInv-P.cjs");function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const C__default=_interopDefaultCompat(C);function G(){try{return node_child_process.execSync("git --version",{stdio:"pipe"}),!0}catch{return!1}}async function b(e,i=!1,r=!1){try{return await update.updateConfig({cwd:e,configFile:"basis.config",onUpdate:t=>{t.git&&(i&&t.git.hooks&&delete t.git.hooks,r&&t.git.config&&delete t.git.config,Object.keys(t.git).length===0&&delete t.git)}}),!0}catch{return!1}}const M=["feat","fix","docs","style","refactor","perf","test","build","ci","chore","revert"];function parseCommitMessage(e){const i=e.trim().split(`
|
|
2
|
-
`),r=i[0].match(/^(\w+)(\(([^)]+)\))?(!)?:\s*(.+)$/);if(!r)return null;const[,t,,o,n,s]=r,c=i.slice(1).find(l=>l.trim())?.trim(),a=i.slice(-1)[0]?.trim();return{type:t,scope:o,description:s,body:c,footer:a,isBreaking:!!n||e.includes("BREAKING CHANGE:")}}function validateCommitMessage(e,i={}){const r=[],{types:t=M,maxLength:o=72,minLength:n=10,scopeRequired:s=!1,allowedScopes:c=[]}=i,a=parseCommitMessage(e);if(!a)return{valid:!1,errors:["Invalid commit format. Expected: type(scope): description"]};t.includes(a.type)||r.push(`Invalid type '${a.type}'. Allowed: ${t.join(", ")}`);const l=e.split(`
|
|
3
|
-
`)[0];return l.length>o&&r.push(`Header too long (${l.length}). Max: ${o}`),l.length<n&&r.push(`Header too short (${l.length}). Min: ${n}`),s&&!a.scope&&r.push("Scope is required"),a.scope&&c.length>0&&!c.includes(a.scope)&&r.push(`Invalid scope '${a.scope}'. Allowed: ${c.join(", ")}`),{valid:r.length===0,errors:r}}async function lintCommitMessage(e=process.cwd(),i){if(!G())return consola.consola.warn("Git command not available, skipping commit message linting"),!0;const{config:r}=await utils.loadConfig({cwd:e,overrides:i?{git:{commitMsg:i}}:void 0}),t=r.git?.commitMsg||{};let o;try{const s=pathe.resolve(".git/COMMIT_EDITMSG");await utils.fileExists(s)?o=(await promises.readFile(s)).toString("utf8"):o=node_child_process.execSync("git log -1 --pretty=%B",{encoding:"utf8"}).trim()}catch(s){return consola.consola.error("Failed to read commit message:",s),!1}const n=validateCommitMessage(o,t);return n.valid?!0:(consola.consola.error("Invalid commit message:"),n.errors.forEach(s=>consola.consola.error(` ${s}`)),!1)}async function w(e){const i=pathe.resolve(e,".git/config");if(!await utils.fileExists(i))return null;const r=new Date().toISOString().replace(/[:.]/g,"-"),t=pathe.resolve(e,`.git/config.backup.${r}`);try{return await promises.copyFile(i,t),t}catch(o){return consola.consola.warn("Failed to create Git config backup:",o),null}}async function readGitConfig(e=process.cwd()){const i=pathe.resolve(e,".git/config");if(!await utils.fileExists(i))return{};try{const r=await promises.readFile(i,"utf8");return C__default.parse(r)}catch(r){return consola.consola.warn("Failed to read .git/config:",r),{}}}async function writeGitConfig(e,i=process.cwd()){const r=pathe.resolve(i,".git/config");try{let t=C__default.stringify(e,{whitespace:!0});t=t.split(`
|
|
4
|
-
`).map(o=>o&&!o.startsWith("[")&&o.includes("=")?` ${o}`:o).join(`
|
|
5
|
-
`),await promises.writeFile(r,t,"utf8")}catch(t){throw consola.consola.error("Failed to write .git/config:",t),t}}function S(e,i){if(!i)return!0;for(const[r,t]of Object.entries(i)){if(typeof t!="object"||!t)continue;const o=e[r];if(!o||typeof o!="object")return!1;for(const[n,s]of Object.entries(t))if(s!==void 0&&o[n]!==s)return!1}return!0}async function setupGitConfig(e=process.cwd(),i){const{config:r}=await utils.loadConfig({cwd:e,overrides:i?{git:{config:i}}:void 0}),t=r.git?.config||{};if(Object.keys(t).length===0)return!0;try{const o=await readGitConfig(e);if(S(o,t))return!0;await w(e);const n=defu.defu(o,t);return await writeGitConfig(n,e),!0}catch(o){return consola.consola.error("Failed to setup Git configuration:",o),!1}}async function resetGitConfig(e=process.cwd(),i=!0,r={}){try{await w(e);const t=await readGitConfig(e);if(!t||Object.keys(t).length===0)return!0;const o={};if(i&&t.user&&(o.user=t.user),t.core){const n=["repositoryformatversion","filemode","bare","logallrefupdates"],s={};n.forEach(c=>{t.core[c]!==void 0&&(s[c]=t.core[c])}),Object.keys(s).length>0&&(o.core=s)}return await writeGitConfig(o,e),r.updateConfig?await b(e,!1,!0):!0}catch(t){return consola.consola.error("Failed to reset Git configuration:",t),!1}}async function setupGitHooks(e=process.cwd(),i){const{config:r}=await utils.loadConfig({cwd:e,overrides:i?{git:{hooks:i}}:void 0}),t=r.git?.hooks||{},o=pathe.resolve(e,".git/hooks");if(!await utils.fileExists(o))return consola.consola.error("Git hooks directory not found. Is this a Git repository?"),!1;let n=!0;for(const[s,c]of Object.entries(t)){const a=pathe.resolve(o,s);try{let l=`#!/bin/sh
|
|
6
|
-
|
|
7
|
-
`;if(typeof c=="string")l+=`${c}
|
|
8
|
-
`;else if(c&&typeof c=="object"&&"commands"in c){const f=c.commands;l+=`${f.join(`
|
|
9
|
-
`)}
|
|
10
|
-
`}await promises.writeFile(a,l,{mode:493})}catch(l){consola.consola.error(`Failed to setup ${s} hook:`,l),n=!1}}return n}async function initGitRepo(e=process.cwd()){if(!G())return consola.consola.warn("Git command not available, cannot initialize repository"),!1;try{try{return node_child_process.execSync("git rev-parse --git-dir",{cwd:e,stdio:"pipe"}),!0}catch{return node_child_process.execSync("git init",{cwd:e,stdio:"inherit"}),consola.consola.success("Initialized Git repository"),!0}}catch(i){return consola.consola.error("Failed to initialize Git repository:",i),!1}}async function setupGit(e=process.cwd()){const{config:i}=await utils.loadConfig({cwd:e}),r=i.git||{},t=(await Promise.allSettled([setupGitConfig(e,r.config),setupGitHooks(e,r.hooks)])).filter(o=>o.status==="rejected"||o.status==="fulfilled"&&!o.value);return t.length===0?(consola.consola.success("Git setup completed successfully!"),!0):(consola.consola.error(`${t.length} Git setup step(s) failed`),!1)}async function removeGitHooks(e=process.cwd(),i,r={}){const t=pathe.resolve(e,".git/hooks");if(!await utils.fileExists(t))return consola.consola.warn("Git hooks directory not found. Is this a Git repository?"),!0;let o=!0,n;if(i&&i.length>0)n=i;else{const{config:s}=await utils.loadConfig({cwd:e});n=Object.keys(s.git?.hooks||{})}for(const s of n){const c=pathe.resolve(t,s);if(await utils.fileExists(c))try{await promises.unlink(c)}catch(a){consola.consola.error(`Failed to remove ${s} hook:`,a),o=!1}}if(!i&&r.updateConfig){const s=await b(e,!0,!1);o=o&&s}return o}exports.initGitRepo=initGitRepo,exports.lintCommitMessage=lintCommitMessage,exports.parseCommitMessage=parseCommitMessage,exports.readGitConfig=readGitConfig,exports.removeGitHooks=removeGitHooks,exports.resetGitConfig=resetGitConfig,exports.setupGit=setupGit,exports.setupGitConfig=setupGitConfig,exports.setupGitHooks=setupGitHooks,exports.validateCommitMessage=validateCommitMessage,exports.writeGitConfig=writeGitConfig;
|