Skip to content
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,6 @@ runs:
with:
node-version-file: 'core-web/.nvmrc'

- name: 'Enable Corepack'
run: corepack enable
shell: bash

- name: 'Set versions from VERSION file'
id: set_versions
working-directory: ${{ github.workspace }}/core-web/libs/sdk/
Expand Down Expand Up @@ -136,20 +132,51 @@ runs:
echo "::endgroup::"
shell: bash

- name: Set up pnpm
uses: pnpm/action-setup@v4
with:
package_json_file: core-web/package.json
run_install: false

- name: Get pnpm store directory path
id: pnpm-info
shell: bash
run: |
echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
echo "version=$(pnpm -v)" >> $GITHUB_OUTPUT

- id: restore-cache-pnpm
name: Restore pnpm Store Cache
uses: actions/cache/restore@v4
with:
path: ${{ steps.pnpm-info.outputs.dir }}
key: ${{ runner.os }}-pnpm-${{ steps.pnpm-info.outputs.version }}-${{ hashFiles('core-web/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-${{ steps.pnpm-info.outputs.version }}
${{ runner.os }}-pnpm-

- name: 'Install project'
working-directory: ${{ github.workspace }}/core-web/
run: |
set -euo pipefail
yarn install
npm --version
pnpm install --frozen-lockfile
pnpm --version
node --version
shell: bash

- id: save-cache-pnpm
name: Save pnpm Store Cache
if: ${{ steps.restore-cache-pnpm.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: ${{ steps.pnpm-info.outputs.dir }}
key: ${{ steps.restore-cache-pnpm.outputs.cache-primary-key }}

- name: 'Build SDK packages'
working-directory: ${{ github.workspace }}/core-web/
run: |
set -euo pipefail
npx nx run-many --target=build --projects='sdk-*' --configuration=production --skip-nx-cache
pnpm exec nx run-many --target=build --projects='sdk-*' --configuration=production --skip-nx-cache
shell: bash

- name: 'Publish SDK packages to NPM'
Expand Down
59 changes: 41 additions & 18 deletions .github/actions/core-cicd/maven-job/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,28 +184,51 @@ runs:
uses: actions/cache/restore@v4
with:
path: installs
key: node-binary-${{ hashFiles('core-web/.nvmrc') }}
# hash nodejs-parent/pom.xml so the pnpm-era layout (install-node-and-npm
# + corepack shim) is not mixed with the yarn-era layout from cached
# builds of the previous toolchain.
key: node-binary-${{ hashFiles('core-web/.nvmrc', 'nodejs-parent/pom.xml') }}

- name: Get yarn cache directory path
id: yarn-info
- name: Verify pnpm version is in sync between package.json and nodejs-parent/pom.xml
if: ${{ inputs.requires-node == 'true' }}
shell: bash
run: |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
echo "version=$(yarn -v)" >> $GITHUB_OUTPUT

set -euo pipefail
pkg_json_pm=$(jq -r '.packageManager' core-web/package.json)
pkg_json_version="${pkg_json_pm#pnpm@}"
pom_version=$(grep -oE '<pnpm\.version>[^<]+</pnpm\.version>' nodejs-parent/pom.xml | sed -E 's|</?pnpm\.version>||g')
if [ "$pkg_json_version" != "$pom_version" ]; then
echo "::error::pnpm version mismatch: core-web/package.json=$pkg_json_version vs nodejs-parent/pom.xml=$pom_version. Keep these in sync — Maven uses the pom value while the pnpm store cache key uses the package.json value." >&2
exit 1
fi
echo "pnpm version in sync: $pom_version"

- name: Set up pnpm
if: ${{ inputs.requires-node == 'true' }}
uses: pnpm/action-setup@v4
with:
package_json_file: core-web/package.json
run_install: false

- id: restore-cache-yarn
name: Restore Yarn Cache
- name: Get pnpm store directory path
id: pnpm-info
if: ${{ inputs.requires-node == 'true' }}
shell: bash
run: |
echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
echo "version=$(pnpm -v)" >> $GITHUB_OUTPUT

- id: restore-cache-pnpm
name: Restore pnpm Store Cache
if: ${{ inputs.requires-node == 'true' }}
uses: actions/cache/restore@v4
with:
path: ${{ steps.yarn-info.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ steps.yarn-info.outputs.version }}-${{ hashFiles('**/yarn.lock') }}
path: ${{ steps.pnpm-info.outputs.dir }}
key: ${{ runner.os }}-pnpm-${{ steps.pnpm-info.outputs.version }}-${{ hashFiles('core-web/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-yarn-${{ steps.yarn-info.outputs.version }}
${{ runner.os }}-yarn-
${{ runner.os }}-pnpm-${{ steps.pnpm-info.outputs.version }}
${{ runner.os }}-pnpm-


- id: cache-sonar
name: Cache SonarQube Packages
Expand Down Expand Up @@ -394,13 +417,13 @@ runs:
path: installs
key: ${{ steps.restore-cache-node.outputs.cache-primary-key }}

- id: save-cache-yarn
name: Save Yarn Cache
if: ${{ inputs.generate-artifacts == 'true' && steps.restore-cache-yarn.outputs.cache-hit != 'true' }}
- id: save-cache-pnpm
name: Save pnpm Store Cache
if: ${{ inputs.requires-node == 'true' && inputs.generate-artifacts == 'true' && steps.restore-cache-pnpm.outputs.cache-hit != 'true' }}
uses: actions/cache/save@v4
with:
path: ${{ steps.yarn-info.outputs.dir }}
key: ${{ steps.restore-cache-yarn.outputs.cache-primary-key }}
path: ${{ steps.pnpm-info.outputs.dir }}
key: ${{ steps.restore-cache-pnpm.outputs.cache-primary-key }}

- id: save-cache-sonar
name: Save SonarQube Cache
Expand Down
6 changes: 3 additions & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ just test-postman ai # Shorter command
cd core-web

# Install dependencies first
yarn install # Required before first test
pnpm install # Required before first test

# Run specific component tests (RECOMMENDED)
nx run dotcms-ui:test --testNamePattern="ContentTypeComponent"
Expand Down Expand Up @@ -578,7 +578,7 @@ export PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
source ~/.zshrc

# Reinstall dependencies
cd core-web && yarn install
cd core-web && pnpm install
```

### Issue #6: Dependency Version Conflict
Expand Down Expand Up @@ -716,7 +716,7 @@ curl -X GET http://localhost:8080/api/v1/myresource/123
cd core-web

# 2. Install dependencies (first time only)
yarn install
pnpm install

# 3. Start development server
nx serve dotcms-ui
Expand Down
14 changes: 7 additions & 7 deletions .github/instructions/frontend.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ All frontend code lives in **`core-web/`**. It is an Nx monorepo with TypeScript
### Nx commands (run from repo root or from `core-web/`)

```bash
cd core-web && yarn nx show projects
cd core-web && yarn nx run dotcms-ui:serve
cd core-web && yarn nx run <project>:test
cd core-web && yarn nx run <project>:test -t MyComponent
cd core-web && yarn nx affected -t build --exclude='tag:skip:build'
cd core-web && yarn nx affected -t lint --exclude='tag:skip:lint'
cd core-web && yarn nx affected -t test --exclude='tag:skip:test'
cd core-web && pnpm nx show projects
cd core-web && pnpm nx run dotcms-ui:serve
cd core-web && pnpm nx run <project>:test
cd core-web && pnpm nx run <project>:test -t MyComponent
cd core-web && pnpm nx affected -t build --exclude='tag:skip:build'
cd core-web && pnpm nx affected -t lint --exclude='tag:skip:lint'
cd core-web && pnpm nx affected -t test --exclude='tag:skip:test'
```

## File structure
Expand Down
Loading
Loading