@funish/basis 0.0.1 → 0.0.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/README.md +120 -31
- package/dist/chunks/config.cjs +1 -1
- package/dist/chunks/config.mjs +1 -1
- package/dist/chunks/git.cjs +1 -0
- package/dist/chunks/git.mjs +1 -0
- package/dist/chunks/init.cjs +1 -1
- package/dist/chunks/init.mjs +1 -1
- package/dist/chunks/lint.cjs +1 -1
- package/dist/chunks/lint.mjs +1 -1
- package/dist/chunks/publish.cjs +1 -1
- package/dist/chunks/publish.mjs +1 -1
- package/dist/chunks/version.cjs +1 -1
- package/dist/chunks/version.mjs +1 -1
- package/dist/cli.cjs +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/config.cjs +1 -1
- package/dist/config.d.cts +1 -1
- package/dist/config.d.mts +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +188 -25
- package/dist/index.d.mts +188 -25
- package/dist/index.d.ts +188 -25
- package/dist/index.mjs +1 -1
- package/dist/shared/basis.0WCUjjhy.mjs +1 -0
- package/dist/shared/basis.1ZgFrMJb.mjs +7 -0
- package/dist/shared/basis.B4p52ive.cjs +1 -0
- package/dist/shared/basis.BEOfVK6U.cjs +3 -0
- package/dist/shared/basis.BJhSbOyA.cjs +1 -0
- package/dist/shared/basis.BvLeB_5F.d.cts +253 -0
- package/dist/shared/basis.BvLeB_5F.d.mts +253 -0
- package/dist/shared/basis.BvLeB_5F.d.ts +253 -0
- package/dist/shared/basis.C8S2dWvt.cjs +7 -0
- package/dist/shared/basis.CHVACS4W.cjs +1 -0
- package/dist/shared/basis.CkZpidFZ.mjs +1 -0
- package/dist/shared/basis.DcC8NBqt.mjs +3 -0
- package/dist/shared/basis.DzMHJtq5.mjs +10 -0
- package/dist/shared/basis.plLH3j3N.mjs +1 -0
- package/dist/shared/basis.sOTOmfHG.cjs +10 -0
- package/package.json +7 -3
- package/dist/chunks/githooks.cjs +0 -1
- package/dist/chunks/githooks.mjs +0 -1
- package/dist/shared/basis.ByJ8R9TE.cjs +0 -1
- package/dist/shared/basis.C0E7mwQ6.mjs +0 -1
- package/dist/shared/basis.C5wlo6IO.mjs +0 -1
- package/dist/shared/basis.CBZIV3-V.mjs +0 -19
- package/dist/shared/basis.CSSuyvpq.cjs +0 -1
- package/dist/shared/basis.CgpyxNW3.cjs +0 -1
- package/dist/shared/basis.D57HxVvD.cjs +0 -4
- package/dist/shared/basis.DeKfEQsQ.cjs +0 -5
- package/dist/shared/basis.DweCjqFb.cjs +0 -19
- package/dist/shared/basis.O4so-uuj.mjs +0 -5
- package/dist/shared/basis.dc3ybBoz.mjs +0 -1
- package/dist/shared/basis.iRZ1Ylu8.d.cts +0 -127
- package/dist/shared/basis.iRZ1Ylu8.d.mts +0 -127
- package/dist/shared/basis.iRZ1Ylu8.d.ts +0 -127
- package/dist/shared/basis.rDVxD7qf.mjs +0 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { B as BasisConfig, I as InitOptions,
|
|
2
|
-
export {
|
|
1
|
+
import { B as BasisConfig, I as InitOptions, V as VersionOptions, a as VersionUpdateResult, P as PublishOptions, b as PublishResult, C as CommitMessage, G as GitConfig, c as GitConfigData, L as LintConfig } from './shared/basis.BvLeB_5F.js';
|
|
2
|
+
export { f as CommitMsgConfig, j as GitConfigSection, i as GitConfigValue, k as PackageManagerConfig, m as PublishConfig, g as VALID_GIT_HOOKS, h as ValidGitHook, l as VersionConfig, e as defaultConfig, d as defineBasisConfig } from './shared/basis.BvLeB_5F.js';
|
|
3
3
|
import * as c12 from 'c12';
|
|
4
4
|
import { LoadConfigOptions } from 'c12';
|
|
5
5
|
|
|
@@ -20,59 +20,211 @@ declare class Basis {
|
|
|
20
20
|
*/
|
|
21
21
|
lintStaged(): Promise<boolean>;
|
|
22
22
|
/**
|
|
23
|
-
* Run
|
|
23
|
+
* Run linting for entire project
|
|
24
|
+
*/
|
|
25
|
+
lintProject(): Promise<boolean>;
|
|
26
|
+
/**
|
|
27
|
+
* Check project dependencies
|
|
28
|
+
*/
|
|
29
|
+
lintDependencies(): Promise<boolean>;
|
|
30
|
+
/**
|
|
31
|
+
* Check project structure
|
|
32
|
+
*/
|
|
33
|
+
lintStructure(): Promise<boolean>;
|
|
34
|
+
/**
|
|
35
|
+
* Check project documentation
|
|
36
|
+
*/
|
|
37
|
+
lintDocs(): Promise<boolean>;
|
|
38
|
+
/**
|
|
39
|
+
* Run all lint checks
|
|
40
|
+
*/
|
|
41
|
+
lintAll(): Promise<boolean>;
|
|
42
|
+
/**
|
|
43
|
+
* Validate commit message
|
|
24
44
|
*/
|
|
25
45
|
lintCommitMessage(): Promise<boolean>;
|
|
26
46
|
/**
|
|
27
|
-
*
|
|
47
|
+
* Setup Git hooks
|
|
48
|
+
*/
|
|
49
|
+
setupGitHooks(): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Setup Git configuration
|
|
52
|
+
*/
|
|
53
|
+
setupGitConfig(): Promise<boolean>;
|
|
54
|
+
/**
|
|
55
|
+
* Setup complete Git configuration (hooks + config)
|
|
56
|
+
*/
|
|
57
|
+
setupGit(): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Initialize Git repository with basis configuration
|
|
60
|
+
*/
|
|
61
|
+
initGitRepo(): Promise<boolean>;
|
|
62
|
+
/**
|
|
63
|
+
* Remove Git hooks
|
|
64
|
+
*/
|
|
65
|
+
removeGitHooks(updateConfig?: boolean): Promise<boolean>;
|
|
66
|
+
/**
|
|
67
|
+
* Reset Git configuration
|
|
68
|
+
*/
|
|
69
|
+
resetGitConfig(keepUser?: boolean, updateConfig?: boolean): Promise<boolean>;
|
|
70
|
+
/**
|
|
71
|
+
* Update package version
|
|
72
|
+
*/
|
|
73
|
+
updateVersion(options?: VersionOptions): Promise<VersionUpdateResult>;
|
|
74
|
+
/**
|
|
75
|
+
* Update to specific version
|
|
76
|
+
*/
|
|
77
|
+
setVersion(version: string): Promise<VersionUpdateResult>;
|
|
78
|
+
/**
|
|
79
|
+
* Increment patch version
|
|
80
|
+
*/
|
|
81
|
+
patchVersion(): Promise<VersionUpdateResult>;
|
|
82
|
+
/**
|
|
83
|
+
* Increment minor version
|
|
84
|
+
*/
|
|
85
|
+
minorVersion(): Promise<VersionUpdateResult>;
|
|
86
|
+
/**
|
|
87
|
+
* Increment major version
|
|
88
|
+
*/
|
|
89
|
+
majorVersion(): Promise<VersionUpdateResult>;
|
|
90
|
+
/**
|
|
91
|
+
* Create prerelease version
|
|
92
|
+
*/
|
|
93
|
+
prereleaseVersion(preid?: string): Promise<VersionUpdateResult>;
|
|
94
|
+
/**
|
|
95
|
+
* Publish package to registry
|
|
96
|
+
*/
|
|
97
|
+
publish(options?: PublishOptions): Promise<PublishResult>;
|
|
98
|
+
/**
|
|
99
|
+
* Publish with dry run
|
|
100
|
+
*/
|
|
101
|
+
publishDryRun(options?: PublishOptions): Promise<PublishResult>;
|
|
102
|
+
/**
|
|
103
|
+
* Publish to specific tag
|
|
104
|
+
*/
|
|
105
|
+
publishToTag(tag: string, options?: PublishOptions): Promise<PublishResult>;
|
|
106
|
+
/**
|
|
107
|
+
* Publish as stable release (latest tag)
|
|
108
|
+
*/
|
|
109
|
+
publishStable(options?: PublishOptions): Promise<PublishResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Get current working directory
|
|
112
|
+
*/
|
|
113
|
+
getCwd(): string;
|
|
114
|
+
/**
|
|
115
|
+
* Set working directory
|
|
116
|
+
*/
|
|
117
|
+
setCwd(cwd: string): void;
|
|
118
|
+
/**
|
|
119
|
+
* Reload configuration from file
|
|
28
120
|
*/
|
|
29
|
-
|
|
121
|
+
reloadConfig(): Promise<BasisConfig>;
|
|
30
122
|
/**
|
|
31
|
-
*
|
|
123
|
+
* Run complete project setup (init + git setup)
|
|
32
124
|
*/
|
|
33
|
-
|
|
125
|
+
setup(options?: InitOptions): Promise<boolean>;
|
|
34
126
|
/**
|
|
35
|
-
*
|
|
127
|
+
* Run complete release workflow (lint + version + publish)
|
|
36
128
|
*/
|
|
37
|
-
|
|
129
|
+
release(versionOptions?: VersionOptions, publishOptions?: PublishOptions): Promise<{
|
|
130
|
+
version: VersionUpdateResult;
|
|
131
|
+
publish: PublishResult;
|
|
132
|
+
}>;
|
|
38
133
|
}
|
|
39
134
|
/**
|
|
40
135
|
* Create a new Basis instance
|
|
41
136
|
*/
|
|
42
137
|
declare function createBasis(cwd?: string): Basis;
|
|
43
138
|
|
|
44
|
-
declare function installHooks(cwd?: string, config?: GitHooksConfig): Promise<void>;
|
|
45
|
-
declare function uninstallHooks(cwd?: string, config?: GitHooksConfig): Promise<void>;
|
|
46
|
-
declare function listHooks(cwd?: string, config?: GitHooksConfig): Promise<void>;
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* Initialize basis configuration in the current project
|
|
50
|
-
*/
|
|
51
|
-
declare function init(cwd?: string, options?: InitOptions): Promise<boolean>;
|
|
52
|
-
|
|
53
139
|
/**
|
|
54
|
-
* Parse commit message
|
|
140
|
+
* Parse commit message into structured format
|
|
55
141
|
*/
|
|
56
142
|
declare function parseCommitMessage(message: string): CommitMessage | null;
|
|
57
143
|
/**
|
|
58
|
-
* Validate commit message
|
|
144
|
+
* Validate commit message against rules
|
|
59
145
|
*/
|
|
60
|
-
declare function validateCommitMessage(message: string, config?:
|
|
146
|
+
declare function validateCommitMessage(message: string, config?: GitConfig["commitMsg"]): {
|
|
61
147
|
valid: boolean;
|
|
62
148
|
errors: string[];
|
|
63
149
|
};
|
|
64
150
|
/**
|
|
65
|
-
*
|
|
151
|
+
* Lint commit message from Git
|
|
152
|
+
*/
|
|
153
|
+
declare function lintCommitMessage(cwd?: string, config?: GitConfig["commitMsg"]): Promise<boolean>;
|
|
154
|
+
/**
|
|
155
|
+
* Read Git configuration from .git/config using ini parser
|
|
156
|
+
*/
|
|
157
|
+
declare function readGitConfig(cwd?: string): Promise<GitConfigData>;
|
|
158
|
+
/**
|
|
159
|
+
* Write Git configuration to .git/config using ini format
|
|
160
|
+
*/
|
|
161
|
+
declare function writeGitConfig(config: GitConfigData, cwd?: string): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Setup Git configuration with backup and safe merging
|
|
164
|
+
*/
|
|
165
|
+
declare function setupGitConfig(cwd?: string, config?: GitConfig["config"]): Promise<boolean>;
|
|
166
|
+
/**
|
|
167
|
+
* Reset Git configuration with backup
|
|
168
|
+
*/
|
|
169
|
+
declare function resetGitConfig(cwd?: string, keepUser?: boolean, options?: {
|
|
170
|
+
updateConfig?: boolean;
|
|
171
|
+
}): Promise<boolean>;
|
|
172
|
+
/**
|
|
173
|
+
* Setup Git hooks
|
|
174
|
+
*/
|
|
175
|
+
declare function setupGitHooks(cwd?: string, config?: GitConfig["hooks"]): Promise<boolean>;
|
|
176
|
+
/**
|
|
177
|
+
* Initialize Git repository with basis configuration
|
|
178
|
+
*/
|
|
179
|
+
declare function initGitRepo(cwd?: string): Promise<boolean>;
|
|
180
|
+
/**
|
|
181
|
+
* Run comprehensive Git setup
|
|
182
|
+
*/
|
|
183
|
+
declare function setupGit(cwd?: string): Promise<boolean>;
|
|
184
|
+
/**
|
|
185
|
+
* Remove Git hooks
|
|
186
|
+
*/
|
|
187
|
+
declare function removeGitHooks(cwd?: string, hooksToRemove?: string[], options?: {
|
|
188
|
+
updateConfig?: boolean;
|
|
189
|
+
}): Promise<boolean>;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Initialize basis configuration in the current project
|
|
193
|
+
*/
|
|
194
|
+
declare function init(cwd?: string, options?: InitOptions): Promise<boolean>;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Get staged files (only existing files, not deleted ones)
|
|
66
198
|
*/
|
|
67
199
|
declare function getStagedFiles(): string[];
|
|
200
|
+
/**
|
|
201
|
+
* Get all project files based on patterns using fast-glob
|
|
202
|
+
*/
|
|
203
|
+
declare function getProjectFiles(cwd: string, patterns?: string[], exclude?: string[]): Promise<string[]>;
|
|
68
204
|
/**
|
|
69
205
|
* Lint staged files
|
|
70
206
|
*/
|
|
71
207
|
declare function lintStaged(cwd?: string, config?: LintConfig["staged"]): Promise<boolean>;
|
|
72
208
|
/**
|
|
73
|
-
* Lint
|
|
209
|
+
* Lint entire project using commands (similar to staged but for all project files)
|
|
210
|
+
*/
|
|
211
|
+
declare function lintProject(cwd?: string, config?: LintConfig["project"]): Promise<boolean>;
|
|
212
|
+
/**
|
|
213
|
+
* Check dependencies
|
|
74
214
|
*/
|
|
75
|
-
declare function
|
|
215
|
+
declare function lintDependencies(cwd?: string, config?: LintConfig["dependencies"]): Promise<boolean>;
|
|
216
|
+
/**
|
|
217
|
+
* Check project structure
|
|
218
|
+
*/
|
|
219
|
+
declare function lintStructure(cwd?: string, config?: LintConfig["structure"]): Promise<boolean>;
|
|
220
|
+
/**
|
|
221
|
+
* Check documentation
|
|
222
|
+
*/
|
|
223
|
+
declare function lintDocs(cwd?: string, config?: LintConfig["docs"]): Promise<boolean>;
|
|
224
|
+
/**
|
|
225
|
+
* Run all lint checks
|
|
226
|
+
*/
|
|
227
|
+
declare function lintAll(cwd?: string): Promise<boolean>;
|
|
76
228
|
|
|
77
229
|
/**
|
|
78
230
|
* Publish package to npm registry
|
|
@@ -85,5 +237,16 @@ declare function publishPackage(cwd: string, options?: PublishOptions): Promise<
|
|
|
85
237
|
declare function updatePackageVersion(cwd: string, options?: VersionOptions): Promise<VersionUpdateResult>;
|
|
86
238
|
|
|
87
239
|
declare function loadConfig(options?: LoadConfigOptions<BasisConfig>): Promise<c12.ResolvedConfig<BasisConfig, c12.ConfigLayerMeta>>;
|
|
240
|
+
/**
|
|
241
|
+
* Check if file or directory exists
|
|
242
|
+
*/
|
|
243
|
+
declare function fileExists(path: string): Promise<boolean>;
|
|
244
|
+
/**
|
|
245
|
+
* Get package manager specific commands
|
|
246
|
+
*/
|
|
247
|
+
declare function getPackageManagerCommands(packageManager: string): {
|
|
248
|
+
outdated: string;
|
|
249
|
+
audit: string;
|
|
250
|
+
};
|
|
88
251
|
|
|
89
|
-
export { Basis, BasisConfig, CommitMessage,
|
|
252
|
+
export { Basis, BasisConfig, CommitMessage, GitConfig, GitConfigData, InitOptions, LintConfig, PublishOptions, PublishResult, VersionOptions, VersionUpdateResult, createBasis, fileExists, getPackageManagerCommands, getProjectFiles, getStagedFiles, init, initGitRepo, lintAll, lintCommitMessage, lintDependencies, lintDocs, lintProject, lintStaged, lintStructure, loadConfig, parseCommitMessage, publishPackage, readGitConfig, removeGitHooks, resetGitConfig, setupGit, setupGitConfig, setupGitHooks, updatePackageVersion, validateCommitMessage, writeGitConfig };
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{defaultConfig,defineBasisConfig}from"./config.mjs";import{
|
|
1
|
+
export{defaultConfig,defineBasisConfig}from"./config.mjs";import{l as r,s as n,a as o,b as c,i as p,r as u,c as w}from"./shared/basis.DzMHJtq5.mjs";export{p as parseCommitMessage,d as readGitConfig,v as validateCommitMessage,w as writeGitConfig}from"./shared/basis.DzMHJtq5.mjs";import{i as g}from"./shared/basis.1ZgFrMJb.mjs";import{l as h,a as l,b as m,c as d,d as f,e as y}from"./shared/basis.DcC8NBqt.mjs";export{f as getProjectFiles,g as getStagedFiles}from"./shared/basis.DcC8NBqt.mjs";import{p as e}from"./shared/basis.plLH3j3N.mjs";import{u as i}from"./shared/basis.0WCUjjhy.mjs";import{l as C}from"./shared/basis.CkZpidFZ.mjs";export{f as fileExists,g as getPackageManagerCommands}from"./shared/basis.CkZpidFZ.mjs";import"node:child_process";import"node:fs/promises";import"c12/update";import"consola";import"defu";import"ini";import"pathe";import"magicast";import"nypm";import"pkg-types";import"fast-glob";import"micromatch";import"semver";import"c12";class G{config=null;cwd;constructor(t=process.cwd()){this.cwd=t}async getConfig(){if(!this.config){const{config:t}=await C({cwd:this.cwd});this.config=t}return this.config}async init(t={}){return await g(this.cwd,t)}async lintStaged(){const t=await this.getConfig();return await h(this.cwd,t.lint?.staged)}async lintProject(){const t=await this.getConfig();return await l(this.cwd,t.lint?.project)}async lintDependencies(){const t=await this.getConfig();return await m(this.cwd,t.lint?.dependencies)}async lintStructure(){const t=await this.getConfig();return await d(this.cwd,t.lint?.structure)}async lintDocs(){const t=await this.getConfig();return await f(this.cwd,t.lint?.docs)}async lintAll(){return await y(this.cwd)}async lintCommitMessage(){const t=await this.getConfig();return await r(this.cwd,t.git?.commitMsg)}async setupGitHooks(){const t=await this.getConfig();return await n(this.cwd,t.git?.hooks)}async setupGitConfig(){const t=await this.getConfig();return await o(this.cwd,t.git?.config)}async setupGit(){return await c(this.cwd)}async initGitRepo(){return await p(this.cwd)}async removeGitHooks(t=!1){return await u(this.cwd,void 0,{updateConfig:t})}async resetGitConfig(t=!0,s=!1){return await w(this.cwd,t,{updateConfig:s})}async updateVersion(t={}){return await i(this.cwd,t)}async setVersion(t){return await i(this.cwd,{version:t})}async patchVersion(){return await i(this.cwd,{})}async minorVersion(){return await i(this.cwd,{minor:!0})}async majorVersion(){return await i(this.cwd,{major:!0})}async prereleaseVersion(t){return await i(this.cwd,{prerelease:!0,preid:t})}async publish(t={}){return await e(this.cwd,t)}async publishDryRun(t={}){return await e(this.cwd,{...t,dryRun:!0})}async publishToTag(t,s={}){return await e(this.cwd,{...s,tag:t})}async publishStable(t={}){return await e(this.cwd,{...t,stable:!0})}getCwd(){return this.cwd}setCwd(t){this.cwd=t,this.config=null}async reloadConfig(){return this.config=null,await this.getConfig()}async setup(t={}){return await this.init(t)?await this.setupGit():!1}async release(t={},s={}){if(!await this.lintAll())throw new Error("Lint checks failed. Fix issues before releasing.");const b=await this.updateVersion(t),k=await this.publish(s);return{version:b,publish:k}}}function v(a=process.cwd()){return new G(a)}const V=["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"];export{G as Basis,V as VALID_GIT_HOOKS,v as createBasis,g as init,p as initGitRepo,y as lintAll,r as lintCommitMessage,m as lintDependencies,f as lintDocs,l as lintProject,h as lintStaged,d as lintStructure,C as loadConfig,e as publishPackage,u as removeGitHooks,w as resetGitConfig,c as setupGit,o as setupGitConfig,n as setupGitHooks,i as updatePackageVersion};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{execSync as g}from"node:child_process";import{consola as s}from"consola";import{readPackageJSON as v,resolvePackageJSON as f,writePackageJSON as h}from"pkg-types";import m from"semver";import{l as $}from"./basis.CkZpidFZ.mjs";async function P(r,o={}){const{config:u}=await $({cwd:r}),i=u.version||{},d=await v(r),t=d.version;if(!t)throw new Error("No version found in package.json");const n=o.version?m.valid(o.version)?o.version:(()=>{throw new Error(`Invalid version format: ${o.version}`)})():(()=>{if(!m.valid(t))throw new Error(`Invalid current version format: ${t}`);const e=m.prerelease(t),c=o.preid||(e&&typeof e[0]=="string"?e[0]:null)||i.prereleaseId||"edge";let a;o.major?a="major":o.minor?a="minor":o.prerelease?a=e?"prerelease":"prepatch":a=e?"prerelease":"patch";const l=a==="prerelease"||a.startsWith("pre")?m.inc(t,a,c):m.inc(t,a);if(!l)throw new Error("Failed to calculate new version");return l})();s.info(`Updating version: ${t} \u2192 ${n}`);const w=await f(r);await h(w,{...d,version:n});const p={oldVersion:t,newVersion:n};if(i.autoCommit){const e=o.message||i.commitMessage?.replace("{version}",n)||`chore: release v${n}`;try{g("git add package.json",{cwd:r}),g(`git commit -m "${e}"`,{cwd:r}),s.success(`Committed version update: ${e}`)}catch(c){s.warn("Failed to commit changes:",c)}}if(i.autoTag){const e=`${i.tagPrefix||"v"}${n}`;try{g(`git tag ${e}`,{cwd:r}),s.success(`Created git tag: ${e}`),p.tagName=e}catch(c){s.warn("Failed to create git tag:",c)}}if(i.autoPush)try{g("git push",{cwd:r}),i.autoTag&&g("git push --tags",{cwd:r}),s.success("Pushed changes to remote")}catch(e){s.warn("Failed to push changes:",e)}return p}export{P as u};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import{updateConfig as k}from"c12/update";import{consola as s}from"consola";import{parseModule as C,builders as b,generateCode as j}from"magicast";import{detectPackageManager as x,addDevDependency as v,installDependencies as D}from"nypm";import{resolve as c}from"pathe";import{readPackageJSON as w,writePackageJSON as B}from"pkg-types";import{f as l}from"./basis.CkZpidFZ.mjs";import{b as S}from"./basis.DzMHJtq5.mjs";const n={ts:{ext:"ts",label:"TypeScript"},mjs:{ext:"mjs",label:"ES Module"},cjs:{ext:"cjs",label:"CommonJS"}};function G(i){const t=C("");if(i==="cjs"){t.imports.$prepend({from:"@funish/basis",imported:"defineBasisConfig",local:"defineBasisConfig"}),t.exports.default=b.functionCall("defineBasisConfig",{});const o=t.exports.default.$args[0];o.$ast.leadingComments=[{type:"Block",value:`
|
|
2
|
+
Configure your project here
|
|
3
|
+
See: https://github.com/funish/basis/tree/main/packages/basis#configuration
|
|
4
|
+
`}]}else{t.imports.$prepend({from:"@funish/basis",imported:"defineBasisConfig",local:"defineBasisConfig"}),t.exports.default=b.functionCall("defineBasisConfig",{});const o=t.exports.default.$args[0];o.$ast.leadingComments=[{type:"Block",value:`
|
|
5
|
+
Configure your project here
|
|
6
|
+
See: https://github.com/funish/basis/tree/main/packages/basis#configuration
|
|
7
|
+
`}]}return j(t).code}async function z(i){if(await l(c(i,"tsconfig.json")))return"ts";try{if((await w(i)).type==="module")return"mjs"}catch{}return"ts"}async function E(i=process.cwd(),t={}){const{force:o=!1,skipGitCheck:$=!1,skipInstall:f=!1}=t;s.start("Initializing basis configuration...");const p=await z(i),m=await s.prompt("Choose config file format:",{type:"select",initial:p,options:[{value:"ts",label:`${n.ts.label} (${n.ts.ext}) ${p==="ts"?"(recommended)":""}`},{value:"mjs",label:`${n.mjs.label} (${n.mjs.ext}) ${p==="mjs"?"(recommended)":""}`},{value:"cjs",label:`${n.cjs.label} (${n.cjs.ext}) ${p==="cjs"?"(recommended)":""}`}]}),g=n[m].ext,r=`basis.config.${g}`,y=c(i,r);if(await l(y)&&!o)return s.error(`${r} already exists. Use --force to overwrite.`),!1;let d=!1;if(!$){if(await l(c(i,".git")))d=await s.prompt("Setup Git hooks and configuration?",{type:"confirm",initial:!0});else if(s.warn("No .git directory found. Git hooks will not work properly."),!await s.prompt("Continue anyway?",{type:"confirm",initial:!1}))return s.info("Initialization cancelled."),!1}const u=(await x(i))?.name||"npm";s.info(`Detected package manager: ${u}`),await k({cwd:i,configFile:"basis.config",createExtension:g,onCreate:()=>(s.info(`Creating ${r}...`),G(m))}),s.success(`Created ${r}`);try{const e=await w(i),h=!!(e.workspaces||await l(c(i,"pnpm-workspace.yaml")));f?!e.devDependencies?.["@funish/basis"]&&!e.dependencies?.["@funish/basis"]&&(e.devDependencies=e.devDependencies||{},e.devDependencies["@funish/basis"]="latest",s.info("Added @funish/basis to devDependencies")):(await v("@funish/basis",{cwd:i,silent:!1,workspace:h}),s.success("Added @funish/basis to devDependencies"));const a="basis git --setup";e.scripts=e.scripts||{},u==="pnpm"?e.scripts.postinstall?e.scripts.postinstall.includes(a)||(e.scripts.postinstall=`${e.scripts.postinstall} && ${a}`):e.scripts.postinstall=a:u==="yarn"?e.scripts.prepare?e.scripts.prepare.includes(a)||(e.scripts.prepare=`${e.scripts.prepare} && ${a}`):e.scripts.prepare=a:e.scripts.postinstall?e.scripts.postinstall.includes(a)||(e.scripts.postinstall=`${e.scripts.postinstall} && ${a}`):e.scripts.postinstall=a,await B(c(i,"package.json"),e),s.success(`Updated package.json scripts${f?" and dependencies":""}`),f?(s.info("Skipped dependency installation"),s.info("Run your package manager's install command to complete setup")):(s.start("Installing dependencies..."),await D({cwd:i,silent:!1}),s.success("Dependencies installed successfully"))}catch(e){return s.error("Failed to setup dependencies:",e),!1}return d&&(s.start("Setting up Git hooks and configuration..."),await S(i)?s.success("Git setup completed!"):s.warn("Git setup failed, but basis config was created successfully")),s.success("Basis initialization completed!"),s.info("You can now:"),s.info(` - Edit ${r} to customize your configuration`),d||s.info(" - Run `basis git --setup` to install git hooks"),!0}export{E as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const node_child_process=require("node:child_process"),consola=require("consola"),nypm=require("nypm"),pkgTypes=require("pkg-types"),g=require("semver"),utils=require("./basis.BJhSbOyA.cjs");function _interopDefaultCompat(a){return a&&typeof a=="object"&&"default"in a?a.default:a}const g__default=_interopDefaultCompat(g);async function k(a,e,o){if(e.checkGitClean&&!o.skipTests)try{if(node_child_process.execSync("git status --porcelain",{cwd:a,encoding:"utf8"}).trim())throw new Error("Working directory is not clean. Commit your changes first.")}catch(s){consola.consola.warn("Could not check git status:",s)}if(e.checkTests&&!o.skipTests){consola.consola.start("Running tests...");try{e.testCommand?node_child_process.execSync(e.testCommand,{cwd:a,stdio:"inherit"}):await nypm.runScript("test",{cwd:a,silent:!1}),consola.consola.success("Tests passed")}catch(s){throw consola.consola.error("Tests failed"),s}}if(e.buildCommand&&!o.skipBuild){consola.consola.start("Building package...");try{e.buildCommand.includes(" ")?node_child_process.execSync(e.buildCommand,{cwd:a,stdio:"inherit"}):await nypm.runScript(e.buildCommand,{cwd:a,silent:!1}),consola.consola.success("Build completed")}catch(s){throw consola.consola.error("Build failed"),s}}}async function C(a,e){if(e.autoGitPush)try{node_child_process.execSync("git push",{cwd:a}),e.createGitTag&&node_child_process.execSync("git push --tags",{cwd:a}),consola.consola.success("Pushed changes to remote")}catch(o){consola.consola.warn("Failed to push changes:",o)}}async function publishPackage(a,e={}){const{config:o}=await utils.loadConfig({cwd:a}),s=o.publish||{},p=await pkgTypes.readPackageJSON(a),{name:i,version:c}=p;if(!i||!c)throw new Error("Missing name or version in package.json");if(!g__default.valid(c))throw new Error(`Invalid version format in package.json: ${c}`);const u=await nypm.detectPackageManager(a),l=u?.command||"npm";await k(a,s,e);let n;if(e.tag)n=e.tag;else if(e.stable||e.latest)n=s.stableTag||"latest";else if(g__default.prerelease(c)){const t=g__default.prerelease(c);n=t&&t[0]||s.defaultTag||"edge"}else n=s.stableTag||"latest";consola.consola.info(`Publishing ${i}@${c} to tag: ${n}`);const d=["publish","--tag",n,"--access",e.access||s.access||"public"];(e.registry||s.registry)&&d.push("--registry",e.registry||s.registry||""),e.dryRun&&d.push("--dry-run");const h=`${l} ${d.join(" ")}`;consola.consola.start("Publishing package...");try{if(node_child_process.execSync(h,{cwd:a,stdio:"inherit"}),e.dryRun)consola.consola.success("Dry run completed successfully");else{consola.consola.success(`Published ${i}@${c} to ${n}`);const t=s.defaultTag||"edge";if(n!==t){consola.consola.start(`Also publishing to ${t} tag...`);try{let r;u?.name==="yarn"?r=`${l} tag add ${i}@${c} ${t}`:r=`${l} dist-tag add ${i}@${c} ${t}`,node_child_process.execSync(r,{cwd:a,stdio:"inherit"}),consola.consola.success(`Also published ${i}@${c} to ${t}`)}catch(r){consola.consola.warn(`Failed to add ${t} tag:`,r)}}await C(a,s)}return{packageName:i,version:c,publishTag:n,dryRun:e.dryRun||!1}}catch(t){throw consola.consola.error("Failed to publish package:",t),t}}exports.publishPackage=publishPackage;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
"use strict";const node_child_process=require("node:child_process"),consola=require("consola"),P=require("fast-glob"),$=require("micromatch"),nypm=require("nypm"),pathe=require("pathe"),pkgTypes=require("pkg-types"),utils=require("./basis.BJhSbOyA.cjs");function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const P__default=_interopDefaultCompat(P),$__default=_interopDefaultCompat($);function getStagedFiles(){try{const e=node_child_process.execSync("git diff --cached --name-only",{encoding:"utf8"}).trim().split(`
|
|
2
|
+
`).filter(Boolean),i=node_child_process.execSync("git diff --cached --name-only --diff-filter=D",{encoding:"utf8"}),s=new Set(i.trim().split(`
|
|
3
|
+
`).filter(Boolean));return e.filter(n=>!s.has(n))}catch{return[]}}async function getProjectFiles(e,i=["**/*"],s=["node_modules/**","dist/**","build/**",".git/**"]){try{return await P__default(i,{cwd:e,ignore:s,onlyFiles:!0,dot:!1,absolute:!1})}catch(n){return consola.consola.warn("Failed to scan project files:",n),[]}}async function lintStaged(e=process.cwd(),i){const{config:s}=await utils.loadConfig({cwd:e,overrides:i?{lint:{staged:i}}:void 0}),n=s.lint?.staged||{},c=getStagedFiles();if(c.length===0)return consola.consola.info("No staged files to lint"),!0;if(Object.keys(n).length===0)return consola.consola.warn("No staged lint configuration found"),!0;let o=!1;const t=new Set;for(const[d,u]of Object.entries(n)){const r=c.filter(l=>!t.has(l)&&$__default.isMatch(l.split("/").pop()||l,d));if(r.length!==0){consola.consola.start(`Linting ${r.length} files: ${d}`);try{const l=`${u} ${r.join(" ")}`;node_child_process.execSync(l,{stdio:"inherit",cwd:e});const f=[];for(const a of r)await utils.fileExists(pathe.resolve(e,a))&&f.push(a);f.length>0&&node_child_process.execSync(`git add ${f.join(" ")}`,{stdio:"inherit",cwd:e}),r.forEach(a=>t.add(a)),consola.consola.success(`${d}`)}catch(l){o=!0,consola.consola.error(`${d} failed:`,l)}}}return!o}async function lintProject(e=process.cwd(),i){const{config:s}=await utils.loadConfig({cwd:e,overrides:i?{lint:{project:i}}:void 0}),n=s.lint?.project||{};if(Object.keys(n).length===0)return consola.consola.warn("No project lint configuration found"),!0;consola.consola.start("Running project-wide linting...");let c=!1;for(const[o,t]of Object.entries(n)){consola.consola.start(`Running project lint: ${o}`);try{node_child_process.execSync(t,{stdio:"inherit",cwd:e}),consola.consola.success(`${o}`)}catch(d){c=!0,consola.consola.error(`${o} failed:`,d)}}return!c}async function lintDependencies(e=process.cwd(),i){const{config:s}=await utils.loadConfig({cwd:e,overrides:i?{lint:{dependencies:i}}:void 0}),n=s.lint?.dependencies||{};let c=!1;try{const o=await pkgTypes.readPackageJSON(e),t={...o.dependencies,...o.devDependencies},d=(await nypm.detectPackageManager(e))?.name||"npm",u=utils.getPackageManagerCommands(d);if(consola.consola.start("Checking dependencies..."),n.blockedPackages&&n.blockedPackages.length>0){const r=Object.keys(t).filter(l=>n.blockedPackages?.includes(l));r.length>0?(consola.consola.error(`Blocked packages found: ${r.join(", ")}`),c=!0):consola.consola.success("No blocked packages found")}if(n.checkOutdated)try{node_child_process.execSync(u.outdated,{cwd:e,stdio:"pipe"}),consola.consola.success("All dependencies are up to date")}catch(r){consola.consola.warn("\u26A0 Some dependencies are outdated:",r)}if(n.checkSecurity)try{node_child_process.execSync(u.audit,{cwd:e,stdio:"pipe"}),consola.consola.success("No security vulnerabilities found")}catch(r){consola.consola.error("Security vulnerabilities detected:",r),c=!0}n.allowedLicenses&&n.allowedLicenses.length>0&&consola.consola.info("\u{1F4DD} License checking requires manual review or additional tooling")}catch(o){consola.consola.error("Failed to check dependencies:",o),c=!0}return!c}async function lintStructure(e=process.cwd(),i){const{config:s}=await utils.loadConfig({cwd:e,overrides:i?{lint:{structure:i}}:void 0}),n=s.lint?.structure||{};let c=!1;if(consola.consola.start("Checking project structure..."),n.requiredFiles)for(const o of n.requiredFiles){const t=pathe.resolve(e,o);await utils.fileExists(t)?consola.consola.success(`Required file found: ${o}`):(consola.consola.error(`Required file missing: ${o}`),c=!0)}if(n.requiredDirs)for(const o of n.requiredDirs){const t=pathe.resolve(e,o);await utils.fileExists(t)?consola.consola.success(`Required directory found: ${o}`):(consola.consola.error(`Required directory missing: ${o}`),c=!0)}if(n.naming&&n.naming.length>0)for(const o of n.naming){const{path:t,files:d,directories:u,description:r}=o;consola.consola.start(`Checking naming rule: ${r||t}`);const l=await getProjectFiles(e,[t]);if(d){const f=new RegExp(d),a=l.filter(p=>{const g=p.split("/").pop()||"";return!f.test(g)});a.length>0?(consola.consola.error(`Files with invalid naming in ${t}: ${a.slice(0,3).join(", ")}${a.length>3?"...":""}`),c=!0):l.length>0&&consola.consola.success(`All files in ${t} follow naming convention`)}if(u){const f=new RegExp(u),a=new Set;l.forEach(g=>{const h=g.split("/");h.pop(),h.forEach(w=>a.add(w))});const p=Array.from(a).filter(g=>!f.test(g));p.length>0?(consola.consola.error(`Directories with invalid naming in ${t}: ${p.slice(0,3).join(", ")}`),c=!0):a.size>0&&consola.consola.success(`All directories in ${t} follow naming convention`)}}return!c}async function lintDocs(e=process.cwd(),i){const{config:s}=await utils.loadConfig({cwd:e,overrides:i?{lint:{docs:i}}:void 0}),n=s.lint?.docs||{};let c=!1;if(consola.consola.start("Checking documentation..."),n.checkReadme!==!1){const o=["README.md","README.rst","README.txt","readme.md"];(await Promise.all(o.map(t=>utils.fileExists(pathe.resolve(e,t))))).some(t=>t)?consola.consola.success("README file found"):(consola.consola.error("No README file found"),c=!0)}if(n.checkChangelog){const o=["CHANGELOG.md","CHANGELOG.rst","HISTORY.md","changelog.md"];(await Promise.all(o.map(t=>utils.fileExists(pathe.resolve(e,t))))).some(t=>t)?consola.consola.success("CHANGELOG file found"):(consola.consola.error("No CHANGELOG file found"),c=!0)}return!c}async function lintAll(e=process.cwd()){const{config:i}=await utils.loadConfig({cwd:e}),s=i.lint||{};consola.consola.start("Running comprehensive project lint...");const n=(await Promise.allSettled([lintProject(e,s.project),lintDependencies(e,s.dependencies),lintStructure(e,s.structure),lintDocs(e,s.docs)])).filter(c=>c.status==="rejected"||c.status==="fulfilled"&&!c.value);return n.length===0?(consola.consola.success("All lint checks passed!"),!0):(consola.consola.error(`${n.length} lint check(s) failed`),!1)}exports.getProjectFiles=getProjectFiles,exports.getStagedFiles=getStagedFiles,exports.lintAll=lintAll,exports.lintDependencies=lintDependencies,exports.lintDocs=lintDocs,exports.lintProject=lintProject,exports.lintStaged=lintStaged,exports.lintStructure=lintStructure;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const promises=require("node:fs/promises"),c12=require("c12"),config=require("../config.cjs");async function loadConfig(e={}){return await c12.loadConfig({name:"basis",cwd:process.cwd(),...e,defaults:{...config.defaultConfig,...e.defaults}})}async function fileExists(e){try{return await promises.access(e),!0}catch{return!1}}function getPackageManagerCommands(e){switch(e){case"yarn":return{outdated:"yarn outdated --json",audit:"yarn audit --level moderate"};case"pnpm":return{outdated:"pnpm outdated --format table",audit:"pnpm audit --audit-level moderate"};case"bun":return{outdated:"bun outdated",audit:"bun audit --audit-level moderate"};default:return{outdated:"npm outdated --json",audit:"npm audit --audit-level moderate"}}}exports.fileExists=fileExists,exports.getPackageManagerCommands=getPackageManagerCommands,exports.loadConfig=loadConfig;
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
interface BasisConfig {
|
|
2
|
+
lint?: LintConfig;
|
|
3
|
+
git?: GitConfig;
|
|
4
|
+
packageManager?: PackageManagerConfig;
|
|
5
|
+
version?: VersionConfig;
|
|
6
|
+
publish?: PublishConfig;
|
|
7
|
+
}
|
|
8
|
+
interface LintConfig {
|
|
9
|
+
staged?: Record<string, string>;
|
|
10
|
+
project?: Record<string, string>;
|
|
11
|
+
dependencies?: {
|
|
12
|
+
checkOutdated?: boolean;
|
|
13
|
+
checkSecurity?: boolean;
|
|
14
|
+
allowedLicenses?: string[];
|
|
15
|
+
blockedPackages?: string[];
|
|
16
|
+
};
|
|
17
|
+
structure?: {
|
|
18
|
+
requiredFiles?: string[];
|
|
19
|
+
requiredDirs?: string[];
|
|
20
|
+
naming?: Array<{
|
|
21
|
+
path: string;
|
|
22
|
+
files?: string;
|
|
23
|
+
directories?: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
}>;
|
|
26
|
+
};
|
|
27
|
+
docs?: {
|
|
28
|
+
checkReadme?: boolean;
|
|
29
|
+
checkChangelog?: boolean;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
interface GitConfig {
|
|
33
|
+
hooks?: Partial<Record<ValidGitHook, string>>;
|
|
34
|
+
config?: {
|
|
35
|
+
core?: {
|
|
36
|
+
editor?: string;
|
|
37
|
+
autocrlf?: boolean | "input";
|
|
38
|
+
eol?: "lf" | "crlf" | "native";
|
|
39
|
+
ignorecase?: boolean;
|
|
40
|
+
filemode?: boolean;
|
|
41
|
+
bare?: boolean;
|
|
42
|
+
logallrefupdates?: boolean;
|
|
43
|
+
repositoryformatversion?: number;
|
|
44
|
+
sharedrepository?: boolean | "group" | "all" | "world" | "everybody";
|
|
45
|
+
worktree?: string;
|
|
46
|
+
precomposeunicode?: boolean;
|
|
47
|
+
protecthfs?: boolean;
|
|
48
|
+
protectntfs?: boolean;
|
|
49
|
+
};
|
|
50
|
+
user?: {
|
|
51
|
+
name?: string;
|
|
52
|
+
email?: string;
|
|
53
|
+
signingkey?: string;
|
|
54
|
+
};
|
|
55
|
+
init?: {
|
|
56
|
+
defaultBranch?: string;
|
|
57
|
+
};
|
|
58
|
+
branch?: {
|
|
59
|
+
autosetupmerge?: boolean | "always";
|
|
60
|
+
autosetuprebase?: "never" | "local" | "remote" | "always";
|
|
61
|
+
};
|
|
62
|
+
push?: {
|
|
63
|
+
default?: "nothing" | "current" | "upstream" | "simple" | "matching";
|
|
64
|
+
followTags?: boolean;
|
|
65
|
+
autoSetupRemote?: boolean;
|
|
66
|
+
};
|
|
67
|
+
pull?: {
|
|
68
|
+
rebase?: boolean | "preserve" | "merges" | "interactive";
|
|
69
|
+
ff?: boolean | "only";
|
|
70
|
+
};
|
|
71
|
+
merge?: {
|
|
72
|
+
tool?: string;
|
|
73
|
+
conflictstyle?: "merge" | "diff3";
|
|
74
|
+
ff?: boolean | "only";
|
|
75
|
+
log?: boolean | number;
|
|
76
|
+
};
|
|
77
|
+
rebase?: {
|
|
78
|
+
autoSquash?: boolean;
|
|
79
|
+
autoStash?: boolean;
|
|
80
|
+
updateRefs?: boolean;
|
|
81
|
+
};
|
|
82
|
+
fetch?: {
|
|
83
|
+
prune?: boolean;
|
|
84
|
+
pruneTags?: boolean;
|
|
85
|
+
fsckobjects?: boolean;
|
|
86
|
+
};
|
|
87
|
+
remote?: {
|
|
88
|
+
[remoteName: string]: {
|
|
89
|
+
url?: string;
|
|
90
|
+
fetch?: string;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
diff?: {
|
|
94
|
+
tool?: string;
|
|
95
|
+
algorithm?: "myers" | "minimal" | "patience" | "histogram";
|
|
96
|
+
renames?: boolean | "copy" | "copies";
|
|
97
|
+
mnemonicprefix?: boolean;
|
|
98
|
+
};
|
|
99
|
+
status?: {
|
|
100
|
+
showUntrackedFiles?: "no" | "normal" | "all";
|
|
101
|
+
branch?: boolean;
|
|
102
|
+
short?: boolean;
|
|
103
|
+
};
|
|
104
|
+
commit?: {
|
|
105
|
+
cleanup?: "strip" | "whitespace" | "verbatim" | "scissors" | "default";
|
|
106
|
+
gpgsign?: boolean;
|
|
107
|
+
template?: string;
|
|
108
|
+
verbose?: boolean;
|
|
109
|
+
};
|
|
110
|
+
log?: {
|
|
111
|
+
abbrevCommit?: boolean;
|
|
112
|
+
decorate?: boolean | "short" | "full" | "auto" | "no";
|
|
113
|
+
showSignature?: boolean;
|
|
114
|
+
};
|
|
115
|
+
transfer?: {
|
|
116
|
+
fsckobjects?: boolean;
|
|
117
|
+
};
|
|
118
|
+
receive?: {
|
|
119
|
+
fsckObjects?: boolean;
|
|
120
|
+
};
|
|
121
|
+
gc?: {
|
|
122
|
+
auto?: number;
|
|
123
|
+
autopacklimit?: number;
|
|
124
|
+
autodetach?: boolean;
|
|
125
|
+
};
|
|
126
|
+
alias?: {
|
|
127
|
+
[aliasName: string]: string;
|
|
128
|
+
};
|
|
129
|
+
url?: {
|
|
130
|
+
[pattern: string]: {
|
|
131
|
+
insteadOf?: string;
|
|
132
|
+
pushInsteadOf?: string;
|
|
133
|
+
};
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
commitMsg?: CommitMsgConfig;
|
|
137
|
+
autoSetup?: boolean;
|
|
138
|
+
autoInitGit?: boolean;
|
|
139
|
+
skipGitCheck?: boolean;
|
|
140
|
+
force?: boolean;
|
|
141
|
+
}
|
|
142
|
+
interface CommitMsgConfig {
|
|
143
|
+
types?: string[];
|
|
144
|
+
maxLength?: number;
|
|
145
|
+
minLength?: number;
|
|
146
|
+
scopeRequired?: boolean;
|
|
147
|
+
allowedScopes?: string[];
|
|
148
|
+
}
|
|
149
|
+
interface CommitMessage {
|
|
150
|
+
type: string;
|
|
151
|
+
scope?: string;
|
|
152
|
+
description: string;
|
|
153
|
+
body?: string;
|
|
154
|
+
footer?: string;
|
|
155
|
+
isBreaking: boolean;
|
|
156
|
+
}
|
|
157
|
+
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"];
|
|
158
|
+
type ValidGitHook = (typeof VALID_GIT_HOOKS)[number];
|
|
159
|
+
type GitConfigValue = string | number | boolean;
|
|
160
|
+
type GitConfigSection = Record<string, GitConfigValue>;
|
|
161
|
+
type GitConfigData = Record<string, GitConfigSection>;
|
|
162
|
+
interface PackageManagerConfig {
|
|
163
|
+
/** Preferred package manager (aligned with nypm support) */
|
|
164
|
+
preferred?: "npm" | "yarn" | "pnpm" | "bun" | "deno";
|
|
165
|
+
/** Auto-detect package manager from project */
|
|
166
|
+
autoDetect?: boolean;
|
|
167
|
+
/** NPM registry URL */
|
|
168
|
+
registry?: string;
|
|
169
|
+
}
|
|
170
|
+
interface VersionConfig {
|
|
171
|
+
/** Git tag prefix */
|
|
172
|
+
tagPrefix?: string;
|
|
173
|
+
/** Auto commit version changes */
|
|
174
|
+
autoCommit?: boolean;
|
|
175
|
+
/** Auto create git tag */
|
|
176
|
+
autoTag?: boolean;
|
|
177
|
+
/** Auto push changes to remote */
|
|
178
|
+
autoPush?: boolean;
|
|
179
|
+
/** Prerelease identifier (alpha, beta, rc) */
|
|
180
|
+
prereleaseId?: string;
|
|
181
|
+
/** Commit message template */
|
|
182
|
+
commitMessage?: string;
|
|
183
|
+
}
|
|
184
|
+
interface PublishConfig {
|
|
185
|
+
/** NPM registry URL */
|
|
186
|
+
registry?: string;
|
|
187
|
+
/** Package access level */
|
|
188
|
+
access?: "public" | "private";
|
|
189
|
+
/** Default publish tag (for non-stable releases) */
|
|
190
|
+
defaultTag?: string;
|
|
191
|
+
/** Stable release tag */
|
|
192
|
+
stableTag?: string;
|
|
193
|
+
/** Build command before publish */
|
|
194
|
+
buildCommand?: string;
|
|
195
|
+
/** Test command before publish */
|
|
196
|
+
testCommand?: string;
|
|
197
|
+
/** Check git working directory is clean */
|
|
198
|
+
checkGitClean?: boolean;
|
|
199
|
+
/** Run tests before publish */
|
|
200
|
+
checkTests?: boolean;
|
|
201
|
+
/** Auto push git changes after publish */
|
|
202
|
+
autoGitPush?: boolean;
|
|
203
|
+
/** Create git tag after publish */
|
|
204
|
+
createGitTag?: boolean;
|
|
205
|
+
}
|
|
206
|
+
interface InitOptions {
|
|
207
|
+
force?: boolean;
|
|
208
|
+
skipGitCheck?: boolean;
|
|
209
|
+
skipInstall?: boolean;
|
|
210
|
+
}
|
|
211
|
+
interface VersionOptions {
|
|
212
|
+
version?: string;
|
|
213
|
+
preid?: string;
|
|
214
|
+
prerelease?: boolean;
|
|
215
|
+
major?: boolean;
|
|
216
|
+
minor?: boolean;
|
|
217
|
+
patch?: boolean;
|
|
218
|
+
tag?: string;
|
|
219
|
+
message?: string;
|
|
220
|
+
}
|
|
221
|
+
interface PublishOptions {
|
|
222
|
+
tag?: string;
|
|
223
|
+
stable?: boolean;
|
|
224
|
+
latest?: boolean;
|
|
225
|
+
dryRun?: boolean;
|
|
226
|
+
access?: "public" | "private";
|
|
227
|
+
registry?: string;
|
|
228
|
+
skipBuild?: boolean;
|
|
229
|
+
skipTests?: boolean;
|
|
230
|
+
}
|
|
231
|
+
interface VersionUpdateResult {
|
|
232
|
+
oldVersion: string;
|
|
233
|
+
newVersion: string;
|
|
234
|
+
tagName?: string;
|
|
235
|
+
}
|
|
236
|
+
interface PublishResult {
|
|
237
|
+
packageName: string;
|
|
238
|
+
version: string;
|
|
239
|
+
publishTag: string;
|
|
240
|
+
dryRun: boolean;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Define a Basis configuration
|
|
245
|
+
*/
|
|
246
|
+
declare function defineBasisConfig(config: BasisConfig): BasisConfig;
|
|
247
|
+
/**
|
|
248
|
+
* Default configuration
|
|
249
|
+
*/
|
|
250
|
+
declare const defaultConfig: BasisConfig;
|
|
251
|
+
|
|
252
|
+
export { defineBasisConfig as d, defaultConfig as e, VALID_GIT_HOOKS as g };
|
|
253
|
+
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, PackageManagerConfig as k, VersionConfig as l, PublishConfig as m };
|