@cluerise/tools 4.2.1 → 5.0.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 +1 -1
- package/dist/configs/.nvmrc +1 -1
- package/dist/configs/.prettierignore +6 -6
- package/dist/configs/_gitignore +2 -1
- package/dist/configs/eslint.config.js +12 -12
- package/dist/configs/release-cwd.config.cjs +26 -0
- package/dist/configs/release.config.js +8 -2
- package/dist/scripts/check-heroku-node-version/main.js +43 -14
- package/dist/scripts/create-commit-message/main.js +29 -22
- package/dist/scripts/format-commit-message/main.js +21 -18
- package/dist/scripts/init/main.js +66 -33
- package/dist/scripts/lint/main.js +42 -35
- package/dist/scripts/release/main.js +233 -34124
- package/dist/scripts/update-node-versions/main.js +44 -15
- package/package.json +4 -4
- package/dist/scripts/release/assets/index-BOULatd3.js +0 -50541
|
@@ -9,19 +9,19 @@ class GitProvider {
|
|
|
9
9
|
static #origins = gitProviderOrigins;
|
|
10
10
|
static #names = Object.keys(this.#origins);
|
|
11
11
|
/**
|
|
12
|
-
*
|
|
12
|
+
* Check if the provided name is a valid Git provider name.
|
|
13
13
|
*
|
|
14
|
-
* @param name
|
|
15
|
-
* @returns True if the name is valid, false
|
|
14
|
+
* @param name The name to check.
|
|
15
|
+
* @returns True if the name is valid, otherwise false.
|
|
16
16
|
*/
|
|
17
17
|
static isValidName(name) {
|
|
18
18
|
return this.#names.includes(name);
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Get the origin URL for the given Git provider name.
|
|
22
22
|
*
|
|
23
|
-
* @param name
|
|
24
|
-
* @returns The origin URL
|
|
23
|
+
* @param name The Git provider name.
|
|
24
|
+
* @returns The origin URL.
|
|
25
25
|
*/
|
|
26
26
|
static getOrigin(name) {
|
|
27
27
|
return this.#origins[name];
|
|
@@ -48,6 +48,13 @@ class PackageJson {
|
|
|
48
48
|
constructor(data) {
|
|
49
49
|
this.#data = data;
|
|
50
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Load and parse the `package.json` file, returning a `PackageJson` instance.
|
|
53
|
+
*
|
|
54
|
+
* Throws an error if the file is invalid or cannot be parsed.
|
|
55
|
+
*
|
|
56
|
+
* @returns A new `PackageJson` instance with parsed data.
|
|
57
|
+
*/
|
|
51
58
|
static async init() {
|
|
52
59
|
const content = await FileSystem.readFile("package.json", { encoding: "utf8" });
|
|
53
60
|
const data = JsonUtils.parse(content);
|
|
@@ -60,21 +67,41 @@ class PackageJson {
|
|
|
60
67
|
return new PackageJson(data);
|
|
61
68
|
}
|
|
62
69
|
/**
|
|
63
|
-
*
|
|
70
|
+
* Get the package name from `package.json`.
|
|
71
|
+
*
|
|
72
|
+
* @returns The package name.
|
|
73
|
+
*/
|
|
74
|
+
get name() {
|
|
75
|
+
return this.#data.name;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get the package version from `package.json`.
|
|
79
|
+
*
|
|
80
|
+
* @returns The package version.
|
|
81
|
+
*/
|
|
82
|
+
get version() {
|
|
83
|
+
return this.#data.version;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get the engines field from `package.json`, if present.
|
|
87
|
+
*
|
|
88
|
+
* @returns The engines object or undefined.
|
|
64
89
|
*/
|
|
65
90
|
get engines() {
|
|
66
91
|
return this.#data.engines;
|
|
67
92
|
}
|
|
68
93
|
/**
|
|
69
|
-
*
|
|
94
|
+
* Set the engines field in `package.json`.
|
|
70
95
|
*
|
|
71
|
-
* @param engines
|
|
96
|
+
* @param engines The engines object to set.
|
|
72
97
|
*/
|
|
73
98
|
set engines(engines) {
|
|
74
99
|
this.#data.engines = engines;
|
|
75
100
|
}
|
|
76
101
|
/**
|
|
77
|
-
*
|
|
102
|
+
* Get the repository field from `package.json`, if present.
|
|
103
|
+
*
|
|
104
|
+
* @returns The repository object or string, or undefined.
|
|
78
105
|
*/
|
|
79
106
|
get repository() {
|
|
80
107
|
return this.#data.repository;
|
|
@@ -111,9 +138,11 @@ class PackageJson {
|
|
|
111
138
|
throw new Error("Unsupported repository URL");
|
|
112
139
|
}
|
|
113
140
|
/**
|
|
114
|
-
*
|
|
141
|
+
* Parse the repository information from `package.json` and return a `GitRepository` object or null.
|
|
142
|
+
*
|
|
143
|
+
* Returns null if no repository is defined or if parsing fails.
|
|
115
144
|
*
|
|
116
|
-
* @returns The parsed GitRepository or null if
|
|
145
|
+
* @returns The parsed `GitRepository`, or null if not available.
|
|
117
146
|
*/
|
|
118
147
|
parseGitRepository() {
|
|
119
148
|
if (!this.repository) {
|
|
@@ -125,7 +154,7 @@ class PackageJson {
|
|
|
125
154
|
return this.#parseGitRepository(this.repository.url);
|
|
126
155
|
}
|
|
127
156
|
/**
|
|
128
|
-
*
|
|
157
|
+
* Save the current `package.json` data to disk, formatting it as prettified JSON.
|
|
129
158
|
*/
|
|
130
159
|
async save() {
|
|
131
160
|
const content = JsonUtils.prettify(this.#data) + "\n";
|
|
@@ -176,7 +205,7 @@ const nodeJsReleaseSchema = z.object({
|
|
|
176
205
|
class NodeJs {
|
|
177
206
|
static #releasesUrl = "https://nodejs.org/dist/index.json";
|
|
178
207
|
/**
|
|
179
|
-
*
|
|
208
|
+
* Fetch all Node.js releases.
|
|
180
209
|
*
|
|
181
210
|
* @returns A promise that resolves to an array of NodeJsRelease objects.
|
|
182
211
|
*/
|
|
@@ -186,7 +215,7 @@ class NodeJs {
|
|
|
186
215
|
return z.array(nodeJsReleaseSchema).parse(data);
|
|
187
216
|
}
|
|
188
217
|
/**
|
|
189
|
-
*
|
|
218
|
+
* Fetch the latest Node.js release.
|
|
190
219
|
*
|
|
191
220
|
* @returns A promise that resolves to the latest NodeJsRelease object or null if no releases are found.
|
|
192
221
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cluerise/tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Tools for maintaining TypeScript projects.",
|
|
5
5
|
"author": "Branislav Holý <brano@holy.am>",
|
|
6
6
|
"repository": "github:cluerise/tools",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"conventional-changelog-conventionalcommits": "9.0.0",
|
|
32
32
|
"eslint": "9.29.0",
|
|
33
33
|
"eslint-config-prettier": "10.1.5",
|
|
34
|
-
"eslint-import-resolver-typescript": "4.4.
|
|
34
|
+
"eslint-import-resolver-typescript": "4.4.4",
|
|
35
35
|
"eslint-plugin-import": "2.32.0",
|
|
36
|
-
"eslint-plugin-prettier": "5.5.
|
|
36
|
+
"eslint-plugin-prettier": "5.5.1",
|
|
37
37
|
"eslint-plugin-simple-import-sort": "12.1.1",
|
|
38
38
|
"eslint-plugin-unicorn": "59.0.1",
|
|
39
39
|
"eslint-plugin-yml": "1.18.0",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"globals": "16.2.0",
|
|
42
42
|
"lint-staged": "16.1.2",
|
|
43
43
|
"prettier": "3.6.1",
|
|
44
|
-
"prettier-plugin-sh": "0.
|
|
44
|
+
"prettier-plugin-sh": "0.18.0",
|
|
45
45
|
"semantic-release": "24.2.5",
|
|
46
46
|
"semver": "7.7.2",
|
|
47
47
|
"smol-toml": "1.3.4",
|