From a00c5370e6b35e0b4e4cba6adad7fa45e4ea357f Mon Sep 17 00:00:00 2001 From: Tim van Dijen Date: Tue, 6 Feb 2024 19:03:45 +0100 Subject: [PATCH] Lose webpack, just install npm-packages and copy the two files manually --- .github/workflows/build-release.yml | 6 ++-- package.json | 17 ++-------- src/resources/js/highlight.js | 10 ------ webpack.config.js | 52 ----------------------------- 4 files changed, 6 insertions(+), 79 deletions(-) delete mode 100644 src/resources/js/highlight.js delete mode 100644 webpack.config.js diff --git a/.github/workflows/build-release.yml b/.github/workflows/build-release.yml index fcc7d7e..eb00553 100644 --- a/.github/workflows/build-release.yml +++ b/.github/workflows/build-release.yml @@ -28,7 +28,7 @@ jobs: run: git fetch --all - uses: actions/setup-node@v4 with: - node-version: 18 + node-version: 20 - name: Install & build assets run: | @@ -37,7 +37,9 @@ jobs: npm install --package-lock-only npm clean-install npm audit fix - npm run build + + cp node_modules/@highlightjs/cdn-assets/highlight.min.js lib/ + cp node_modules/pako/dist/pako_inflate.js lib/pako_inflate.min.js # Store the version, stripping any v-prefix - name: Write release version diff --git a/package.json b/package.json index 8289d90..cb1a5a2 100644 --- a/package.json +++ b/package.json @@ -1,26 +1,13 @@ { "name": "SAML-tracer", - "main": "index.js", "repository": "https://github.com/simplesamlphp/SAML-tracer", "license": "BSD-2-Clause", "engines": { "node": ">=18.0.0", "npm": ">=8.0.0" }, - "scripts": { - "build": "webpack" - }, "dependencies": { - "highlight.js": "^11.9.0", + "@highlightjs/cdn-assets": "^11.9.0", "pako": "^2.1.0" - }, - "devDependencies": { - "babel-loader": "^9.1.3", - "@babel/preset-env": "^7.23.2", - "copy-webpack-plugin": "^11.0.0", - "terser-webpack-plugin": "^5.3.9", - "webpack": "^5.89.0", - "webpack-cli": "^5.1.4" - }, - "browserslist": "last 2 versions, ie 11, > 1%" + } } diff --git a/src/resources/js/highlight.js b/src/resources/js/highlight.js deleted file mode 100644 index aa91498..0000000 --- a/src/resources/js/highlight.js +++ /dev/null @@ -1,10 +0,0 @@ -'use strict'; - -import {highlight as hljs} from "highlight.js/lib/core"; -import http from "highlight.js/lib/languages/http"; -import properties from "highlight.js/lib/languages/properties"; -import xml from "highlight.js/lib/languages/xml"; - -hljs.registerLanguage('http', http); -hljs.registerLanguage('properties', properties); -hljs.registerLanguage('xml', xml); diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 322ec36..0000000 --- a/webpack.config.js +++ /dev/null @@ -1,52 +0,0 @@ -const path = require('path'); -const webpack = require('webpack'); -const CopyWebpackPlugin = require('copy-webpack-plugin'); -const TerserPlugin = require('terser-webpack-plugin'); - -const buildDir = __dirname + '/lib'; - -const localConfig = { - js_filename: '[name].min.js' -}; - -module.exports = environment => { - return { - entry: { - highlight: './src/resources/js/highlight' - }, - output: { - path: path.resolve(buildDir), - filename: localConfig['js_filename'] - }, - mode: 'production', - module: { - rules: [ - { - test: /\.js$/, - use: { - loader: 'babel-loader', - options: { - presets: ['@babel/preset-env'] - } - } - } - ] - }, - optimization: { - minimize: false, - minimizer: [new TerserPlugin({ - extractComments: false, - })], - }, - plugins: [ - new CopyWebpackPlugin({ - patterns: [ - { - from: path.resolve(__dirname + '/node_modules/pako/dist/pako_inflate.js'), - to: '[name].min[ext]' - } - ] - }) - ] - } -};