@funish/basis
Version:
A unified development toolkit with CLI for package management, versioning, publishing, linting, and git hooks management for JavaScript/TypeScript projects.
276 lines (273 loc) • 8.67 kB
text/typescript
interface BasisConfig {
lint?: LintConfig;
git?: GitConfig;
version?: VersionConfig;
publish?: PublishConfig;
}
interface LintConfig {
staged?: Record<string, string>;
project?: Record<string, string>;
dependencies?: {
checkOutdated?: boolean;
checkSecurity?: boolean;
allowedLicenses?: string[];
blockedPackages?: string[];
};
structure?: {
requiredFiles?: string[];
requiredDirs?: string[];
naming?: Array<{
path: string;
files?: string;
directories?: string;
description?: string;
}>;
};
docs?: {
checkReadme?: boolean;
checkChangelog?: boolean;
};
fix?: {
/** Enable automatic fixing for all supported issues */
autoFix?: boolean;
/** Dependency fix options */
dependencies?: {
/** Automatically remove blocked packages */
removeBlocked?: boolean;
/** Automatically update outdated dependencies */
updateOutdated?: boolean;
/** Attempt to fix security vulnerabilities */
fixSecurity?: boolean;
/** Ask for confirmation before making changes */
interactive?: boolean;
};
/** Structure fix options */
structure?: {
/** Automatically create missing required files */
createMissingFiles?: boolean;
/** Automatically create missing required directories */
createMissingDirs?: boolean;
/** Generate file templates for missing files */
generateTemplates?: boolean;
};
/** Documentation fix options */
docs?: {
/** Generate README.md template if missing */
generateReadme?: boolean;
/** Generate CHANGELOG.md template if missing */
generateChangelog?: boolean;
};
};
}
interface GitConfig {
hooks?: Partial<Record<ValidGitHook, string>>;
config?: {
core?: {
editor?: string;
autocrlf?: boolean | "input";
eol?: "lf" | "crlf" | "native";
ignorecase?: boolean;
filemode?: boolean;
bare?: boolean;
logallrefupdates?: boolean;
repositoryformatversion?: number;
sharedrepository?: boolean | "group" | "all" | "world" | "everybody";
worktree?: string;
precomposeunicode?: boolean;
protecthfs?: boolean;
protectntfs?: boolean;
};
user?: {
name?: string;
email?: string;
signingkey?: string;
};
init?: {
defaultBranch?: string;
};
branch?: {
autosetupmerge?: boolean | "always";
autosetuprebase?: "never" | "local" | "remote" | "always";
};
push?: {
default?: "nothing" | "current" | "upstream" | "simple" | "matching";
followTags?: boolean;
autoSetupRemote?: boolean;
};
pull?: {
rebase?: boolean | "preserve" | "merges" | "interactive";
ff?: boolean | "only";
};
merge?: {
tool?: string;
conflictstyle?: "merge" | "diff3";
ff?: boolean | "only";
log?: boolean | number;
};
rebase?: {
autoSquash?: boolean;
autoStash?: boolean;
updateRefs?: boolean;
};
fetch?: {
prune?: boolean;
pruneTags?: boolean;
fsckobjects?: boolean;
};
remote?: {
[remoteName: string]: {
url?: string;
fetch?: string;
};
};
diff?: {
tool?: string;
algorithm?: "myers" | "minimal" | "patience" | "histogram";
renames?: boolean | "copy" | "copies";
mnemonicprefix?: boolean;
};
status?: {
showUntrackedFiles?: "no" | "normal" | "all";
branch?: boolean;
short?: boolean;
};
commit?: {
cleanup?: "strip" | "whitespace" | "verbatim" | "scissors" | "default";
gpgsign?: boolean;
template?: string;
verbose?: boolean;
};
log?: {
abbrevCommit?: boolean;
decorate?: boolean | "short" | "full" | "auto" | "no";
showSignature?: boolean;
};
transfer?: {
fsckobjects?: boolean;
};
receive?: {
fsckObjects?: boolean;
};
gc?: {
auto?: number;
autopacklimit?: number;
autodetach?: boolean;
};
alias?: {
[aliasName: string]: string;
};
url?: {
[pattern: string]: {
insteadOf?: string;
pushInsteadOf?: string;
};
};
};
commitMsg?: CommitMsgConfig;
autoSetup?: boolean;
autoInitGit?: boolean;
skipGitCheck?: boolean;
force?: boolean;
}
interface CommitMsgConfig {
types?: string[];
maxLength?: number;
minLength?: number;
scopeRequired?: boolean;
allowedScopes?: string[];
}
interface CommitMessage {
type: string;
scope?: string;
description: string;
body?: string;
footer?: string;
isBreaking: boolean;
}
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"];
type ValidGitHook = (typeof VALID_GIT_HOOKS)[number];
type GitConfigValue = string | number | boolean;
type GitConfigSection = Record<string, GitConfigValue>;
type GitConfigData = Record<string, GitConfigSection>;
interface VersionConfig {
/** Git tag prefix */
tagPrefix?: string;
/** Auto commit version changes */
autoCommit?: boolean;
/** Auto create git tag */
autoTag?: boolean;
/** Auto push changes to remote */
autoPush?: boolean;
/** Prerelease identifier (alpha, beta, rc) */
prereleaseId?: string;
/** Commit message template */
commitMessage?: string;
}
interface PublishConfig {
/** NPM registry URL */
registry?: string;
/** Package access level */
access?: "public" | "private";
/** Default publish tag (for non-stable releases) */
defaultTag?: string;
/** Stable release tag */
stableTag?: string;
/** Build command before publish */
buildCommand?: string;
/** Test command before publish */
testCommand?: string;
/** Check git working directory is clean */
checkGitClean?: boolean;
/** Run tests before publish */
checkTests?: boolean;
/** Auto push git changes after publish */
autoGitPush?: boolean;
/** Create git tag after publish */
createGitTag?: boolean;
}
interface InitOptions {
force?: boolean;
skipGitCheck?: boolean;
skipInstall?: boolean;
}
interface VersionOptions {
version?: string;
preid?: string;
prerelease?: boolean;
major?: boolean;
minor?: boolean;
patch?: boolean;
tag?: string;
message?: string;
}
interface PublishOptions {
tag?: string;
stable?: boolean;
latest?: boolean;
dryRun?: boolean;
access?: "public" | "private";
registry?: string;
skipBuild?: boolean;
skipTests?: boolean;
}
interface VersionUpdateResult {
oldVersion: string;
newVersion: string;
tagName?: string;
}
interface PublishResult {
packageName: string;
version: string;
publishTag: string;
dryRun: boolean;
}
/**
* Define a Basis configuration
*/
declare function defineBasisConfig(config: BasisConfig): BasisConfig;
/**
* Default configuration
*/
declare const defaultConfig: BasisConfig;
export { defineBasisConfig as d, defaultConfig as e, VALID_GIT_HOOKS as g };
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 };