Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 1.126.0 #1538

Open
wants to merge 16 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
with:
node-version: 20.8.1
cache: "yarn"
Expand Down Expand Up @@ -38,7 +38,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
- uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
with:
node-version: 20
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:

- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup Node
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
with:
node-version: 20.8.1
cache: "yarn"

- name: Setup Hugo
uses: peaceiris/actions-hugo@16361eb4acea8698b220b76c0d4e84e1fd22c61d # v2
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3
with:
hugo-version: "0.115.4"
hugo-version: "0.142.0"
extended: true

- name: Install dependencies
Expand Down Expand Up @@ -69,7 +69,7 @@ jobs:
RESOURCE_BASE_URL: ${{ secrets.RESOURCE_BASE_URL }}

- name: Deploy www Preview to Netlify
uses: nwtgck/actions-netlify@7a92f00dde8c92a5a9e8385ec2919775f7647352 # v2.1
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0
if: ${{ github.event_name == 'pull_request' }}
with:
publish-dir: "../ocw-www/public"
Expand All @@ -84,7 +84,7 @@ jobs:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

- name: Deploy v2 Course Preview to Netlify
uses: nwtgck/actions-netlify@7a92f00dde8c92a5a9e8385ec2919775f7647352 # v2.1
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0
if: ${{ github.event_name == 'pull_request' }}
with:
publish-dir: "../ocw-course/public-v2"
Expand Down Expand Up @@ -114,23 +114,23 @@ jobs:

- name: Create comment
if: ${{ steps.fc.outputs.comment-id == 0 }}
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4
continue-on-error: true
with:
issue-number: ${{ github.event.pull_request.number }}
body: ${{ steps.set-comment-body.outputs.body }}

- name: Update comment
if: ${{ steps.fc.outputs.comment-id != 0 }}
uses: peter-evans/create-or-update-comment@23ff15729ef2fc348714a3bb66d2f655ca9066f2 # v3
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4
continue-on-error: true
with:
comment-id: ${{ steps.fc.outputs.comment-id }}
edit-mode: replace
body: ${{ steps.set-comment-body.outputs.body }}

- name: Deploy CI build to Netlify
uses: nwtgck/actions-netlify@7a92f00dde8c92a5a9e8385ec2919775f7647352 # v2.1
uses: nwtgck/actions-netlify@4cbaf4c08f1a7bfa537d6113472ef4424e4eb654 # v3.0
if: ${{ github.event_name == 'push' }}
with:
publish-dir: "../ocw-www/public"
Expand All @@ -150,7 +150,7 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Setup Node
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4
with:
node-version: 20.8.1
cache: "yarn"
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.18.1
22.14.0
875 changes: 0 additions & 875 deletions .yarn/releases/yarn-3.8.3.cjs

This file was deleted.

934 changes: 934 additions & 0 deletions .yarn/releases/yarn-4.6.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-3.8.3.cjs
yarnPath: .yarn/releases/yarn-4.6.0.cjs
supportedArchitectures:
os: [linux, darwin]
cpu: [x64, arm64]
18 changes: 18 additions & 0 deletions RELEASE.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,24 @@
Release Notes
=============

Version 1.126.0
---------------

