@metricinsights/pp-dev 0.9.0 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/CHANGELOG.md +137 -0
  2. package/README.md +146 -229
  3. package/dist/cjs/cli.js +1 -1200
  4. package/dist/cjs/cli.js.map +1 -1
  5. package/dist/cjs/helpers.js +1 -28
  6. package/dist/cjs/helpers.js.map +1 -1
  7. package/dist/cjs/index-7kvqDDBw.js +2 -0
  8. package/dist/cjs/index-7kvqDDBw.js.map +1 -0
  9. package/dist/cjs/index.js +1 -26
  10. package/dist/cjs/index.js.map +1 -1
  11. package/dist/cjs/package.json +10 -7
  12. package/dist/cjs/plugin-CoHlzIq-.js +2 -0
  13. package/dist/cjs/plugin-CoHlzIq-.js.map +1 -0
  14. package/dist/cjs/plugin.js +1 -25
  15. package/dist/cjs/plugin.js.map +1 -1
  16. package/dist/client/client.css +233 -38
  17. package/dist/client/client.css.map +1 -0
  18. package/dist/client/client.js +110 -14
  19. package/dist/client/client.js.map +1 -1
  20. package/dist/client/index.html +39 -26
  21. package/dist/esm/cli.js +1 -1173
  22. package/dist/esm/cli.js.map +1 -1
  23. package/dist/esm/helpers.js +1 -24
  24. package/dist/esm/helpers.js.map +1 -1
  25. package/dist/esm/index-C2GV98GH.js +2 -0
  26. package/dist/esm/index-C2GV98GH.js.map +1 -0
  27. package/dist/esm/index.js +1 -19
  28. package/dist/esm/index.js.map +1 -1
  29. package/dist/esm/package.json +10 -7
  30. package/dist/esm/plugin-B909lge8.js +2 -0
  31. package/dist/esm/plugin-B909lge8.js.map +1 -0
  32. package/dist/esm/plugin.js +1 -16
  33. package/dist/esm/plugin.js.map +1 -1
  34. package/dist/types/index.d.ts +102 -2
  35. package/package.json +10 -7
  36. package/dist/cjs/index-BE4YF5iw.js +0 -331
  37. package/dist/cjs/index-BE4YF5iw.js.map +0 -1
  38. package/dist/cjs/plugin-DZS4Taov.js +0 -1315
  39. package/dist/cjs/plugin-DZS4Taov.js.map +0 -1
  40. package/dist/client/index.d.ts +0 -2
  41. package/dist/esm/index-7YgmP5z7.js +0 -308
  42. package/dist/esm/index-7YgmP5z7.js.map +0 -1
  43. package/dist/esm/plugin-BeHiwpzF.js +0 -1277
  44. package/dist/esm/plugin-BeHiwpzF.js.map +0 -1
  45. package/dist/types/cli.d.ts +0 -3
  46. package/dist/types/helpers.d.ts +0 -24
  47. package/dist/types/plugin.d.ts +0 -86
