2023-03-29 22:24:57 +08:00
|
|
|
import fetchEvents from "./hooks/update-events";
|
|
|
|
import fetchAdvocates from "./hooks/update-advocates";
|
|
|
|
import fetchEcosystemMembers from "./hooks/update-ecosystem";
|
2023-07-04 19:45:47 +08:00
|
|
|
import { generateMocks } from "./hooks/mock/mock-service";
|
2023-03-29 22:24:57 +08:00
|
|
|
|
2023-07-04 19:45:47 +08:00
|
|
|
const { AIRTABLE_API_KEY, GENERATE_CONTENT, NODE_ENV, SITE_URL, MOCK_CONTENT } =
|
|
|
|
process.env;
|
2023-03-10 03:18:47 +08:00
|
|
|
const IS_PRODUCTION = NODE_ENV === "production";
|
|
|
|
|
2023-02-14 00:39:59 +08:00
|
|
|
// https://nuxt.com/docs/api/configuration/nuxt-config
|
2023-02-10 20:35:43 +08:00
|
|
|
export default defineNuxtConfig({
|
2023-05-26 00:00:48 +08:00
|
|
|
modules: ["@nuxt/content", "@nuxt/image-edge", "nuxt-schema-org"],
|
|
|
|
|
|
|
|
schemaOrg: {
|
|
|
|
host: "https://qiskit.org",
|
|
|
|
},
|
2023-04-20 16:03:35 +08:00
|
|
|
|
2023-03-10 03:18:47 +08:00
|
|
|
runtimeConfig: {
|
|
|
|
public: {
|
2023-05-26 16:29:32 +08:00
|
|
|
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: "",
|
2023-06-13 20:55:05 +08:00
|
|
|
siteUrl: SITE_URL || "https://qiskit.org",
|
2023-03-10 03:18:47 +08:00
|
|
|
},
|
|
|
|
},
|
2023-03-29 22:24:57 +08:00
|
|
|
|
2023-02-15 19:22:03 +08:00
|
|
|
css: ["~/assets/scss/main.scss"],
|
2023-03-29 22:24:57 +08:00
|
|
|
|
|
|
|
hooks: {
|
|
|
|
"build:before": async () => {
|
2023-04-12 22:24:29 +08:00
|
|
|
if (IS_PRODUCTION || GENERATE_CONTENT) {
|
2023-03-31 16:09:25 +08:00
|
|
|
await generateContent();
|
|
|
|
}
|
2023-03-29 22:24:57 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2023-05-17 20:56:31 +08:00
|
|
|
image: {
|
2023-06-19 20:11:39 +08:00
|
|
|
inject: true,
|
2023-05-17 20:56:31 +08:00
|
|
|
screens: {
|
|
|
|
sm: 320,
|
|
|
|
md: 672,
|
|
|
|
lg: 1056,
|
|
|
|
xl: 1312,
|
|
|
|
xxl: 1584,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2023-02-15 19:22:03 +08:00
|
|
|
vue: {
|
|
|
|
compilerOptions: {
|
|
|
|
isCustomElement: (tag: string) =>
|
|
|
|
tag.startsWith("qiskit-") || tag.startsWith("bx-"),
|
|
|
|
},
|
|
|
|
},
|
|
|
|
});
|
2023-03-29 22:24:57 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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() {
|
2023-07-04 19:45:47 +08:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2023-03-29 22:24:57 +08:00
|
|
|
// 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."
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|