Skip to content

Commit c3cdab2

Browse files
authored
chore: move copy to external generic-content repo (#12068)
https://mozilla-hub.atlassian.net/browse/MP-1627
1 parent ee6c092 commit c3cdab2

19 files changed

+51
-1067
lines changed

Diff for: .env-dist

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
CONTENT_ROOT=../content/files
22
#CONTENT_TRANSLATED_ROOT=../translated-content/files
33
#CONTRIBUTOR_SPOTLIGHT_ROOT=../mdn-contributor-spotlight/contributors
4+
#GENERIC_CONTENT_ROOT=../generic-content/files
45

56
REACT_APP_DEV_MODE=true
67

Diff for: .github/workflows/prod-build.yml

+7
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,12 @@ jobs:
8989
lfs: true
9090
token: ${{ secrets.MDN_STUDIO_PAT }}
9191

92+
- uses: actions/checkout@v4
93+
if: ${{ ! vars.SKIP_BUILD }}
94+
with:
95+
repository: mdn/generic-content
96+
path: mdn/generic-content
97+
9298
- uses: actions/checkout@v4
9399
if: ${{ ! vars.SKIP_BUILD }}
94100
with:
@@ -189,6 +195,7 @@ jobs:
189195
CONTRIBUTOR_SPOTLIGHT_ROOT: ${{ github.workspace }}/mdn/mdn-contributor-spotlight/contributors
190196
BLOG_ROOT: ${{ github.workspace }}/mdn/mdn-studio/content/posts
191197
CURRICULUM_ROOT: ${{ github.workspace }}/mdn/curriculum
198+
GENERIC_CONTENT_ROOT: ${{ github.workspace }}/mdn/generic-content/files
192199
BASE_URL: "https://developer.mozilla.org"
193200

194201
# The default for this environment variable is geared for writers

Diff for: .github/workflows/stage-build.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ jobs:
124124
lfs: true
125125
token: ${{ secrets.MDN_STUDIO_PAT }}
126126

127+
- uses: actions/checkout@v4
128+
if: ${{ ! vars.SKIP_BUILD }}
129+
with:
130+
repository: mdn/generic-content
131+
path: mdn/generic-content
132+
127133
- uses: actions/checkout@v4
128134
if: ${{ ! vars.SKIP_BUILD }}
129135
with:
@@ -220,11 +226,11 @@ jobs:
220226
CONTRIBUTOR_SPOTLIGHT_ROOT: ${{ github.workspace }}/mdn/mdn-contributor-spotlight/contributors
221227
BLOG_ROOT: ${{ github.workspace }}/mdn/mdn-studio/content/posts
222228
CURRICULUM_ROOT: ${{ github.workspace }}/mdn/curriculum
229+
GENERIC_CONTENT_ROOT: ${{ github.workspace }}/mdn/generic-content/files
223230
BASE_URL: "https://developer.allizom.org"
224231

225232
# rari
226233
BUILD_OUT_ROOT: "client/build"
227-
GENERIC_CONTENT_ROOT: "copy"
228234
LIVE_SAMPLES_BASE_URL: https://live.mdnyalp.dev
229235
INTERACTIVE_EXAMPLES_BASE_URL: https://interactive-examples.mdn.allizom.net
230236
ADDITIONAL_LOCALES_FOR_GENERICS_AND_SPAS: de

Diff for: .github/workflows/test-build.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,12 @@ jobs:
5858
lfs: true
5959
token: ${{ secrets.MDN_STUDIO_PAT }}
6060

61+
- uses: actions/checkout@v4
62+
if: ${{ ! vars.SKIP_BUILD }}
63+
with:
64+
repository: mdn/generic-content
65+
path: mdn/generic-content
66+
6167
- uses: actions/checkout@v4
6268
if: ${{ ! vars.SKIP_BUILD }}
6369
with:
@@ -130,11 +136,11 @@ jobs:
130136
CONTRIBUTOR_SPOTLIGHT_ROOT: ${{ github.workspace }}/mdn/mdn-contributor-spotlight/contributors
131137
BLOG_ROOT: ${{ github.workspace }}/mdn/mdn-studio/content/posts
132138
CURRICULUM_ROOT: ${{ github.workspace }}/mdn/curriculum
139+
GENERIC_CONTENT_ROOT: ${{ github.workspace }}/mdn/generic-content/files
133140
BASE_URL: "https://test.developer.allizom.org"
134141

135142
# rari
136143
BUILD_OUT_ROOT: "client/build"
137-
GENERIC_CONTENT_ROOT: "copy"
138144
LIVE_SAMPLES_BASE_URL: https://live.test.mdnyalp.dev
139145
INTERACTIVE_EXAMPLES_BASE_URL: https://interactive-examples.mdn.allizom.net
140146
ADDITIONAL_LOCALES_FOR_GENERICS_AND_SPAS: de

Diff for: build/spas.ts

+18-20
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import fs from "node:fs";
22
import path from "node:path";
3-
import { fileURLToPath } from "node:url";
43

54
import frontmatter from "front-matter";
65
import { fdir, PathsOutput } from "fdir";
@@ -22,6 +21,7 @@ import {
2221
CONTRIBUTOR_SPOTLIGHT_ROOT,
2322
BUILD_OUT_ROOT,
2423
DEV_MODE,
24+
GENERIC_CONTENT_ROOT,
2525
} from "../libs/env/index.js";
2626
import { isValidLocale } from "../libs/locale-utils/index.js";
2727
import { DocFrontmatter, DocParent, NewsItem } from "../libs/types/document.js";
@@ -271,7 +271,7 @@ export async function buildSPAs(options: {
271271
async function buildStaticPages(
272272
dirpath: string,
273273
slugPrefix?: string,
274-
title = "MDN"
274+
title?: string
275275
) {
276276
const crawler = new fdir()
277277
.withFullPaths()
@@ -282,7 +282,7 @@ export async function buildSPAs(options: {
282282

283283
for (const filepath of filepaths) {
284284
const file = filepath.replace(dirpath, "");
285-
const page = file.split(".")[0];
285+
const page = file.split(".")[0].slice(1);
286286

287287
const locale = DEFAULT_LOCALE;
288288
const pathLocale = locale.toLowerCase();
@@ -320,9 +320,9 @@ export async function buildSPAs(options: {
320320
};
321321
const context: HydrationData = {
322322
hyData,
323-
pageTitle: frontMatter.attributes.title
323+
pageTitle: title
324324
? `${frontMatter.attributes.title} | ${title}`
325-
: title,
325+
: frontMatter.attributes.title,
326326
url,
327327
};
328328

@@ -343,21 +343,19 @@ export async function buildSPAs(options: {
343343
}
344344
}
345345

346-
await buildStaticPages(
347-
fileURLToPath(new URL("../copy/plus/", import.meta.url)),
348-
"plus/docs",
349-
"MDN Plus"
350-
);
351-
await buildStaticPages(
352-
fileURLToPath(new URL("../copy/observatory/", import.meta.url)),
353-
"observatory/docs",
354-
OBSERVATORY_TITLE
355-
);
356-
await buildStaticPages(
357-
fileURLToPath(new URL("../copy/community/", import.meta.url)),
358-
"",
359-
"Contribute to MDN"
360-
);
346+
if (GENERIC_CONTENT_ROOT) {
347+
await buildStaticPages(
348+
path.join(GENERIC_CONTENT_ROOT, "plus"),
349+
"plus/docs",
350+
"MDN Plus"
351+
);
352+
await buildStaticPages(
353+
path.join(GENERIC_CONTENT_ROOT, "observatory"),
354+
"observatory/docs",
355+
OBSERVATORY_TITLE
356+
);
357+
await buildStaticPages(path.join(GENERIC_CONTENT_ROOT, "community"));
358+
}
361359

362360
// Build all the home pages in all locales.
363361
// Fetch merged content PRs for the latest contribution section.

Diff for: copy/community/community.md

-160
This file was deleted.

Diff for: copy/config.json

-29
This file was deleted.

0 commit comments

Comments
 (0)