Browse Source

Migrate to npm 7

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
John Molakvoæ (skjnldsv) 2 years ago
parent
commit
49b490ce6d
6 changed files with 23847 additions and 111 deletions
  1. 44 0
      .github/workflows/lint-eslint.yml
  2. 0 22
      .github/workflows/lint.yml
  3. 33 60
      .github/workflows/node.yml
  4. 23760 1
      package-lock.json
  5. 6 19
      package.json
  6. 4 9
      webpack.common.js

+ 44 - 0
.github/workflows/lint-eslint.yml

@@ -0,0 +1,44 @@
+# This workflow is provided via the organization template repository
+#
+# https://github.com/nextcloud/.github
+# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+
+name: Lint
+
+on:
+  pull_request:
+  push:
+    branches:
+      - master
+      - stable*
+
+jobs:
+  lint:
+    runs-on: ubuntu-latest
+
+    name: eslint
+
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Read package.json node and npm engines version
+        uses: skjnldsv/read-package-engines-version-actions@v1.1
+        id: versions
+        with:
+          fallbackNode: '^12'
+          fallbackNpm: '^6'
+
+      - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
+        uses: actions/setup-node@v2
+        with:
+          node-version: ${{ steps.versions.outputs.nodeVersion }}
+
+      - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
+        run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
+
+      - name: Install dependencies
+        run: npm ci
+
+      - name: Lint
+        run: npm run lint

+ 0 - 22
.github/workflows/lint.yml

@@ -40,25 +40,3 @@ jobs:
         composer run cs:check -- --format=checkstyle | cs2pr
         composer run cs:check || ( echo 'Please run `composer run cs:fix` to format your code' && exit 1 )
       shell: bash
-
-  node:
-    runs-on: ubuntu-latest
-
-    strategy:
-      matrix:
-        node-version: [12.x]
-
-    name: eslint node${{ matrix.node-version }}
-    steps:
-      - uses: actions/checkout@v2
-
-      - name: Set up node ${{ matrix.node-version }}
-        uses: actions/setup-node@v1
-        with:
-          node-version: ${{ matrix.node-version }}
-
-      - name: Install dependencies
-        run: npm ci
-
-      - name: Lint
-        run: npm run lint

+ 33 - 60
.github/workflows/node.yml

@@ -1,3 +1,8 @@
+# This workflow is provided via the organization template repository
+#
+# https://github.com/nextcloud/.github
+# https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
+
 name: Node
 
 on:
@@ -9,71 +14,39 @@ on:
 
 jobs:
   build:
-
     runs-on: ubuntu-latest
 
-    strategy:
-      matrix:
-        node-version: [12.x]
-
+    name: node
     steps:
-    - uses: actions/checkout@v2
-    - name: Use node ${{ matrix.node-version }}
-      uses: actions/setup-node@v1
-      with:
-        node-version: ${{ matrix.node-version }}
-    - name: Install dependencies & build
-      run: |
-        make clean
-        npm ci
-        npm run build --if-present
-    - name: Check webpack build changes
-      run: |
-        bash -c "[[ ! \"`git status --porcelain `\" ]] || ( echo 'Uncommited changes in webpack build' && git status && exit 1 )"
-      env:
-        CI: true
+      - name: Checkout
+        uses: actions/checkout@v2
 
-  test:
-    runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        node-version: [12.x]
-    steps:
-    - uses: actions/checkout@v2
-    - name: Use node ${{ matrix.node-version }}
-      uses: actions/setup-node@v1
-      with:
-          node-version: ${{ matrix.node-version }}
-    - name: Install dependencies
-      run: |
-          npm ci
-    - name: Test
-      run: npm run test
-
-  jsunit:
-    runs-on: ubuntu-latest
-    steps:
-    - uses: actions/checkout@v2
-    - name: Use node ${{ matrix.node-version }}
-      uses: actions/setup-node@v1
-      with:
-          node-version: ${{ matrix.node-version }}
-    - name: Test
-      run: ./autotest-js.sh
+      - name: Read package.json node and npm engines version
+        uses: skjnldsv/read-package-engines-version-actions@v1.1
+        id: versions
+        with:
+          fallbackNode: '^12'
+          fallbackNpm: '^6'
 
-  handlebars:
-    runs-on: ubuntu-latest
-    strategy:
-      matrix:
-        node-version: [12.x]
-    steps:
-      - uses: actions/checkout@v2
-      - name: Use node ${{ matrix.node-version }}
-        uses: actions/setup-node@v1
+      - name: Set up node ${{ steps.versions.outputs.nodeVersion }}
+        uses: actions/setup-node@v2
         with:
