Skip to content
Merged
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
36 changes: 16 additions & 20 deletions .github/workflows/app-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache: 'pnpm'
cache-dependency-path: |
yarn.lock
package.json
src/**/package.json
test_apps/encore-app/pnpm-lock.yaml
test_apps/encore-app/package.json

- uses: shivammathur/setup-php@v2
Expand All @@ -54,33 +54,29 @@ jobs:
run: php .github/build-packages.php

# We always install PHP deps because of the UX Translator, which requires `var/translations` to exists
- name: Install App dependencies
- name: Install PHP dependencies
uses: ramsey/composer-install@v3
with:
working-directory: test_apps/encore-app
dependency-versions: highest

- if: matrix.ux-packages-source == 'php-vendor'
name: Refresh dependencies from vendor/
working-directory: test_apps/encore-app
run: yarn
env:
YARN_ENABLE_HARDENED_MODE: 0
YARN_ENABLE_IMMUTABLE_INSTALLS: 0
- working-directory: test_apps/encore-app
run: pnpm install --ignore-workspace
Copy link
Member Author

@Kocal Kocal Jul 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--ignore-workspace allows to ignore the pnpm-workspace.yaml from parent folders, and install dependencies from test_apps/encore-app only (test_apps/encore-app is not a workspace on purpose)


- if: matrix.ux-packages-source == 'js-packages'
name: Install UX JS packages with a JS package manager
working-directory: test_apps/encore-app
run: |
PACKAGES_TO_INSTALL=''
for PACKAGE in $(cd ../..; yarn workspaces list --no-private --json); do
PACKAGE_DIR=../../$(echo $PACKAGE | jq -r '.location')
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL $PACKAGE_DIR"
for PACKAGE in $(cd ../..; pnpm ls -r --json --depth -1 | jq 'map(select(.private != true))' | jq -c '.[]'); do
PACKAGE_ABSOLUTE_PATH=$(echo $PACKAGE | jq -r '.path')
PACKAGE_RELATIVE_PATH=$(realpath --relative-to=. "$PACKAGE_ABSOLUTE_PATH")
PACKAGES_TO_INSTALL="$PACKAGES_TO_INSTALL file:$PACKAGE_RELATIVE_PATH"
done
echo "Installing packages: $PACKAGES_TO_INSTALL"
yarn add --dev $PACKAGES_TO_INSTALL
pnpm add --save-dev $PACKAGES_TO_INSTALL

- name: Ensure UX packages are installed from "${{ matrix.ux-packages-source == 'php-vendor' && 'vendor/symfony/ux-...' || '../../../src/**/assets' }}"
- name: Ensure UX packages are installed from "${{ env.EXPECTED_PATTERN }}"
working-directory: test_apps/encore-app
run: |
for PACKAGE in $(cat package.json | jq -c '(.dependencies // {}) + (.devDependencies // {}) | to_entries[] | select(.key | startswith("@symfony/ux-")) | {name: .key, version: .value}'); do
Expand All @@ -97,12 +93,12 @@ jobs:
fi
done;
env:
EXPECTED_PATTERN: ${{ matrix.ux-packages-source == 'php-vendor' && 'file:vendor/symfony/*' || '../../src/*' }}
EXPECTED_PATTERN: ${{ matrix.ux-packages-source == 'php-vendor' && 'file:vendor/symfony/*' || 'file:../../src/*' }}

- name: Run Encore (dev)
- name: Ensure project can be built in dev mode
working-directory: test_apps/encore-app
run: yarn encore dev
run: pnpm run dev

- name: Run Encore (prod)
- name: Ensure project can be built in prod mode
working-directory: test_apps/encore-app
run: yarn encore production
run: pnpm run build
6 changes: 3 additions & 3 deletions .github/workflows/code-quality.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
- run: yarn --immutable
- run: yarn ci
cache: 'pnpm'
- run: pnpm install --frozen-lockfile
- run: pnpm run ci

coding-style-php:
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/dist-files-unbuilt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache: 'pnpm'
cache-dependency-path: |
yarn.lock
pnpm-lock.yaml
**/package.json
- run: yarn --immutable && yarn build
- run: pnpm install --frozen-lockfile && pnpm run build

