Skip to content

Commit 463ebe1

Browse files
committed
#330 Upgrade CCM To ESM (#433)
1 parent 46eba1f commit 463ebe1

File tree

121 files changed

+2036
-2018
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+2036
-2018
lines changed

.github/workflows/ccm.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
- main
88
- '[0-9][0-9][0-9][0-9].[0-9][0-9].*' # 2021.01.x
99
- '2024-03-01-dep-update'
10+
- 'i330_alt_cjs_esm_upgrade'
1011
tags:
1112
- '[0-9][0-9][0-9][0-9].[0-9][0-9].[0-9][0-9]' # 2021.01.01
1213

@@ -22,7 +23,7 @@ env:
2223
jobs:
2324
build:
2425
# to test a feature, change the repo name to your github id
25-
if: github.repository_owner == 'tl-its-umich-edu'
26+
if: github.repository_owner == 'tl-its-umich-edu' || github.repository_owner == 'pushyamig'
2627
runs-on: ubuntu-latest
2728
steps:
2829

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,9 @@ you create a migration file and run the migration using `umzug`.
188188
Developers have to write `up` and `down` migration steps manually.
189189
190190
1. Running migrations locally
191-
1. Run migrations: `docker exec -it ccm_web node -r ts-node/register server/src/migrator up`
192-
2. Revert a migration: `docker exec -it ccm_web node -r ts-node/register server/src/migrator down`.
193-
3. Create a migration file: `docker exec -it ccm_web node -r ts-node/register server/src/migrator create --name my-migration.ts`.
191+
1. Run migrations: `docker exec -it ccm_web node --loader ts-node/esm server/src/migrator.ts up`
192+
2. Revert a migration: `docker exec -it ccm_web node --loader ts-node/esm server/src/migrator.ts down`.
193+
3. Create a migration file: `docker exec -it ccm_web node --loader ts-node/esm server/src/migrator.ts create --name my-migration.ts`.
194194
195195
This generates a migration file called `<timestamp>.my-migration.ts`.
196196
The timestamp prefix can be customized to be date-only or omitted,
@@ -201,9 +201,9 @@ Developers have to write `up` and `down` migration steps manually.
201201
2. Running the migration are usually done when server is starting up, but in addition if you want to run migrations or revert use above commands
202202
203203
3. Running migrations `docker-compose-prod.yml`
204-
1. For running the migrations in in dev/test/prod, use `docker exec -it ccm_web_prod node server/src/migrator up` and `docker exec -it ccm_web_prod node server/src/migrator down`.
204+
1. For running the migrations in in dev/test/prod, use `docker exec -it ccm_web_prod node --loader ts-node/esm server/src/migrator.js up` and `docker exec -it ccm_web_prod node --loader ts-node/esm server/src/migrator.js down`.
205205
2. The reason for the separate setups for running migrations for local/non-prod and prod is locally, we don't
206-
transpile TypeScript to Javascript and so we always use `ts-node/register` module for running in node
206+
transpile TypeScript to Javascript and so we always use `ts-node/esm` module for running in node
207207
environment.
208208
209209
#### Troubleshooting
@@ -352,7 +352,7 @@ This code will hopefully only remain in this repository temporarily.
352352
2. The action is triggered whenever a commit is made to the `main` branch. E.g., when a pull request is merged to `main`.
353353
3. OpenShift projects can periodically pull this image from GHCR. Configure only **_NON-PRODUCTION_** CCM projects to pull the image…
354354
```sh
355-
oc tag ghcr.io/tl-its-umich-edu/canvas-course-manager-next:latest canvas-course-manager-next:latest --scheduled --reference-policy=local
355+
oc tag ghcr.io/tl-its-umich-edu/canvas-course-manager-next:main canvas-course-manager-next:main --scheduled --reference-policy=local
356356
```
357357
See the OpenShift documentation "[Managing image streams: Configuring periodic importing of image stream tags](https://docs.openshift.com/container-platform/4.11/openshift_images/image-streams-manage.html#images-imagestream-import_image-streams-managing)" for details.
358358

ccm_web/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ COPY --from=base \
2929
/base/package.json \
3030
/base/package-lock.json \
3131
/base/start.sh \
32-
/base/ecosystem.config.js \
32+
/base/ecosystem.config.cjs \
3333
./
3434
RUN npm install --production
3535
RUN npm install [email protected] -g

