Unlink scripts submodule and commit contents as normal directory
This commit is contained in:
1 parent
4f7dea111f
commit
6488b3ea85
48 files changed
+2876
-1
No files matched your search
@@ -0,0 +1,33 @@
|
||||
const { version, author: authorMeta, repository, license } = require('../package.json');
|
||||
|
||||
const githubRepoRegex = /github\.com[:/]+([^/]+)\/([^/#.]+)(?:\.git)?/;
|
||||
const [, author = '', name = ''] = repository?.url?.match(githubRepoRegex) || [];
|
||||
|
||||
const slug = `${author}/${name}`;
|
||||
const url = `https://github.com/${slug}`;
|
||||
|
||||
const nameMappings = {
|
||||
sniffcat: 'SniffCat',
|
||||
abuseipdb: 'AbuseIPDB',
|
||||
};
|
||||
|
||||
const getPrettyName = repo => {
|
||||
const repoLower = repo.toLowerCase();
|
||||
return Object.entries(nameMappings)
|
||||
.reduce((best, [key, value]) =>
|
||||
repoLower.includes(key.toLowerCase()) && key.length > best.key.length
|
||||
? { key, value }
|
||||
: best,
|
||||
{ key: '', value: repo }).value;
|
||||
};
|
||||
|
||||
module.exports = Object.freeze({
|
||||
version,
|
||||
repoAuthor: author,
|
||||
authorMeta,
|
||||
repoName: name,
|
||||
prettyName: getPrettyName(name),
|
||||
repoSlug: slug,
|
||||
repoUrl: url,
|
||||
license,
|
||||
});
|
||||
Reference in new issue
Block a user