@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
package/README.md
CHANGED
|
@@ -4,97 +4,97 @@
|
|
|
4
4
|
[](https://www.npmjs.com/package/@funish/basis)
|
|
5
5
|
[](https://www.npmjs.com/package/@funish/basis)
|
|
6
6
|
|
|
7
|
-
> A
|
|
7
|
+
> A modern development toolkit with unified CLI for package management, versioning, publishing, code quality, and Git workflow automation.
|
|
8
8
|
|
|
9
9
|
**🧑💻 Contributing?** See the [monorepo documentation](https://github.com/funish/basis) for development setup and contribution guidelines.
|
|
10
10
|
|
|
11
11
|
## What is Basis?
|
|
12
12
|
|
|
13
|
-
Basis is your **unified development toolkit** for modern
|
|
13
|
+
Basis is your **unified development toolkit** for modern projects. Instead of juggling multiple CLI tools, Basis provides a single interface for all your development workflow needs.
|
|
14
14
|
|
|
15
15
|
## Features
|
|
16
16
|
|
|
17
17
|
- 🎯 **Unified CLI**: One command interface for all development tasks
|
|
18
|
-
- 📦 **Package Management**:
|
|
19
|
-
- 🏷️ **Version Management**: Semantic versioning with automated git tagging
|
|
20
|
-
- 🚀 **Publishing**:
|
|
21
|
-
-
|
|
22
|
-
- 🛠️ **
|
|
23
|
-
-
|
|
24
|
-
- 💻 **
|
|
25
|
-
- 💪 **TypeScript First**: Full TypeScript support with excellent DX
|
|
26
|
-
- 📚 **Smart Defaults**: Best practices built-in, fully customizable
|
|
18
|
+
- 📦 **Package Management**: Add, remove dependencies with auto-detected package manager (npm, yarn, pnpm, bun, deno)
|
|
19
|
+
- 🏷️ **Version Management**: Semantic versioning with automated git tagging
|
|
20
|
+
- 🚀 **Publishing**: Flexible publishing with tag strategy
|
|
21
|
+
- 🔍 **Code Quality**: Linting, formatting, and type checking
|
|
22
|
+
- 🛠️ **Project Audit**: Dependency and structure validation
|
|
23
|
+
- 🪪 **Smart Git Hooks**: Automatic git hook management and commit message validation
|
|
24
|
+
- 💻 **Direct TS Execution**: Run TypeScript files directly without compilation
|
|
27
25
|
- 🔧 **Single Configuration**: One config file for all functionality
|
|
28
26
|
|
|
29
27
|
## Quick Start
|
|
30
28
|
|
|
31
|
-
###
|
|
29
|
+
### Installation
|
|
32
30
|
|
|
33
31
|
```bash
|
|
34
|
-
# Install globally
|
|
32
|
+
# Install globally (recommended)
|
|
35
33
|
pnpm add -g @funish/basis
|
|
36
|
-
|
|
37
|
-
# Or install globally with npm
|
|
38
34
|
npm install -g @funish/basis
|
|
39
35
|
|
|
40
|
-
# Verify installation
|
|
41
|
-
basis --version
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### Alternative Installation Methods
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
# Install in your project with pnpm
|
|
48
|
-
pnpm add -D @funish/basis
|
|
49
|
-
|
|
50
|
-
# Or with npm
|
|
51
|
-
npm install -D @funish/basis
|
|
52
|
-
|
|
53
36
|
# Or use directly without installation
|
|
54
37
|
npx @funish/basis init
|
|
55
38
|
```
|
|
56
39
|
|
|
57
|
-
### Initialize
|
|
40
|
+
### Initialize
|
|
58
41
|
|
|
59
42
|
```bash
|
|
60
|
-
cd your-
|
|
43
|
+
cd your-project
|
|
61
44
|
basis init
|
|
62
45
|
|
|
63
|
-
#
|
|
64
|
-
#
|
|
65
|
-
#
|
|
66
|
-
|
|
67
|
-
# Your project now has:
|
|
68
|
-
# ✅ Configuration file with Git hooks that adapt to your package manager
|
|
69
|
-
# ✅ Git hooks setup (if selected during init)
|
|
70
|
-
# ✅ Tool-agnostic linting workflow
|
|
71
|
-
# ✅ Package management through unified CLI
|
|
72
|
-
# ✅ Version management with semantic versioning
|
|
73
|
-
# ✅ Publishing workflow with multi-tag strategy
|
|
46
|
+
# This creates:
|
|
47
|
+
# ✅ basis.config.ts with Git hooks
|
|
48
|
+
# ✅ Git hooks setup (run 'basis git setup' to activate)
|
|
74
49
|
```
|
|
75
50
|
|
|
76
51
|
## CLI Commands
|
|
77
52
|
|
|
78
|
-
###
|
|
53
|
+
### Code Quality
|
|
79
54
|
|
|
80
55
|
```bash
|
|
81
|
-
#
|
|
82
|
-
basis
|
|
83
|
-
|
|
56
|
+
# Lint code
|
|
57
|
+
basis lint
|
|
58
|
+
|
|
59
|
+
# Format code
|
|
60
|
+
basis fmt
|
|
84
61
|
|
|
62
|
+
# Type check
|
|
63
|
+
basis check
|
|
64
|
+
|
|
65
|
+
# Build project
|
|
66
|
+
basis build
|
|
67
|
+
|
|
68
|
+
# Audit code quality
|
|
69
|
+
basis audit # Run all audits
|
|
70
|
+
basis audit --dependencies # Audit dependencies only
|
|
71
|
+
basis audit --structure # Audit structure only
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Package Management
|
|
75
|
+
|
|
76
|
+
```bash
|
|
85
77
|
# Add dependencies
|
|
86
|
-
basis add lodash
|
|
87
|
-
basis add -D typescript
|
|
88
|
-
basis add --workspace app react # Add to specific workspace
|
|
89
|
-
basis add -g @funish/basis # Install globally
|
|
78
|
+
basis add lodash
|
|
79
|
+
basis add -D typescript
|
|
90
80
|
|
|
91
81
|
# Remove dependencies
|
|
92
|
-
basis remove lodash
|
|
93
|
-
basis remove -D typescript
|
|
82
|
+
basis remove lodash
|
|
94
83
|
|
|
95
|
-
#
|
|
96
|
-
basis
|
|
97
|
-
|
|
84
|
+
# Execute package without installation
|
|
85
|
+
basis dlx prettier --write .
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Run Scripts or Files
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
# Run package.json scripts
|
|
92
|
+
basis run dev
|
|
93
|
+
basis run build
|
|
94
|
+
|
|
95
|
+
# Run TypeScript/JavaScript files directly
|
|
96
|
+
basis run src/index.ts
|
|
97
|
+
basis run scripts/setup.js
|
|
98
98
|
```
|
|
99
99
|
|
|
100
100
|
### Version Management
|
|
@@ -106,434 +106,138 @@ basis version minor # 1.0.0 → 1.1.0
|
|
|
106
106
|
basis version major # 1.0.0 → 2.0.0
|
|
107
107
|
|
|
108
108
|
# Prerelease versions
|
|
109
|
-
basis version
|
|
110
|
-
basis version
|
|
109
|
+
basis version prerelease # 1.0.0 → 1.0.1-edge.0
|
|
110
|
+
basis version prerelease --preid beta # 1.0.0 → 1.0.1-beta.0
|
|
111
111
|
|
|
112
112
|
# Specific version
|
|
113
113
|
basis version 2.0.0
|
|
114
|
-
|
|
115
|
-
# Custom commit message
|
|
116
|
-
basis version patch --message "fix: critical bug"
|
|
117
114
|
```
|
|
118
115
|
|
|
119
116
|
### Publishing
|
|
120
117
|
|
|
121
118
|
```bash
|
|
122
|
-
#
|
|
123
|
-
basis publish
|
|
124
|
-
|
|
125
|
-
# Stable release (to latest + edge tags)
|
|
126
|
-
basis publish --stable
|
|
119
|
+
# Publish with tag detection
|
|
120
|
+
basis publish # Auto-detect tag based on version
|
|
121
|
+
basis publish --tag beta # Custom tag
|
|
127
122
|
|
|
128
|
-
#
|
|
129
|
-
basis publish --tag
|
|
130
|
-
basis publish --tag alpha
|
|
131
|
-
|
|
132
|
-
# Dry run
|
|
133
|
-
basis publish --dry-run
|
|
134
|
-
|
|
135
|
-
# Skip build/tests
|
|
136
|
-
basis publish --skip-build --skip-tests
|
|
123
|
+
# With git operations
|
|
124
|
+
basis publish --git # Also create git tag and commit
|
|
137
125
|
```
|
|
138
126
|
|
|
139
|
-
###
|
|
127
|
+
### Git Operations
|
|
140
128
|
|
|
141
129
|
```bash
|
|
142
|
-
#
|
|
143
|
-
basis
|
|
144
|
-
|
|
145
|
-
# Run project-wide linting
|
|
146
|
-
basis lint --project
|
|
147
|
-
|
|
148
|
-
# Check dependencies
|
|
149
|
-
basis lint --deps
|
|
150
|
-
|
|
151
|
-
# Check project structure
|
|
152
|
-
basis lint --structure
|
|
153
|
-
|
|
154
|
-
# Check documentation
|
|
155
|
-
basis lint --docs
|
|
156
|
-
|
|
157
|
-
# Run all lint checks
|
|
158
|
-
basis lint --all
|
|
159
|
-
|
|
160
|
-
# Auto-fix issues (can be combined with any check)
|
|
161
|
-
basis lint --deps --fix # Check and fix dependency issues
|
|
162
|
-
basis lint --structure --fix # Check and fix structure issues
|
|
163
|
-
basis lint --docs --fix # Check and fix documentation issues
|
|
164
|
-
basis lint --all --fix # Check and fix all issues
|
|
165
|
-
basis lint --staged --fix # Note: --fix only works with --deps, --structure, --docs, --all
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
#### Auto-fix Features
|
|
169
|
-
|
|
170
|
-
The `--fix` flag enables automatic fixing of common issues:
|
|
171
|
-
|
|
172
|
-
**🔧 Dependency Fixes**:
|
|
130
|
+
# Setup Git hooks
|
|
131
|
+
basis git setup # Install hooks from config
|
|
173
132
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
- **Fix security vulnerabilities**: Attempt to fix security issues using `npm audit fix` or equivalent
|
|
177
|
-
|
|
178
|
-
**📁 Structure Fixes**:
|
|
179
|
-
|
|
180
|
-
- **Create missing files**: Generate empty files for items in `requiredFiles`
|
|
181
|
-
- **Create missing directories**: Generate directories for items in `requiredDirs`
|
|
182
|
-
|
|
183
|
-
**📝 Documentation Fixes**:
|
|
184
|
-
|
|
185
|
-
- **Generate README.md**: Create an empty README.md if missing
|
|
186
|
-
- **Generate CHANGELOG.md**: Create an empty CHANGELOG.md if missing
|
|
187
|
-
|
|
188
|
-
**Configuration**: All fix behaviors are controlled by the `lint.fix` configuration in your `basis.config.ts`:
|
|
189
|
-
|
|
190
|
-
```ts
|
|
191
|
-
export default defineBasisConfig({
|
|
192
|
-
lint: {
|
|
193
|
-
fix: {
|
|
194
|
-
dependencies: {
|
|
195
|
-
removeBlocked: true, // Enable automatic removal of blocked packages
|
|
196
|
-
updateOutdated: false, // Disable automatic updates (manual control)
|
|
197
|
-
fixSecurity: true, // Enable security fix attempts
|
|
198
|
-
},
|
|
199
|
-
structure: {
|
|
200
|
-
createMissingFiles: true, // Enable file creation
|
|
201
|
-
createMissingDirs: true, // Enable directory creation
|
|
202
|
-
},
|
|
203
|
-
docs: {
|
|
204
|
-
generateReadme: true, // Enable README generation
|
|
205
|
-
generateChangelog: false, // Disable CHANGELOG generation
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
},
|
|
209
|
-
});
|
|
210
|
-
```
|
|
211
|
-
|
|
212
|
-
### Git Hooks Management
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
# Setup git configuration and hooks
|
|
216
|
-
basis git setup
|
|
217
|
-
|
|
218
|
-
# Setup git configuration only
|
|
219
|
-
basis git config
|
|
220
|
-
|
|
221
|
-
# Setup git hooks only
|
|
222
|
-
basis git hooks
|
|
223
|
-
|
|
224
|
-
# Remove git hooks
|
|
225
|
-
basis git remove # Remove all basis-managed hooks
|
|
226
|
-
basis git remove pre-commit # Remove specific hook
|
|
227
|
-
basis git remove --update-config # Remove hooks AND config from basis.config.ts
|
|
228
|
-
|
|
229
|
-
# Reset git configuration
|
|
230
|
-
basis git reset # Reset config (keep user info)
|
|
231
|
-
basis git reset --no-keep-user # Reset config (remove user info)
|
|
232
|
-
basis git reset --update-config # Reset config AND remove from basis.config.ts
|
|
233
|
-
|
|
234
|
-
# Initialize git repository with basis configuration
|
|
235
|
-
basis git init
|
|
133
|
+
# Check staged files
|
|
134
|
+
basis git staged
|
|
236
135
|
|
|
237
136
|
# Validate commit message
|
|
238
|
-
basis git
|
|
239
|
-
```
|
|
137
|
+
basis git lint-commit
|
|
240
138
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
# Initialize configuration
|
|
245
|
-
basis init # Initialize basis configuration (interactive)
|
|
246
|
-
basis init --force # Overwrite existing configuration
|
|
247
|
-
basis init --skip-git-check # Skip git directory check
|
|
248
|
-
basis init --skip-install # Skip dependency installation
|
|
249
|
-
|
|
250
|
-
# Interactive setup will:
|
|
251
|
-
# 1. Auto-detect recommended config format (.ts/.mjs/.cjs)
|
|
252
|
-
# 2. Ask you to choose your preferred format
|
|
253
|
-
# 3. Offer to setup Git hooks and configuration
|
|
254
|
-
|
|
255
|
-
# Configuration
|
|
256
|
-
basis config # Show current configuration
|
|
257
|
-
basis config --json # Output configuration as JSON
|
|
258
|
-
basis config --path # Show configuration file path
|
|
259
|
-
|
|
260
|
-
# Help
|
|
261
|
-
basis --help # Show help
|
|
262
|
-
basis <command> --help # Show command-specific help
|
|
139
|
+
# Git passthrough
|
|
140
|
+
basis git status
|
|
141
|
+
basis git log --oneline
|
|
263
142
|
```
|
|
264
143
|
|
|
265
144
|
## Configuration
|
|
266
145
|
|
|
267
|
-
Basis uses a single configuration file for all
|
|
146
|
+
Basis uses a single configuration file for all features:
|
|
268
147
|
|
|
269
148
|
```ts
|
|
270
|
-
// basis.config.ts
|
|
271
|
-
import { defineBasisConfig } from "@funish/basis";
|
|
149
|
+
// basis.config.ts
|
|
150
|
+
import { defineBasisConfig } from "@funish/basis/config";
|
|
272
151
|
|
|
273
152
|
export default defineBasisConfig({
|
|
274
|
-
//
|
|
275
|
-
|
|
276
|
-
git: {
|
|
277
|
-
hooks: {
|
|
278
|
-
"pre-commit": "pnpmbasis lint --staged", // Auto-adapts to your package manager
|
|
279
|
-
"commit-msg": "pnpmbasis git --lint-commit",
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
});
|
|
283
|
-
```
|
|
153
|
+
// Linting configuration (oxlint)
|
|
154
|
+
lint: {},
|
|
284
155
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
const { defineBasisConfig } = require("@funish/basis");
|
|
156
|
+
// Formatting configuration (oxfmt)
|
|
157
|
+
fmt: {},
|
|
288
158
|
|
|
289
|
-
|
|
290
|
-
// Configure your project here
|
|
291
|
-
// See: https://github.com/funish/basis/tree/main/packages/basis#configuration
|
|
159
|
+
// Git configuration
|
|
292
160
|
git: {
|
|
161
|
+
// Git hooks
|
|
293
162
|
hooks: {
|
|
294
|
-
"pre-commit": "
|
|
295
|
-
"commit-msg": "
|
|
163
|
+
"pre-commit": "basis git staged",
|
|
164
|
+
"commit-msg": "basis git lint-commit",
|
|
296
165
|
},
|
|
297
|
-
},
|
|
298
|
-
});
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
> **💡 Configuration**: The generated config file only shows the Git hooks that are customized for your package manager. All other configuration options use smart defaults and can be added as needed.
|
|
302
|
-
|
|
303
|
-
### Full Configuration Example
|
|
304
|
-
|
|
305
|
-
Here's a complete configuration with all available options:
|
|
306
|
-
|
|
307
|
-
```ts
|
|
308
|
-
// basis.config.ts
|
|
309
|
-
import { defineBasisConfig } from "@funish/basis";
|
|
310
166
|
|
|
311
|
-
|
|
312
|
-
// Linting configuration
|
|
313
|
-
lint: {
|
|
314
|
-
// Staged files linting patterns
|
|
167
|
+
// Staged files check (lint-staged style)
|
|
315
168
|
staged: {
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
},
|
|
320
|
-
// Project-wide linting commands
|
|
321
|
-
project: {
|
|
322
|
-
typecheck: "pnpm tsc --noEmit",
|
|
323
|
-
"format-check": "pnpm prettier --check .",
|
|
324
|
-
},
|
|
325
|
-
// Auto-fix configuration
|
|
326
|
-
fix: {
|
|
327
|
-
// Dependency fix options
|
|
328
|
-
dependencies: {
|
|
329
|
-
removeBlocked: true, // Auto-remove blocked packages
|
|
330
|
-
updateOutdated: true, // Auto-update outdated dependencies
|
|
331
|
-
fixSecurity: true, // Auto-fix security vulnerabilities
|
|
332
|
-
},
|
|
333
|
-
// Structure fix options
|
|
334
|
-
structure: {
|
|
335
|
-
createMissingFiles: true, // Auto-create missing required files
|
|
336
|
-
createMissingDirs: true, // Auto-create missing required directories
|
|
337
|
-
},
|
|
338
|
-
// Documentation fix options
|
|
339
|
-
docs: {
|
|
340
|
-
generateReadme: true, // Auto-create README.md if missing
|
|
341
|
-
generateChangelog: true, // Auto-create CHANGELOG.md if missing
|
|
169
|
+
rules: {
|
|
170
|
+
"*.{ts,tsx,js,jsx}": "basis lint --fix",
|
|
171
|
+
"*.{json,md,yml,yaml}": "basis fmt --write",
|
|
342
172
|
},
|
|
343
173
|
},
|
|
344
|
-
},
|
|
345
|
-
|
|
346
|
-
// Git configuration
|
|
347
|
-
git: {
|
|
348
|
-
// Hook commands
|
|
349
|
-
hooks: {
|
|
350
|
-
"pre-commit": "pnpmbasis lint --staged",
|
|
351
|
-
"commit-msg": "pnpmbasis git --lint-commit",
|
|
352
|
-
},
|
|
353
174
|
|
|
354
175
|
// Commit message validation
|
|
355
176
|
commitMsg: {
|
|
356
|
-
types: [
|
|
357
|
-
"feat",
|
|
358
|
-
"fix",
|
|
359
|
-
"docs",
|
|
360
|
-
"style",
|
|
361
|
-
"refactor",
|
|
362
|
-
"perf",
|
|
363
|
-
"test",
|
|
364
|
-
"build",
|
|
365
|
-
"ci",
|
|
366
|
-
"chore",
|
|
367
|
-
],
|
|
177
|
+
types: ["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore"],
|
|
368
178
|
maxLength: 72,
|
|
369
179
|
minLength: 10,
|
|
370
|
-
scopeRequired: false,
|
|
371
|
-
allowedScopes: ["api", "ui", "core"],
|
|
372
180
|
},
|
|
181
|
+
},
|
|
373
182
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
183
|
+
// Run configuration (jiti)
|
|
184
|
+
run: {},
|
|
185
|
+
|
|
186
|
+
// Audit configuration
|
|
187
|
+
audit: {
|
|
188
|
+
dependencies: {
|
|
189
|
+
outdated: true,
|
|
190
|
+
security: true,
|
|
191
|
+
licenses: {
|
|
192
|
+
allowed: ["MIT", "Apache-2.0", "BSD-3-Clause"],
|
|
193
|
+
blocked: ["GPL"],
|
|
194
|
+
},
|
|
195
|
+
blocked: ["bad-package"],
|
|
196
|
+
},
|
|
197
|
+
structure: {
|
|
198
|
+
required: ["README.md", "LICENSE"],
|
|
199
|
+
files: [
|
|
200
|
+
{
|
|
201
|
+
pattern: "src/**/*.ts",
|
|
202
|
+
rule: "^[a-z][a-z0-9-]*\\.ts$",
|
|
203
|
+
message: "Files should use kebab-case",
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
dirs: [
|
|
207
|
+
{
|
|
208
|
+
pattern: "src/*/",
|
|
209
|
+
rule: "^[a-z][a-z0-9-]*$",
|
|
210
|
+
message: "Directories should use kebab-case",
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
},
|
|
378
214
|
},
|
|
379
215
|
|
|
380
|
-
// Version
|
|
216
|
+
// Version configuration
|
|
381
217
|
version: {
|
|
382
|
-
|
|
383
|
-
autoCommit: true, // Auto commit version changes
|
|
384
|
-
autoTag: true, // Auto create git tag
|
|
385
|
-
autoPush: false, // Manual push control
|
|
386
|
-
prereleaseId: "edge", // Default prerelease identifier
|
|
387
|
-
commitMessage: "chore: release v{version}",
|
|
218
|
+
preid: "edge",
|
|
388
219
|
},
|
|
389
220
|
|
|
390
221
|
// Publishing configuration
|
|
391
222
|
publish: {
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
checkTests: true, // Run tests before publish
|
|
400
|
-
autoGitPush: true, // Push after publish
|
|
401
|
-
createGitTag: true, // Create git tag after publish
|
|
223
|
+
tag: "latest",
|
|
224
|
+
git: {
|
|
225
|
+
tagPrefix: "v",
|
|
226
|
+
message: (version) => `chore: release v${version}`,
|
|
227
|
+
push: true,
|
|
228
|
+
signTag: false,
|
|
229
|
+
},
|
|
402
230
|
},
|
|
403
231
|
});
|
|
404
232
|
```
|
|
405
233
|
|
|
406
234
|
## Publishing Strategy
|
|
407
235
|
|
|
408
|
-
Basis
|
|
409
|
-
|
|
410
|
-
### Tag Types
|
|
411
|
-
|
|
412
|
-
- **`edge`**: Always points to the latest published version (any type)
|
|
413
|
-
- **`latest`**: Points to stable releases
|
|
414
|
-
- **Prerelease Tags**: `alpha`, `beta`, `rc` versions get their own tags
|
|
415
|
-
- **Custom Tags**: Flexible tagging for different release channels
|
|
416
|
-
|
|
417
|
-
### Examples
|
|
236
|
+
Basis uses intelligent tag detection based on version:
|
|
418
237
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
# → Published to: latest + edge
|
|
423
|
-
|
|
424
|
-
# Version 1.1.0-beta.1 (prerelease)
|
|
425
|
-
basis publish
|
|
426
|
-
# → Published to: beta + edge
|
|
427
|
-
|
|
428
|
-
# Version 1.2.0 (custom workflow)
|
|
429
|
-
basis publish --tag canary
|
|
430
|
-
# → Published to: canary + edge
|
|
431
|
-
```
|
|
432
|
-
|
|
433
|
-
### Installation Examples
|
|
434
|
-
|
|
435
|
-
```bash
|
|
436
|
-
# Install stable version
|
|
437
|
-
pnpm add @funish/basis # Gets latest tag
|
|
438
|
-
|
|
439
|
-
# Install edge version (latest published)
|
|
440
|
-
pnpm add @funish/basis@edge
|
|
441
|
-
|
|
442
|
-
# Install prerelease
|
|
443
|
-
pnpm add @funish/basis@beta
|
|
444
|
-
|
|
445
|
-
# Install specific version
|
|
446
|
-
pnpm add @funish/basis@1.0.0
|
|
447
|
-
```
|
|
448
|
-
|
|
449
|
-
## Core Concepts
|
|
450
|
-
|
|
451
|
-
### 🎯 **Unified CLI**
|
|
452
|
-
|
|
453
|
-
Single command interface for package management, versioning, publishing, linting, and git hooks. No more switching between different tools.
|
|
454
|
-
|
|
455
|
-
### 📦 **Auto-Detected Package Manager**
|
|
456
|
-
|
|
457
|
-
Basis automatically detects your preferred package manager (npm, yarn, pnpm, bun, deno) and uses the appropriate commands, powered by [nypm](https://github.com/unjs/nypm).
|
|
458
|
-
|
|
459
|
-
### 🏷️ **Semantic Versioning**
|
|
460
|
-
|
|
461
|
-
Built-in semantic versioning support using the standard [semver](https://www.npmjs.com/package/semver) package, with automated git tagging and commit generation.
|
|
462
|
-
|
|
463
|
-
### 🔧 **Tool Agnostic**
|
|
464
|
-
|
|
465
|
-
Basis doesn't force specific tools. Use ESLint, Oxlint, Biome, or any other linter. Basis orchestrates your existing tools, doesn't replace them.
|
|
466
|
-
|
|
467
|
-
### 📦 **Modern Foundations**
|
|
468
|
-
|
|
469
|
-
Built on the [unjs ecosystem](https://unjs.io/), leveraging proven tools like `citty`, `consola`, `c12`, `nypm`, and `semver` for maximum reliability and performance.
|
|
470
|
-
|
|
471
|
-
## Integration
|
|
472
|
-
|
|
473
|
-
Basis integrates seamlessly with:
|
|
474
|
-
|
|
475
|
-
- **Package Managers**: npm, yarn, pnpm, bun, deno (auto-detected)
|
|
476
|
-
- **Linters**: ESLint, Oxlint, Biome, Prettier, StyleLint
|
|
477
|
-
- **Git**: Works with any git workflow and hosting provider
|
|
478
|
-
- **CI/CD**: GitHub Actions, GitLab CI, Jenkins
|
|
479
|
-
- **Frameworks**: React, Vue, Angular, Next.js, Nuxt, SvelteKit
|
|
480
|
-
|
|
481
|
-
## Why Choose Basis?
|
|
482
|
-
|
|
483
|
-
### Instead of juggling multiple tools:
|
|
484
|
-
|
|
485
|
-
```bash
|
|
486
|
-
npm install package # Package management
|
|
487
|
-
yarn version patch # Version management
|
|
488
|
-
npm publish --tag beta # Publishing
|
|
489
|
-
npx lint-staged # Linting
|
|
490
|
-
git config --global ... # Git configuration
|
|
491
|
-
```
|
|
492
|
-
|
|
493
|
-
### Use one unified command:
|
|
494
|
-
|
|
495
|
-
```bash
|
|
496
|
-
basis add package # Unified package management
|
|
497
|
-
basis version patch # Unified version management
|
|
498
|
-
basis publish --tag beta # Unified publishing
|
|
499
|
-
basis lint --staged # Unified linting
|
|
500
|
-
basis git setup # Unified git setup
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
## API
|
|
504
|
-
|
|
505
|
-
```ts
|
|
506
|
-
import {
|
|
507
|
-
createBasis,
|
|
508
|
-
defineBasisConfig,
|
|
509
|
-
// Import module functions directly for maximum flexibility
|
|
510
|
-
init,
|
|
511
|
-
setupGit,
|
|
512
|
-
lintAll,
|
|
513
|
-
updatePackageVersion,
|
|
514
|
-
publishPackage,
|
|
515
|
-
} from "@funish/basis";
|
|
516
|
-
|
|
517
|
-
// Programmatic usage with Basis class (for config caching and workflows)
|
|
518
|
-
const basis = createBasis(process.cwd());
|
|
519
|
-
|
|
520
|
-
// High-level workflows
|
|
521
|
-
await basis.setup({ force: false, skipGitCheck: false, skipInstall: false }); // init + git setup
|
|
522
|
-
await basis.release({ patch: true }, { stable: true }); // lint + version + publish
|
|
523
|
-
|
|
524
|
-
// Configuration management
|
|
525
|
-
const config = await basis.getConfig(); // Cached config loading
|
|
526
|
-
await basis.reloadConfig(); // Force reload
|
|
527
|
-
basis.setCwd("/different/path"); // Change working directory
|
|
528
|
-
|
|
529
|
-
// Or use module functions directly for more control
|
|
530
|
-
const cwd = process.cwd();
|
|
531
|
-
await init(cwd, { force: true });
|
|
532
|
-
await setupGit(cwd);
|
|
533
|
-
await lintAll(cwd);
|
|
534
|
-
await updatePackageVersion(cwd, { patch: true });
|
|
535
|
-
await publishPackage(cwd, { stable: true });
|
|
536
|
-
```
|
|
238
|
+
- **Stable** (1.0.0): Published to `latest` + `edge`
|
|
239
|
+
- **Prerelease** (1.0.0-beta.1): Published to `beta` + `edge`
|
|
240
|
+
- **Custom tag**: Use `--tag` to override
|
|
537
241
|
|
|
538
242
|
## License
|
|
539
243
|
|