-          node-version: ${{ matrix.node-version }}
-      - name: Install dependencies
+          node-version: ${{ steps.versions.outputs.nodeVersion }}
+
+      - name: Set up npm ${{ steps.versions.outputs.npmVersion }}
+        run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
+
+      - name: Install dependencies & build
         run: |
           npm ci
-      - name: Run compile
-        run: ./build/compile-handlebars-templates.sh
+          npm run build --if-present
+
+      - name: Check webpack build changes
+        run: |
+          bash -c "[[ ! \"`git status --porcelain `\" ]] || exit 1"
+
+      - name: Show changes on failure
+        if: failure()
+        run: |
+          git status
+          git --no-pager diff

File diff suppressed because it is too large
+ 23760 - 1
package-lock.json


+ 6 - 19
package.json

@@ -90,30 +90,17 @@
     "webdav": "^4.6.0"
   },
   "devDependencies": {
-    "@babel/core": "^7.14.6",
-    "@babel/plugin-proposal-class-properties": "^7.14.5",
-    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
-    "@babel/preset-env": "^7.14.7",
-    "@nextcloud/babel-config": "^1.0.0-beta.1",
+    "@nextcloud/babel-config": "^1.0.0",
     "@nextcloud/browserslist-config": "^2.1.0",
-    "@nextcloud/eslint-config": "^2.2.0",
-    "@nextcloud/eslint-plugin": "^1.5.0",
+    "@nextcloud/eslint-config": "^4.0.0",
+    "@nextcloud/stylelint-config": "^1.0.0-beta.0",
     "@testing-library/jest-dom": "^5.14.1",
     "@testing-library/user-event": "^13.1.9",
     "@testing-library/vue": "^5.8.1",
-    "babel-eslint": "^10.1.0",
-    "babel-jest": "^26.6.3",
     "babel-loader": "^8.2.2",
     "babel-loader-exclude-node-modules-except": "^1.2.1",
     "css-loader": "^5.2.7",
-    "eslint": "^6.8.0",
-    "eslint-config-standard": "^14.1.1",
     "eslint-loader": "^4.0.2",
-    "eslint-plugin-import": "^2.23.3",
-    "eslint-plugin-node": "^11.1.0",
-    "eslint-plugin-promise": "^4.3.1",
-    "eslint-plugin-standard": "^4.1.0",
-    "eslint-plugin-vue": "^6.2.2",
     "exports-loader": "^1.1.1",
     "file-loader": "^6.2.0",
     "handlebars-loader": "^1.7.1",
@@ -128,14 +115,14 @@
     "vue-template-compiler": "^2.6.12",
     "webpack": "^4.46.0",
     "webpack-cli": "^4.7.2",
-    "webpack-merge": "^5.8.0",
-    "webpack-node-externals": "^3.0.0"
+    "webpack-merge": "^5.8.0"
   },
   "browserslist": [
     "extends @nextcloud/browserslist-config"
   ],
   "engines": {
-    "node": ">=10.0.0"
+    "node": ">=14.0.0",
+    "npm": ">=7.0.0"
   },
   "jest": {
     "moduleFileExtensions": [

+ 4 - 9
webpack.common.js

@@ -1,9 +1,11 @@
 /* eslint-disable camelcase */
 const { merge } = require('webpack-merge')
 const { VueLoaderPlugin } = require('vue-loader')
-const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except')
 const path = require('path')
 
+const BabelLoaderExcludeNodeModulesExcept = require('babel-loader-exclude-node-modules-except')
+const ESLintPlugin = require('eslint-webpack-plugin')
+
 const accessibility = require('./apps/accessibility/webpack')
 const comments = require('./apps/comments/webpack')
 const core = require('./core/webpack')
@@ -68,13 +70,6 @@ module.exports = []
 					test: /\.scss$/,
 					use: ['style-loader', 'css-loader', 'sass-loader'],
 				},
-				{
-					test: /\.(js|vue)$/,
-					loader: 'eslint-loader',
-					// no checks against vendors, modules or handlebar compiled files
-					exclude: /node_modules|vendor|templates\.js/,
-					enforce: 'pre',
-				},
 				{
 					test: /\.vue$/,
 					loader: 'vue-loader',
@@ -123,7 +118,7 @@ module.exports = []
 
 			],
 		},
-		plugins: [new VueLoaderPlugin()],
+		plugins: [new VueLoaderPlugin(), new ESLintPlugin()],
 		resolve: {
 			alias: {
 				OC: path.resolve(__dirname, './core/src/OC'),

Some files were not shown because too many files changed in this diff