@funish/basis 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +70 -24
- 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 +193 -24
- package/dist/index.d.mts +193 -24
- package/dist/index.d.ts +193 -24
- package/dist/index.mjs +1 -1
- package/dist/shared/{basis.dc3ybBoz.mjs → basis.BglwV-us.mjs} +1 -1
- package/dist/shared/{basis.CgpyxNW3.cjs → basis.Bhi6kSAJ.cjs} +1 -1
- package/dist/shared/basis.BjS41bTE.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.C7U9rUSl.mjs +1 -0
- package/dist/shared/basis.CASkqgVR.mjs +1 -0
- package/dist/shared/basis.D2srGCU3.cjs +1 -0
- package/dist/shared/basis.D3bv4yUV.mjs +3 -0
- package/dist/shared/basis.DHqql56x.mjs +10 -0
- package/dist/shared/basis.DXBdQ4nF.mjs +1 -0
- package/dist/shared/basis.DcyVtmjR.cjs +1 -0
- package/dist/shared/basis.FJWRn1Ix.cjs +3 -0
- package/dist/shared/basis.QoGvLLsN.cjs +10 -0
- package/package.json +5 -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.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.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.mts
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.mjs';
|
|
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.mjs';
|
|
3
3
|
import * as c12 from 'c12';
|
|
4
4
|
import { LoadConfigOptions } from 'c12';
|
|
5
5
|
|
|
@@ -20,59 +20,224 @@ 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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Parse commit message into structured format
|
|
141
|
+
*/
|
|
142
|
+
declare function parseCommitMessage(message: string): CommitMessage | null;
|
|
143
|
+
/**
|
|
144
|
+
* Validate commit message against rules
|
|
145
|
+
*/
|
|
146
|
+
declare function validateCommitMessage(message: string, config?: GitConfig["commitMsg"]): {
|
|
147
|
+
valid: boolean;
|
|
148
|
+
errors: string[];
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
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>;
|
|
47
190
|
|
|
48
191
|
/**
|
|
49
192
|
* Initialize basis configuration in the current project
|
|
50
193
|
*/
|
|
51
194
|
declare function init(cwd?: string, options?: InitOptions): Promise<boolean>;
|
|
52
|
-
|
|
53
195
|
/**
|
|
54
|
-
*
|
|
196
|
+
* Preview generated configuration
|
|
55
197
|
*/
|
|
56
|
-
declare function
|
|
198
|
+
declare function previewBasisConfig(options?: {
|
|
199
|
+
enableStagedLinting?: boolean;
|
|
200
|
+
enableCommitMsgLinting?: boolean;
|
|
201
|
+
customLintPatterns?: string[];
|
|
202
|
+
customExcludePatterns?: string[];
|
|
203
|
+
}): string;
|
|
57
204
|
/**
|
|
58
|
-
*
|
|
205
|
+
* Create minimal configuration for quick setup
|
|
59
206
|
*/
|
|
60
|
-
declare function
|
|
61
|
-
|
|
62
|
-
errors: string[];
|
|
63
|
-
};
|
|
207
|
+
declare function createMinimalConfig(): string;
|
|
208
|
+
|
|
64
209
|
/**
|
|
65
|
-
* Get staged files
|
|
210
|
+
* Get staged files (only existing files, not deleted ones)
|
|
66
211
|
*/
|
|
67
212
|
declare function getStagedFiles(): string[];
|
|
213
|
+
/**
|
|
214
|
+
* Get all project files based on patterns
|
|
215
|
+
*/
|
|
216
|
+
declare function getProjectFiles(cwd: string, patterns?: string[], exclude?: string[]): Promise<string[]>;
|
|
68
217
|
/**
|
|
69
218
|
* Lint staged files
|
|
70
219
|
*/
|
|
71
220
|
declare function lintStaged(cwd?: string, config?: LintConfig["staged"]): Promise<boolean>;
|
|
72
221
|
/**
|
|
73
|
-
* Lint
|
|
222
|
+
* Lint entire project using commands (similar to staged but for all project files)
|
|
223
|
+
*/
|
|
224
|
+
declare function lintProject(cwd?: string, config?: LintConfig["project"]): Promise<boolean>;
|
|
225
|
+
/**
|
|
226
|
+
* Check dependencies
|
|
74
227
|
*/
|
|
75
|
-
declare function
|
|
228
|
+
declare function lintDependencies(cwd?: string, config?: LintConfig["dependencies"]): Promise<boolean>;
|
|
229
|
+
/**
|
|
230
|
+
* Check project structure
|
|
231
|
+
*/
|
|
232
|
+
declare function lintStructure(cwd?: string, config?: LintConfig["structure"]): Promise<boolean>;
|
|
233
|
+
/**
|
|
234
|
+
* Check documentation
|
|
235
|
+
*/
|
|
236
|
+
declare function lintDocs(cwd?: string, config?: LintConfig["docs"]): Promise<boolean>;
|
|
237
|
+
/**
|
|
238
|
+
* Run all lint checks
|
|
239
|
+
*/
|
|
240
|
+
declare function lintAll(cwd?: string): Promise<boolean>;
|
|
76
241
|
|
|
77
242
|
/**
|
|
78
243
|
* Publish package to npm registry
|
|
@@ -85,5 +250,9 @@ declare function publishPackage(cwd: string, options?: PublishOptions): Promise<
|
|
|
85
250
|
declare function updatePackageVersion(cwd: string, options?: VersionOptions): Promise<VersionUpdateResult>;
|
|
86
251
|
|
|
87
252
|
declare function loadConfig(options?: LoadConfigOptions<BasisConfig>): Promise<c12.ResolvedConfig<BasisConfig, c12.ConfigLayerMeta>>;
|
|
253
|
+
/**
|
|
254
|
+
* Check if file or directory exists
|
|
255
|
+
*/
|
|
256
|
+
declare function fileExists(path: string): Promise<boolean>;
|
|
88
257
|
|
|
89
|
-
export { Basis, BasisConfig, CommitMessage,
|
|
258
|
+
export { Basis, BasisConfig, CommitMessage, GitConfig, GitConfigData, InitOptions, LintConfig, PublishOptions, PublishResult, VersionOptions, VersionUpdateResult, createBasis, createMinimalConfig, fileExists, getProjectFiles, getStagedFiles, init, initGitRepo, lintAll, lintCommitMessage, lintDependencies, lintDocs, lintProject, lintStaged, lintStructure, loadConfig, parseCommitMessage, previewBasisConfig, publishPackage, readGitConfig, removeGitHooks, resetGitConfig, setupGit, setupGitConfig, setupGitHooks, updatePackageVersion, validateCommitMessage, writeGitConfig };
|
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,224 @@ 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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
139
|
+
/**
|
|
140
|
+
* Parse commit message into structured format
|
|
141
|
+
*/
|
|
142
|
+
declare function parseCommitMessage(message: string): CommitMessage | null;
|
|
143
|
+
/**
|
|
144
|
+
* Validate commit message against rules
|
|
145
|
+
*/
|
|
146
|
+
declare function validateCommitMessage(message: string, config?: GitConfig["commitMsg"]): {
|
|
147
|
+
valid: boolean;
|
|
148
|
+
errors: string[];
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
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>;
|
|
47
190
|
|
|
48
191
|
/**
|
|
49
192
|
* Initialize basis configuration in the current project
|
|
50
193
|
*/
|
|
51
194
|
declare function init(cwd?: string, options?: InitOptions): Promise<boolean>;
|
|
52
|
-
|
|
53
195
|
/**
|
|
54
|
-
*
|
|
196
|
+
* Preview generated configuration
|
|
55
197
|
*/
|
|
56
|
-
declare function
|
|
198
|
+
declare function previewBasisConfig(options?: {
|
|
199
|
+
enableStagedLinting?: boolean;
|
|
200
|
+
enableCommitMsgLinting?: boolean;
|
|
201
|
+
customLintPatterns?: string[];
|
|
202
|
+
customExcludePatterns?: string[];
|
|
203
|
+
}): string;
|
|
57
204
|
/**
|
|
58
|
-
*
|
|
205
|
+
* Create minimal configuration for quick setup
|
|
59
206
|
*/
|
|
60
|
-
declare function
|
|
61
|
-
|
|
62
|
-
errors: string[];
|
|
63
|
-
};
|
|
207
|
+
declare function createMinimalConfig(): string;
|
|
208
|
+
|
|
64
209
|
/**
|
|
65
|
-
* Get staged files
|
|
210
|
+
* Get staged files (only existing files, not deleted ones)
|
|
66
211
|
*/
|
|
67
212
|
declare function getStagedFiles(): string[];
|
|
213
|
+
/**
|
|
214
|
+
* Get all project files based on patterns
|
|
215
|
+
*/
|
|
216
|
+
declare function getProjectFiles(cwd: string, patterns?: string[], exclude?: string[]): Promise<string[]>;
|
|
68
217
|
/**
|
|
69
218
|
* Lint staged files
|
|
70
219
|
*/
|
|
71
220
|
declare function lintStaged(cwd?: string, config?: LintConfig["staged"]): Promise<boolean>;
|
|
72
221
|
/**
|
|
73
|
-
* Lint
|
|
222
|
+
* Lint entire project using commands (similar to staged but for all project files)
|
|
223
|
+
*/
|
|
224
|
+
declare function lintProject(cwd?: string, config?: LintConfig["project"]): Promise<boolean>;
|
|
225
|
+
/**
|
|
226
|
+
* Check dependencies
|
|
74
227
|
*/
|
|
75
|
-
declare function
|
|
228
|
+
declare function lintDependencies(cwd?: string, config?: LintConfig["dependencies"]): Promise<boolean>;
|
|
229
|
+
/**
|
|
230
|
+
* Check project structure
|
|
231
|
+
*/
|
|
232
|
+
declare function lintStructure(cwd?: string, config?: LintConfig["structure"]): Promise<boolean>;
|
|
233
|
+
/**
|
|
234
|
+
* Check documentation
|
|
235
|
+
*/
|
|
236
|
+
declare function lintDocs(cwd?: string, config?: LintConfig["docs"]): Promise<boolean>;
|
|
237
|
+
/**
|
|
238
|
+
* Run all lint checks
|
|
239
|
+
*/
|
|
240
|
+
declare function lintAll(cwd?: string): Promise<boolean>;
|
|
76
241
|
|
|
77
242
|
/**
|
|
78
243
|
* Publish package to npm registry
|
|
@@ -85,5 +250,9 @@ declare function publishPackage(cwd: string, options?: PublishOptions): Promise<
|
|
|
85
250
|
declare function updatePackageVersion(cwd: string, options?: VersionOptions): Promise<VersionUpdateResult>;
|
|
86
251
|
|
|
87
252
|
declare function loadConfig(options?: LoadConfigOptions<BasisConfig>): Promise<c12.ResolvedConfig<BasisConfig, c12.ConfigLayerMeta>>;
|
|
253
|
+
/**
|
|
254
|
+
* Check if file or directory exists
|
|
255
|
+
*/
|
|
256
|
+
declare function fileExists(path: string): Promise<boolean>;
|
|
88
257
|
|
|
89
|
-
export { Basis, BasisConfig, CommitMessage,
|
|
258
|
+
export { Basis, BasisConfig, CommitMessage, GitConfig, GitConfigData, InitOptions, LintConfig, PublishOptions, PublishResult, VersionOptions, VersionUpdateResult, createBasis, createMinimalConfig, fileExists, getProjectFiles, getStagedFiles, init, initGitRepo, lintAll, lintCommitMessage, lintDependencies, lintDocs, lintProject, lintStaged, lintStructure, loadConfig, parseCommitMessage, previewBasisConfig, 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 w,c as u}from"./shared/basis.DHqql56x.mjs";export{p as parseCommitMessage,d as readGitConfig,v as validateCommitMessage,w as writeGitConfig}from"./shared/basis.DHqql56x.mjs";import{i as g}from"./shared/basis.DXBdQ4nF.mjs";export{c as createMinimalConfig,p as previewBasisConfig}from"./shared/basis.DXBdQ4nF.mjs";import{l as h,a as l,b as d,c as m,d as f,e as y}from"./shared/basis.D3bv4yUV.mjs";export{f as getProjectFiles,g as getStagedFiles}from"./shared/basis.D3bv4yUV.mjs";import{p as e}from"./shared/basis.BglwV-us.mjs";import{u as i}from"./shared/basis.CASkqgVR.mjs";import{l as C}from"./shared/basis.C7U9rUSl.mjs";export{f as fileExists}from"./shared/basis.C7U9rUSl.mjs";import"node:child_process";import"node:fs/promises";import"consola";import"ini";import"magicast";import"pathe";import"nypm";import"pkg-types";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 d(this.cwd,t.lint?.dependencies)}async lintStructure(){const t=await this.getConfig();return await m(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 w(this.cwd,void 0,{updateConfig:t})}async resetGitConfig(t=!0,s=!1){return await u(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),v=await this.publish(s);return{version:b,publish:v}}}function k(a=process.cwd()){return new G(a)}const x=["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,x as VALID_GIT_HOOKS,k as createBasis,g as init,p as initGitRepo,y as lintAll,r as lintCommitMessage,d as lintDependencies,f as lintDocs,l as lintProject,h as lintStaged,m as lintStructure,C as loadConfig,e as publishPackage,w as removeGitHooks,u as resetGitConfig,c as setupGit,o as setupGitConfig,n as setupGitHooks,i as updatePackageVersion};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{execSync as d}from"node:child_process";import{consola as e}from"consola";import{detectPackageManager as w,runScript as y}from"nypm";import{readPackageJSON as $}from"pkg-types";import h from"semver";import{l as k}from"./basis.
|
|
1
|
+
import{execSync as d}from"node:child_process";import{consola as e}from"consola";import{detectPackageManager as w,runScript as y}from"nypm";import{readPackageJSON as $}from"pkg-types";import h from"semver";import{l as k}from"./basis.C7U9rUSl.mjs";async function b(a,t,o){if(t.checkGitClean&&!o.skipTests)try{if(d("git status --porcelain",{cwd:a,encoding:"utf8"}).trim())throw new Error("Working directory is not clean. Commit your changes first.")}catch(i){e.warn("Could not check git status:",i)}if(t.checkTests&&!o.skipTests){e.start("Running tests...");try{t.testCommand?d(t.testCommand,{cwd:a,stdio:"inherit"}):await y("test",{cwd:a,silent:!1}),e.success("Tests passed")}catch(i){throw e.error("Tests failed"),i}}if(t.buildCommand&&!o.skipBuild){e.start("Building package...");try{d(t.buildCommand,{cwd:a,stdio:"inherit"}),e.success("Build completed")}catch(i){throw e.error("Build failed"),i}}}async function T(a,t){if(t.autoGitPush)try{d("git push",{cwd:a}),t.createGitTag&&d("git push --tags",{cwd:a}),e.success("Pushed changes to remote")}catch(o){e.warn("Failed to push changes:",o)}}async function C(a,t={}){const{config:o}=await k({cwd:a}),i=o.publish||{},m=await $(a),{name:n,version:c}=m;if(!n||!c)throw new Error("Missing name or version in package.json");if(!h.valid(c))throw new Error(`Invalid version format in package.json: ${c}`);const p=await w(a),u=p?.command||"npm";await b(a,i,t);let r;if(t.tag)r=t.tag;else if(t.stable||t.latest)r=i.stableTag||"latest";else if(h.prerelease(c)){const s=h.prerelease(c);r=s&&s[0]||i.defaultTag||"edge"}else r=i.stableTag||"latest";e.info(`Publishing ${n}@${c} to tag: ${r}`);const g=["publish","--tag",r,"--access",t.access||i.access||"public"];(t.registry||i.registry)&&g.push("--registry",t.registry||i.registry||""),t.dryRun&&g.push("--dry-run");const f=`${u} ${g.join(" ")}`;e.start("Publishing package...");try{if(d(f,{cwd:a,stdio:"inherit"}),t.dryRun)e.success("Dry run completed successfully");else{e.success(`Published ${n}@${c} to ${r}`);const s=i.defaultTag||"edge";if(r!==s){e.start(`Also publishing to ${s} tag...`);try{let l;p?.name==="yarn"?l=`${u} tag add ${n}@${c} ${s}`:l=`${u} dist-tag add ${n}@${c} ${s}`,d(l,{cwd:a,stdio:"inherit"}),e.success(`Also published ${n}@${c} to ${s}`)}catch(l){e.warn(`Failed to add ${s} tag:`,l)}}await T(a,i)}return{packageName:n,version:c,publishTag:r,dryRun:t.dryRun||!1}}catch(s){throw e.error("Failed to publish package:",s),s}}export{C as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const node_child_process=require("node:child_process"),consola=require("consola"),nypm=require("nypm"),pkgTypes=require("pkg-types"),
|
|
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.DcyVtmjR.cjs");function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const g__default=_interopDefaultCompat(g);async function k(e,t,n){if(t.checkGitClean&&!n.skipTests)try{if(node_child_process.execSync("git status --porcelain",{cwd:e,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(t.checkTests&&!n.skipTests){consola.consola.start("Running tests...");try{t.testCommand?node_child_process.execSync(t.testCommand,{cwd:e,stdio:"inherit"}):await nypm.runScript("test",{cwd:e,silent:!1}),consola.consola.success("Tests passed")}catch(s){throw consola.consola.error("Tests failed"),s}}if(t.buildCommand&&!n.skipBuild){consola.consola.start("Building package...");try{node_child_process.execSync(t.buildCommand,{cwd:e,stdio:"inherit"}),consola.consola.success("Build completed")}catch(s){throw consola.consola.error("Build failed"),s}}}async function C(e,t){if(t.autoGitPush)try{node_child_process.execSync("git push",{cwd:e}),t.createGitTag&&node_child_process.execSync("git push --tags",{cwd:e}),consola.consola.success("Pushed changes to remote")}catch(n){consola.consola.warn("Failed to push changes:",n)}}async function publishPackage(e,t={}){const{config:n}=await utils.loadConfig({cwd:e}),s=n.publish||{},p=await pkgTypes.readPackageJSON(e),{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 d=await nypm.detectPackageManager(e),l=d?.command||"npm";await k(e,s,t);let o;if(t.tag)o=t.tag;else if(t.stable||t.latest)o=s.stableTag||"latest";else if(g__default.prerelease(c)){const a=g__default.prerelease(c);o=a&&a[0]||s.defaultTag||"edge"}else o=s.stableTag||"latest";consola.consola.info(`Publishing ${i}@${c} to tag: ${o}`);const u=["publish","--tag",o,"--access",t.access||s.access||"public"];(t.registry||s.registry)&&u.push("--registry",t.registry||s.registry||""),t.dryRun&&u.push("--dry-run");const h=`${l} ${u.join(" ")}`;consola.consola.start("Publishing package...");try{if(node_child_process.execSync(h,{cwd:e,stdio:"inherit"}),t.dryRun)consola.consola.success("Dry run completed successfully");else{consola.consola.success(`Published ${i}@${c} to ${o}`);const a=s.defaultTag||"edge";if(o!==a){consola.consola.start(`Also publishing to ${a} tag...`);try{let r;d?.name==="yarn"?r=`${l} tag add ${i}@${c} ${a}`:r=`${l} dist-tag add ${i}@${c} ${a}`,node_child_process.execSync(r,{cwd:e,stdio:"inherit"}),consola.consola.success(`Also published ${i}@${c} to ${a}`)}catch(r){consola.consola.warn(`Failed to add ${a} tag:`,r)}}await C(e,s)}return{packageName:i,version:c,publishTag:o,dryRun:t.dryRun||!1}}catch(a){throw consola.consola.error("Failed to publish package:",a),a}}exports.publishPackage=publishPackage;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const node_child_process=require("node:child_process"),consola=require("consola"),pkgTypes=require("pkg-types"),g=require("semver"),utils=require("./basis.DcyVtmjR.cjs");function _interopDefaultCompat(e){return e&&typeof e=="object"&&"default"in e?e.default:e}const g__default=_interopDefaultCompat(g);async function updatePackageVersion(e,t={}){const{config:u}=await utils.loadConfig({cwd:e}),r=u.version||{},i=await pkgTypes.readPackageJSON(e),s=i.version;if(!s)throw new Error("No version found in package.json");const c=t.version?g__default.valid(t.version)?t.version:(()=>{throw new Error(`Invalid version format: ${t.version}`)})():(()=>{if(!g__default.valid(s))throw new Error(`Invalid current version format: ${s}`);const o=g__default.prerelease(s),n=t.preid||(o&&typeof o[0]=="string"?o[0]:null)||r.prereleaseId||"edge";let a;t.major?a="major":t.minor?a="minor":t.prerelease?a=o?"prerelease":"prepatch":a=o?"prerelease":"patch";const d=a==="prerelease"||a.startsWith("pre")?g__default.inc(s,a,n):g__default.inc(s,a);if(!d)throw new Error("Failed to calculate new version");return d})();consola.consola.info(`Updating version: ${s} \u2192 ${c}`);const p=await pkgTypes.resolvePackageJSON(e);await pkgTypes.writePackageJSON(p,{...i,version:c});const l={oldVersion:s,newVersion:c};if(r.autoCommit){const o=t.message||r.commitMessage?.replace("{version}",c)||`chore: release v${c}`;try{node_child_process.execSync("git add package.json",{cwd:e}),node_child_process.execSync(`git commit -m "${o}"`,{cwd:e}),consola.consola.success(`Committed version update: ${o}`)}catch(n){consola.consola.warn("Failed to commit changes:",n)}}if(r.autoTag){const o=`${r.tagPrefix||"v"}${c}`;try{node_child_process.execSync(`git tag ${o}`,{cwd:e}),consola.consola.success(`Created git tag: ${o}`),l.tagName=o}catch(n){consola.consola.warn("Failed to create git tag:",n)}}if(r.autoPush)try{node_child_process.execSync("git push",{cwd:e}),r.autoTag&&node_child_process.execSync("git push --tags",{cwd:e}),consola.consola.success("Pushed changes to remote")}catch(o){consola.consola.warn("Failed to push changes:",o)}return l}exports.updatePackageVersion=updatePackageVersion;
|