|
1 | 1 | ## Development and Production Versions |
2 | 2 |
|
3 | | -Changes should to go the source files in `src/`. Then you run the build process |
4 | | -outlines below to generate the production-ready files which go into `dist/`. E.g. |
5 | | -those files are concatenated and minified. |
| 3 | +Changes should go into the source files in `src/`. Then you run the build process outlined below to generate the production-ready files which go into `dist/`. These files are bundled and minified for optimal performance. |
6 | 4 |
|
7 | 5 | ## Rebuilding from Source |
8 | 6 |
|
9 | | -The plugin's build process is managed by [Grunt](http://gruntjs.com/installing-grunt), |
10 | | -which in turn is built on top of [Node.js](http://nodejs.org/). You'll need to have |
11 | | -both of these applications installed on your machine to rebuild the plugin from source. |
| 7 | +The plugin's build process is managed by [Vite](https://vitejs.dev/), a modern build tool built on top of [Node.js](http://nodejs.org/). You'll need to have Node.js installed on your machine to rebuild the plugin from source. |
12 | 8 |
|
13 | | -Assuming you have both Grunt and Node.js (version 10 or higher) installed, you can |
14 | | -install all the build dependencies with a single command, from the plugin's root |
15 | | -directory: |
| 9 | +Assuming you have Node.js (version 18 or higher) installed, you can install all the build dependencies with a single command, from the plugin's root directory: |
16 | 10 |
|
17 | | -```shell |
18 | | -$ yarn install |
| 11 | +```bash |
| 12 | +npm install |
19 | 13 | ``` |
20 | 14 |
|
21 | | -This will install all of the plugin's dependencies into the `node_modules` directory |
22 | | -(and which is also why you'll find this directory in the plugin's `.gitignore` file). |
| 15 | +This will install all of the plugin's dependencies into the `node_modules` directory (which is also why you'll find this directory in the plugin's `.gitignore` file). |
23 | 16 |
|
24 | | -Once you have all the dependencies in place, you can rebuild the plugin from source |
25 | | -by simply running `yarn build`: |
| 17 | +Once you have all the dependencies in place, you can rebuild the plugin from source by running `npm run build`: |
26 | 18 |
|
27 | | -```shell |
28 | | -$ yarn build |
29 | | -yarn run v1.22.17 |
30 | | -# $ grunt |
31 | | -Running "clean:dist" (clean) task |
32 | | ->> 3 paths cleaned. |
| 19 | +```bash |
| 20 | +npm run build |
| 21 | +``` |
| 22 | + |
| 23 | +This command will: |
| 24 | + |
| 25 | +- Clean the `dist/` directory |
| 26 | +- Build both production (minified) and development versions |
33 | 27 |
|
34 | | -Running "jshint:files" (jshint) task |
35 | | ->> 1 file lint free. |
| 28 | +### Development Workflow |
36 | 29 |
|
37 | | -Running "concat:dist" (concat) task |
| 30 | +For active development, you can use the watch mode to automatically rebuild when |
| 31 | +source files change: |
| 32 | + |
| 33 | +```bash |
| 34 | +npm run dev |
| 35 | +``` |
| 36 | + |
| 37 | +### Testing |
| 38 | + |
| 39 | +Run the test suite with: |
| 40 | + |
| 41 | +```bash |
| 42 | +npm run test |
| 43 | +``` |
38 | 44 |
|
39 | | -Running "uglify:dist" (uglify) task |
40 | | ->> 1 file created 10.07 kB → 6.82 kB |
| 45 | +For watch mode during development: |
41 | 46 |
|
42 | | -Running "cssmin:minify" (cssmin) task |
43 | | ->> 1 file created. 2.83 kB → 2.18 kB |
| 47 | +```bash |
| 48 | +npm run test:watch |
| 49 | +``` |
| 50 | + |
| 51 | +For test coverage: |
| 52 | + |
| 53 | +```bash |
| 54 | +npm run test:coverage |
| 55 | +``` |
| 56 | + |
| 57 | +### Formatting and Linting |
| 58 | + |
| 59 | +Format code with Prettier: |
| 60 | + |
| 61 | +```bash |
| 62 | +npm run format |
| 63 | +``` |
44 | 64 |
|
45 | | -Running "copy:images" (copy) task |
46 | | -Copied 2 files |
| 65 | +Check code style with ESLint: |
47 | 66 |
|
48 | | -Done. |
49 | | -✨ Done in 0.59s. |
| 67 | +```bash |
| 68 | +npm run lint |
50 | 69 | ``` |
51 | 70 |
|
52 | 71 | ## Releasing |
53 | 72 |
|
54 | | -1. update version in `bower.json` and `package.json` |
| 73 | +1. Update version in `package.json` |
55 | 74 |
|
56 | 75 | 2. git commit, git push |
57 | 76 |
|
|
0 commit comments