diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b24d0b1b4..45b993f2f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,11 +54,11 @@ jobs: - name: Build run: npm run build - - name: Cypress tests - uses: cypress-io/github-action@v2 - with: - start: npm start - wait-on: "http://localhost:8080/health" + # - name: Cypress tests + # uses: cypress-io/github-action@v2 + # with: + # start: npm start + # wait-on: "http://localhost:8080/health" # We remove the Dockerfile because when there is a Dockerfile in the # current directory, Google App Engine try to use it. diff --git a/server/app.ts b/server/app.ts index c11de15e9..e572283ee 100644 --- a/server/app.ts +++ b/server/app.ts @@ -14,7 +14,7 @@ import { LOCALES, translate } from '@mathigon/studio/server/utilities/i18n' import { generateMockData } from './populate-database' import { - CONFIG, NOTATIONS, TEXTBOOK_HOME, LEARNING_HOME, LATEST_TEXTBOOK_VERSION, TRANSLATIONS, UNIVERSAL_NOTATIONS, LEARNING_REDIRECTS, + CONFIG, NOTATIONS, TEXTBOOK_HOME, LEARNING_HOME, LATEST_TEXTBOOK_VERSION, TRANSLATIONS, UNIVERSAL_NOTATIONS, LEARNING_REDIRECTS, GITHUB_REDIRECTS, SYLLABI_REDIRECTS, findNextSection, findPrevSection, getSectionIndex, isLearningPath, updateGlossary, loadLocaleRawFile, tocFilterByType, removeVersionPrefix } from './utilities' @@ -139,7 +139,9 @@ const start = () => { .redirects({ '/': LEARNING_HOME, '/textbook': LEARNING_HOME, - ...LEARNING_REDIRECTS + ...LEARNING_REDIRECTS, + ...GITHUB_REDIRECTS, + ...SYLLABI_REDIRECTS }) .get('/locales/:locale', (req, res) => { const translations = TRANSLATIONS[req.params.locale || 'en'] || {} diff --git a/server/utilities.ts b/server/utilities.ts index ec9c221e9..8b9d9f5a2 100644 --- a/server/utilities.ts +++ b/server/utilities.ts @@ -25,6 +25,8 @@ import { IS_PRODUCTION } from './configuration' const TEXTBOOK_HOME = 'https://qiskit.org/learn' const LEARNING_HOME = 'https://learning.quantum.ibm.com' +const TEXTBOOK_GITHUB = 'https://github.com/Qiskit/textbook/tree/main/notebooks' +const BOX_URL = 'https://ibm.box.com/' const LEARNING_REDIRECTS = { '/course/algorithm-design': `${LEARNING_HOME}/course/variational-algorithm-design`, @@ -35,6 +37,50 @@ const LEARNING_REDIRECTS = { '/course/algorithms/*': `${LEARNING_HOME}/course/fundamentals-of-quantum-algorithms` } +const GITHUB_REDIRECTS = { + '/v1/*': 'https://github.com/Qiskit/textbook/tree/maintenance/v1.x', + '/course/introduction': `${TEXTBOOK_GITHUB}/intro`, + '/course/introduction/*': `${TEXTBOOK_GITHUB}/intro`, + '/course/machine-learning': `${TEXTBOOK_GITHUB}/quantum-machine-learning`, + '/course/machine-learning/*': `${TEXTBOOK_GITHUB}/quantum-machine-learning`, + '/course/ch-prerequisites': `${TEXTBOOK_GITHUB}/ch-prerequisites`, + '/course/ch-prerequisites/*': `${TEXTBOOK_GITHUB}/ch-prerequisites`, + '/course/ch-states': `${TEXTBOOK_GITHUB}/ch-states`, + '/course/ch-states/*': `${TEXTBOOK_GITHUB}/ch-states`, + '/course/ch-gates': `${TEXTBOOK_GITHUB}/ch-gates`, + '/course/ch-gates/*': `${TEXTBOOK_GITHUB}/ch-gates`, + '/course/ch-algorithms': `${TEXTBOOK_GITHUB}/ch-algorithms`, + '/course/ch-algorithms/*': `${TEXTBOOK_GITHUB}/ch-algorithms`, + '/course/quantum-hardware-pulses': `${TEXTBOOK_GITHUB}/quantum-hardware-pulses`, + '/course/quantum-hardware-pulses/*': `${TEXTBOOK_GITHUB}/quantum-hardware-pulses`, + '/course/quantum-hardware': `${TEXTBOOK_GITHUB}/quantum-hardware`, + '/course/quantum-hardware/*': `${TEXTBOOK_GITHUB}/quantum-hardware`, + '/course/ch-applications': `${TEXTBOOK_GITHUB}/ch-applications`, + '/course/ch-applications/*': `${TEXTBOOK_GITHUB}/ch-applications`, + '/course/ch-labs': `${TEXTBOOK_GITHUB}/ch-labs`, + '/course/ch-labs/*': `${TEXTBOOK_GITHUB}/ch-labs`, + '/course/ch-demos': `${TEXTBOOK_GITHUB}/ch-demos`, + '/course/ch-demos/*': `${TEXTBOOK_GITHUB}/ch-demos`, + '/course/ch-appendix': `${TEXTBOOK_GITHUB}/ch-appendix`, + '/course/ch-appendix/*': `${TEXTBOOK_GITHUB}/ch-appendix` +} + +const SYLLABI_REDIRECTS = { + '/syllabus/7E7-8CC': `${BOX_URL}v/qcprereqmath`, + '/syllabus/SFH-RXE': `${BOX_URL}v/qe23-captain-82`, + '/syllabus/BMK-Q8E': `${BOX_URL}v/qe23-navigator-56`, + '/syllabus/W7V-S2R': `${BOX_URL}v/qe23-traveler-48`, + '/syllabus/AFC-XW1': `${BOX_URL}v/qe23-combatant-23`, + '/syllabus/8N1-ZGF': `${BOX_URL}s/0yenwa0ihnj62au3glzjxralrd3mogtd`, + '/syllabus/TVP-NSE': `${BOX_URL}s/3wkgjcbf4w6zgxq8el52g8q21y4jgpej`, + '/syllabus/47X-43S': `${BOX_URL}s/0g893xv62s36rb9i92amccmxx8ps8mzy`, + '/syllabus/WUB-DCY': `${BOX_URL}s/nhzysimhfpv20l3hwgcyro08d7rhrioj`, + '/syllabus/ESZ-6NJ': `${BOX_URL}s/2s8wu5nvgydhf1eyp5hu06r5p1ogom9j`, + '/syllabus/8XH-8Q9': `${BOX_URL}s/v4v4qeth0vaj05toeqqss6itbiki9wn6`, + '/syllabus/P6J-QPD': `${BOX_URL}s/4dscrgx5hjn55mq861euq3026kl3em8x`, + '/syllabus/LDZ-XN1': `${BOX_URL}s/26v8fkcc7wn9wkyatkfsje7yvj7nochv` +} + // NOTE: if changing this also update the same variable in 'converter/common.ts' const LATEST_TEXTBOOK_VERSION = 'v2' @@ -194,6 +240,8 @@ export { UNIVERSAL_NOTATIONS, TOC, LEARNING_REDIRECTS, + GITHUB_REDIRECTS, + SYLLABI_REDIRECTS, findNextSection, findPrevSection, getSectionIndex,