Skip to content

Commit

Permalink
chore: move copy to external generic-content repo (#12068)
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoMcA authored Dec 6, 2024
1 parent ee6c092 commit c3cdab2
Show file tree
Hide file tree
Showing 19 changed files with 51 additions and 1,067 deletions.
1 change: 1 addition & 0 deletions .env-dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
CONTENT_ROOT=../content/files
#CONTENT_TRANSLATED_ROOT=../translated-content/files
#CONTRIBUTOR_SPOTLIGHT_ROOT=../mdn-contributor-spotlight/contributors
#GENERIC_CONTENT_ROOT=../generic-content/files

REACT_APP_DEV_MODE=true

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/prod-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ jobs:
lfs: true
token: ${{ secrets.MDN_STUDIO_PAT }}

- uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD }}
with:
repository: mdn/generic-content
path: mdn/generic-content

- uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD }}
with:
Expand Down Expand Up @@ -189,6 +195,7 @@ jobs:
CONTRIBUTOR_SPOTLIGHT_ROOT: ${{ github.workspace }}/mdn/mdn-contributor-spotlight/contributors
BLOG_ROOT: ${{ github.workspace }}/mdn/mdn-studio/content/posts
CURRICULUM_ROOT: ${{ github.workspace }}/mdn/curriculum
GENERIC_CONTENT_ROOT: ${{ github.workspace }}/mdn/generic-content/files
BASE_URL: "https://developer.mozilla.org"

# The default for this environment variable is geared for writers
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,12 @@ jobs:
lfs: true
token: ${{ secrets.MDN_STUDIO_PAT }}

- uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD }}
with:
repository: mdn/generic-content
path: mdn/generic-content

- uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD }}
with:
Expand Down Expand Up @@ -220,11 +226,11 @@ jobs:
CONTRIBUTOR_SPOTLIGHT_ROOT: ${{ github.workspace }}/mdn/mdn-contributor-spotlight/contributors
BLOG_ROOT: ${{ github.workspace }}/mdn/mdn-studio/content/posts
CURRICULUM_ROOT: ${{ github.workspace }}/mdn/curriculum
GENERIC_CONTENT_ROOT: ${{ github.workspace }}/mdn/generic-content/files
BASE_URL: "https://developer.allizom.org"

# rari
BUILD_OUT_ROOT: "client/build"
GENERIC_CONTENT_ROOT: "copy"
LIVE_SAMPLES_BASE_URL: https://live.mdnyalp.dev
INTERACTIVE_EXAMPLES_BASE_URL: https://interactive-examples.mdn.allizom.net
ADDITIONAL_LOCALES_FOR_GENERICS_AND_SPAS: de
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ jobs:
lfs: true
token: ${{ secrets.MDN_STUDIO_PAT }}

- uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD }}
with:
repository: mdn/generic-content
path: mdn/generic-content

- uses: actions/checkout@v4
if: ${{ ! vars.SKIP_BUILD }}
with:
Expand Down Expand Up @@ -130,11 +136,11 @@ jobs:
CONTRIBUTOR_SPOTLIGHT_ROOT: ${{ github.workspace }}/mdn/mdn-contributor-spotlight/contributors
BLOG_ROOT: ${{ github.workspace }}/mdn/mdn-studio/content/posts
CURRICULUM_ROOT: ${{ github.workspace }}/mdn/curriculum
GENERIC_CONTENT_ROOT: ${{ github.workspace }}/mdn/generic-content/files
BASE_URL: "https://test.developer.allizom.org"

# rari
BUILD_OUT_ROOT: "client/build"
GENERIC_CONTENT_ROOT: "copy"
LIVE_SAMPLES_BASE_URL: https://live.test.mdnyalp.dev
INTERACTIVE_EXAMPLES_BASE_URL: https://interactive-examples.mdn.allizom.net
ADDITIONAL_LOCALES_FOR_GENERICS_AND_SPAS: de
Expand Down
38 changes: 18 additions & 20 deletions build/spas.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import fs from "node:fs";
import path from "node:path";
import { fileURLToPath } from "node:url";

import frontmatter from "front-matter";
import { fdir, PathsOutput } from "fdir";
Expand All @@ -22,6 +21,7 @@ import {
CONTRIBUTOR_SPOTLIGHT_ROOT,
BUILD_OUT_ROOT,
DEV_MODE,
GENERIC_CONTENT_ROOT,
} from "../libs/env/index.js";
import { isValidLocale } from "../libs/locale-utils/index.js";
import { DocFrontmatter, DocParent, NewsItem } from "../libs/types/document.js";
Expand Down Expand Up @@ -271,7 +271,7 @@ export async function buildSPAs(options: {
async function buildStaticPages(
dirpath: string,
slugPrefix?: string,
title = "MDN"
title?: string
) {
const crawler = new fdir()
.withFullPaths()
Expand All @@ -282,7 +282,7 @@ export async function buildSPAs(options: {

for (const filepath of filepaths) {
const file = filepath.replace(dirpath, "");
const page = file.split(".")[0];
const page = file.split(".")[0].slice(1);

const locale = DEFAULT_LOCALE;
const pathLocale = locale.toLowerCase();
Expand Down Expand Up @@ -320,9 +320,9 @@ export async function buildSPAs(options: {
};
const context: HydrationData = {
hyData,
pageTitle: frontMatter.attributes.title
pageTitle: title
? `${frontMatter.attributes.title} | ${title}`
: title,
: frontMatter.attributes.title,
url,
};

Expand All @@ -343,21 +343,19 @@ export async function buildSPAs(options: {
}
}

await buildStaticPages(
fileURLToPath(new URL("../copy/plus/", import.meta.url)),
"plus/docs",
"MDN Plus"
);
await buildStaticPages(
fileURLToPath(new URL("../copy/observatory/", import.meta.url)),
"observatory/docs",
OBSERVATORY_TITLE
);
await buildStaticPages(
fileURLToPath(new URL("../copy/community/", import.meta.url)),
"",
"Contribute to MDN"
);
if (GENERIC_CONTENT_ROOT) {
await buildStaticPages(
path.join(GENERIC_CONTENT_ROOT, "plus"),
"plus/docs",
"MDN Plus"
);
await buildStaticPages(
path.join(GENERIC_CONTENT_ROOT, "observatory"),
"observatory/docs",
OBSERVATORY_TITLE
);
await buildStaticPages(path.join(GENERIC_CONTENT_ROOT, "community"));
}

// Build all the home pages in all locales.
// Fetch merged content PRs for the latest contribution section.
Expand Down
160 changes: 0 additions & 160 deletions copy/community/community.md

This file was deleted.

29 changes: 0 additions & 29 deletions copy/config.json

This file was deleted.

Loading

0 comments on commit c3cdab2

Please sign in to comment.