@monoweave/plugin-github 2.17.1 → 3.1.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/lib/index.d.ts +1 -1
- package/lib/index.js +4 -8
- package/lib/plugin.js +13 -20
- package/lib/request.js +1 -4
- package/package.json +14 -13
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { type PluginHooks } from '@monoweave/types';
|
|
2
2
|
export declare const PluginName = "GitHub Plugin";
|
|
3
|
-
import { type PluginOptions } from './plugin';
|
|
3
|
+
import { type PluginOptions } from './plugin.js';
|
|
4
4
|
export default function GitHubPlugin({ onReleaseAvailable }: Pick<PluginHooks, 'onReleaseAvailable'>, options?: PluginOptions | undefined): void;
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
exports.PluginName = 'GitHub Plugin';
|
|
6
|
-
const plugin_1 = require("./plugin");
|
|
7
|
-
function GitHubPlugin({ onReleaseAvailable }, options) {
|
|
8
|
-
onReleaseAvailable.tapPromise(exports.PluginName, (0, plugin_1.createPluginInternals)(options ?? {}));
|
|
1
|
+
export const PluginName = 'GitHub Plugin';
|
|
2
|
+
import { createPluginInternals } from './plugin.js';
|
|
3
|
+
export default function GitHubPlugin({ onReleaseAvailable }, options) {
|
|
4
|
+
onReleaseAvailable.tapPromise(PluginName, createPluginInternals(options ?? {}));
|
|
9
5
|
}
|
package/lib/plugin.js
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const git_1 = require("@monoweave/git");
|
|
8
|
-
const logging_1 = __importDefault(require("@monoweave/logging"));
|
|
9
|
-
const core_1 = require("@yarnpkg/core");
|
|
10
|
-
const request_1 = require("./request");
|
|
11
|
-
exports.PluginName = 'GitHub Plugin';
|
|
12
|
-
const createPluginInternals = (options) => async (context, config, changeset) => {
|
|
1
|
+
import { parseRepositoryProperty } from '@monoweave/git';
|
|
2
|
+
import logging from '@monoweave/logging';
|
|
3
|
+
import { MessageName, structUtils } from '@yarnpkg/core';
|
|
4
|
+
import { request } from './request.js';
|
|
5
|
+
export const PluginName = 'GitHub Plugin';
|
|
6
|
+
export const createPluginInternals = (options) => async (context, config, changeset) => {
|
|
13
7
|
const { Octokit } = await import('@octokit/core');
|
|
14
8
|
const { throttling } = await import('@octokit/plugin-throttling');
|
|
15
9
|
// Try GH_TOKEN first for backwards compatibility with older versions of Monoweave
|
|
16
10
|
const personalAccessToken = process.env.GH_TOKEN || process.env.GITHUB_TOKEN;
|
|
17
11
|
if (!personalAccessToken) {
|
|
18
|
-
context.report.reportWarning(
|
|
12
|
+
context.report.reportWarning(MessageName.UNNAMED, 'Missing GitHub Personal Access Token. Unable to create GitHub release(s).');
|
|
19
13
|
}
|
|
20
14
|
const ThrottledOctokit = Octokit.plugin(throttling);
|
|
21
15
|
const octokit = personalAccessToken
|
|
@@ -38,7 +32,7 @@ const createPluginInternals = (options) => async (context, config, changeset) =>
|
|
|
38
32
|
changelog = 'Implicit version bump due to dependency updates.';
|
|
39
33
|
}
|
|
40
34
|
if (!changelog) {
|
|
41
|
-
|
|
35
|
+
logging.info(`[${PluginName}] Skipping release for ${changeData.tag} as there's no changelog.`, {
|
|
42
36
|
report: context.report,
|
|
43
37
|
});
|
|
44
38
|
continue;
|
|
@@ -59,15 +53,15 @@ const createPluginInternals = (options) => async (context, config, changeset) =>
|
|
|
59
53
|
if (!changes.length)
|
|
60
54
|
continue;
|
|
61
55
|
const pkgName = changes[0].name;
|
|
62
|
-
const workspace = context.project.getWorkspaceByIdent(
|
|
63
|
-
const { owner, repository: repo } = await
|
|
56
|
+
const workspace = context.project.getWorkspaceByIdent(structUtils.parseIdent(pkgName));
|
|
57
|
+
const { owner, repository: repo } = await parseRepositoryProperty(workspace, {
|
|
64
58
|
fallbackToTopLevel: true,
|
|
65
59
|
});
|
|
66
60
|
if (!owner || !repo) {
|
|
67
|
-
context.report.reportError(
|
|
61
|
+
context.report.reportError(MessageName.UNNAMED, `Cannot determine GitHub owner or repository for '${pkgName}'`);
|
|
68
62
|
continue;
|
|
69
63
|
}
|
|
70
|
-
|
|
64
|
+
logging.info(`[${PluginName}] Creating release for '${tag}' in ${owner}/${repo}`, {
|
|
71
65
|
report: context.report,
|
|
72
66
|
});
|
|
73
67
|
const combinedChangelog = changes
|
|
@@ -75,7 +69,7 @@ const createPluginInternals = (options) => async (context, config, changeset) =>
|
|
|
75
69
|
.map((change) => change.changelog)
|
|
76
70
|
.join('\n');
|
|
77
71
|
if (octokit && !config.dryRun) {
|
|
78
|
-
await
|
|
72
|
+
await request(octokit, 'POST /repos/{owner}/{repo}/releases', {
|
|
79
73
|
owner,
|
|
80
74
|
repo,
|
|
81
75
|
tag_name: tag,
|
|
@@ -87,4 +81,3 @@ const createPluginInternals = (options) => async (context, config, changeset) =>
|
|
|
87
81
|
}
|
|
88
82
|
}
|
|
89
83
|
};
|
|
90
|
-
exports.createPluginInternals = createPluginInternals;
|
package/lib/request.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monoweave/plugin-github",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
|
+
"type": "module",
|
|
4
5
|
"repository": {
|
|
5
6
|
"type": "git",
|
|
6
7
|
"url": "https://github.com/monoweave/monoweave.git",
|
|
@@ -29,20 +30,20 @@
|
|
|
29
30
|
"prepack": "run workspace:build \"$(pwd)\""
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"@
|
|
33
|
-
"@
|
|
34
|
-
"
|
|
35
|
-
"
|
|
33
|
+
"@monoweave/test-utils": "0.0.0",
|
|
34
|
+
"@types/node": "^22.18.13",
|
|
35
|
+
"tapable": "^2.3.0",
|
|
36
|
+
"vitest": "^3.2.4"
|
|
36
37
|
},
|
|
37
38
|
"dependencies": {
|
|
38
|
-
"@monoweave/git": "^1.
|
|
39
|
-
"@monoweave/io": "^1.
|
|
40
|
-
"@monoweave/logging": "^1.
|
|
41
|
-
"@monoweave/types": "^1.
|
|
42
|
-
"@octokit/core": "^6.1.
|
|
43
|
-
"@octokit/plugin-throttling": "^9.
|
|
44
|
-
"@yarnpkg/core": "^4.
|
|
45
|
-
"@yarnpkg/fslib": "^3.1.
|
|
39
|
+
"@monoweave/git": "^2.1.0",
|
|
40
|
+
"@monoweave/io": "^2.1.0",
|
|
41
|
+
"@monoweave/logging": "^2.1.0",
|
|
42
|
+
"@monoweave/types": "^2.1.0",
|
|
43
|
+
"@octokit/core": "^6.1.6",
|
|
44
|
+
"@octokit/plugin-throttling": "^9.6.1",
|
|
45
|
+
"@yarnpkg/core": "^4.5.0",
|
|
46
|
+
"@yarnpkg/fslib": "^3.1.4",
|
|
46
47
|
"@yarnpkg/shell": "^4.1.3"
|
|
47
48
|
},
|
|
48
49
|
"types": "./lib/index.d.ts"
|