metascope 0.8.4 → 0.9.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/dist/bin/cli.js +30426 -29237
- package/dist/bin/{jiti-DDHyYNLW.js → jiti-B26uDQuv.js} +2 -2
- package/dist/bin/renovate-CEC0BhMB.js +1 -0
- package/dist/bin/shared-Ch5JsD6s.js +8 -0
- package/dist/bin/shared2-Dhjk_Okb.js +1 -0
- package/dist/bin/web-tree-sitter.wasm +0 -0
- package/dist/lib/data/license-urls.js +2904 -0
- package/dist/lib/file-matching.js +5 -2
- package/dist/lib/log.d.ts +0 -1
- package/dist/lib/metadata-types.d.ts +16 -9
- package/dist/lib/metadata.d.ts +0 -1
- package/dist/lib/metadata.js +5 -5
- package/dist/lib/package.js +1 -1
- package/dist/lib/parsers/configparser-parser.js +14 -12
- package/dist/lib/parsers/gemspec-parser.js +41 -42
- package/dist/lib/parsers/go-mod-parser.js +51 -45
- package/dist/lib/parsers/makefile-config-parser.js +7 -6
- package/dist/lib/parsers/properties-parser.js +1 -1
- package/dist/lib/parsers/rfc822-header-parser.js +8 -6
- package/dist/lib/parsers/setup-py-parser.js +28 -24
- package/dist/lib/source.d.ts +6 -2
- package/dist/lib/sources/arduino-library-properties.d.ts +0 -1
- package/dist/lib/sources/arduino-library-properties.js +6 -7
- package/dist/lib/sources/cinder-cinderblock-xml.d.ts +0 -1
- package/dist/lib/sources/cinder-cinderblock-xml.js +5 -5
- package/dist/lib/sources/code-stats.d.ts +3 -2
- package/dist/lib/sources/codemeta-json.d.ts +0 -1
- package/dist/lib/sources/codemeta-json.js +21 -20
- package/dist/lib/sources/dependency-updates.d.ts +17 -8
- package/dist/lib/sources/dependency-updates.js +38 -34
- package/dist/lib/sources/file-stats.d.ts +7 -4
- package/dist/lib/sources/git-config.d.ts +0 -1
- package/dist/lib/sources/git-stats.d.ts +47 -24
- package/dist/lib/sources/git-stats.js +51 -33
- package/dist/lib/sources/github-actions.d.ts +0 -1
- package/dist/lib/sources/github-actions.js +4 -3
- package/dist/lib/sources/github.d.ts +156 -78
- package/dist/lib/sources/github.js +11 -8
- package/dist/lib/sources/go-go-mod.d.ts +0 -1
- package/dist/lib/sources/go-goreleaser-yaml.d.ts +0 -1
- package/dist/lib/sources/go-goreleaser-yaml.js +5 -3
- package/dist/lib/sources/java-pom-xml.d.ts +0 -1
- package/dist/lib/sources/java-pom-xml.js +12 -12
- package/dist/lib/sources/license-file.d.ts +0 -1
- package/dist/lib/sources/metadata-file.d.ts +0 -1
- package/dist/lib/sources/metadata-file.js +9 -10
- package/dist/lib/sources/metascope.d.ts +9 -5
- package/dist/lib/sources/node-npm-registry.d.ts +21 -11
- package/dist/lib/sources/node-npm-registry.js +12 -6
- package/dist/lib/sources/node-package-json.d.ts +0 -1
- package/dist/lib/sources/obsidian-plugin-manifest-json.d.ts +17 -9
- package/dist/lib/sources/obsidian-plugin-manifest-json.js +2 -2
- package/dist/lib/sources/obsidian-plugin-registry.d.ts +3 -2
- package/dist/lib/sources/obsidian-plugin-registry.js +2 -1
- package/dist/lib/sources/openframeworks-addon-config-mk.d.ts +0 -1
- package/dist/lib/sources/openframeworks-install-xml.d.ts +0 -1
- package/dist/lib/sources/openframeworks-install-xml.js +3 -3
- package/dist/lib/sources/processing-library-properties.d.ts +0 -1
- package/dist/lib/sources/processing-library-properties.js +9 -10
- package/dist/lib/sources/processing-sketch-properties.d.ts +0 -1
- package/dist/lib/sources/processing-sketch-properties.js +13 -20
- package/dist/lib/sources/publiccode-yaml.d.ts +0 -1
- package/dist/lib/sources/publiccode-yaml.js +61 -58
- package/dist/lib/sources/python-pkg-info.d.ts +0 -1
- package/dist/lib/sources/python-pkg-info.js +6 -5
- package/dist/lib/sources/python-pypi-registry.d.ts +21 -11
- package/dist/lib/sources/python-pypi-registry.js +23 -16
- package/dist/lib/sources/python-pyproject-toml.d.ts +0 -1
- package/dist/lib/sources/python-setup-cfg.d.ts +2 -3
- package/dist/lib/sources/python-setup-cfg.js +10 -9
- package/dist/lib/sources/python-setup-py.d.ts +0 -1
- package/dist/lib/sources/readme-file.d.ts +0 -1
- package/dist/lib/sources/readme-file.js +4 -3
- package/dist/lib/sources/ruby-gemspec.d.ts +0 -1
- package/dist/lib/sources/rust-cargo-toml.d.ts +0 -1
- package/dist/lib/sources/rust-cargo-toml.js +1 -1
- package/dist/lib/sources/xcode-info-plist.d.ts +0 -1
- package/dist/lib/sources/xcode-info-plist.js +29 -31
- package/dist/lib/sources/xcode-project-pbxproj.d.ts +0 -1
- package/dist/lib/sources/xcode-project-pbxproj.js +17 -16
- package/dist/lib/templates/codemeta-json.d.ts +1 -0
- package/dist/lib/templates/codemeta.d.ts +1 -0
- package/dist/lib/templates/codemeta.js +98 -89
- package/dist/lib/templates/frontmatter.d.ts +2 -1
- package/dist/lib/templates/frontmatter.js +1 -1
- package/dist/lib/templates/index.d.ts +2 -1
- package/dist/lib/templates/index.js +1 -1
- package/dist/lib/templates/metadata.d.ts +1 -0
- package/dist/lib/templates/project.d.ts +1 -0
- package/dist/lib/utilities/codemeta-helpers.js +14 -13
- package/dist/lib/utilities/fetch.js +18 -2
- package/dist/lib/utilities/formatting.js +1 -1
- package/dist/lib/utilities/github.js +2 -2
- package/dist/lib/utilities/license-identification.d.ts +9 -4
- package/dist/lib/utilities/license-identification.js +37 -23
- package/dist/lib/utilities/template-helpers.d.ts +7 -5
- package/dist/lib/utilities/template-helpers.js +15 -14
- package/dist/lib/utilities/tree-sitter-wasm.d.ts +0 -1
- package/dist/lib/utilities/tree-sitter-wasm.js +1 -1
- package/package.json +18 -17
- package/readme.md +13 -11
- package/dist/bin/renovate-CpDMbQZd.js +0 -1
- package/dist/bin/shared-Dix5HPlG.js +0 -6
|
@@ -6,8 +6,8 @@ import { stat } from "node:fs/promises";
|
|
|
6
6
|
import { join, resolve } from "node:path";
|
|
7
7
|
import { simpleGit } from "simple-git";
|
|
8
8
|
//#region src/lib/sources/git-stats.ts
|
|
9
|
-
const VERSION_TAG_REGEX = /^v?\d+(?:\.\d+){1,2}
|
|
10
|
-
const LEADING_V_REGEX = /^v
|
|
9
|
+
const VERSION_TAG_REGEX = /^v?\d+(?:\.\d+){1,2}$/v;
|
|
10
|
+
const LEADING_V_REGEX = /^v/v;
|
|
11
11
|
const gitStatsSource = defineSource({
|
|
12
12
|
async discover(context) {
|
|
13
13
|
return (await getMatches(context.options, [".git/config"])).map((value) => resolve(value, "../../"));
|
|
@@ -21,41 +21,56 @@ const gitStatsSource = defineSource({
|
|
|
21
21
|
git.log(),
|
|
22
22
|
git.branch(),
|
|
23
23
|
git.tags(),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}),
|
|
32
|
-
|
|
24
|
+
(async () => {
|
|
25
|
+
return (await git.raw([
|
|
26
|
+
"rev-list",
|
|
27
|
+
"--max-parents=0",
|
|
28
|
+
"HEAD",
|
|
29
|
+
"--format=%aI"
|
|
30
|
+
])).trim().split("\n").filter((line) => !line.startsWith("commit ")).at(-1) ?? void 0;
|
|
31
|
+
})(),
|
|
32
|
+
(async () => {
|
|
33
|
+
return (await git.raw(["ls-files"])).trim().split("\n").filter(Boolean);
|
|
34
|
+
})(),
|
|
33
35
|
git.getRemotes(),
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
36
|
+
(async () => {
|
|
37
|
+
try {
|
|
38
|
+
const count = (await git.raw(["submodule", "status"])).trim().split("\n").filter(Boolean).length;
|
|
39
|
+
return count > 0 ? count : void 0;
|
|
40
|
+
} catch {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
})(),
|
|
44
|
+
(async () => {
|
|
45
|
+
try {
|
|
46
|
+
return (await git.raw(["lfs", "ls-files"])).trim().length > 0 ? true : void 0;
|
|
47
|
+
} catch {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
})()
|
|
39
51
|
]);
|
|
40
52
|
const contributors = new Set(logResult.all.map((commit) => commit.author_email));
|
|
41
53
|
const tagNameLatest = tagResult.latest ?? void 0;
|
|
42
54
|
const [trackedSizeBytes, tagDateLatest, versionTagInfo, remoteStatusEntries] = await Promise.all([
|
|
43
|
-
batchMap(trackedFiles, async (file) => {
|
|
44
|
-
try {
|
|
45
|
-
return (await stat(join(context.options.path, file))).size;
|
|
46
|
-
} catch {
|
|
47
|
-
return 0;
|
|
48
|
-
}
|
|
49
|
-
}).then((sizes) => sizes.reduce((sum, size) => sum + size, 0)),
|
|
50
55
|
(async () => {
|
|
51
|
-
|
|
56
|
+
return (await batchMap(trackedFiles, async (file) => {
|
|
57
|
+
try {
|
|
58
|
+
return (await stat(join(context.options.path, file))).size;
|
|
59
|
+
} catch {
|
|
60
|
+
return 0;
|
|
61
|
+
}
|
|
62
|
+
})).reduce((sum, size) => sum + size, 0);
|
|
63
|
+
})(),
|
|
64
|
+
(async () => {
|
|
65
|
+
if (tagNameLatest === void 0 || tagNameLatest === "") return;
|
|
52
66
|
try {
|
|
53
|
-
|
|
67
|
+
const trimmed = (await git.raw([
|
|
54
68
|
"log",
|
|
55
69
|
"-1",
|
|
56
70
|
"--format=%aI",
|
|
57
71
|
tagNameLatest
|
|
58
|
-
])).trim()
|
|
72
|
+
])).trim();
|
|
73
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
59
74
|
} catch {
|
|
60
75
|
return;
|
|
61
76
|
}
|
|
@@ -65,16 +80,19 @@ const gitStatsSource = defineSource({
|
|
|
65
80
|
const versionTags = (await git.raw(["tag", "--sort=-creatordate"])).trim().split("\n").filter(Boolean).filter((tag) => VERSION_TAG_REGEX.test(tag));
|
|
66
81
|
const tagReleaseCount = versionTags.length > 0 ? versionTags.length : void 0;
|
|
67
82
|
const match = versionTags[0];
|
|
68
|
-
if (match)
|
|
69
|
-
|
|
70
|
-
tagVersionDateLatest: (await git.raw([
|
|
83
|
+
if (match !== void 0) {
|
|
84
|
+
const trimmedDate = (await git.raw([
|
|
71
85
|
"log",
|
|
72
86
|
"-1",
|
|
73
87
|
"--format=%aI",
|
|
74
88
|
match
|
|
75
|
-
])).trim()
|
|
76
|
-
|
|
77
|
-
|
|
89
|
+
])).trim();
|
|
90
|
+
return {
|
|
91
|
+
tagReleaseCount,
|
|
92
|
+
tagVersionDateLatest: trimmedDate.length > 0 ? trimmedDate : void 0,
|
|
93
|
+
tagVersionLatest: match.replace(LEADING_V_REGEX, "")
|
|
94
|
+
};
|
|
95
|
+
}
|
|
78
96
|
return {
|
|
79
97
|
tagReleaseCount,
|
|
80
98
|
tagVersionDateLatest: void 0,
|
|
@@ -98,7 +116,7 @@ const gitStatsSource = defineSource({
|
|
|
98
116
|
"--count",
|
|
99
117
|
`HEAD...${reference}`
|
|
100
118
|
])).trim().split(" ").map(Number);
|
|
101
|
-
return [remote.name, {
|
|
119
|
+
if (ahead !== void 0 && behind !== void 0) return [remote.name, {
|
|
102
120
|
ahead,
|
|
103
121
|
behind
|
|
104
122
|
}];
|
|
@@ -83,7 +83,7 @@ async function fetchWorkflowRuns(octokit, owner, repo, defaultBranch) {
|
|
|
83
83
|
for (const run of response.data.workflow_runs) {
|
|
84
84
|
if (runsByPath.has(run.path)) continue;
|
|
85
85
|
let durationMs;
|
|
86
|
-
if (run.run_started_at) durationMs = new Date(run.updated_at).getTime() - new Date(run.run_started_at).getTime();
|
|
86
|
+
if (run.run_started_at !== void 0 && run.run_started_at !== "") durationMs = new Date(run.updated_at).getTime() - new Date(run.run_started_at).getTime();
|
|
87
87
|
const conclusion = workflowRunConclusion.safeParse(run.conclusion);
|
|
88
88
|
const status = workflowRunStatus.safeParse(run.status);
|
|
89
89
|
if (!conclusion.success || !status.success) continue;
|
|
@@ -124,9 +124,10 @@ const githubActionsSource = {
|
|
|
124
124
|
else try {
|
|
125
125
|
const ownerRepo = await resolveOwnerRepo(context);
|
|
126
126
|
if (ownerRepo) {
|
|
127
|
-
const
|
|
127
|
+
const githubToken = context.options.credentials?.githubToken;
|
|
128
|
+
const octokit = new Octokit(githubToken !== void 0 && githubToken !== "" ? { auth: githubToken } : void 0);
|
|
128
129
|
let defaultBranch = ensureArray(context.metadata?.github)[0]?.data.defaultBranch;
|
|
129
|
-
if (
|
|
130
|
+
if (defaultBranch === void 0 || defaultBranch === "") defaultBranch = (await octokit.rest.repos.get({
|
|
130
131
|
owner: ownerRepo.owner,
|
|
131
132
|
repo: ownerRepo.repo
|
|
132
133
|
})).data.default_branch;
|
|
@@ -1,92 +1,170 @@
|
|
|
1
1
|
import { OneOrMany, SourceRecord } from "../source.js";
|
|
2
|
-
|
|
3
2
|
//#region src/lib/sources/github.d.ts
|
|
4
3
|
type GitHubInfo = {
|
|
5
|
-
/** ISO 8601 date when the repo was archived, if applicable. */
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
4
|
+
/** ISO 8601 date when the repo was archived, if applicable. */
|
|
5
|
+
archivedAt?: string;
|
|
6
|
+
/** Name of the repository's code of conduct. */
|
|
7
|
+
codeOfConduct?: string;
|
|
8
|
+
/** Commits the default branch is ahead of the upstream fork parent. */
|
|
9
|
+
commitsAheadUpstream?: number;
|
|
10
|
+
/** Commits the default branch is behind the upstream fork parent. */
|
|
11
|
+
commitsBehindUpstream?: number;
|
|
12
|
+
/** Number of contributors to the repository. */
|
|
13
|
+
contributorCount?: number;
|
|
14
|
+
/** ISO 8601 date when the repo was created. */
|
|
15
|
+
createdAt?: string;
|
|
16
|
+
/** GitHub's internal numeric repository ID. */
|
|
17
|
+
databaseId?: number;
|
|
18
|
+
/** Name of the default branch (e.g. "main"). */
|
|
19
|
+
defaultBranch?: string;
|
|
20
|
+
/** Repository description. */
|
|
21
|
+
description?: string;
|
|
22
|
+
/** Total number of discussions. */
|
|
23
|
+
discussionCount?: number;
|
|
24
|
+
/** Repository disk usage in bytes. */
|
|
25
|
+
diskUsageBytes?: number;
|
|
26
|
+
/** Number of forks. */
|
|
27
|
+
forkCount?: number;
|
|
28
|
+
/** URL of the upstream repository this was forked from. */
|
|
29
|
+
forkedFrom?: string;
|
|
30
|
+
/** Funding links configured on the repository. */
|
|
18
31
|
fundingLinks?: Array<{
|
|
19
32
|
platform: string;
|
|
20
33
|
url: string;
|
|
21
|
-
}>;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
34
|
+
}>;
|
|
35
|
+
/** Whether a CONTRIBUTING file exists. */
|
|
36
|
+
hasContributing?: boolean;
|
|
37
|
+
/** Whether discussions are enabled. */
|
|
38
|
+
hasDiscussionsEnabled?: boolean;
|
|
39
|
+
/** Whether issues are enabled. */
|
|
40
|
+
hasIssuesEnabled?: boolean;
|
|
41
|
+
/** Whether the repo uses Git LFS (detected via .gitattributes). */
|
|
42
|
+
hasLfs?: boolean;
|
|
43
|
+
/** Whether GitHub Pages is enabled. */
|
|
44
|
+
hasPages?: boolean;
|
|
45
|
+
/** Whether projects are enabled. */
|
|
46
|
+
hasProjectsEnabled?: boolean;
|
|
47
|
+
/** Whether sponsorships are enabled. */
|
|
48
|
+
hasSponsorshipsEnabled?: boolean;
|
|
49
|
+
/** Whether vulnerability alerts are enabled. */
|
|
50
|
+
hasVulnerabilityAlertsEnabled?: boolean;
|
|
51
|
+
/** Whether the wiki is enabled. */
|
|
52
|
+
hasWikiEnabled?: boolean;
|
|
53
|
+
/** Homepage URL set on the repository. */
|
|
54
|
+
homepageUrl?: string;
|
|
55
|
+
/** Whether the repository is archived. */
|
|
56
|
+
isArchived?: boolean;
|
|
57
|
+
/** Whether the repository is disabled. */
|
|
58
|
+
isDisabled?: boolean;
|
|
59
|
+
/** Whether the repository is a fork. */
|
|
60
|
+
isFork?: boolean;
|
|
61
|
+
/** Whether the repository belongs to an organization. */
|
|
62
|
+
isInOrganization?: boolean;
|
|
63
|
+
/** Whether the repository is a mirror. */
|
|
64
|
+
isMirror?: boolean;
|
|
65
|
+
/** Whether the repository is private. */
|
|
66
|
+
isPrivate?: boolean;
|
|
67
|
+
/** Whether a security policy is enabled. */
|
|
68
|
+
isSecurityPolicyEnabled?: boolean;
|
|
69
|
+
/** Number of closed issues. */
|
|
70
|
+
issueCountClosed?: number;
|
|
71
|
+
/** Number of open issues. */
|
|
72
|
+
issueCountOpen?: number;
|
|
73
|
+
/** Whether the repository is a template. */
|
|
74
|
+
isTemplate?: boolean;
|
|
75
|
+
/** Languages used in the repo, keyed by name with size in bytes. */
|
|
42
76
|
languages?: Record<string, number>;
|
|
43
77
|
/** License identifier (unused; codemeta provides this). */
|
|
44
78
|
/** SPDX license key (e.g. "mit"). */
|
|
45
|
-
licenseKey?: string;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
79
|
+
licenseKey?: string;
|
|
80
|
+
/** Human-readable license name. */
|
|
81
|
+
licenseName?: string;
|
|
82
|
+
/** SPDX license identifier (e.g. "MIT"). */
|
|
83
|
+
licenseSpdxId?: string;
|
|
84
|
+
/** URL to the license text. */
|
|
85
|
+
licenseUrl?: string;
|
|
86
|
+
/** URL of the upstream mirror, if applicable. */
|
|
87
|
+
mirrorUrl?: string;
|
|
88
|
+
/** Repository name. */
|
|
89
|
+
name?: string;
|
|
90
|
+
/** Full "owner/repo" identifier. */
|
|
91
|
+
nameWithOwner?: string;
|
|
92
|
+
/** URL to the repository's Open Graph image. */
|
|
93
|
+
openGraphImageUrl?: string;
|
|
94
|
+
/** GitHub username of the repository owner. */
|
|
95
|
+
ownerLogin?: string;
|
|
96
|
+
/** Owner type, e.g. "User" or "Organization". */
|
|
97
|
+
ownerType?: string;
|
|
98
|
+
/** Full "owner/repo" of the parent fork source. */
|
|
99
|
+
parentNameWithOwner?: string;
|
|
100
|
+
/** Primary programming language of the repository. */
|
|
101
|
+
primaryLanguage?: string;
|
|
102
|
+
/** Number of closed pull requests. */
|
|
103
|
+
pullRequestCountClosed?: number;
|
|
104
|
+
/** Number of merged pull requests. */
|
|
105
|
+
pullRequestCountMerged?: number;
|
|
106
|
+
/** Number of open pull requests. */
|
|
107
|
+
pullRequestCountOpen?: number;
|
|
108
|
+
/** ISO 8601 date of the most recent push. */
|
|
109
|
+
pushedAt?: string;
|
|
110
|
+
/** Total number of releases. */
|
|
111
|
+
releaseCount?: number;
|
|
112
|
+
/** ISO 8601 date of the latest release. */
|
|
113
|
+
releaseDateLatest?: string;
|
|
114
|
+
/** Total download count across latest release assets. */
|
|
115
|
+
releaseDownloadCount?: number;
|
|
116
|
+
/** Tag name of the latest release. */
|
|
117
|
+
releaseVersionLatest?: string;
|
|
118
|
+
/** URL to the security policy. */
|
|
119
|
+
securityPolicyUrl?: string;
|
|
120
|
+
/** Repository merge and branch settings. */
|
|
66
121
|
settings?: {
|
|
67
|
-
/** Whether "Update branch" button is enabled. */
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
122
|
+
/** Whether "Update branch" button is enabled. */
|
|
123
|
+
allowUpdateBranch?: boolean;
|
|
124
|
+
/** Whether auto-merge is allowed. */
|
|
125
|
+
autoMergeAllowed?: boolean;
|
|
126
|
+
/** Whether branches are deleted after merge. */
|
|
127
|
+
deleteBranchOnMerge?: boolean;
|
|
128
|
+
/** Whether forking is allowed. */
|
|
129
|
+
forkingAllowed?: boolean;
|
|
130
|
+
/** Whether merge commits are allowed. */
|
|
131
|
+
mergeCommitAllowed?: boolean;
|
|
132
|
+
/** Template for merge commit messages. */
|
|
133
|
+
mergeCommitMessage?: string;
|
|
134
|
+
/** Template for merge commit titles. */
|
|
135
|
+
mergeCommitTitle?: string;
|
|
136
|
+
/** Whether rebase merging is allowed. */
|
|
137
|
+
rebaseMergeAllowed?: boolean;
|
|
138
|
+
/** Whether squash merging is allowed. */
|
|
139
|
+
squashMergeAllowed?: boolean;
|
|
140
|
+
/** Template for squash merge commit messages. */
|
|
141
|
+
squashMergeCommitMessage?: string;
|
|
142
|
+
/** Template for squash merge commit titles. */
|
|
143
|
+
squashMergeCommitTitle?: string;
|
|
144
|
+
/** Whether web-based commits require sign-off. */
|
|
78
145
|
webCommitSignoffRequired?: boolean;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
146
|
+
};
|
|
147
|
+
/** SSH clone URL. */
|
|
148
|
+
sshUrl?: string;
|
|
149
|
+
/** Number of stars. */
|
|
150
|
+
stargazerCount?: number;
|
|
151
|
+
/** Number of git submodules (detected via .gitmodules). */
|
|
152
|
+
submoduleCount?: number;
|
|
153
|
+
/** URL of the template repository this was created from. */
|
|
154
|
+
templateFrom?: string;
|
|
155
|
+
/** Repository topics. */
|
|
156
|
+
topics?: string[];
|
|
157
|
+
/** ISO 8601 date the repo was last updated. */
|
|
158
|
+
updatedAt?: string;
|
|
159
|
+
/** GitHub URL of the repository. */
|
|
160
|
+
url?: string;
|
|
161
|
+
/** Whether a custom Open Graph image is set. */
|
|
162
|
+
usesCustomOpenGraphImage?: boolean;
|
|
163
|
+
/** Repository visibility (e.g. "PUBLIC", "PRIVATE"). */
|
|
164
|
+
visibility?: string;
|
|
165
|
+
/** Number of open vulnerability alerts. */
|
|
166
|
+
vulnerabilityAlertCount?: number;
|
|
167
|
+
/** Number of watchers. */
|
|
90
168
|
watcherCount?: number;
|
|
91
169
|
};
|
|
92
170
|
type GitHubData = OneOrMany<SourceRecord<GitHubInfo>> | undefined;
|
|
@@ -218,7 +218,7 @@ async function checkHasPages(octokit, owner, repo) {
|
|
|
218
218
|
}
|
|
219
219
|
async function getUpstreamComparison(octokit, owner, repo, defaultBranch, parent) {
|
|
220
220
|
const parentBranch = parent.defaultBranchRef?.name;
|
|
221
|
-
if (
|
|
221
|
+
if (parentBranch === void 0 || parentBranch === "") return;
|
|
222
222
|
try {
|
|
223
223
|
const response = await octokit.rest.repos.compareCommitsWithBasehead({
|
|
224
224
|
basehead: `${parent.owner.login}:${parentBranch}...${owner}:${defaultBranch}`,
|
|
@@ -234,11 +234,11 @@ async function getUpstreamComparison(octokit, owner, repo, defaultBranch, parent
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
function countSubmodules(gitmodulesText) {
|
|
237
|
-
if (
|
|
238
|
-
return gitmodulesText.match(/\[submodule\s/
|
|
237
|
+
if (gitmodulesText === void 0 || gitmodulesText === "") return 0;
|
|
238
|
+
return gitmodulesText.match(/\[submodule\s/gv)?.length ?? 0;
|
|
239
239
|
}
|
|
240
240
|
function detectLfs(gitattributesText) {
|
|
241
|
-
if (
|
|
241
|
+
if (gitattributesText === void 0 || gitattributesText === "") return false;
|
|
242
242
|
return gitattributesText.includes("filter=lfs");
|
|
243
243
|
}
|
|
244
244
|
function extractLanguages(data) {
|
|
@@ -247,7 +247,8 @@ function extractLanguages(data) {
|
|
|
247
247
|
return languages;
|
|
248
248
|
}
|
|
249
249
|
function mapRepoData(data, extras) {
|
|
250
|
-
const
|
|
250
|
+
const totalReleaseDownloads = data.latestRelease?.releaseAssets.nodes.reduce((sum, asset) => sum + asset.downloadCount, 0) ?? 0;
|
|
251
|
+
const releaseDownloadCount = totalReleaseDownloads === 0 || Number.isNaN(totalReleaseDownloads) ? void 0 : totalReleaseDownloads;
|
|
251
252
|
return {
|
|
252
253
|
archivedAt: data.archivedAt ?? void 0,
|
|
253
254
|
codeOfConduct: data.codeOfConduct?.name ?? void 0,
|
|
@@ -303,7 +304,7 @@ function mapRepoData(data, extras) {
|
|
|
303
304
|
pullRequestCountMerged: data.mergedPullRequests.totalCount,
|
|
304
305
|
pullRequestCountOpen: data.openPullRequests.totalCount,
|
|
305
306
|
pushedAt: data.pushedAt ?? void 0,
|
|
306
|
-
releaseCount: data.releases.totalCount
|
|
307
|
+
releaseCount: data.releases.totalCount === 0 ? void 0 : data.releases.totalCount,
|
|
307
308
|
releaseDateLatest: data.latestRelease?.createdAt ?? void 0,
|
|
308
309
|
releaseDownloadCount,
|
|
309
310
|
releaseVersionLatest: data.latestRelease?.tagName ?? void 0,
|
|
@@ -351,8 +352,10 @@ const githubSource = defineSource({
|
|
|
351
352
|
key: "github",
|
|
352
353
|
async parse(input, context) {
|
|
353
354
|
log.debug("Extracting GitHub metadata...");
|
|
354
|
-
const [owner, repo] = input.split("/");
|
|
355
|
-
|
|
355
|
+
const [owner, repo] = input.split("/", 2);
|
|
356
|
+
if (owner === void 0 || repo === void 0) throw new Error(`Invalid GitHub repo identifier "${input}", expected "owner/repo"`);
|
|
357
|
+
const githubToken = context.options.credentials?.githubToken;
|
|
358
|
+
const octokit = new Octokit(githubToken !== void 0 && githubToken !== "" ? { auth: githubToken } : void 0);
|
|
356
359
|
const [graphqlResult, hasPages] = await Promise.all([octokit.graphql(graphqlQuery, {
|
|
357
360
|
owner,
|
|
358
361
|
repo
|
|
@@ -47,7 +47,8 @@ function isNonEmptyString(value) {
|
|
|
47
47
|
* `{{`).
|
|
48
48
|
*/
|
|
49
49
|
function firstString(sections, field) {
|
|
50
|
-
for (const section of sections)
|
|
50
|
+
for (const section of sections) {
|
|
51
|
+
if (!isPlainObject(section)) continue;
|
|
51
52
|
const value = section[field];
|
|
52
53
|
if (isNonEmptyString(value) && !value.includes("{{")) return value.trim();
|
|
53
54
|
}
|
|
@@ -126,7 +127,8 @@ function parse$1(source) {
|
|
|
126
127
|
}
|
|
127
128
|
const goosSet = /* @__PURE__ */ new Set();
|
|
128
129
|
const builds = collectSections(data, "builds", "build");
|
|
129
|
-
for (const build of builds)
|
|
130
|
+
for (const build of builds) {
|
|
131
|
+
if (!isPlainObject(build)) continue;
|
|
130
132
|
const { goos } = build;
|
|
131
133
|
if (Array.isArray(goos)) {
|
|
132
134
|
for (const os of goos) if (typeof os === "string") goosSet.add(os.toLowerCase());
|
|
@@ -142,7 +144,7 @@ const goGoreleaserYamlSource = defineSource({
|
|
|
142
144
|
key: "goGoreleaserYaml",
|
|
143
145
|
async parse(input, context) {
|
|
144
146
|
const data = parse$1(await readFile(resolve(context.options.path, input), "utf8"));
|
|
145
|
-
|
|
147
|
+
return data === void 0 ? void 0 : {
|
|
146
148
|
data,
|
|
147
149
|
source: input
|
|
148
150
|
};
|
|
@@ -107,7 +107,7 @@ function parse(content) {
|
|
|
107
107
|
devDependencies,
|
|
108
108
|
developers: parsePersonEntries(project.developers, "developer"),
|
|
109
109
|
groupId,
|
|
110
|
-
identifier: groupId && artifactId ? `${groupId}.${artifactId}` : void 0,
|
|
110
|
+
identifier: groupId !== void 0 && artifactId !== void 0 ? `${groupId}.${artifactId}` : void 0,
|
|
111
111
|
inceptionYear: getString(project.inceptionYear),
|
|
112
112
|
issueManagementUrl: getNestedUrl(project.issueManagement),
|
|
113
113
|
javaVersion: parseJavaVersion(project),
|
|
@@ -142,10 +142,10 @@ function getCleanString(value) {
|
|
|
142
142
|
*/
|
|
143
143
|
function resolveName(project, groupId, artifactId) {
|
|
144
144
|
const name = getString(project.name);
|
|
145
|
-
if (
|
|
145
|
+
if (name === void 0) return;
|
|
146
146
|
let resolved = name;
|
|
147
|
-
if (groupId) resolved = resolved.replaceAll("${project.groupId}", groupId);
|
|
148
|
-
if (artifactId) resolved = resolved.replaceAll("${project.artifactId}", artifactId);
|
|
147
|
+
if (groupId !== void 0) resolved = resolved.replaceAll("${project.groupId}", () => groupId);
|
|
148
|
+
if (artifactId !== void 0) resolved = resolved.replaceAll("${project.artifactId}", () => artifactId);
|
|
149
149
|
return resolved;
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
@@ -167,7 +167,7 @@ function parsePersonEntries(container, childKey) {
|
|
|
167
167
|
for (const entry of ensureArray(children)) {
|
|
168
168
|
if (!is.plainObject(entry)) continue;
|
|
169
169
|
const name = getString(entry.name);
|
|
170
|
-
if (
|
|
170
|
+
if (name === void 0) continue;
|
|
171
171
|
results.push({
|
|
172
172
|
email: getString(entry.email),
|
|
173
173
|
name,
|
|
@@ -187,7 +187,7 @@ function parseLicenses(project) {
|
|
|
187
187
|
if (!is.plainObject(entry)) continue;
|
|
188
188
|
const name = getString(entry.name);
|
|
189
189
|
const url = getString(entry.url);
|
|
190
|
-
if (name
|
|
190
|
+
if (name !== void 0 || url !== void 0) results.push({
|
|
191
191
|
name,
|
|
192
192
|
url
|
|
193
193
|
});
|
|
@@ -208,14 +208,14 @@ function parseDependencies(project) {
|
|
|
208
208
|
if (!is.plainObject(entry)) continue;
|
|
209
209
|
const groupId = getString(entry.groupId);
|
|
210
210
|
const artifactId = getString(entry.artifactId);
|
|
211
|
-
if (
|
|
212
|
-
const
|
|
211
|
+
if (groupId === void 0 || artifactId === void 0) continue;
|
|
212
|
+
const dependency = {
|
|
213
213
|
artifactId,
|
|
214
214
|
groupId,
|
|
215
215
|
version: getCleanString(entry.version)
|
|
216
216
|
};
|
|
217
|
-
if (getString(entry.scope) === "test") devDependencies.push(
|
|
218
|
-
else dependencies.push(
|
|
217
|
+
if (getString(entry.scope) === "test") devDependencies.push(dependency);
|
|
218
|
+
else dependencies.push(dependency);
|
|
219
219
|
}
|
|
220
220
|
return {
|
|
221
221
|
dependencies,
|
|
@@ -235,7 +235,7 @@ function parseScmUrl(project) {
|
|
|
235
235
|
function parseOrganization(project) {
|
|
236
236
|
if (!is.plainObject(project.organization)) return;
|
|
237
237
|
const name = getString(project.organization.name);
|
|
238
|
-
if (
|
|
238
|
+
if (name === void 0) return;
|
|
239
239
|
return {
|
|
240
240
|
name,
|
|
241
241
|
url: getString(project.organization.url)
|
|
@@ -256,7 +256,7 @@ const javaPomXmlSource = defineSource({
|
|
|
256
256
|
key: "javaPomXml",
|
|
257
257
|
async parse(input, context) {
|
|
258
258
|
const data = parse(await readFile(resolve(context.options.path, input), "utf8"));
|
|
259
|
-
|
|
259
|
+
return data === void 0 ? void 0 : {
|
|
260
260
|
data,
|
|
261
261
|
source: input
|
|
262
262
|
};
|