Skip to content

Commit 9d0c656

Browse files
authored
chore: modernize JS stack (#37)
* chore(pkg): migrate to PNPM, upgrade all dev dependencies * chore(pkg): remove husky & lint-staged * chore(eslint): modernize configuration * chore: remove yarn.lock * chore: configure Prettier and run it * fix(jest): re-install JSDom integration * chore(cypress): migrate Cypress configuration * chore: configure Prettier and run it
1 parent 0c442a4 commit 9d0c656

File tree

19 files changed

+5839
-5173
lines changed

19 files changed

+5839
-5173
lines changed

.eslintrc.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
const { generateConfig } = require('@kocal/eslint-config-generator');
2-
3-
const config = generateConfig();
4-
5-
// We don't need @babel/eslint-parser as we don't use Babel
6-
delete config.parser;
7-
delete config.parserOptions;
8-
9-
module.exports = config;
1+
/** @type {import('eslint').BaseConfig} */
2+
module.exports = {
3+
root: true,
4+
env: {
5+
browser: true,
6+
node: true,
7+
es2021: true,
8+
},
9+
extends: ['eslint:recommended', 'eslint-config-prettier'],
10+
};

.github/workflows/ci.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212
COMPOSER_MEMORY_LIMIT: -1
1313

1414
PHP_VERSION_DEFAULT: 8.1
15-
NODE_VERSION: 14.x
15+
NODE_VERSION: 20.x
1616

1717
jobs:
1818
static_analysis:
@@ -30,6 +30,8 @@ jobs:
3030
with:
3131
node-version: ${{ env.NODE_VERSION }}
3232

33+
- uses: pnpm/action-setup@v2
34+
3335
- run: composer validate --strict
3436

3537
- run: composer install --prefer-dist --no-interaction --no-progress
@@ -40,11 +42,13 @@ jobs:
4042

4143
- run: composer rector@ci
4244

43-
- run: yarn install --frozen-lockfile
45+
- run: pnpm install --frozen-lockfile
46+
47+
- run: pnpm lint:check
4448

45-
- run: yarn lint
49+
- run: pnpm format:check
4650

47-
- run: yarn test
51+
- run: pnpm test
4852

4953
test:
5054
runs-on: ubuntu-latest
@@ -149,6 +153,8 @@ jobs:
149153
with:
150154
node-version: ${{ env.NODE_VERSION }}
151155

156+
- uses: pnpm/action-setup@v2
157+
152158
- run: composer install --no-progress --prefer-dist --optimize-autoloader
153159

154160
- name: Run Cypress

.husky/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.husky/pre-commit

Lines changed: 0 additions & 4 deletions
This file was deleted.

.prettierignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
fixtures/applications/Symfony/var
2+
fixtures/applications/Symfony/vendor
3+
tools/
4+
vendor/

.prettierrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"printWidth": 120,
44
"overrides": [
55
{
6-
"files": ["*.{yml,yaml}", ".*.{yml,yaml}"],
6+
"files": ["*.{yml,yaml,json}"],
77
"options": {
88
"tabWidth": 4
99
}

cypress.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const { defineConfig } = require('cypress');
2+
3+
module.exports = defineConfig({
4+
fixturesFolder: 'tests/Bridge/Cypress/fixtures',
5+
screenshotsFolder: 'tests/Bridge/Cypress/screenshots',
6+
videosFolder: 'tests/Bridge/Cypress/videos',
7+
e2e: {
8+
setupNodeEvents(on, config) {
9+
return require('./tests/Bridge/Cypress/plugins/index.js')(on, config);
10+
},
11+
baseUrl: 'http://127.0.0.1:8000/',
12+
specPattern: 'tests/Bridge/Cypress/specs/**/*.cy.{js,jsx,ts,tsx}',
13+
supportFile: 'tests/Bridge/Cypress/support/index.js',
14+
},
15+
});

cypress.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

lint-staged.config.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

package.json

Lines changed: 33 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,35 @@
11
{
2-
"private": true,
3-
"version": "0.0.0-development",
4-
"description": "Test your emails with Behat and Cypress, when using the Symfony Mailer component.",
5-
"repository": "https://github.com/Kocal/SymfonyMailerTesting",
6-
"author": "Hugo Alliaume <hugo@alliau.me>",
7-
"license": "MIT",
8-
"scripts": {
9-
"lint": "eslint *.js src tests --ext .js,.vue",
10-
"prettier": "prettier",
11-
"test": "jest",
12-
"prepare": "husky install"
13-
},
14-
"peerDependencies": {
15-
"cypress": ">=4.0.0"
16-
},
17-
"devDependencies": {
18-
"@kocal/eslint-config-generator": "^2.0.3",
19-
"@types/jest": "^27.4.0",
20-
"cypress": "^7.4.0",
21-
"eslint": "^7.27.0",
22-
"eslint-plugin-chai-friendly": "^0.7.1",
23-
"eslint-plugin-cypress": "^2.11.3",
24-
"eslint-plugin-jest": "^26.1.0",
25-
"eslint-plugin-mocha": "^9.0.0",
26-
"husky": "^6.0.0",
27-
"jest": "^27.5.1",
28-
"lint-staged": "^11.0.0",
29-
"prettier": "^2.0.5"
30-
}
2+
"private": true,
3+
"version": "0.0.0-development",
4+
"engines": {
5+
"node": "20.x"
6+
},
7+
"packageManager": "pnpm@8.14.0",
8+
"description": "Test your emails with Behat and Cypress, when using the Symfony Mailer component.",
9+
"repository": "https://github.com/Kocal/SymfonyMailerTesting",
10+
"author": "Hugo Alliaume <hugo@alliau.me>",
11+
"license": "MIT",
12+
"scripts": {
13+
"lint:check": "eslint *.js src tests --ext .js,.vue",
14+
"lint": "eslint --fix *.js src tests --ext .js,.vue",
15+
"format:check": "prettier . --check",
16+
"format": "prettier . --write",
17+
"test": "jest"
18+
},
19+
"peerDependencies": {
20+
"cypress": ">=4.0.0"
21+
},
22+
"devDependencies": {
23+
"@types/jest": "^29.5.11",
24+
"cypress": "^13.6.3",
25+
"eslint": "^8.56.0",
26+
"eslint-config-prettier": "^9.1.0",
27+
"eslint-plugin-chai-friendly": "^0.7.4",
28+
"eslint-plugin-cypress": "^2.15.1",
29+
"eslint-plugin-jest": "^27.6.3",
30+
"eslint-plugin-mocha": "^10.2.0",
31+
"jest": "^29.7.0",
32+
"jest-environment-jsdom": "^29.7.0",
33+
"prettier": "^3.2.4"
34+
}
3135
}

0 commit comments

Comments
 (0)