Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions .github/workflows/ci.reusable.misc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ jobs:
- run: npx lerna run bundle:alone --scope "@dzcode.io/web"
- run: npx lerna run generate:sitemap --scope "@dzcode.io/web"
- run: npx lerna run generate:htmls --scope "@dzcode.io/web"
- run: npm run --prefix web/cloudflare ts:check
7 changes: 4 additions & 3 deletions web/cloudflare/functions/w/contributions-sitemap.xml.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Env } from "handler/contribution";
import { environments } from "@dzcode.io/utils/dist/config/environment";
import { Language, Languages } from "@dzcode.io/models/dist/language";
import { LANGUAGES } from "@dzcode.io/models/dist/language";
import { getContributionURL } from "@dzcode.io/web/dist/utils/contribution";
import { fsConfig } from "@dzcode.io/utils/dist/config";
import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory";
import { Endpoints } from "@dzcode.io/api/dist/app/endpoints";
import { LanguageCode } from "@dzcode.io/utils/dist/language";

function xmlEscape(s: string) {
return s.replace(
Expand All @@ -20,9 +21,9 @@ export const onRequest: PagesFunction<Env> = async (context) => {
stage = "development";
}
const fullstackConfig = fsConfig(stage);
const links: Array<{ url: string; lang: Language["code"] }> = [];
const links: Array<{ url: string; lang: LanguageCode }> = [];

for (const lang of Languages) {
for (const lang of LANGUAGES) {
const fetchV2 = fetchV2Factory<Endpoints>(fullstackConfig, lang.code);
const { contributions } = await fetchV2("api:contributions/for-sitemap", {});

Expand Down
7 changes: 4 additions & 3 deletions web/cloudflare/functions/w/contributors-sitemap.xml.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Env } from "handler/contributor";
import { environments } from "@dzcode.io/utils/dist/config/environment";
import { Language, Languages } from "@dzcode.io/models/dist/language";
import { LANGUAGES } from "@dzcode.io/models/dist/language";
import { getContributorURL } from "@dzcode.io/web/dist/utils/contributor";
import { fsConfig } from "@dzcode.io/utils/dist/config";
import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory";
import { Endpoints } from "@dzcode.io/api/dist/app/endpoints";
import { LanguageCode } from "@dzcode.io/utils/dist/language";

export const onRequest: PagesFunction<Env> = async (context) => {
let stage = context.env.STAGE;
Expand All @@ -13,8 +14,8 @@ export const onRequest: PagesFunction<Env> = async (context) => {
stage = "development";
}
const fullstackConfig = fsConfig(stage);
const links: Array<{ url: string; lang: Language["code"] }> = [];
for (const lang of Languages) {
const links: Array<{ url: string; lang: LanguageCode }> = [];
for (const lang of LANGUAGES) {
const fetchV2 = fetchV2Factory<Endpoints>(fullstackConfig, lang.code);
const { contributors } = await fetchV2("api:contributors/for-sitemap", {});
for (const contributor of contributors) {
Expand Down
7 changes: 4 additions & 3 deletions web/cloudflare/functions/w/projects-sitemap.xml.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { Env } from "handler/project";
import { environments } from "@dzcode.io/utils/dist/config/environment";
import { Language, Languages } from "@dzcode.io/models/dist/language";
import { getProjectURL } from "@dzcode.io/web/dist/utils/project";
import { fsConfig } from "@dzcode.io/utils/dist/config";
import { fetchV2Factory } from "@dzcode.io/utils/dist/fetch/factory";
import { Endpoints } from "@dzcode.io/api/dist/app/endpoints";
import { LANGUAGES } from "@dzcode.io/models/dist/language";
import { LanguageCode } from "@dzcode.io/utils/dist/language";

export const onRequest: PagesFunction<Env> = async (context) => {
let stage = context.env.STAGE;
Expand All @@ -13,8 +14,8 @@ export const onRequest: PagesFunction<Env> = async (context) => {
stage = "development";
}
const fullstackConfig = fsConfig(stage);
const links: Array<{ url: string; lang: Language["code"] }> = [];
for (const lang of Languages) {
const links: Array<{ url: string; lang: LanguageCode }> = [];
for (const lang of LANGUAGES) {
const fetchV2 = fetchV2Factory<Endpoints>(fullstackConfig, lang.code);
const { projects } = await fetchV2("api:projects/for-sitemap", {});
for (const project of projects) {
Expand Down
1 change: 1 addition & 0 deletions web/cloudflare/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
},
"private": true,
"scripts": {
"ts:check": "tsc --noEmit",
"build": "lerna run build:alone --scope=@dzcode.io/web --include-dependencies --stream",
"deploy:prd": "npm run generate:config -- production && wrangler pages deploy --branch main",
"deploy:stg": "npm run generate:config -- staging && wrangler pages deploy --branch main",
Expand Down
3 changes: 3 additions & 0 deletions web/cloudflare/scripts/generate-config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-nocheck

import { writeFileSync } from "fs";

// Get the environment passed as argument
Expand Down
Loading