From a684e6ba836f7c553968d7d026ed7941e1a612d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Go=C5=82=C4=99biowski-Owczarek?= Date: Wed, 24 Mar 2021 23:36:25 +0100 Subject: [PATCH] Build: Restore the external directory In gh-4466, we removed the `external` directory in favor of loading some files directly from `node_modules`. This works fine locally but when deploying code for tests, this makes it impossible to not deploy `node_modules` as well. To avoid the issue, this change restores usage of the `external` directory. One change is that we no longer commit this directory to the repository, its only purpose is to have clear isolation from `node_modules`. Ref gh-4466 Closess gh-4865 --- .eslintignore | 1 + .gitignore | 2 +- .npmignore | 1 + Gruntfile.js | 28 ++++++++++++++++++++++++---- package.json | 1 + test/index.html | 10 +++++----- test/karma.debug.html | 2 +- 7 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.eslintignore b/.eslintignore index 6bc5c48b6..e1d456ddf 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,4 +1,5 @@ amd +external node_modules *.min.js dist/** diff --git a/.gitignore b/.gitignore index 836cb81c4..9cc148904 100644 --- a/.gitignore +++ b/.gitignore @@ -17,7 +17,7 @@ npm-debug.log* !/dist/.eslintrc.json /amd - +/external /node_modules /test/data/core/jquery-iterability-transpiled.js diff --git a/.npmignore b/.npmignore index 4dde6c8cd..58ba3ab2b 100644 --- a/.npmignore +++ b/.npmignore @@ -7,6 +7,7 @@ /.travis.yml /build +/external /speed /test /Gruntfile.js diff --git a/Gruntfile.js b/Gruntfile.js index 5021c59e9..4afbec921 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -71,6 +71,25 @@ module.exports = function( grunt ) { } } }, + npmcopy: { + all: { + options: { + destPrefix: "external" + }, + files: { + "npo/npo.js": "native-promise-only/lib/npo.src.js", + + "qunit/qunit.js": "qunit/qunit/qunit.js", + "qunit/qunit.css": "qunit/qunit/qunit.css", + "qunit/LICENSE.txt": "qunit/LICENSE.txt", + + "requirejs/require.js": "requirejs/require.js", + + "sinon/sinon.js": "sinon/pkg/sinon.js", + "sinon/LICENSE.txt": "sinon/LICENSE" + } + } + }, jsonlint: { pkg: { src: [ "package.json" ] @@ -162,9 +181,9 @@ module.exports = function( grunt ) { }, files: [ "test/data/jquery-1.9.1.js", - "node_modules/sinon/pkg/sinon.js", - "node_modules/native-promise-only/lib/npo.src.js", - "node_modules/requirejs/require.js", + "external/sinon/sinon.js", + "external/npo/npo.js", + "external/requirejs/require.js", "test/data/testinit.js", "test/jquery.js", @@ -188,7 +207,7 @@ module.exports = function( grunt ) { served: true, nocache: true }, - { pattern: "node_modules/**", included: false, served: true }, + { pattern: "external/**", included: false, served: true }, { pattern: "test/**/*.@(js|css|jpg|html|xml|svg)", included: false, @@ -343,6 +362,7 @@ module.exports = function( grunt ) { ] ); grunt.registerTask( "test:prepare", [ + "npmcopy", "qunit_fixture", "babel:tests" ] ); diff --git a/package.json b/package.json index eeac68c93..092067e24 100644 --- a/package.json +++ b/package.json @@ -42,6 +42,7 @@ "grunt-jsonlint": "2.1.2", "grunt-karma": "4.0.0", "grunt-newer": "1.3.0", + "grunt-npmcopy": "0.2.0", "gzip-js": "0.3.2", "husky": "4.2.5", "insight": "0.10.3", diff --git a/test/index.html b/test/index.html index 27032f5c5..b3c64aede 100644 --- a/test/index.html +++ b/test/index.html @@ -3,7 +3,7 @@ jQuery Test Suite - + - - - - + + + + diff --git a/test/karma.debug.html b/test/karma.debug.html index 8040ef2cd..9eb6c9885 100644 --- a/test/karma.debug.html +++ b/test/karma.debug.html @@ -5,7 +5,7 @@ DEBUG - +