forked from Qiskit/qiskit.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nuxt.config.ts
104 lines (91 loc) · 2.81 KB
/
nuxt.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
import fetchEvents from "./hooks/update-events";
import fetchAdvocates from "./hooks/update-advocates";
import fetchEcosystemMembers from "./hooks/update-ecosystem";
import { generateMocks } from "./hooks/mock/mock-service";
import pkg from "./package.json";
const { AIRTABLE_API_KEY, GENERATE_CONTENT, NODE_ENV, SITE_URL, MOCK_CONTENT } =
process.env;
const IS_PRODUCTION = NODE_ENV === "production";
// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
app: {
head: {
meta: [
{ hid: "description", name: "description", content: pkg.description },
],
},
},
modules: ["@nuxt/content", "@nuxt/image-edge", "nuxt-schema-org"],
schemaOrg: {
host: "https://qiskit.org",
},
runtimeConfig: {
public: {
IBM_ANALYTICS_SEGMENT_ANALYTICS_CATEGORY: "",
IBM_ANALYTICS_SEGMENT_INSTANCE_ID: "",
IBM_ANALYTICS_SEGMENT_ANALYTICS_KEY: "",
IBM_ANALYTICS_SEGMENT_ENABLED: IS_PRODUCTION,
IBM_ANALYTICS_SEGMENT_PRODUCT_CODE: "",
IBM_ANALYTICS_SEGMENT_PRODUCT_CODE_TYPE: "",
IBM_ANALYTICS_SEGMENT_PRODUCT_TITLE: "",
IBM_ANALYTICS_SEGMENT_SCRIPT_SRC: "",
IBM_ANALYTICS_SEGMENT_UT30: "",
siteUrl: SITE_URL || "https://qiskit.org",
},
},
css: ["~/assets/scss/main.scss"],
hooks: {
"build:before": async () => {
if (IS_PRODUCTION || GENERATE_CONTENT) {
await generateContent();
}
},
},
image: {
inject: true,
screens: {
sm: 320,
md: 672,
lg: 1056,
xl: 1312,
xxl: 1584,
},
},
vue: {
compilerOptions: {
isCustomElement: (tag: string) =>
tag.startsWith("qiskit-") || tag.startsWith("bx-"),
},
},
});
/**
* Fetches data from Airtable and generates the advocates, ecosystem and events
* content.
* @returns A promise that resolves when the content has been generated
*/
async function generateContent() {
if (MOCK_CONTENT && MOCK_CONTENT === "true") {
// eslint-disable-next-line no-console
console.info("Mocking content...");
await generateMocks();
// eslint-disable-next-line no-console
console.info("Content generated...");
return;
}
// eslint-disable-next-line no-console
console.info("Generating the ecosystem content...");
await fetchEcosystemMembers("./content/ecosystem");
if (AIRTABLE_API_KEY) {
// eslint-disable-next-line no-console
console.info("Generating the events content...");
await fetchEvents(AIRTABLE_API_KEY, "./content/events");
// eslint-disable-next-line no-console
console.info("Generating the advocates content...");
await fetchAdvocates(AIRTABLE_API_KEY, "./content/advocates");
} else {
// eslint-disable-next-line no-console
console.warn(
"No AIRTABLE_API_KEY environment variable found. Skipping content generation."
);
}
}