mirror of https://github.com/FriendsOfTYPO3/tea.git synced 2024-11-24 04:16:11 +01:00

[TASK] Streamline nodejs dependency management (#1302)

With #1289 the `nodejs` dependency management has
been changed from `yarn` to `npm` missing the one
or other important requirement.

This change streamlines the management by ...

* adding a `.nvmrc` file to the repository root to
  allow automatic nodejs/npm switch if the nvm shell
  switching is available on the host system.
* adding a `.npmrc` file to specify the lock file
  version and engine option.
* adding `nodejs` and `npm` version constraints as
  `engine` specification to the `package.json` file.
* remove `package-lock.json` from `.gitignore` and
  add it to the repository to ensure reproducable
  setups - which becomes more important if extension
  get custom backend/frontend modules and javascript.
* adding `package-lock.json` to exclude it from archive,
  due to remove from the `.gitignore` file.
* ensuring that new development files are excluded from
  packaging and publishing.
* use `npm ci` in GitHub action workflows to install
  from the lock-file.

Note: This change unblocks adding `npm` dispatching
to `Build/Scripts/runTests.sh`.

Resolves: #1301
Related: #1289
This commit is contained in:
Stefan Bürk 2024-05-14 12:13:43 +02:00 committed by GitHub
parent 0928b386dc
commit dc04824b4c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 5056 additions and 4 deletions

3
.gitattributes vendored
View file

@ -5,6 +5,8 @@
/.github/ export-ignore
/.gitignore export-ignore
/.gitlab/ export-ignore
/.npmrc export-ignore
/.nvmrc export-ignore
/.php-cs-fixer.php export-ignore
/.phpstorm.meta.php export-ignore
/.prettierrc.js export-ignore
@ -14,6 +16,7 @@
/Tests/ export-ignore
/eslint.config.json export-ignore
/package.json export-ignore
/package-lock.json export-ignore
/phive.xml export-ignore
/phpcs.xml export-ignore
/phpstan-baseline.neon export-ignore

View file

@ -93,9 +93,11 @@ jobs:
- name: "Checkout"
uses: actions/checkout@v4
- name: "Install modules"
run: npm install
run: |
npm ci
- name: "Run command"
run: "npm run lint:${{ matrix.command }}"
run: |
npm run lint:${{ matrix.command }}
unit-tests:
name: "Unit tests"
runs-on: ubuntu-22.04

1
.gitignore vendored
View file

@ -10,7 +10,6 @@
/generate-documentation.sh
/nbproject
/node_modules/
/package-lock.json
/var
/yarn-error.log
/yarn.lock

View file

@ -1,5 +1,5 @@
.default-frontend:
image: node:latest
image: node:18
needs: [ ]
cache:
key: "$CI_PROJECT_ID"

2
.npmrc Normal file
View file

@ -0,0 +1,2 @@
lockfile-version=3
engine-strict=true

1
.nvmrc Normal file
View file

@ -0,0 +1 @@
v18.19

View file

@ -192,7 +192,10 @@
"rm .prettierrc.js",
"rm Configuration/FunctionalTests.xml",
"rm Configuration/UnitTests.xml",
"rm .npmrc",
"rm .nvmrc",
"rm package.json",
"rm package-lock.json",
"rm phive.xml",
"rm phpcs.xml",
"rm phpstan-baseline.neon",

5038
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -9,6 +9,10 @@
"author": "",
"version": "1.0.0",
"license": "ISC",
"engines": {
"node": ">=18.19.0 <19.0.0",
"npm": ">=10.0.0"
},
"scripts": {
"lint:js": "eslint 'Resources/Public/**/*.js'",
"lint:js:fix": "eslint 'Resources/Public/**/*.js' --quiet --fix",