🌐 AI搜索 & 代理 主页
Skip to content

Commit a684e6b

Browse files
authored
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
1 parent b2bbaa3 commit a684e6b

File tree

7 files changed

+34
-11
lines changed

7 files changed

+34
-11
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
amd
2+
external
23
node_modules
34
*.min.js
45
dist/**

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ npm-debug.log*
1717
!/dist/.eslintrc.json
1818

1919
/amd
20-
20+
/external
2121
/node_modules
2222

2323
/test/data/core/jquery-iterability-transpiled.js

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
/.travis.yml
88

99
/build
10+
/external
1011
/speed
1112
/test
1213
/Gruntfile.js

Gruntfile.js

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,25 @@ module.exports = function( grunt ) {
7171
}
7272
}
7373
},
74+
npmcopy: {
75+
all: {
76+
options: {
77+
destPrefix: "external"
78+
},
79+
files: {
80+
"npo/npo.js": "native-promise-only/lib/npo.src.js",
81+
82+
"qunit/qunit.js": "qunit/qunit/qunit.js",
83+
"qunit/qunit.css": "qunit/qunit/qunit.css",
84+
"qunit/LICENSE.txt": "qunit/LICENSE.txt",
85+
86+
"requirejs/require.js": "requirejs/require.js",
87+
88+
"sinon/sinon.js": "sinon/pkg/sinon.js",
89+
"sinon/LICENSE.txt": "sinon/LICENSE"
90+
}
91+
}
92+
},
7493
jsonlint: {
7594
pkg: {
7695
src: [ "package.json" ]
@@ -162,9 +181,9 @@ module.exports = function( grunt ) {
162181
},
163182
files: [
164183
"test/data/jquery-1.9.1.js",
165-
"node_modules/sinon/pkg/sinon.js",
166-
"node_modules/native-promise-only/lib/npo.src.js",
167-
"node_modules/requirejs/require.js",
184+
"external/sinon/sinon.js",
185+
"external/npo/npo.js",
186+
"external/requirejs/require.js",
168187
"test/data/testinit.js",
169188

170189
"test/jquery.js",
@@ -188,7 +207,7 @@ module.exports = function( grunt ) {
188207
served: true,
189208
nocache: true
190209
},
191-
{ pattern: "node_modules/**", included: false, served: true },
210+
{ pattern: "external/**", included: false, served: true },
192211
{
193212
pattern: "test/**/*.@(js|css|jpg|html|xml|svg)",
194213
included: false,
@@ -343,6 +362,7 @@ module.exports = function( grunt ) {
343362
] );
344363

345364
grunt.registerTask( "test:prepare", [
365+
"npmcopy",
346366
"qunit_fixture",
347367
"babel:tests"
348368
] );

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
"grunt-jsonlint": "2.1.2",
4343
"grunt-karma": "4.0.0",
4444
"grunt-newer": "1.3.0",
45+
"grunt-npmcopy": "0.2.0",
4546
"gzip-js": "0.3.2",
4647
"husky": "4.2.5",
4748
"insight": "0.10.3",

test/index.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<title>jQuery Test Suite</title>
6-
<link rel="stylesheet" href="../node_modules/qunit/qunit/qunit.css" />
6+
<link rel="stylesheet" href="../external/qunit/qunit.css" />
77
<link rel="stylesheet" href="data/testsuite.css" />
88

99
<!--
@@ -12,10 +12,10 @@
1212
-->
1313
<script src="data/jquery-1.9.1.js"></script>
1414

15-
<script src="../node_modules/qunit/qunit/qunit.js"></script>
16-
<script src="../node_modules/sinon/pkg/sinon.js"></script>
17-
<script src="../node_modules/native-promise-only/lib/npo.src.js"></script>
18-
<script src="../node_modules/requirejs/require.js"></script>
15+
<script src="../external/qunit/qunit.js"></script>
16+
<script src="../external/sinon/sinon.js"></script>
17+
<script src="../external/npo/npo.js"></script>
18+
<script src="../external/requirejs/require.js"></script>
1919
<!-- See testinit for the list of tests -->
2020
<script src="data/testinit.js"></script>
2121

test/karma.debug.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<title>DEBUG</title>
66
<meta charset="utf-8">
77
<!-- Karma serves this page from /context.html. Other files are served from /base -->
8-
<link rel="stylesheet" href="/base/node_modules/qunit/qunit/qunit.css" />
8+
<link rel="stylesheet" href="/base/external/qunit/qunit/qunit.css" />
99
<link rel="stylesheet" href="/base/test/data/testsuite.css" />
1010
</head>
1111
<body id="body">

0 commit comments

Comments
 (0)