Skip to content

Commit

Permalink
Migrate from Yarn Classic to Yarn Berry
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocal committed Sep 29, 2024
1 parent 15ad6a9 commit 23176e4
Show file tree
Hide file tree
Showing 13 changed files with 10,845 additions and 7,405 deletions.
4 changes: 4 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/.yarn/** linguist-vendored
/.yarn/releases/* binary
/.yarn/plugins/**/* binary
/.pnp.* binary linguist-generated
6 changes: 4 additions & 2 deletions .github/workflows/high-depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,16 @@ jobs:
with:
node-version: ${{matrix.node-versions}}

- run: corepack enable

- name: Remove Lock File
run: rm yarn.lock

- name: Install Yarn Dependencies
run: yarn install
run: yarn install --mode update-lockfile && yarn install

- name: Show Installed Versions
run: yarn list --depth=0
run: yarn info --name-only

- name: Run Tests
run: yarn test
2 changes: 2 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
with:
node-version: '22'

- run: corepack enable

- name: Install Yarn Dependencies
run: yarn install

Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/low-depends.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
with:
node-version: ${{matrix.node-versions}}

- run: corepack enable

- name: Remove Lock File
run: rm yarn.lock

Expand All @@ -40,10 +42,10 @@ jobs:
git commit -am "Force Lowest Dependencies"
- name: Install Yarn Dependencies
run: yarn install
run: yarn install --mode update-lockfile && yarn install

- name: Show Installed Versions
run: yarn list --depth=0
run: yarn info --name-only

- name: Run Tests
run: yarn test
4 changes: 3 additions & 1 deletion .github/workflows/stable-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ jobs:
with:
node-version: ${{matrix.node-versions}}

- run: corepack enable

- name: Install Yarn Dependencies
run: yarn install

- name: Show Installed Versions
run: yarn list --depth=0
run: yarn info --name-only

- name: Run Tests
run: yarn test
2 changes: 2 additions & 0 deletions .github/workflows/testing_apps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ jobs:
with:
node-version: '22'

- run: corepack enable

- if: ${{ contains(matrix.app.name, 'pnpm') }}
name: Install pnpm
uses: pnpm/action-setup@v4
Expand Down
14 changes: 12 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
node_modules/
npm-debug.log*
# https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

node_modules
yarn-error.log

/test_tmp
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "4.7.0",
"description": "Webpack Encore is a simpler way to integrate Webpack into your application",
"main": "index.js",
"packageManager": "yarn@4.5.0",
"scripts": {
"test": "yarn run test:main && yarn run test:persistent-cache",
"test:main": "mocha --reporter spec test --recursive --ignore test/persistent-cache/*",
Expand Down Expand Up @@ -51,7 +52,7 @@
"@babel/preset-react": "^7.9.0",
"@babel/preset-typescript": "^7.0.0",
"@hotwired/stimulus": "^3.0.0",
"@symfony/mock-module": "file:fixtures/stimulus/mock-module",
"@symfony/mock-module": "portal:fixtures/stimulus/mock-module",
"@symfony/stimulus-bridge": "^3.0.0",
"@vue/babel-helper-vue-jsx-merge-props": "^1.0.0",
"@vue/babel-plugin-jsx": "^1.0.0",
Expand Down Expand Up @@ -223,6 +224,5 @@
"lib/",
"bin/",
"index.js"
],
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
]
}
2 changes: 1 addition & 1 deletion scripts/force-lowest-dependencies.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const vueLoaderLowVersion = '15.0.11';
*/
function getLowestVersion(dependency, range) {
return new Promise((resolve, reject) => {
if (range.startsWith('file:')) {
if (range.startsWith('file:') || range.startsWith('portal:')) {
resolve([dependency, range]);
}

Expand Down
13 changes: 9 additions & 4 deletions test/bin/encore.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,13 +286,18 @@ module.exports = Encore.getWebpackConfig();

describe('Without webpack-dev-server installed', () => {
before(() => {
execSync('yarn remove webpack-dev-server --dev', { cwd: projectDir });
execSync('yarn remove webpack-dev-server', { cwd: projectDir });
});

after(() => {
after(function() {
// Yarn install can take a long time
this.timeout(10000);

let output;
// Re-install webpack-dev-server and ensure the project is in a clean state
execSync('git checkout package.json', { cwd: projectDir });
execSync('yarn install', { cwd: projectDir });
try { output = execSync('git checkout package.json yarn.lock', { cwd: projectDir }); console.log(output.toString()) } catch(e) { console.error(e); }

Check failure on line 298 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Statement inside of curly braces should be on next line

Check failure on line 298 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Missing semicolon

Check failure on line 298 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Closing curly brace should be on the same line as opening curly brace or on the line after the previous block

Check failure on line 298 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Expected space(s) after "catch"

Check failure on line 298 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Statement inside of curly braces should be on next line

Check failure on line 298 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Closing curly brace should be on the same line as opening curly brace or on the line after the previous block
// try { output = execSync('yarn install --mode update-lockfile' , { cwd: projectDir }); console.log(output.toString()) } catch(e) { console.error(e); }
try { output = execSync('yarn install ', { cwd: projectDir }); console.log(output.toString()) } catch(e) { console.error(e); }

Check failure on line 300 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Statement inside of curly braces should be on next line

Check failure on line 300 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Missing semicolon

Check failure on line 300 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Closing curly brace should be on the same line as opening curly brace or on the line after the previous block

Check failure on line 300 in test/bin/encore.js

View workflow job for this annotation

GitHub Actions / ESLint

Expected space(s) after "catch"
});

it('Throw an error when trying to use the webpack-dev-server if not installed', done => {
Expand Down
4 changes: 2 additions & 2 deletions test/functional.js
Original file line number Diff line number Diff line change
Expand Up @@ -2070,14 +2070,14 @@ module.exports = {
'main.js',
'main.css',
'manifest.json',
'node_modules_symfony_mock-module_dist_controller_js.js',
'fixtures_stimulus_mock-module_dist_controller_js.js',
'entrypoints.json',
'runtime.js',
]);

// test controllers and style are shipped
webpackAssert.assertOutputFileContains('main.js', 'app-controller');
webpackAssert.assertOutputFileContains('node_modules_symfony_mock-module_dist_controller_js.js', 'mock-module-controller');
webpackAssert.assertOutputFileContains('fixtures_stimulus_mock-module_dist_controller_js.js', 'mock-module-controller');
webpackAssert.assertOutputFileContains('main.css', 'body {}');

done();
Expand Down
Loading

0 comments on commit 23176e4

Please # to comment.