Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HOTFIX] Deprecate OLD_CONTENT_DIR #11922

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/hooks/useClientSideGitHubContributors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect, useState } from "react"

import type { Author, FileContributorsState } from "@/lib/types"

import { GITHUB_COMMITS_URL, OLD_CONTENT_DIR } from "@/lib/constants"
import { GITHUB_COMMITS_URL, CONTENT_DIR } from "@/lib/constants"

export const gitHubAuthHeaders = {
headers: new Headers({
Expand All @@ -17,8 +17,7 @@ const fetchGitHubContributors = async (
relativePath: string,
): Promise<FileContributorsState> => {
const url = new URL(GITHUB_COMMITS_URL)
// TODO: OLD_CONTENT_DIR -> CONTENT_DIR for production
const filePath = join(OLD_CONTENT_DIR, relativePath, "index.md")
const filePath = join(CONTENT_DIR, relativePath, "index.md")
url.searchParams.set("path", filePath)

try {
Expand Down
5 changes: 2 additions & 3 deletions src/hooks/useClientSideGitHubLastEdit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { Lang, LastUpdatedState } from "@/lib/types"
import {
DEFAULT_LOCALE,
GITHUB_COMMITS_URL,
OLD_CONTENT_DIR,
CONTENT_DIR,
} from "@/lib/constants"

import { gitHubAuthHeaders } from "@/hooks/useClientSideGitHubContributors"
Expand All @@ -18,12 +18,11 @@ const fetchGitHubLastEdit = async (
locale?: Lang
): Promise<LastUpdatedState> => {
const url = new URL(GITHUB_COMMITS_URL)
// TODO: OLD_CONTENT_DIR -> CONTENT_DIR for production
const localePath =
locale && locale !== DEFAULT_LOCALE
? join("translations", locale, relativePath)
: relativePath
const filePath = join(OLD_CONTENT_DIR, localePath, "index.md")
const filePath = join(CONTENT_DIR, localePath, "index.md")
url.searchParams.set("path", filePath)

try {
Expand Down
1 change: 0 additions & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { ReportsModel } from "@crowdin/crowdin-api-client"

import i18nConfig from "../../i18n.config.json"

export const OLD_CONTENT_DIR = "src/content"
export const CONTENT_DIR = "public/content"
export const TRANSLATIONS_DIR = "public/content/translations"
export const TRANSLATED_IMAGES_DIR = "/content/translations"
Expand Down