Skip to content

Commit 3a82e5d

Browse files
committed
Build: replace grunt tasks with npm scripts
Includes: - **lint**: lint all code using new eslint flat config - **build**: build using rollup, minify using uglify, process for dist - **npmcopy**: copy some node module files to the external folder - **start**: watch source files and rebuild on changes using rollup.watch Also: - Update the build function in the release script to use the new build - Update CONTRIBUTING.md and README.md with new scripts - Confirm the min file was identical to the main branch build, aside from the version update. - Keep uglify-js at 3.9.4, which is the last version that officially supported the ie8 argument, which we need for ie9 Closes jquerygh-512
1 parent 3f7103e commit 3a82e5d

38 files changed

+1013
-2217
lines changed

.eslintignore

Lines changed: 0 additions & 6 deletions
This file was deleted.

.eslintrc-browser.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

.eslintrc-node.json

Lines changed: 0 additions & 18 deletions
This file was deleted.

.eslintrc.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

.github/workflows/browserstack-3.x.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ jobs:
7070
- name: Install dependencies
7171
run: npm install
7272

73-
- name: Build
74-
run: npm run build
73+
- name: Pretest script
74+
run: npm run pretest
7575

7676
- name: Test
7777
run: |

.github/workflows/browserstack-git.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ jobs:
5555
- name: Install dependencies
5656
run: npm install
5757

58-
- name: Build
59-
run: npm run build
58+
- name: Pretest script
59+
run: npm run pretest
6060

6161
- name: Test
6262
run: |

.gitignore

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ CDN
88
/*.html
99
.DS_Store
1010
.sizecache.json
11+
.eslintcache
1112

12-
# Ignore everything in dist folder except for eslint config
13-
/dist/*
14-
!/dist/.eslintrc.json
15-
13+
/dist
1614
/external
1715
/node_modules
1816

CONTRIBUTING.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,8 @@ See: [jQuery Core Style Guide](http://docs.jquery.com/JQuery_Core_Style_Guidelin
6868

6969
To test the plugin you will need:
7070

71-
* Some kind of localhost server(any will do)
7271
* Node.js
7372
* NPM (comes with the latest version of Node.js)
74-
* Grunt (install with: `npm install grunt -g`)
75-
7673

7774
### Build a Local Copy of the plugin
7875

@@ -108,13 +105,19 @@ Get in the habit of pulling in the "upstream" `main` branch to stay up to date a
108105
$ git pull upstream main
109106
```
110107

111-
Run the Grunt tools:
108+
Run the build and rebuild when source files change:
109+
110+
```bash
111+
$ npm start
112+
```
113+
114+
In another terminal, run the test server:
112115

113116
```bash
114-
$ grunt && grunt watch
117+
$ npm run test:server
115118
```
116119

117-
Now open the jQuery test suite in a browser at http://localhost/test. If there is a port, be sure to include it.
120+
Now open the jQuery test suite in a browser at http://localhost:3000/test/.
118121

119122
Success! You just built and tested jQuery!
120123

Gruntfile.js

Lines changed: 0 additions & 155 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,21 +89,12 @@ Build and run tests:
8989
====================================================
9090

9191
## Build with `npm` commands
92-
```sh
93-
$ git clone git://github.com/jquery/jquery-migrate.git
94-
$ cd jquery-migrate
95-
$ npm install
96-
$ npm run build
97-
```
98-
99-
## Build with [`grunt`](http://gruntjs.com/)
10092

10193
```sh
10294
$ git clone git://github.com/jquery/jquery-migrate.git
10395
$ cd jquery-migrate
10496
$ npm install
105-
$ npm install -g grunt-cli
106-
$ grunt build
97+
$ npm run build
10798
```
10899

109100
### Run tests
@@ -115,5 +106,7 @@ $ npm test
115106
### Or
116107

117108
```sh
118-
$ grunt test
109+
$ npm run test:server
119110
```
111+
112+
and open http://localhost:3000/test/ in your browser.

build/release.mjs renamed to build/release.js

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
* JQuery Migrate Plugin Release Management
44
*/
55

6-
"use strict";
7-
86
// Debugging variables
97
var dryrun = false,
108
skipRemote = false;
@@ -14,6 +12,7 @@ import child from "child_process";
1412
import path from "path";
1513
import chalk from "chalk";
1614
import enquirer from "enquirer";
15+
import { build } from "./tasks/build";
1716

1817
var releaseVersion,
1918
nextVersion,
@@ -27,7 +26,6 @@ var releaseVersion,
2726

2827
// Windows needs the .cmd version but will find the non-.cmd
2928
// On Windows, also ensure the HOME environment variable is set
30-
gruntCmd = process.platform === "win32" ? "grunt.cmd" : "grunt",
3129
npmCmd = process.platform === "win32" ? "npm.cmd" : "npm",
3230

3331
readmeFile = "README.md",
@@ -40,10 +38,10 @@ var releaseVersion,
4038
steps(
4139
initialize,
4240
checkGitStatus,
43-
gruntBuild,
41+
buildRelease,
4442
updateVersions,
4543
tagReleaseVersion,
46-
gruntBuild,
44+
buildRelease,
4745
makeReleaseCopies,
4846
publishToNPM,
4947
setNextVersion,
@@ -64,7 +62,7 @@ function initialize( next ) {
6462

6563
// -r skip remote mode, no remote commands are executed
6664
// (git push, npm publish, cdn copy)
67-
// Reset with `git reset --hard HEAD~2 && git tag -d (version) && grunt`
65+
// Reset with `git reset --hard HEAD~2 && git tag -d (version) && npm run build`
6866
if ( process.argv[ 2 ] === "-r" ) {
6967
process.argv.shift();
7068
skipRemote = true;
@@ -153,14 +151,9 @@ function updateVersions( next ) {
153151
next();
154152
}
155153

156-
function gruntBuild( next ) {
157-
exec( gruntCmd, [], function( error, stdout, stderr ) {
158-
if ( error ) {
159-
die( error + stderr );
160-
}
161-
log( stdout || "(no output)" );
162-
next();
163-
} );
154+
async function buildRelease( next ) {
155+
await build( { version: releaseVersion } );
156+
next();
164157
}
165158

166159
function makeReleaseCopies( next ) {

0 commit comments

Comments
 (0)