This repository was archived by the owner on Aug 7, 2026. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathbase.js
More file actions
82 lines (71 loc) · 2.15 KB
/
Copy pathbase.js
File metadata and controls
82 lines (71 loc) · 2.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// GitHub API classes
import getOctokit from './octokit.js'
// Utilities
import log from '../util/log.js'
/**
* Base class for GitHub-related classes providing common functionality.
* Sets up logging and Octokit instance for GitHub API interactions.
*/
export default class Base {
// Private fields
#logger
#octokit
#archived = false
#forked = false
/**
* Creates a new Base instance with logging and GitHub API client.
* @param {object} options - Configuration options for the base class
* @param {string|null} [options.token=null] - GitHub personal access token for authentication
* @param {string|null} [options.hostname=null] - GitHub hostname for Enterprise servers
* @param {boolean} [options.debug=false] - Enable debug logging
* @param {boolean} [options.archived=false] - Skip archived repositories
* @param {boolean} [options.forked=false] - Skip forked repositories
* @throws {Error} Throws an error if Octokit initialization fails
*/
constructor({token = null, hostname = null, debug = false, archived = false, forked = false} = {}) {
this.#logger = log('Base', token, debug)
this.#archived = archived
this.#forked = forked
try {
this.#octokit = getOctokit(token, hostname, debug)
} catch (error) {
this.#logger.error(error.message)
throw error
}
}
/**
* Gets the logger instance.
* @returns {object} The logger instance
*/
get logger() {
return this.#logger
}
/**
* Gets the spinner instance (same as logger for compatibility).
* @returns {object} The logger instance with spinner functionality
*/
get spinner() {
return this.#logger
}
/**
* Gets the Octokit instance.
* @returns {object} The Octokit instance
*/
get octokit() {
return this.#octokit
}
/**
* Gets the archived repositories flag.
* @returns {boolean} True if archived repositories should be skipped, false otherwise
*/
get archived() {
return this.#archived
}
/**
* Gets the forked repositories flag.
* @returns {boolean} True if forked repositories should be skipped, false otherwise
*/
get forked() {
return this.#forked
}
}