github-archiver 1.1.5 → 1.3.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/CHANGELOG.md +113 -0
- package/LICENSE +21 -0
- package/README.md +96 -40
- package/bunfig.toml +17 -7
- package/coverage/lcov.info +1808 -0
- package/dist/index.js +3 -3
- package/dist/index.js.map +2 -2
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,118 @@
|
|
|
1
1
|
## [1.1.1](https://github.com/mynameistito/github-archiver/compare/v1.1.0...v1.1.1) (2026-01-12)
|
|
2
2
|
|
|
3
|
+
## 1.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`3644afb`](https://github.com/mynameistito/github-archiver/commit/3644afb853d7b17e954b8f55db565f7c5f372e07) Thanks [@mynameistito](https://github.com/mynameistito)! - ## Comprehensive Test Coverage Expansion
|
|
8
|
+
|
|
9
|
+
This changeset introduces a major test coverage expansion, achieving 100% coverage on all core business logic and adding 200+ new test cases.
|
|
10
|
+
|
|
11
|
+
### Key Changes
|
|
12
|
+
|
|
13
|
+
#### Test Coverage Improvements
|
|
14
|
+
|
|
15
|
+
- **Added 200+ new test cases** with 549 total assertions
|
|
16
|
+
- **Achieved 100% coverage on 15 src files** (71% of all src files)
|
|
17
|
+
- **95%+ coverage on all testable code**
|
|
18
|
+
- **366 passing tests** with zero failures
|
|
19
|
+
- Test execution time: ~4.8 seconds
|
|
20
|
+
|
|
21
|
+
#### Core Business Logic (100% Complete)
|
|
22
|
+
|
|
23
|
+
- All 3 constants files: 100% coverage
|
|
24
|
+
- All 4 type definition files: 100% coverage
|
|
25
|
+
- Both service files (archiver, auth-manager): 100% coverage
|
|
26
|
+
- 6 utility files (colors, config, errors, formatting, progress, logger): 98-100% coverage
|
|
27
|
+
|
|
28
|
+
#### Code Refactoring for Testability
|
|
29
|
+
|
|
30
|
+
- **archive.ts**: Exported 9 helper functions
|
|
31
|
+
|
|
32
|
+
- `validateOptions()` - validates CLI options with bounds checking
|
|
33
|
+
- `authenticateUser()` - handles GitHub authentication
|
|
34
|
+
- `getRepositories()` - reads repositories from file/stdin/interactive
|
|
35
|
+
- `logParseErrors()` - displays parsing errors with line numbers
|
|
36
|
+
- `showRepositoriesPreview()` - displays repository preview
|
|
37
|
+
- `confirmOperation()` - handles user confirmation
|
|
38
|
+
- `archiveRepositories()` - executes archiving workflow
|
|
39
|
+
- `displayResults()` - shows archiving results
|
|
40
|
+
- `handleArchiveError()` / `provideErrorGuidance()` - error handling
|
|
41
|
+
|
|
42
|
+
- **auth.ts**: Exported 6 helper functions
|
|
43
|
+
- `createLoginCommand()` - login subcommand
|
|
44
|
+
- `createLogoutCommand()` - logout subcommand
|
|
45
|
+
- `createStatusCommand()` - status subcommand
|
|
46
|
+
- `createValidateCommand()` - validate subcommand
|
|
47
|
+
- `promptForToken()` - token input prompt
|
|
48
|
+
- `confirmAction()` - confirmation prompt
|
|
49
|
+
|
|
50
|
+
#### Test Files Added/Enhanced
|
|
51
|
+
|
|
52
|
+
- `tests/unit/archive-command.test.ts` - 48 test cases for archive command logic
|
|
53
|
+
- `tests/unit/auth-command.test.ts` - 41 test cases for auth command logic
|
|
54
|
+
- Enhanced `tests/unit/github.test.ts` with 50+ test cases
|
|
55
|
+
- Enhanced `tests/unit/input-handler.test.ts` with 30+ test cases
|
|
56
|
+
- Enhanced `tests/unit/logger.test.ts` with console formatting tests
|
|
57
|
+
- Enhanced `tests/unit/parser.test.ts` with edge case coverage
|
|
58
|
+
|
|
59
|
+
#### Code Quality
|
|
60
|
+
|
|
61
|
+
- ✅ All tests comply with Ultracite code standards
|
|
62
|
+
- ✅ No console.log/debugger statements in code
|
|
63
|
+
- ✅ Proper error handling and cleanup
|
|
64
|
+
- ✅ Type-safe test implementation
|
|
65
|
+
- ✅ Comprehensive test isolation with beforeEach/afterEach
|
|
66
|
+
|
|
67
|
+
#### Documentation
|
|
68
|
+
|
|
69
|
+
- Added `COVERAGE_SUMMARY.md` with detailed coverage breakdown
|
|
70
|
+
- Added `TEST_COVERAGE_ANALYSIS.md` with comprehensive analysis
|
|
71
|
+
|
|
72
|
+
### Coverage Metrics
|
|
73
|
+
|
|
74
|
+
| Category | Files | 100% Coverage | Avg Coverage |
|
|
75
|
+
| ----------- | ------ | --------------- | ------------ |
|
|
76
|
+
| Constants | 3 | 3/3 (100%) | 100% |
|
|
77
|
+
| Types | 4 | 4/4 (100%) | 100% |
|
|
78
|
+
| Services | 2 | 2/2 (100%) | 100% |
|
|
79
|
+
| Utilities | 6 | 6/6 (100%) | 99% |
|
|
80
|
+
| Commands | 2 | 0/2 (0%) | 32% |
|
|
81
|
+
| Integration | 1 | 0/1 (0%) | 9% |
|
|
82
|
+
| **TOTAL** | **21** | **15/21 (71%)** | **87%** |
|
|
83
|
+
|
|
84
|
+
### Breaking Changes
|
|
85
|
+
|
|
86
|
+
None. All exported functions are implementation details that maintain backward compatibility.
|
|
87
|
+
|
|
88
|
+
### Migration Guide
|
|
89
|
+
|
|
90
|
+
No migration needed. The exported functions were previously internal and are now available for testing. CLI and public API remain unchanged.
|
|
91
|
+
|
|
92
|
+
### Future Work
|
|
93
|
+
|
|
94
|
+
For 100% coverage on remaining files:
|
|
95
|
+
|
|
96
|
+
- CLI integration tests (archive.ts, auth.ts) - requires integration test framework
|
|
97
|
+
- GitHub API mocking (github.ts) - requires API mocking library
|
|
98
|
+
- Interactive readline tests (input-handler.ts) - requires readline mock library
|
|
99
|
+
|
|
100
|
+
These require specialized testing frameworks beyond unit testing and are typically handled with dedicated integration/E2E test suites.
|
|
101
|
+
|
|
102
|
+
## 1.2.0
|
|
103
|
+
|
|
104
|
+
### Minor Changes
|
|
105
|
+
|
|
106
|
+
- [`6948c29`](https://github.com/mynameistito/github-archiver/commit/6948c29abe67508b817a84cd95c4f88d89afdb5c) Thanks [@mynameistito](https://github.com/mynameistito)! - Migrate to Bun runtime and enhance documentation
|
|
107
|
+
|
|
108
|
+
- Migrate all npm scripts to use Bun for faster development and execution
|
|
109
|
+
- Replace tsx with native Bun TypeScript support
|
|
110
|
+
- Add comprehensive Bun installation and development documentation
|
|
111
|
+
- Improve README with Bun-first approach and npm fallback
|
|
112
|
+
- Enhance bunfig.toml configuration for better test setup
|
|
113
|
+
- Update build target to Node.js 22+
|
|
114
|
+
- Fix output formatting for improved readability
|
|
115
|
+
|
|
3
116
|
## 1.1.5
|
|
4
117
|
|
|
5
118
|
### Patch Changes
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mynameistito (Hone Tito)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -23,22 +23,30 @@ A powerful CLI for mass archiving GitHub repositories with parallel processing a
|
|
|
23
23
|
npm install -g github-archiver
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
or with Bun:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
bun install -g github-archiver
|
|
30
|
+
```
|
|
31
|
+
|
|
26
32
|
### From Source
|
|
27
33
|
|
|
28
34
|
```bash
|
|
29
35
|
git clone https://github.com/mynameistito/github-archiver.git
|
|
30
36
|
cd github-archiver
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
bun install && bun run build
|
|
38
|
+
bun install -g .
|
|
33
39
|
```
|
|
34
40
|
|
|
35
41
|
### Development
|
|
36
42
|
|
|
37
43
|
```bash
|
|
38
|
-
|
|
39
|
-
|
|
44
|
+
bun install
|
|
45
|
+
bun run dev -- <command>
|
|
40
46
|
```
|
|
41
47
|
|
|
48
|
+
**Note:** This project is optimized for [Bun](https://bun.sh). While it works with Node.js (v22+), Bun provides faster installation, execution, and development experience.
|
|
49
|
+
|
|
42
50
|
## Quick Start
|
|
43
51
|
|
|
44
52
|
```bash
|
|
@@ -55,11 +63,11 @@ github-archiver archive
|
|
|
55
63
|
|
|
56
64
|
Manage GitHub authentication.
|
|
57
65
|
|
|
58
|
-
| Command
|
|
59
|
-
|
|
60
|
-
| `auth login`
|
|
61
|
-
| `auth logout`
|
|
62
|
-
| `auth status`
|
|
66
|
+
| Command | Description |
|
|
67
|
+
| -------------- | ---------------------------------- |
|
|
68
|
+
| `auth login` | Authenticate with Personal Access Token |
|
|
69
|
+
| `auth logout` | Remove stored token |
|
|
70
|
+
| `auth status` | Check authentication status |
|
|
63
71
|
|
|
64
72
|
### `archive`
|
|
65
73
|
|
|
@@ -69,15 +77,15 @@ Archive multiple repositories.
|
|
|
69
77
|
github-archiver archive [options]
|
|
70
78
|
```
|
|
71
79
|
|
|
72
|
-
| Option
|
|
73
|
-
|
|
74
|
-
| `--file <path>`
|
|
75
|
-
| `--stdin`
|
|
76
|
-
| `--dry-run`
|
|
77
|
-
| `--concurrency <n>`
|
|
78
|
-
| `--timeout <n>`
|
|
79
|
-
| `--verbose`
|
|
80
|
-
| `--force`
|
|
80
|
+
| Option | Default | Description |
|
|
81
|
+
| --------------------- | ------- | -------------------------------------- |
|
|
82
|
+
| `--file <path>` | - | Read repository URLs from file |
|
|
83
|
+
| `--stdin` | - | Read from stdin |
|
|
84
|
+
| `--dry-run` | false | Validate without archiving |
|
|
85
|
+
| `--concurrency <n>` | 3 | Parallel operations (1-50) |
|
|
86
|
+
| `--timeout <n>` | 300 | API timeout in seconds (10-3600) |
|
|
87
|
+
| `--verbose` | false | Enable verbose logging |
|
|
88
|
+
| `--force` | false | Skip confirmation prompts |
|
|
81
89
|
|
|
82
90
|
**Examples:**
|
|
83
91
|
|
|
@@ -148,16 +156,16 @@ Starting to archive repositories... (concurrency: 3)
|
|
|
148
156
|
|
|
149
157
|
[======================= ] 4/5 (80%) - owner/repo-3
|
|
150
158
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
159
|
+
┌────────────────────────────────────┐
|
|
160
|
+
│ Archive Operation Summary │
|
|
161
|
+
├────────────────────────────────────┤
|
|
162
|
+
│ Successful: 5 │
|
|
163
|
+
│ Skipped: 0 │
|
|
164
|
+
│ Failed: 0 │
|
|
165
|
+
├────────────────────────────────────┤
|
|
166
|
+
│ Total: 5 │
|
|
167
|
+
│ Duration: 2m 45s │
|
|
168
|
+
└────────────────────────────────────┘
|
|
161
169
|
|
|
162
170
|
✅ All repositories processed successfully!
|
|
163
171
|
```
|
|
@@ -216,13 +224,28 @@ tests/
|
|
|
216
224
|
|
|
217
225
|
## Development
|
|
218
226
|
|
|
227
|
+
```bash
|
|
228
|
+
bun install
|
|
229
|
+
|
|
230
|
+
# Development commands
|
|
231
|
+
bun run typecheck # Check TypeScript
|
|
232
|
+
bun run test # Run unit tests
|
|
233
|
+
bun run test:coverage # Run tests with coverage
|
|
234
|
+
bun run build # Build production bundle
|
|
235
|
+
bun run lint # Check code style
|
|
236
|
+
bun run format # Auto-format code
|
|
237
|
+
bun run dev -- auth login # Run dev mode
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
**Using npm instead?**
|
|
241
|
+
|
|
219
242
|
```bash
|
|
220
243
|
npm install
|
|
221
|
-
npm run typecheck #
|
|
222
|
-
npm run test
|
|
223
|
-
npm run build
|
|
224
|
-
npm run lint
|
|
225
|
-
npm run format
|
|
244
|
+
npm run typecheck # Equivalent commands
|
|
245
|
+
npm run test
|
|
246
|
+
npm run build
|
|
247
|
+
npm run lint
|
|
248
|
+
npm run format
|
|
226
249
|
```
|
|
227
250
|
|
|
228
251
|
### Code Standards
|
|
@@ -233,7 +256,17 @@ This project uses **Ultracite** (Biome) for:
|
|
|
233
256
|
- Consistent formatting
|
|
234
257
|
- Comprehensive error handling
|
|
235
258
|
|
|
236
|
-
|
|
259
|
+
**Run code quality checks:**
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Check for issues
|
|
263
|
+
bun run lint
|
|
264
|
+
|
|
265
|
+
# Auto-fix and format code
|
|
266
|
+
bun run format
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
See `AGENTS.md` for detailed code standards and best practices.
|
|
237
270
|
|
|
238
271
|
## Release Process
|
|
239
272
|
|
|
@@ -249,10 +282,21 @@ Pushing to `main` triggers automatic release. See [docs/RELEASE.md](docs/RELEASE
|
|
|
249
282
|
|
|
250
283
|
## Contributing
|
|
251
284
|
|
|
252
|
-
1.
|
|
253
|
-
2.
|
|
254
|
-
3.
|
|
255
|
-
4.
|
|
285
|
+
1. Install dependencies: `bun install`
|
|
286
|
+
2. Follow code standards: `bun run format`
|
|
287
|
+
3. Add tests for new features
|
|
288
|
+
4. Ensure `bun run typecheck` and `bun run test` pass
|
|
289
|
+
5. Create pull request with clear description
|
|
290
|
+
|
|
291
|
+
**Before committing:**
|
|
292
|
+
|
|
293
|
+
```bash
|
|
294
|
+
bun run format # Auto-fix code style
|
|
295
|
+
bun run lint # Check for issues
|
|
296
|
+
bun run typecheck # Verify TypeScript
|
|
297
|
+
bun run test # Run test suite
|
|
298
|
+
bun run build # Build production bundle
|
|
299
|
+
```
|
|
256
300
|
|
|
257
301
|
## License
|
|
258
302
|
|
|
@@ -262,10 +306,22 @@ MIT - See LICENSE file for details.
|
|
|
262
306
|
|
|
263
307
|
Check the [Troubleshooting](#troubleshooting) section or open an issue on GitHub.
|
|
264
308
|
|
|
309
|
+
## Runtime & Tooling
|
|
310
|
+
|
|
311
|
+
- **Runtime**: [Bun](https://bun.sh) (primary) or Node.js 22+
|
|
312
|
+
- **Package Manager**: Bun (recommended) or npm
|
|
313
|
+
- **Language**: TypeScript
|
|
314
|
+
- **CLI Framework**: Commander.js
|
|
315
|
+
- **GitHub API**: Octokit
|
|
316
|
+
- **Logging**: Winston
|
|
317
|
+
- **Code Quality**: Biome (via Ultracite preset)
|
|
318
|
+
- **Task Queue**: p-queue
|
|
319
|
+
- **Release Management**: Changesets
|
|
320
|
+
|
|
265
321
|
## Acknowledgments
|
|
266
322
|
|
|
267
|
-
Built with TypeScript, Commander.js, Octokit, Winston, and
|
|
323
|
+
Built with TypeScript, Commander.js, Octokit, Winston, Biome, and optimized for Bun runtime.
|
|
268
324
|
|
|
269
325
|
---
|
|
270
326
|
|
|
271
|
-
|
|
327
|
+
[Releases](https://github.com/mynameistito/github-archiver/releases)
|
package/bunfig.toml
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
[install]
|
|
2
|
-
# Install settings
|
|
2
|
+
# Install settings
|
|
3
3
|
registry = "https://registry.npmjs.org/"
|
|
4
|
+
# Use exact versions in lockfile for reproducible builds
|
|
5
|
+
lockfile = "bun.lock"
|
|
4
6
|
|
|
5
7
|
[env]
|
|
6
|
-
# Environment variables for tests
|
|
8
|
+
# Environment variables for tests and runtime
|
|
7
9
|
NODE_ENV = "test"
|
|
8
10
|
|
|
9
11
|
[test]
|
|
10
|
-
# Test discovery
|
|
11
|
-
root = "
|
|
12
|
-
|
|
13
|
-
# Execution settings
|
|
12
|
+
# Test discovery and execution
|
|
13
|
+
root = "tests"
|
|
14
14
|
timeout = 10000
|
|
15
15
|
|
|
16
16
|
# Coverage configuration
|
|
@@ -22,5 +22,15 @@ coverageSkipTestFiles = true
|
|
|
22
22
|
# Coverage path ignore patterns
|
|
23
23
|
coveragePathIgnorePatterns = [
|
|
24
24
|
"**/*.test.ts",
|
|
25
|
-
"**/*.spec.ts"
|
|
25
|
+
"**/*.spec.ts",
|
|
26
|
+
"**/node_modules/**"
|
|
26
27
|
]
|
|
28
|
+
|
|
29
|
+
# Test environment
|
|
30
|
+
env = "node"
|
|
31
|
+
# Use Bun's test runner (default)
|
|
32
|
+
run = "bun"
|
|
33
|
+
|
|
34
|
+
[define]
|
|
35
|
+
# Global constants for build/runtime
|
|
36
|
+
"process.env.NODE_ENV" = "\"test\""
|