- Upgrade yarn from 3.8.7 to 4.6.0. (#1532)
- Update Yarn to v3.8.7 (#1535)
- Update Node.js to v22 (#1534)
- Fix milestone links being unclickable due to carousel overlay (#1521)
- Update Node.js to v20.18.3 (#1533)
- Upgrade Hugo version to latest (0.142.0) (#1512)
- Update peter-evans/create-or-update-comment action to v4 (#1528)
- Update peaceiris/actions-hugo action to v3 (#1527)
- Update dependency sass-loader to v16 (#1453)
- Update dependency envalid to v8 (#1525)
- Update dependency @types/sinon to v17 (#1523)
- Update dependency cross-env to v7 (#1524)
- Update nwtgck/actions-netlify action to v3 (#1526)
- Update actions/setup-node action to v4 (#1351)

Version 1.125.0 (Released February 24, 2025)
---------------

Expand Down
8 changes: 4 additions & 4 deletions base-theme/layouts/partials/featured_course_cards.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ <h2 class="{{ $klass }}">Featured Courses</h2>
{{ range $index, $courseItem := $courses }}
{{- $urlPath := partial "site_root_url.html" $courseItem.id -}}
{{- $url := delimit (slice (strings.TrimSuffix "/" $staticApiBaseUrl) $urlPath "/data.json") "" -}}
{{ with resources.GetRemote $url }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ errorf "Failed to fetch featured course info from %v with error %v" $url . }}
{{ else }}
{{ else with .Value }}
{{- $courseData := . | unmarshal -}}
{{ partial "course_carousel_card.html" (dict "itemsInCarousel" $itemsInCarousel "courseData" $courseData "index" $index "urlPath" $urlPath "numCourses" (len $courses))}}
{{ else }}
{{ errorf "Failed to fetch featured course info from %v" $url }}
{{ end }}
{{ else }}
{{ errorf "Failed to fetch featured course info from %v" $url }}
{{ end }}
{{ end }}
</div>
Expand Down
8 changes: 4 additions & 4 deletions base-theme/layouts/partials/get_instructors.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
{{ range . }}
{{ $staticApiBaseUrl := getenv "STATIC_API_BASE_URL" }}
{{ $url := (print (strings.TrimSuffix "/" $staticApiBaseUrl) "/instructors/" . "/index.json") }}
{{ with resources.GetRemote $url }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ errorf "Failed to fetch instructors from %v with error %v" $url . }}
{{ else }}
{{ else with .Value }}
{{ $data := (. | unmarshal).data }}
{{ $searchUrl := partial "get_search_url.html" (dict "key" "instructors" "value" (title $data.title)) }}
{{ $instructor := merge $data (dict "url" $searchUrl) }}
{{ $instructors = $instructors | append $instructor }}
{{ else }}
{{ errorf "Failed to fetch instructors from %v" $url }}
{{ end }}
{{ else }}
{{ errorf "Failed to fetch instructors from %v" $url }}
{{ end }}
{{ end }}
{{ return $instructors }}
8 changes: 4 additions & 4 deletions base-theme/layouts/partials/get_site_metadata.html
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{{ $courseData := slice }}
{{ $staticApiBaseUrl := getenv "STATIC_API_BASE_URL" }}
{{ $url := (print (strings.TrimSuffix "/" $staticApiBaseUrl) "/" . "/data.json") }}
{{ with resources.GetRemote $url }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{ errorf "Failed to fetch course data from %v with error %v" $url . }}
{{ else }}
{{ else with .Value}}
{{ $courseData = unmarshal . }}
{{ else }}
{{ errorf "Failed to fetch course data from %v" $url }}
{{ end }}
{{ else }}
{{ errorf "Failed to fetch course data from %v" $url }}
{{ end }}
{{ return $courseData }}
10 changes: 5 additions & 5 deletions fields/layouts/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ <h1>
{{- range (first 5 $subfield.Params.courses) -}}
{{- $id := .id -}}
{{- $url := delimit (slice (strings.TrimSuffix "/" $staticApiBaseUrl) "/" $id "/data.json") "" -}}
{{ with resources.GetRemote $url }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{- $errorMessage := printf "Failed to fetch sub-fields on %v via %v with error: %v" site.BaseURL $url . -}}
{{- partial "sentry_capture_message.html" $errorMessage -}}
{{ else }}
{{ else with .Value }}
{{- $data := . | unmarshal -}}
{{- $data = merge $data (dict "url_path" $id) -}}
{{- $subfield_data = $subfield_data | append (dict $id $data) -}}
{{ else }}
{{ $errorMessage := printf "Failed to fetch sub-fields through %v on %v" $url site.BaseURL }}
{{ partial "sentry_capture_message.html" $errorMessage }}
{{ end }}
{{ else }}
{{ $errorMessage := printf "Failed to fetch sub-fields through %v on %v" $url site.BaseURL }}
{{ partial "sentry_capture_message.html" $errorMessage }}
{{ end }}
{{- end -}}
{{ end }}
Expand Down
10 changes: 5 additions & 5 deletions fields/layouts/subfields/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
{{- range $courselist.Params.courses -}}
{{- $id := .id -}}
{{- $url := delimit (slice (strings.TrimSuffix "/" $staticApiBaseUrl) "/" .id "/data.json") "" -}}
{{ with resources.GetRemote $url }}
{{ with try (resources.GetRemote $url) }}
{{ with .Err }}
{{- $errorMessage := printf "Failed to fetch sub-field on %v via %v with error: %v" site.BaseURL $url . -}}
{{- partial "sentry_capture_message.html" $errorMessage -}}
{{ else }}
{{ else with .Value }}
{{- $data := . | unmarshal -}}
{{- $data = merge $data (dict "url_path" $id) -}}
{{- $courseListData = $courseListData | append (dict $id $data) -}}
{{ else }}
{{ $errorMessage := printf "Failed to fetch sub-field through %v on %v" $url site.BaseURL }}
{{ partial "sentry_capture_message.html" $errorMessage }}
{{ end }}
{{ else }}
{{ $errorMessage := printf "Failed to fetch sub-field through %v on %v" $url site.BaseURL }}
{{ partial "sentry_capture_message.html" $errorMessage }}
{{ end }}
{{- end -}}
{{ end }}
Expand Down
18 changes: 9 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "ocw-hugo-themes",
"version": "1.125.0",
"version": "1.126.0",
"description": "A Hugo theme for building OCW websites",
"repository": "mitodl/ocw-hugo-themes",
"main": "base-theme/assets/index.js",
"packageManager": "yarn@3.8.3",
"packageManager": "yarn@4.6.0",
"scripts": {
"lint": "eslint $PROJECT_CWD/'**/*.{js,jsx,ts,tsx}'",
"start": "NODE_ENV=development ts-node ./package_scripts/start.ts",
Expand Down Expand Up @@ -89,20 +89,20 @@
"@types/react-dom": "^17.0.11",
"@types/react-infinite-scroller": "^1.2.2",
"@types/serve-handler": "^6.1.1",
"@types/sinon": "^10.0.6",
"@types/sinon": "^17.0.0",
"@types/video.js": "^7.3.29",
"@typescript-eslint/eslint-plugin": "^5.40.1",
"ansi-colors": "^4.1.3",
"clean-webpack-plugin": "^4.0.0",
"cli-table3": "^0.6.3",
"commander": "^12.0.0",
"concurrently": "^9.0.0",
"concurrently": "^6.3.0",
"copy-webpack-plugin": "^11.0.0",
"cross-env": "^6.0.0",
"cross-env": "^7.0.0",
"css-loader": "^3.0.0",
"css-minimizer-webpack-plugin": "^4.0.0",
"dotenv-webpack": "^8.0.0",
"envalid": "^7.3.1",
"envalid": "^8.0.0",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^7.32.0",
Expand All @@ -113,9 +113,9 @@
"eslint-plugin-react-hooks": "^4.6.0",
"exec-sh": "^0.4.0",
"file-loader": "^5.0.2",
"hugo-bin-extended": "^0.119.0",
"hugo-bin-extended": "^0.142.0",
"imports-loader": "^0.8.0",
"inquirer": "^12.0.0",
"inquirer": "^8.2.5",
"jest": "^27.4.7",
"jest-fetch-mock": "^3.0.3",
"jest-watch-typeahead": "^2.2.0",
Expand All @@ -130,7 +130,7 @@
"recursive-readdir": "^2.2.3",
"rimraf": "^6.0.0",
"sass-lint": "^1.13.1",
"sass-loader": "^8.0.0",
"sass-loader": "^16.0.0",
"serve-handler": "^6.1.3",
"sinon": "^19.0.0",
"terser-webpack-plugin": "^5.3.3",
Expand Down
2 changes: 1 addition & 1 deletion package_scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else
npm run build:webpack -- --output-path=$STATIC_PATH
cd $CONTENT_PATH
# Run Hugo build
hugo --config $CONFIG_PATH --themesDir $THEMES_PATH -d dist -v
hugo --config $CONFIG_PATH --themesDir $THEMES_PATH -d dist --logLevel info
GIT_HASH=`git rev-parse HEAD`
printf $GIT_HASH >> $STATIC_PATH/hash.txt
fi
22 changes: 15 additions & 7 deletions package_scripts/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,16 @@ type HugoServerOptions = {
bind: string
config: string
themesDir: string
renderToDisk: boolean
logLevel?: string
}

const hugoServer = (
opts: Partial<HugoServerOptions> & Pick<HugoServerOptions, "config">
) => {
const allOpts: HugoServerOptions = {
port: 3000,
bind: "0.0.0.0",
themesDir: process.cwd(),
renderToDisk: true,
port: 3000,
bind: "0.0.0.0",
themesDir: process.cwd(),
...opts
}
return `hugo server ${u.getOptions(allOpts)}`
Expand Down Expand Up @@ -162,7 +161,13 @@ const makeEnvOpt = (
]
}

const start = program.description("Start ocw-hugo-themes development servers.")
const start = program
.description("Start ocw-hugo-themes development servers.")
.option(
"--logLevel [value]",
"Set the log level for Hugo (options: debug, info, warn, error).",
"info"
)

type StartOptions = {
gitContentSource: string
Expand Down Expand Up @@ -194,10 +199,13 @@ const startSiteAction = async (opts: StartOptions, cliOptNames: string[]) => {

await ensureHugoConfig("COURSE_HUGO_CONFIG_PATH")

const globalOpts = program.opts() as { logLevel: string }
const logLevel = globalOpts.logLevel

startWebpackAnd({
name: "hugo",
cwd: opts.contentDir,
command: hugoServer({ config: opts.config })
command: hugoServer({ config: opts.config, logLevel })
})
}

Expand Down
7 changes: 4 additions & 3 deletions package_scripts/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ type HugoOptions = {
themesDir: string
config: string
destination: string
verbose?: boolean
environment?: "development" | "production"
logLevel?: string
cacheDir?: string
ignoreCache?: boolean
}
Expand All @@ -67,8 +67,9 @@ type HugoOptions = {
* for more.
*/
const hugo = (hugoOptions: HugoOptions, execOptions: SpawnOptions) => {
const flags = getOptions(hugoOptions)
return execSh(`yarn hugo ${flags} --verbose`, execOptions)
const opts = { ...hugoOptions, logLevel: hugoOptions.logLevel || "info" }
const flags = getOptions(opts)
return execSh(`yarn hugo ${flags}`, execOptions)
}

export type { HugoOptions }
Expand Down
3 changes: 1 addition & 2 deletions tests-e2e/LocalOcw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ class LocalOCW {
destination: path.join(this.rootDestinationDir, destInTmp),
ignoreCache: true,
config: site.configPath,
baseURL: destInTmp,
verbose: true
baseURL: destInTmp
},
{
cwd: fromRoot(`./test-sites/${site.name}`),
Expand Down
3 changes: 2 additions & 1 deletion tests-e2e/fixtures.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ test("The fixtures are what Hugo would produce.", async () => {
* the test homepage.
*/
"courses/some-featured-course",
"courses/some-new-course"
"courses/some-new-course",
"ocw-ci-test-www/instructors/"
]

const fixtureDir = path.resolve(__dirname, "../test-sites/__fixtures__")
Expand Down
Loading