package/CHANGELOG.md ADDED
@@ -0,0 +1,137 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `@metricinsights/pp-dev` package will be documented in this file.
4
+
5
+ ## [0.10.0] - 2024-03-21
6
+
7
+ ### Changed
8
+ - Removed unused `pino` and `pino-pretty` dependencies
9
+
10
+ ## [0.9.0] - 2025-01-31
11
+
12
+ ### Added
13
+ - Added support for MI v7.1.0 instances
14
+ - Added new API endpoints for v7 instances
15
+
16
+ ## [0.8.0] - 2024-11-15
17
+
18
+ ### Changed
19
+ - Updated package dependencies to latest versions
20
+ - Improved template loading mechanism
21
+
22
+ ## [0.7.0] - 2024-02-28
23
+
24
+ ### Added
25
+ - Added icon font generation tool
26
+ - Added changelog generator for assets
27
+ - Added image optimization tool
28
+
29
+ ### Changed
30
+ - Improved helper logging system
31
+
32
+ ## [0.6.0] - 2024-01-18
33
+
34
+ ### Added
35
+ - Added support for React.js, TypeScript, and Next.js templates
36
+ - Added new npm package structure
37
+ - Added documentation for templates
38
+
39
+ ### Changed
40
+ - Updated template code structure
41
+ - Improved helper info panel
42
+
43
+ ## [0.5.0] - 2023-10-16
44
+
45
+ ### Added
46
+ - Added Next.js support (beta)
47
+ - Added SSL validation support
48
+ - Added shields for package information
49
+
50
+ ### Changed
51
+ - Fixed Next.js dependency versions
52
+ - Improved helper UI
53
+
54
+ ## [0.4.0] - 2023-05-29
55
+
56
+ ### Added
57
+ - Added CI/CD support
58
+ - Added package for CI/CD
59
+ - Added documentation
60
+
61
+ ### Changed
62
+ - Updated publish configuration
63
+ - Improved installation command
64
+
65
+ ## [0.3.3] - 2023-11-14
66
+
67
+ ### Changed
68
+ - Fixed URL parameters handling in helper
69
+ - Improved helper UI
70
+
71
+ ## [0.3.2] - 2023-11-14
72
+
73
+ ### Changed
74
+ - Fixed Next.js dependency versions
75
+ - Improved helper UI
76
+
77
+ ## [0.3.1] - 2023-12-04
78
+
79
+ ### Changed
80
+ - Fixed URL parameters handling in helper
81
+ - Improved helper UI
82
+
83
+ ## [0.3.0] - 2023-11-08
84
+
85
+ ### Added
86
+ - Added Next.js support
87
+ - Added helper info panel
88
+ - Added support for React.js templates
89
+
90
+ ### Changed
91
+ - Improved helper UI
92
+ - Updated template loading mechanism
93
+
94
+ ## [0.2.0] - 2023-05-25
95
+
96
+ ### Added
97
+ - Added support for React.js templates
98
+ - Added helper info panel
99
+ - Added documentation
100
+
101
+ ### Changed
102
+ - Improved template loading mechanism
103
+ - Updated package structure
104
+
105
+ ## [0.1.1] - 2023-05-23
106
+
107
+ ### Changed
108
+ - Fixed template loading issues
109
+ - Improved helper UI
110
+
111
+ ## [0.1.0] - 2023-05-17
112
+
113
+ ### Added
114
+ - Initial release
115
+ - Basic template support
116
+ - Helper UI implementation
117
+
118
+ ## [0.0.3] - 2023-05-17
119
+
120
+ ### Added
121
+ - Added basic template support
122
+ - Added helper UI
123
+
124
+ ### Changed
125
+ - Improved package structure
126
+
127
+ ## [0.0.2] - 2023-05-17
128
+
129
+ ### Added
130
+ - Added basic package structure
131
+ - Added helper implementation
132
+
133
+ ## [0.0.1] - 2023-05-17
134
+
135
+ ### Added
136
+ - Initial package setup
137
+ - Basic helper functionality
package/README.md CHANGED
@@ -8,30 +8,35 @@
8
8
  The PP Dev Helper is a development framework and build tool for Metric Insights' Portal Pages, designed to make the
9
9
  lives of PP developers easier:
10
10
 
11
- - build your Portal Page
12
- - run/test locally with API requests proxied to a Metric Insights server
13
- - a lot more (to be documented soon!)
11
+ - Build and test Portal Pages locally
12
+ - Proxy API requests to a Metric Insights server
13
+ - Hot module replacement for faster development
14
+ - Image optimization and asset management
15
+ - Template variable transformation
16
+ - Code synchronization with Metric Insights instances
14
17
 