ccm_web/client/src/App.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,19 @@
11
import React, { useEffect, useState } from 'react'
22
import { Route, Routes, useLocation } from 'react-router-dom'
33

4-
import { getCourse } from './api'
4+
import { getCourse } from './api.js'
55
import './App.css'
6-
import APIErrorMessage from './components/APIErrorMessage'
7-
import AuthorizePrompt from './components/AuthorizePrompt'
8-
import ErrorAlert from './components/ErrorAlert'
9-
import Layout from './components/Layout'
10-
import useGlobals from './hooks/useGlobals'
11-
import usePromise from './hooks/usePromise'
12-
import { CanvasCourseBase } from './models/canvas'
13-
import allFeatures from './models/FeatureUIData'
14-
import Home from './pages/Home'
15-
import NotFound from './pages/NotFound'
16-
import redirect from './utils/redirect'
6+
import APIErrorMessage from './components/APIErrorMessage.js'
7+
import AuthorizePrompt from './components/AuthorizePrompt.js'
8+
import ErrorAlert from './components/ErrorAlert.js'
9+
import Layout from './components/Layout.js'
10+
import useGlobals from './hooks/useGlobals.js'
11+
import usePromise from './hooks/usePromise.js'
12+
import { CanvasCourseBase } from './models/canvas.js'
13+
import allFeatures from './models/FeatureUIData.js'
14+
import Home from './pages/Home.js'
15+
import NotFound from './pages/NotFound.js'
16+
import redirect from './utils/redirect.js'
1717

1818
function App (): JSX.Element {
1919
const features = allFeatures.map(f => f.features).flat()

ccm_web/client/src/api.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import {
22
CanvasCourseBase, CanvasCourseSection, CanvasCourseSectionBase, CanvasEnrollment,
33
CanvasUserCondensed, CourseWithSections
4-
} from './models/canvas'
5-
import { ExternalUserSuccess } from './models/externalUser'
6-
import { Globals, CsrfToken } from './models/models'
7-
import handleErrors, { CanvasError } from './utils/handleErrors'
4+
} from './models/canvas.js'
5+
import { ExternalUserSuccess } from './models/externalUser.js'
6+
import { Globals, CsrfToken } from './models/models.js'
7+
import handleErrors, { CanvasError } from './utils/handleErrors.js'
88

99
const jsonMimeType = 'application/json'
1010

ccm_web/client/src/components/APIErrorMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { Typography } from '@mui/material'
33

4-
import { CanvasError } from '../utils/handleErrors'
4+
import { CanvasError } from '../utils/handleErrors.js'
55

66
interface APIErrorMessageProps {
77
context: string

ccm_web/client/src/components/APIErrorsTable.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React, { useState } from 'react'
22

3-
import CustomTable, { TableColumn } from './CustomTable'
4-
import { ErrorDescription } from '../utils/handleErrors'
3+
import CustomTable, { TableColumn } from './CustomTable.js'
4+
import { ErrorDescription } from '../utils/handleErrors.js'
55

66
interface NumberedErrorDescription extends ErrorDescription {
77
rowNumber: number

ccm_web/client/src/components/Accordion.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
AccordionDetails as MUIAccordionDetails,
66
AccordionSummary as MUIAccordionSummary
77
} from '@mui/material'
8-
import ExpandMoreIcon from '@mui/icons-material/ExpandMore'
8+
import {ExpandMore as ExpandMoreIcon} from '@mui/icons-material'
99

1010
const PREFIX = 'Accordion'
1111

ccm_web/client/src/components/AuthorizePrompt.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from 'react'
22
import { styled } from '@mui/material/styles'
33
import { Button, Typography } from '@mui/material'
44

5-
import Help from './Help'
5+
import Help from './Help.js'
66

77
const PREFIX = 'AuthorizePrompt'
88

ccm_web/client/src/components/Breadcrumbs.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import React from 'react'
22
import { styled } from '@mui/material/styles'
33
import { Link as RouterLink } from 'react-router-dom'
44
import { Breadcrumbs as MuiBreadcrumbs, Link, Typography } from '@mui/material'
5-
import NavigateNextIcon from '@mui/icons-material/NavigateNext'
5+
import {NavigateNext as NavigateNextIcon} from '@mui/icons-material'
66

7-
import { FeatureUIProps } from '../models/FeatureUIData'
7+
import { FeatureUIProps } from '../models/FeatureUIData.js'
88

99
const PREFIX = 'Breadcrumbs'
1010

0 commit comments

Comments
 (0)