qiskit.org/nuxt.config.ts

184 lines
4.6 KiB
TypeScript
Raw Normal View History

/// <reference path="types/index.d.ts" />
2019-06-06 23:12:57 +08:00
import path from 'path'
import fs from 'fs'
2020-04-08 15:48:46 +08:00
import consola from 'consola'
// TODO: Deletes markdown references. We are not using md as content anymore
// import markdownIt from 'markdown-it'
// import miLinkAttributes from 'markdown-it-link-attributes'
// import miAnchor from 'markdown-it-anchor'
// import uslug from 'uslug'
// import Mode from 'frontmatter-markdown-loader/mode'
import pkg from './package.json'
2020-04-08 15:48:46 +08:00
import fetchEvents from './hooks/update-events'
import fetchAdvocates from './hooks/update-advocates'
import fetchEcosystemMembers from './hooks/update-ecosystem'
2020-04-08 15:48:46 +08:00
const {
NODE_ENV,
ENABLE_ANALYTICS,
GENERATE_CONTENT,
AIRTABLE_API_KEY
} = process.env
const IS_PRODUCTION = NODE_ENV === 'production'
2019-06-06 14:30:22 +08:00
// const md = markdownIt({
// linkify: true,
// html: true
// })
// md.use(miLinkAttributes, {
// pattern: /^https?:/,
// attrs: {
// target: '_blank',
// rel: 'noopener'
// }
// })
// md.use(miAnchor, {
// slugify (id: any) { return uslug(id) }
// })
export default defineNuxtConfig({
// target: 'static',
2021-10-25 21:00:13 +08:00
feat: learn page v2 (#2574) * add prereq content * add img * add course page images * add correct links * capitalize Notebooks * add quantum states and qubits content * fix segment value * add recommended references, small fix to list spacing * add multiple qubit and entanglement content * added external recommendations content * add quantum protocols and quantum algorithms content * add quantum protocols and quantum algorithms content * fix lint error * update external recommended links * add investigating quantum hardware content * renaming to avoid collisions * add Investigating Quantum Hardware Using Quantum Circuits content * New learn content for q algorithms for apps * Added tutorials section * Added other platforms content * Added URLs for the tutorials * Fixed a typo between simple and sample * Improved images from tutorials * Added the texts for youtube and medium * Fixed typos * Added bonus level to textbook pages * Removed q-system-error-analysis card * changed order * description can use the whole space from the beggining instead of grow from bottom * better title height * updated sections and quantum lab thumbnail (#2590) * add Quantum Computing Labs content * fix: learn content consistent thumbnails (#2597) * Add chapters section to learn page * remove overview page header grid * undo renaming * change heading * feat: add new helpful resource tile (#2618) * update external readings links * update cta and intro page * migrate textbook-beta route and components to /learn * remove new-content from copy script * implement mega-menu-dropdown web component * readd segment attributes * use new web-component and clean up component html * fix section title * 2021 QGSS URL fix * fix: consistent thumbnail sizes (#2650) * use latest wc package * update @qiskit/web-components and use of mega-dropdown-menu Co-authored-by: @techtolentino Co-authored-by: //va <vabarbosa@users.noreply.github.com> Co-authored-by: David <9059044+Tansito@users.noreply.github.com> Co-authored-by: Gregorio Iniesta <korgan00@gmail.com> Co-authored-by: Chris Fisher <clfshr@gmail.com>
2022-06-09 21:12:03 +08:00
// Disable Server Side rendering
ssr: false,
// Inline server bundle dependencies
// standalone: true,
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',
}
},
2019-06-06 14:30:22 +08:00
/*
** Headers of the page
*/
app: {
head: {
title: pkg.name,
meta: [
{ charset: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
{ hid: 'description', name: 'description', content: pkg.description }
],
link: [
{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }
]
}
2019-06-06 14:30:22 +08:00
},
/*
** Customize the progress-bar color
*/
// loading: { color: '#fff' },
2019-06-06 14:30:22 +08:00
// Global CSS: https://go.nuxtjs.dev/config-css
2019-06-06 14:30:22 +08:00
css: [
'~/assets/scss/main.scss'
2019-06-06 14:30:22 +08:00
],
/*
** Plugins to load before mounting the App.
2019-06-06 14:30:22 +08:00
*/
plugins: [
// '~/plugins/router-hooks.ts',
// '~/plugins/carbon.ts',
// '~/plugins/deep-load.ts',
// { src: '~/plugins/hotjar.ts', mode: 'client' },
// ...optional(
// IS_PRODUCTION || ENABLE_ANALYTICS,
// { src: '~/plugins/segment-analytics.ts', mode: 'client' } as const
// )
2019-06-06 14:30:22 +08:00
],
/*
** Nuxt.js modules
*/
modules: [
'@nuxt/content'
2019-06-06 14:30:22 +08:00
],
/*
** Build configuration
*/
build: {
2019-06-25 04:23:22 +08:00
// TODO: Workaround for dealing with. Remove once its solved:
// https://github.com/nuxt/nuxt.js/issues/3877
// splitChunks: {
// layouts: true
// }
},
generate: {
// TODO It is preferred to use nitro.prerender.routes
// https://nuxt.com/docs/api/configuration/nuxt-config#routes
//TODO: This is the code for the old events
// routes: (function () {
// const events = getContentUrls('events')
// return [...events]
// function getContentUrls (contentRoot: string): string[] {
// return fs.readdirSync(path.resolve(__dirname, 'content', contentRoot))
// .filter(isContentAndNotReadme)
// .map(toContentUrl(contentRoot))
// }
// function isContentAndNotReadme (filename: string): boolean {
// return path.extname(filename) === '.md' &&
// path.parse(filename).name.toUpperCase() !== 'README'
// }
// function toContentUrl (contentRoot: string): (s: string) => string {
// return (filename: string): string => {
// return `/${contentRoot}/${path.parse(filename).name}`
// }
// }
// })()
},
hooks: {
// build: {
// async before () {
// if (!IS_PRODUCTION && !GENERATE_CONTENT) {
// console.warn('Skipping content generation. Set GENERATE_CONTENT to enable it.')
// return
// }
// await generateContent()
// }
// }
2019-06-06 14:30:22 +08:00
}
})
// function optional<T> (test: any, ...plugins: T[]): T[] {
// return test ? plugins : []
// }
// async function generateContent () {
// if (AIRTABLE_API_KEY) {
// consola.info('Generating community event previews')
// await fetchEvents(AIRTABLE_API_KEY, './content/events')
// consola.info('Generating advocate previews')
// await fetchAdvocates(AIRTABLE_API_KEY, './content/advocates')
// } else {
// consola.warn('Cannot generate events: missing AIRTABLE_API_KEY environment variable')
// }
2020-04-08 15:48:46 +08:00
// await fetchEcosystemMembers('./content/ecosystem')
// }