- name: Check if JS dist files are current
run: |
Expand Down
14 changes: 5 additions & 9 deletions .github/workflows/release-on-npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,25 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'yarn'
cache: 'pnpm'
cache-dependency-path: |
yarn.lock
pnpm-lock.yaml
package.json
src/**/package.json
- run: yarn --immutable
- run: pnpm install --frozen-lockfile

- name: Update version of JS packages
run: yarn workspaces foreach -pA exec "npm version ${{ env.VERSION }} --no-git-tag-version --no-workspaces-update"
run: pnpm version ${{ env.VERSION }} --no-git-tag-version --workspaces --no-workspaces-update

- name: Commit changes
run: |
git add .
git commit -m "Update versions to ${{ env.VERSION }}"

- name: Replace local "workspace:*" occurrences
run: |
yarn workspaces foreach -pA exec "sed -i 's/\"workspace:\*\"/\"${{ env.VERSION }}\"/g' package.json"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is automatically done when running pnpm publish, see https://pnpm.io/workspaces#publishing-workspace-packages

- name: Publish on NPM
env:
NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
run: yarn workspaces foreach -A --no-private npm publish --access public --tolerate-republish
run: pnpm publish --recursive --access public --no-git-checks

- name: Push changes
env:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/unit-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ jobs:
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
cache: 'pnpm'
cache-dependency-path: |
yarn.lock
pnpm-lock.yaml
package.json
src/**/package.json
- run: yarn --immutable
- run: yarn playwright install
- run: yarn test
- run: pnpm install --frozen-lockfile
- run: pnpm exec playwright install
- run: pnpm run test
11 changes: 1 addition & 10 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

vendor/
node_modules
yarn-error.log

.doctor-rst.cache
.php-cs-fixer.cache
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.6
22.11
2 changes: 0 additions & 2 deletions .yarnrc.yml

This file was deleted.

32 changes: 16 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing
Thank you for considering contributing to Symfony UX!

Thank you for considering contributing to Symfony UX!

Symfony UX is an open source, community-driven project, and we are happy to receive contributions from the community!

Expand Down Expand Up @@ -39,15 +39,15 @@ To set up the development environment, you need the following tools:

- [PHP](https://www.php.net/downloads.php) 8.1 or higher
- [Composer](https://getcomposer.org/download/)
- [Node.js](https://nodejs.org/en/download/package-manager) 22 or higher
- [Node.js](https://nodejs.org/en/download/package-manager) 22.11 or higher
- [Corepack](https://github.com/nodejs/corepack)
- [Yarn](https://yarnpkg.com/) 4 or higher
- [PNPM](https://pnpm.io/) 10.13 or higher

With these tools installed, you can install the project dependencies:

```shell
$ composer install
$ corepack enable && yarn install
$ corepack enable && pnpm install
```

### Linking Symfony UX packages to your project
Expand Down Expand Up @@ -79,17 +79,17 @@ Assets are specific to each Symfony UX package:
- Assets **must be** compatible with the [Symfony AssetMapper](https://symfony.com/doc/current/frontend/asset_mapper.html) and [Symfony Webpack Encore](https://symfony.com/doc/current/frontend/encore/index.html).

To help you with assets, you can run the following commands in a specific package directory (e.g., `src/Map/assets/`):
- `yarn run build`: build (compile) assets from the package,
- `yarn run watch`: watch for modifications and rebuild assets from the package,
- `yarn run test`: run the tests from the package,
- `yarn run check`: run the formatter, linter, and sort imports, and fails if any modifications
- `yarn run check --write`: run the formatter, linter, imports sorting, and write modifications

Thanks to [Yarn Workspaces](https://yarnpkg.com/features/workspaces), you can also run these commands from the root directory of the project:
- `yarn run build`: build (compile) assets from **all** packages,
- `yarn run test`: run the tests from **all** packages,
- `yarn run check`: run the formatter, linter, and sort imports for **all** packages, and fails if any modifications
- `yarn run check --write`: run the formatter, linter, imports sorting for **all** packages, and write modifications
- `pnpm run build`: build (compile) assets from the package,
- `pnpm run watch`: watch for modifications and rebuild assets from the package,
- `pnpm run test`: run the tests from the package,
- `pnpm run check`: run the formatter, linter, and sort imports, and fails if any modifications
- `pnpm run check --write`: run the formatter, linter, imports sorting, and write modifications

Thanks to [PNPM Workspaces](https://pnpm.io/workspaces), you can also run these commands from the root directory of the project:
- `pnpm run build`: build (compile) assets from **all** packages,
- `pnpm run test`: run the tests from **all** packages,
- `pnpm run check`: run the formatter, linter, and sort imports for **all** packages, and fails if any modifications
- `pnpm run check --write`: run the formatter, linter, imports sorting for **all** packages, and write modifications

### Working on documentation

Expand Down
16 changes: 8 additions & 8 deletions bin/test_package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ fi

runTestSuite() {
echo -e "Running tests for $workspace...\n"
yarn run -T vitest --run || { all_tests_passed=false; }
pnpm exec vitest --run || { all_tests_passed=false; }
}

processWorkspace() {
Expand All @@ -39,15 +39,15 @@ processWorkspace() {
echo "No package.json found at $package_json_path"
return
fi

workspace=$(jq -r '.name' "$package_json_path")
if [ -z "$workspace" ]; then
echo "No name found in package.json at $package_json_path"
return
fi

echo -e "Processing workspace $workspace at location $location...\n"

echo "Checking '$package_json_path' for peerDependencies and importmap dependencies to have the same version"
deps=$(jq -r '.peerDependencies | keys[]' "$package_json_path")
for library in $deps; do
Expand Down Expand Up @@ -76,15 +76,15 @@ processWorkspace() {
if [ -n "$trimmed_version" ]; then
# Install each version of the library separately
echo -e " - Install $library@$trimmed_version for $workspace\n"
yarn workspace "$workspace" add "$library@$trimmed_version" --peer
pnpm add "$library@$trimmed_version" --save-peer --filter "$workspace"

runTestSuite
fi
done

echo " -> Reverting version changes for $library"
yarn workspace "$workspace" add "$library@$versionValue" --peer
done

echo " -> Reverting version changes from $package_json_path"
git checkout -- "$package_json_path"
else
echo -e " -> No peerDependencies found with multiple versions defined\n"
runTestSuite
Expand Down
26 changes: 6 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"private": true,
"packageManager": "[email protected]",
"packageManager": "[email protected]+sha512.37ebf1a5c7a30d5fabe0c5df44ee8da4c965ca0c5af3dbab28c3a1681b70a256218d05c81c9c0dcf767ef6b8551eb5b960042b9ed4300c59242336377e01cfad",
"type": "module",
"workspaces": [
"src/*/assets",
"src/*/src/Bridge/*/assets"
],
"scripts": {
"build": "yarn workspaces foreach -Ap --topological-dev run build",
"test": "yarn workspaces foreach -Ap --topological-dev run test",
"build": "pnpm run -r --aggregate-output build",
"test": "pnpm run -r --aggregate-output test",
"check": "biome check",
"ci": "biome ci"
},
Expand All @@ -17,28 +17,14 @@
"@rollup/plugin-commonjs": "^28.0.6",
"@rollup/plugin-node-resolve": "^16.0.1",
"@rollup/plugin-typescript": "^12.1.4",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/user-event": "^14.6.1",
"@testing-library/dom": "catalog:",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catalogs are like an alias to a constraint version.
When defining the catalog version for @testing-library/dom, then it will always install the exact same version when installing the same package in different places (if we use the same catalog ofc)

"@testing-library/jest-dom": "catalog:",
"@types/node": "^22.6.0",
"@vitest/browser": "^2.1.1",
"jsdom": "^26.1.0",
"lightningcss": "^1.28.2",
"playwright": "^1.47.0",
"rollup": "^4.44.1",
"tinyglobby": "^0.2.14",
"tslib": "^2.6.3",
"tsx": "^4.20.3",
"typescript": "^5.8.3",
"vitest": "^2.1.1"
},
"resolutions": {
"@swup/plugin/@swup/prettier-config": "link:node_modules/.cache/null",
"@swup/plugin/@swup/browserslist-config": "link:node_modules/.cache/null",
"@swup/plugin/microbundle": "link:node_modules/.cache/null",
"@swup/plugin/prettier": "link:node_modules/.cache/null",
"@swup/plugin/shelljs": "link:node_modules/.cache/null",
"@swup/plugin/shelljs-live": "link:node_modules/.cache/null"
"vitest": "catalog:"
},
"version": "2.27.0"
}
Loading
Loading