diff --git a/.changeset/rare-buckets-roll.md b/.changeset/rare-buckets-roll.md
new file mode 100644
index 0000000..1248544
--- /dev/null
+++ b/.changeset/rare-buckets-roll.md
@@ -0,0 +1,5 @@
+---
+"@lunariajs/core": patch
+---
+
+Move into supporting only GitHub
diff --git a/packages/core/src/dashboard/components.ts b/packages/core/src/dashboard/components.ts
index 7594910..5504fdf 100644
--- a/packages/core/src/dashboard/components.ts
+++ b/packages/core/src/dashboard/components.ts
@@ -113,9 +113,9 @@ export const LocaleDetails = (
${missingPages.map(
(page) => html`
- ${GitHostingLink(page.gitHostingUrl, page.sharedPath)}
+ ${Link(page.gitHubURL, page.sharedPath)}
${CreatePageLink(
- page.translations[lang]?.gitHostingUrl!,
+ page.translations[lang]?.gitHubURL!,
dashboard.ui['statusByLocale.createFileLink']
)}
@@ -206,7 +206,7 @@ export const TableBody = (
(page) =>
html`
- ${GitHostingLink(page.gitHostingUrl, page.sharedPath)} |
+ ${Link(page.gitHubURL, page.sharedPath)} |
${locales.map(({ lang }) => {
return TableContentStatus(page.translations, lang, dashboard);
})}
@@ -229,12 +229,10 @@ export const TableContentStatus = (
>${dashboard.ui['status.emojiMissing']}`
: translations[lang]?.isOutdated || !translations[lang]?.completeness.complete
- ? html`${dashboard.ui['status.emojiOutdated']}`
- : html`${dashboard.ui['status.emojiDone']}`}
@@ -247,23 +245,23 @@ export const ContentDetailsLinks = (
dashboard: Dashboard
) => {
return html`
- ${GitHostingLink(page.gitHostingUrl, page.sharedPath)}
+ ${Link(page.gitHubURL, page.sharedPath)}
${page.translations[lang]
- ? html`(${GitHostingLink(
- page.translations[lang]?.gitHostingUrl!,
+ ? html`(${Link(
+ page.translations[lang]?.gitHubURL!,
!page.translations[lang]?.completeness.complete
? dashboard.ui['statusByLocale.incompleteTranslationLink']
: dashboard.ui['statusByLocale.outdatedTranslationLink']
)},
- ${GitHostingLink(
- page.translations[lang]?.sourceHistoryUrl!,
+ ${Link(
+ page.translations[lang]?.sourceHistoryURL!,
dashboard.ui['statusByLocale.sourceChangeHistoryLink']
)})`
: ''}
`;
};
-export const GitHostingLink = (href: string, text: string) => {
+export const Link = (href: string, text: string) => {
return html`${text}`;
};
diff --git a/packages/core/src/schemas/config.ts b/packages/core/src/schemas/config.ts
index 84ff1ea..96e4b70 100644
--- a/packages/core/src/schemas/config.ts
+++ b/packages/core/src/schemas/config.ts
@@ -28,16 +28,13 @@ export const LunariaConfigSchema = z.object({
sharedPathResolver: SharedPathResolverSchema,
/** Fuction to construct the locale-specific path from the source path of the same content. */
localePathConstructor: LocalePathConstructorSchema,
- /** The URL of your current repository, used to generate history links, e.g. `"https://github.com/Yan-Thomas/lunaria"`. */
+ /** The URL of your current repository, used to generate history links, e.g. `"https://github.com/Yan-Thomas/lunaria/"`. */
repository: z
.string()
.url()
- .refine(
- (url) => url.startsWith('https://github.com/') || url.startsWith('https://gitlab.com/'),
- {
- message: 'URL needs to be a valid `"https://github.com/"` or `"https://gitlab.com/"` link.',
- }
- )
+ .refine((url) => url.startsWith('https://github.com/'), {
+ message: 'URL needs to be a valid GitHub link (`"https://github.com/"`).',
+ })
.transform((url) => normalizeURL(url))
.describe(
'The URL of your current repository, used to generate history links, e.g. `"https://github.com/Yan-Thomas/lunaria/"`.'
diff --git a/packages/core/src/tracker.ts b/packages/core/src/tracker.ts
index 6c894ee..e2e0e0a 100644
--- a/packages/core/src/tracker.ts
+++ b/packages/core/src/tracker.ts
@@ -24,7 +24,7 @@ import { getPageHistory } from './utils/git.js';
import {
getFrontmatterFromFile,
getFrontmatterProperty,
- getGitHostingURL,
+ getGitHubURL,
loadFile,
renderToString,
toUtcString,
@@ -55,7 +55,7 @@ export async function getTranslationStatus(
const fileStatus: FileTranslationStatus = {
sharedPath,
sourcePage: sourceFile,
- gitHostingUrl: getGitHostingURL({
+ gitHubURL: getGitHubURL({
repository: repository,
rootDir: rootDir,
filePath: sourceFile.filePath,
@@ -73,13 +73,13 @@ export async function getTranslationStatus(
sourcePath: sourceFile.filePath,
});
- const existingPageURL = getGitHostingURL({
+ const existingPageURL = getGitHubURL({
repository: repository,
rootDir: rootDir,
filePath: localeFilePath,
});
- const missingPageURL = getGitHostingURL({
+ const missingPageURL = getGitHubURL({
repository: repository,
rootDir: rootDir,
type: 'new',
@@ -98,8 +98,8 @@ export async function getTranslationStatus(
isOutdated:
(translationFile && sourceFile.lastMajorChange > translationFile.lastMajorChange) ??
false,
- gitHostingUrl: !translationFile ? missingPageURL : existingPageURL,
- sourceHistoryUrl: getGitHostingURL({
+ gitHubURL: !translationFile ? missingPageURL : existingPageURL,
+ sourceHistoryURL: getGitHubURL({
repository: repository,
rootDir: rootDir,
filePath: sourceFile.filePath,
diff --git a/packages/core/src/types.ts b/packages/core/src/types.ts
index cad5b45..e2e8c99 100644
--- a/packages/core/src/types.ts
+++ b/packages/core/src/types.ts
@@ -38,7 +38,7 @@ export type FileData = {
lastMajorCommitMessage: string;
};
-export type GitHostingURL = {
+export type GitHubURL = {
type?: string;
refName?: string;
query?: string;
@@ -50,7 +50,7 @@ export type GitHostingURL = {
export type FileTranslationStatus = {
sharedPath: string;
sourcePage: FileData;
- gitHostingUrl: string;
+ gitHubURL: string;
translations: {
[locale: string]: TranslationStatus;
};
@@ -64,8 +64,8 @@ export type TranslationStatus = {
};
isMissing: boolean;
isOutdated: boolean;
- gitHostingUrl: string;
- sourceHistoryUrl: string;
+ gitHubURL: string;
+ sourceHistoryURL: string;
};
export type RegExpGroups =
diff --git a/packages/core/src/utils/misc.ts b/packages/core/src/utils/misc.ts
index 91af989..a040ce4 100644
--- a/packages/core/src/utils/misc.ts
+++ b/packages/core/src/utils/misc.ts
@@ -4,7 +4,7 @@ import { extname } from 'node:path';
import { joinURL } from 'ufo';
import { parse } from 'ultramatter';
import { frontmatterFileExtensions } from '../constants.js';
-import type { GitHostingURL } from '../types.js';
+import type { GitHubURL } from '../types.js';
export function renderToString(data: any) {
const { strings, values } = data;
@@ -66,13 +66,13 @@ export const loadFile = jiti(process.cwd(), {
esmResolve: true,
});
-export function getGitHostingURL({
+export function getGitHubURL({
type = 'blob',
refName = 'main',
query = '',
repository,
rootDir,
filePath = '',
-}: GitHostingURL) {
+}: GitHubURL) {
return joinURL(repository, type, refName, rootDir, filePath, query);
}