diff --git a/.eslintignore b/.eslintignore deleted file mode 100644 index 5e992599f89..00000000000 --- a/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -dist/**/* -external/**/* -tests/lib/vendor/**/* -ui/vendor/**/* diff --git a/.eslintrc.json b/.eslintrc.json deleted file mode 100644 index e7d67eb0e51..00000000000 --- a/.eslintrc.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "root": true, - - "extends": "jquery", - - // Uncomment to find useless comment disable directives - // "reportUnusedDisableDirectives": true, - - "parserOptions": { - "ecmaVersion": 2018 - }, - - "env": { - "es6": true, - "node": true - }, - - "rules": { - "strict": [ "error", "global" ] - } -} diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e7c145c0a6d..5344af32438 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -33,7 +33,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/init@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 # Override language selection by uncommenting this and choosing your languages # with: # languages: go, javascript, csharp, python, cpp, java @@ -41,7 +41,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/autobuild@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 # âšī¸ Command-line programs to run using the OS shell. # đ https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun @@ -55,4 +55,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@dd746615b3b9d728a6a37ca2045b68ca76d4841a # v3.28.8 + uses: github/codeql-action/analyze@28deaeda66b76a05916b6923827895f2b14ab387 # v3.28.16 diff --git a/.github/workflows/filestash.yml b/.github/workflows/filestash.yml index 7716025a081..9f0960a4a98 100644 --- a/.github/workflows/filestash.yml +++ b/.github/workflows/filestash.yml @@ -20,12 +20,12 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ env.NODE_VERSION }} - name: Cache - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: ~/.npm key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index 6279223a35b..cccd059d28e 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -34,12 +34,12 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ env.NODE_VERSION }} - name: Cache - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: ~/.npm key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} @@ -49,12 +49,13 @@ jobs: - name: Install npm dependencies run: npm install - - name: Lint - run: npm run lint - - name: Build run: npm run build + # Lint must happen after build as we lint generated files. + - name: Lint + run: npm run lint + - name: Test run: | npm run test:unit -- \ @@ -78,12 +79,12 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ env.NODE_VERSION }} - name: Cache - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: ~/.npm key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} @@ -116,12 +117,12 @@ jobs: uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0 with: node-version: ${{ env.NODE_VERSION }} - name: Cache - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3 with: path: ~/.npm key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-npm-lock-${{ hashFiles('**/package-lock.json') }} diff --git a/Gruntfile.js b/Gruntfile.js index 334e4bb1ae1..bbb71d33e52 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -51,9 +51,6 @@ const cssFiles = [ // minified files const minify = { - options: { - preserveComments: false - }, main: { options: { banner: createBanner( uiFiles ) @@ -174,7 +171,7 @@ grunt.initConfig( { } }, - uglify: minify, + minify, htmllint: { good: { options: { @@ -207,9 +204,12 @@ grunt.initConfig( { "ui/**/*.js", "!ui/vendor/**/*.js", "Gruntfile.js", + "dist/jquery-ui.js", + "dist/jquery-ui.min.js", "build/**/*.js", "tests/unit/**/*.js", "tests/lib/**/*.js", + "!tests/lib/vendor/**/*.js", "demos/**/*.js" ] }, @@ -403,9 +403,9 @@ grunt.registerTask( "lint", [ "csslint", "htmllint" ] ); -grunt.registerTask( "build", [ "requirejs", "concat" ] ); -grunt.registerTask( "default", [ "lint", "build" ] ); -grunt.registerTask( "sizer", [ "requirejs:js", "uglify:main", "compare_size:all" ] ); -grunt.registerTask( "sizer_all", [ "requirejs:js", "uglify", "compare_size" ] ); +grunt.registerTask( "build", [ "requirejs", "concat", "minify:main" ] ); +grunt.registerTask( "default", [ "build", "lint" ] ); +grunt.registerTask( "sizer", [ "requirejs:js", "minify:main", "compare_size:all" ] ); +grunt.registerTask( "sizer_all", [ "requirejs:js", "minify", "compare_size" ] ); }; diff --git a/bower.json b/bower.json index eec454dea05..eb3187e0c38 100644 --- a/bower.json +++ b/bower.json @@ -13,7 +13,7 @@ }, "devDependencies": { "jquery-color": "3.0.0", - "jquery-mousewheel": "3.1.12", + "jquery-mousewheel": "3.2.2", "jquery-simulate": "1.1.1", "qunit": "2.19.4", "requirejs": "2.1.14", diff --git a/build/tasks/minify.js b/build/tasks/minify.js new file mode 100644 index 00000000000..6d83831ee3c --- /dev/null +++ b/build/tasks/minify.js @@ -0,0 +1,53 @@ +"use strict"; + +const swc = require( "@swc/core" ); + +module.exports = function( grunt ) { + +grunt.registerMultiTask( "minify", async function() { + const done = this.async(); + const options = this.options(); + + for ( const file of this.files ) { + if ( file.src.length === 0 ) { + grunt.log.writeln( + `No source file found, skipping minification to "${ file.dest }".` ); + continue; + } + if ( file.src.length !== 1 ) { + grunt.fail.warn( "Minifying multiple source files into one " + + "destination file not supported" ); + } + + const contents = grunt.file.read( file.src[ 0 ] ); + + const { code } = await swc.minify( + contents, + { + compress: { + ecma: 5, + hoist_funs: false, + loops: false + }, + format: { + ecma: 5, + asciiOnly: true, + comments: false, + preamble: options.banner + }, + inlineSourcesContent: false, + mangle: true, + module: false, + sourceMap: false + } + ); + + grunt.file.write( file.dest, code ); + + grunt.log.writeln( `File ${ file.dest } created.` ); + } + + done(); +} ); + +}; diff --git a/demos/.eslintrc.json b/demos/.eslintrc.json deleted file mode 100644 index 805ec8eb261..00000000000 --- a/demos/.eslintrc.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "root": true, - - "extends": "../ui/.eslintrc.json", - - "globals": { - "require": true - } -} diff --git a/demos/spinner/currency.html b/demos/spinner/currency.html index 4180b12e111..fa3744ba51c 100644 --- a/demos/spinner/currency.html +++ b/demos/spinner/currency.html @@ -7,7 +7,7 @@ - - - - - - + + + + +
+ + + + + +