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-04-04 05:25:39 +08:00
|
|
|
import pkg from "./package.json";
|
2023-03-29 22:24:57 +08:00
|
|
|
|
2023-03-31 16:09:25 +08:00
|
|
|
const { AIRTABLE_API_KEY, GENERATE_CONTENT, NODE_ENV } = 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-04-04 05:25:39 +08:00
|
|
|
app: {
|
|
|
|
head: {
|
|
|
|
meta: [
|
|
|
|
{ hid: "description", name: "description", content: pkg.description },
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2023-03-10 03:18:47 +08:00
|
|
|
runtimeConfig: {
|
|
|
|
// Keys within public are also exposed client-side
|
|
|
|
public: {
|
|
|
|
analyticsScriptUrl: IS_PRODUCTION
|
|
|
|
? "https://cloud.ibm.com/analytics/build/bluemix-analytics.min.js"
|
|
|
|
: "https://dev.console.test.cloud.ibm.com/analytics/build/bluemix-analytics.min.js",
|
|
|
|
analyticsKey: IS_PRODUCTION
|
|
|
|
? "ffdYLviQze3kzomaINXNk6NwpY9LlXcw"
|
|
|
|
: "zbHWEXPUfXm0K6C7HbegwB5ewDEC8o1H",
|
|
|
|
isAnalyticsEnabled: true,
|
|
|
|
},
|
|
|
|
},
|
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-03-31 16:09:25 +08:00
|
|
|
if (GENERATE_CONTENT) {
|
|
|
|
await generateContent();
|
|
|
|
}
|
2023-03-29 22:24:57 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
|
2023-02-15 19:22:03 +08:00
|
|
|
ssr: false,
|
2023-03-29 22:24:57 +08:00
|
|
|
|
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() {
|
|
|
|
// 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."
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|