15
18
  pp-dev is based on [Vite](https://vitejs.dev/).
16
19
 
17
- ## Usage
20
+ ## Installation
18
21
 
19
- Package installation
20
-
21
- ```shell
22
- $ npm i @metricinsights/pp-dev
22
+ ```bash
23
+ npm install @metricinsights/pp-dev
23
24
  ```
24
25
 
25
- ### Define Configuration
26
+ ## Configuration
27
+
28
+ ### Configuration File
26
29
 
27
- You'll need to create a file with the name `pp-dev.config` and extension `js` or
28
- `cjs` (if you define type `module` in package.json), or `ts` if you want to use TypeScript, or `json`.
30
+ Create a configuration file named `pp-dev.config` with one of these extensions:
31
+ - `.js` or `.cjs` (for CommonJS)
32
+ - `.ts` (for TypeScript)
33
+ - `.json`
29
34
 
30
- Alternatively, you can define configuration in your `package.json` via the `pp-dev` key
35
+ Alternatively, you can define configuration in your `package.json` using the `pp-dev` key.
31
36
 
32
- Generic configuration examples:
37
+ ### Configuration Examples
33
38
 
34
- - JavaScript
39
+ #### JavaScript (CommonJS)
35
40
 
36
41
  ```javascript
37
42
  // pp-dev.config.js
@@ -45,7 +50,7 @@ module.exports = {
45
50
  };
46
51
  ```
47
52
 
48
- - TypeScript
53
+ #### TypeScript
49
54
 
50
55
  ```typescript
51
56
  // pp-dev.config.ts
@@ -60,22 +65,22 @@ const config: PPDevConfig = {
60
65
  export default config;
61
66
  ```
62
67
 
63
- - JSON as `pp-dev.config.json`
68
+ #### JSON
64
69
 
65
70
  ```json
71
+ // pp-dev.config.json
66
72
  {
67
73
  "backendBaseURL": "https://mi.company.com",
68
74
  "portalPageId": 1
69
75
  }
70
76
  ```
71
77
 
72
- - JSON as `package.json`
78
+ #### package.json
73
79
 
74
80
  ```json
75
81
  {
76
- "name": "<project-name>",
82
+ "name": "my-portal-page",
77
83
  "version": "1.0.0",
78
- "scripts": {},
79
84
  "pp-dev": {
80
85
  "backendBaseURL": "https://mi.company.com",
81
86
  "portalPageId": 1
@@ -83,244 +88,156 @@ export default config;
83
88
  }
84
89
  ```
85
90
 
86
- ## [Next.js](https://nextjs.org/) Configuration
87
-
88
- To use the PP Dev Helper with Next.js:
89
-
90
- 1. Add pp-dev config to your root directory.
91
-
92
- 2. Change your `dev` script in `package.json` to `pp-dev next`.
93
-
94
- 3. Finally, wrap your next.config with a `withPPDev` function.
95
-
96
- ```javascript
97
- // next.config.js
98
-
99
- const { withPPDev } = require('@metricinsights/pp-dev');
100
-
101
- module.exports = withPPDev({
102
- // your next config
103
- });
104
- ```
105
-
106
- ### Vite configuration
107
-
108
- If you need to change something in the build you can define a `vite.config` file.
109
- More details [Vite Confighere](https://vitejs.dev/config/)
110
-
111
- ### Configuration API description
112
-
113
- #### `backendBaseURL`
114
-
115
- Type: String
116
-
117
- Example: `https://mi.company.com`
118
-
119
- Description: Defines the backend URL (Metric Insights instance) that is used for proxying requests to the MI backend
120
-
121
- #### `portalPageId`
122
-
123
- Type: Number
124
-
125
- Example: `1`
126
-
127
- Description: Defines the Portal Page ID that used to get Portal Page Variable values.
128
-
129
- #### `miHudLess`
130
-
131
- Type: Boolean
132
-
133
- Default: `false`
134
-
135
- Example: `true`
136
-
137
- Description: Disables Metric Insights navigation bar for local development
138
-
139
- #### `templateLess`
140
-
141
- Type: Boolean
142
-
143
- Default: `false`
144
-
145
- Example: `true`
146
-
147
- Description: Disables Template Variables transformation. Used when developing a Portal Page without a template
148
-
149
- #### `enableProxyCache`
150
-
151
- Type: Boolean
152
-
153
- Default: `true`
154
-
155
- Description: Enables proxy cache. If you want to disable proxy cache, you need to set this option to `false`
156
-
157
- #### `proxyCacheTTL`
158
-
159
- Type: Number
160
-
161
- Default: `10 * 60 * 1000`
162
-
163
- Description: Defines proxy cache TTL in milliseconds
164
-
165
- #### `disableSSLValidation`
91
+ ## Configuration Options
166
92
 
167
- Type: Boolean
93
+ ### Required Options
168
94
 
169
- Default: `false`
95
+ | Option | Type | Description |
96
+ |--------|------|-------------|
97
+ | `backendBaseURL` | string | URL of the Metric Insights instance for API proxying |
98
+ | `portalPageId` | number | ID of the Portal Page for variable values (deprecated, use `appId` instead) |
99
+ | `appId` | number | ID of the Portal Page for variable values (synonym for `portalPageId`) |
170
100
 
171
- Description: Disables SSL certificate validation for proxy requests. Useful for self-signed certificates
101
+ ### Optional Options
172
102
 
173
- #### `imageOptimizer`
103
+ | Option | Type | Default | Description |
104
+ |--------|------|---------|-------------|
105
+ | `miHudLess` | boolean | `false` | Disables Metric Insights navigation bar in development |
106
+ | `templateLess` | boolean | `false` | Disables template variable transformation |
107
+ | `enableProxyCache` | boolean | `true` | Enables caching of proxied requests |
108
+ | `proxyCacheTTL` | number | `600000` | Cache TTL in milliseconds (10 minutes) |
109
+ | `disableSSLValidation` | boolean | `false` | Disables SSL certificate validation for proxy requests |
110
+ | `imageOptimizer` | boolean \| object | `true` | Controls image optimization. See [vite-plugin-image-optimizer](https://www.npmjs.com/package/vite-plugin-image-optimizer#plugin-options) for object options |
111
+ | `outDir` | string | `dist` | Output directory for builds |
112
+ | `distZip` | boolean \| object | `true` | Controls build output zipping. Object options: `{ outDir?: string, outFileName?: string }` |
113
+ | `syncBackupsDir` | string | `backups` | Directory for asset backups from MI server |
114
+ | `v7Features` | boolean | `false` | Enables Metric Insights v7 features |
115
+ | `personalAccessToken` | string | `process.env.MI_ACCESS_TOKEN` | Personal Access Token for the MI instance |
174
116
 
175
- Type: Boolean | Object
117
+ ### v7Features Details
176
118
 
177
- Default: `true`
119
+ When enabled (`true`), this option:
120
+ 1. Changes development path from `/pt/<portal-page-name>` to `/pl/<portal-page-name>`
121
+ 2. Updates Code Sync feature to use v7.1.0+ URLs
178
122
 
179
- Description: Enables image optimization for build.
180
- If you want to disable image optimization, you need to set this option to `false`.
181
- If you want to customize image optimization, you need to set this option to an object with properties that are described
182
- in the [vite-plugin-image-optimizer](https://www.npmjs.com/package/vite-plugin-image-optimizer#plugin-options)
123
+ ### Personal Access Token
183
124
 
184
- #### `outDir`
125
+ The `personalAccessToken` option allows you to authenticate with the Metric Insights instance. You can set it in your configuration or use the `MI_ACCESS_TOKEN` environment variable.
185
126
 
186
- Type: String
187
-
188
- Default: `dist`
189
-
190
- Description: Define the output directory for the build
191
-
192
- #### `distZip`
193
-
194
- Type: Boolean | { outDir?: string, outFileName?: string }
195
-
196
- Default: `true`
197
-
198
- Description: Enables zipping the build output.
199
- If you want to disable zipping the build output, you need to set this option to `false`.
200
- If you want to customize zipping the build output,
201
- you need to set this option to an object with properties `outDir` and `outFileName`.
202
-
203
- - `outDir` defines the output directory for the zipped build.
204
- - `outFileName` defines the output file name for the zipped build.
205
- You can use placeholder `[templateName]` in the file name to replace it with the template name.
206
-
207
- #### `syncBackupsDir`
208
-
209
- Type: String
210
-
211
- Default: `backups`
212
-
213
- Description: Define the directory for the asset backups that are used for backup assets from the MI server
214
-
215
- #### `v7Features`
216
-
217
- Type: Boolean
218
-
219
- Default: `false`
220
-
221
- Description: Enables V7 features.
222
- If you want to enable V7 features, you need to set this option to `true`.
223
- This option is used for enabling new features that are available only on the Metric Insights v7 instances.
224
- When setting this option to `true`, the CLI will use apply changes:
225
- 1. Default development path will be changed from `/pt/<portal-page-name>` to `/pl/<portal-page-name>`. This will avoid conflicts with the Metric Insights v7 features when developing a Portal Page with the Metric Insights toolbar.
226
- 2. The Code Sync feature will use the new URLs of the Metric Insights v7 instances (available only on the Metric Insights v7.1.0 instances or higher).
227
-
228
- ### CLI API description
229
-
230
- `pp-dev help` - show CLI's help
231
-
232
- Global options:
233
-
234
- - `-c, --config <configFile>` - define the path to the configuration file. Default is `pp-dev.config.js`
235
- - `--base <path>` - public base path (default: `/`)
236
- - `-l, --logLevel <level>` - define the log level. Default is `info`. Available options: `trace`, `debug`, `info`, `warn`, `error`, `silent`
237
- - `--clearScreen` - clear the screen before logging
238
- - `--mode <mode>` - define the environment mode. Default is `development`. Available options: `development`, `production`, `test`
239
-
240
- #### `pp-dev`
241
-
242
- Aliases: `pp-dev dev`, `pp-dev serve`
243
-
244
- Runs application in development mode with hot-reload. Also, its proxies requests to the MI server.
245
-
246
- Available options and arguments:
247
-
248
- - `[root]` - define the root directory for the application. Default is `.`
249
- - `--host <host>` - define the host for the application. Default is `localhost`
250
- - `--port <port>` - define the port for the application. Default is `3000`
251
- - `--open [path]` - open the application in the default browser. You can define the path to open the browser with the specific page
252
- - `--strictPort` - enable strict port checking. If the port is already in use, the application will exit with an error
253
-
254
- #### `pp-dev next`
255
-
256
- Aliases: `pp-dev next-server`, `pp-dev next-dev`
257
-
258
- Runs the Next.js application in development mode with hot-reload. Also, its proxies requests to the MI server.
127
+ Example:
128
+ ```javascript
129
+ // pp-dev.config.js
130
+ module.exports = {
131
+ backendBaseURL: 'https://mi.company.com',
132
+ appId: 1,
133
+ personalAccessToken: process.env.MI_ACCESS_TOKEN,
134
+ };
135
+ ```
259
136
 
260
- Available options and arguments:
137
+ ## CLI Commands
261
138
 
262
- - `[root]` - define the root directory for the application. Default is `.`
263
- - `--port <port>` - define the port for the application. Default is `3000`
264
- - `--host <host>` - define the host for the application. Default is `localhost`
139
+ ### Global Options
265
140
 
266
- #### `pp-dev build`
141
+ | Option | Description |
142
+ |--------|-------------|
143
+ | `-c, --config <file>` | Path to configuration file (default: `pp-dev.config.js`) |
144
+ | `--base <path>` | Public base path (default: `/`) |
145
+ | `-l, --logLevel <level>` | Log level: `trace`, `debug`, `info`, `warn`, `error`, `silent` (default: `info`) |
146
+ | `--clearScreen` | Clear screen before logging |
147
+ | `--mode <mode>` | Environment mode: `development`, `production`, `test` (default: `development`) |
267
148
 
268
- Runs the application build. Will create `dist` and `dist-zip` folders. `dist` folder contains unzipped build files. `dist-zip` contains file `<package-name>.zip` with files from the `dist` folder
149
+ ### Development Server
269
150
 
270
- Available options and arguments:
151
+ ```bash
152
+ pp-dev [root] [options]
153
+ # Aliases: pp-dev dev, pp-dev serve
154
+ ```
271
155
 
272
- - `[root]` - define the root directory for the application. Default is `.`
273
- - `--target <target>` - transpile target. Default is `modules`.
274
- - `--outDir <outDir>` - define the output directory for the build. Default is `dist`
275
- - `--assetsDir <dir>` - directory under outDir to place assets in Default is `assets`
276
- - `--changelog [assetsFile]` - create a changelog file. You can define the path to the assets file or set `true` to use the default path. Default is `true`. Default path is `backups/<latest>.zip` where `<latest>` is the latest backup file
156
+ | Option | Default | Description |
157
+ |--------|---------|-------------|
158
+ | `[root]` | `.` | Root directory of the application |
159
+ | `--host <host>` | `localhost` | Server hostname |
160
+ | `--port <port>` | `3000` | Server port |
161
+ | `--open [path]` | - | Open browser on server start |
162
+ | `--strictPort` | - | Exit if port is already in use |
277
163
 
278
- #### `pp-dev changelog [oldAssetPath] [newAssetPath]`
164
+ ### Next.js Development
279
165
 
280
- Create a changelog file. You can define the path to the previous and current assets files. If you don't define the path to the previous assets and current assets file, the CLI will try to get it from options. If you don't define the path to the current assets file, the CLI will throw an error.
166
+ ```bash
167
+ pp-dev next [options]
168
+ # Aliases: pp-dev next-server, pp-dev next-dev
169
+ ```
281
170
 
282
- Available options and arguments:
171
+ | Option | Default | Description |
172
+ |--------|---------|-------------|
173
+ | `[root]` | `.` | Root directory of the application |
174
+ | `--port <port>` | `3000` | Server port |
175
+ | `--host <host>` | `localhost` | Server hostname |
283
176
 
284
- - `[oldAssetPath]` - define the path to the current assets file. Can accept path to the folder or path to the zip file
285
- - `[newAssetPath]` - define the path to the previous assets file. Can accept path to the folder or path to the zip file
286
- - `--oldAssetsPath <oldAssetsPath>` - define the path to the previous assets file. Can accept path to the folder or path to the zip file
287
- - `--newAssetsPath <newAssetsPath>` - define the path to the current assets file. Can accept path to the folder or path to the zip file
288
- - `--destination <destination>` - define the destination path for the changelog file. Default is `.`
289
- - `--filename <filename>` - define the filename for the changelog file. Default is `CHANGELOG.html`
177
+ ### Build
290
178
 
291
- #### `pp-dev generate-icon-font [source] [destination]`
179
+ ```bash
180
+ pp-dev build [options]
181
+ ```
292
182
 
293
- Generate an icon font from the source folder. You can define the path to the source folder and the destination folder. If you don't define the path to the source folder, the CLI will try to get it from options. If you don't define the path to the destination folder, the CLI will throw an error.
183
+ | Option | Default | Description |
184
+ |--------|---------|-------------|
185
+ | `[root]` | `.` | Root directory of the application |
186
+ | `--target <target>` | `modules` | Transpile target |
187
+ | `--outDir <dir>` | `dist` | Output directory |
188
+ | `--assetsDir <dir>` | `assets` | Assets directory under outDir |
189
+ | `--changelog [file]` | `true` | Create changelog file |
294
190
 
295
- Available options and arguments:
191
+ ### Changelog Generation
296
192
 
297
- - `[source]` - define the path to the source folder with SVG icons
298
- - `[destination]` - define the path to the destination folder for the generated icon font and styles
299
- - `--source <source>` - define the path to the source folder with SVG icons
300
- - `--destination <destination>` - define the path to the destination folder for the generated icon font and styles
301
- - `--fontName <fontName>` - define the font name. Default is `icon-font`
193
+ ```bash
194
+ pp-dev changelog [oldAssetPath] [newAssetPath] [options]
195
+ ```
302
196
 
303
- ## Migration guide from old Portal Page Helper to new
197
+ | Option | Default | Description |
198
+ |--------|---------|-------------|
199
+ | `[oldAssetPath]` | - | Path to previous assets |
200
+ | `[newAssetPath]` | - | Path to current assets |
201
+ | `--oldAssetsPath <path>` | - | Path to previous assets |
202
+ | `--newAssetsPath <path>` | - | Path to current assets |
203
+ | `--destination <path>` | `.` | Changelog output directory |
204
+ | `--filename <name>` | `CHANGELOG.html` | Changelog filename |
304
205
 
305
- 1. Initialize npm in your portal page repository (if you have `package.json` file in PP folder, you can skip this step):
206
+ ### Icon Font Generation
306
207
 
307
- Go to portal page folder and run command. This command will create `package.json` file in your folder
208
+ ```bash
209
+ pp-dev generate-icon-font [source] [destination] [options]
210
+ ```
308
211
 
309
- ```shell
310
- $ npm init
212
+ | Option | Default | Description |
213
+ |--------|---------|-------------|
214
+ | `[source]` | - | Source directory with SVG icons |
215
+ | `[destination]` | - | Output directory |
216
+ | `--source <path>` | - | Source directory with SVG icons |
217
+ | `--destination <path>` | - | Output directory |
218
+ | `--fontName <name>` | `icon-font` | Font name |
219
+
220
+ ## Next.js Integration
221
+
222
+ 1. Add pp-dev configuration to your project root
223
+ 2. Update `package.json` scripts:
224
+ ```json
225
+ {
226
+ "scripts": {
227
+ "dev": "pp-dev next"
228
+ }
229
+ }
311
230
  ```
231
+ 3. Wrap your Next.js config:
232
+ ```javascript
233
+ // next.config.js
234
+ const { withPPDev } = require('@metricinsights/pp-dev');
312
235
 
313
- 2. Install this package by this command:
314
- ```shell
315
- $ npm i @metricinsights/pp-dev
316
- ```
317
- 3. Create two scripts in `package.json` script section.
236
+ module.exports = withPPDev({
237
+ // your Next.js config
238
+ });
239
+ ```
318
240
 
319
- - `start` script: `"start": "pp-dev"`
320
- - `build` script: `"build": "pp-dev build"`
241
+ ## Vite Configuration
321
242
 
322
- 4. Change all paths to the file in index.html to the absolute path.
323
- If you have a path like `/pt/main.js` this must be changed to `/main.js`.
324
- Also, you may need to add `type="module"` to every script that is added by the `script` tag with the `src` property.
325
- Actually would be good to have only one `script` tag with the `src` tag.
326
- Every other JS file will be imported with construction like this `import helper from './helpers';`
243
+ For custom build configuration, create a `vite.config` file. See [Vite Configuration](https://vitejs.dev/config/) for details.