@metricinsights/pp-dev 0.0.1 → 0.0.2

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.
package/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # pp-dev
2
2
 
3
- Portal Page development framework
3
+ Portal Page development framework and build tool.
4
+
5
+ This package is based on [Vite](https://vitejs.dev/) tool.
4
6
 
5
7
  ## Usage
6
8
 
@@ -10,6 +12,116 @@ Package installation
10
12
  $ npm i @metricinsights/pp-dev
11
13
  ```
12
14
 
15
+ ### Define configuration
16
+
17
+ You need to create the file with the name `pp-dev.config` and extension `js` or
18
+ `cjs` (if you define type `module` in package.json) or `ts` if you want to use Typescript, or `json`.
19
+ You also can define configuration in `package.json` with the `pp-dev` key
20
+
21
+ Config examples:
22
+
23
+ - JavaScript
24
+
25
+ ```javascript
26
+ // pp-dev.config.js
27
+
28
+ /**
29
+ * @type {import('@metricinsights/pp-dev').PPDevConfig}
30
+ */
31
+ module.exports = {
32
+ backendBaseURL: 'https://example.metricinsights.com',
33
+ portalPageId: 1,
34
+ };
35
+ ```
36
+
37
+ - Typescript
38
+
39
+ ```typescript
40
+ // pp-dev.config.ts
41
+
42
+ import { PPDevConfig } from '@metricinsights/pp-dev';
43
+
44
+ const config: PPDevConfig = {
45
+ backendBaseURL: 'https://example.metricinsights.com',
46
+ portalPageId: 1,
47
+ };
48
+
49
+ export default config;
50
+ ```
51
+
52
+ - JSON (`pp-dev.config.json`)
53
+
54
+ ```json
55
+ {
56
+ "backendBaseURL": "https://example.metricinsights.com",
57
+ "portalPageId": 1
58
+ }
59
+ ```
60
+
61
+ - JSON in `package.json` file
62
+
63
+ ```json
64
+ {
65
+ "name": "<project-name>",
66
+ "version": "1.0.0",
67
+ "scripts": {},
68
+ "pp-dev": {
69
+ "backendBaseURL": "https://example.metricinsights.com",
70
+ "portalPageId": 1
71
+ }
72
+ }
73
+ ```
74
+
75
+ ### Vite configuration
76
+
77
+ If you need to change something in the build you can define `vite.config` file.
78
+ More description you can find [here](https://vitejs.dev/config/)
79
+
80
+ ### Configuration API description
81
+
82
+ #### `backendBaseURL`
83
+
84
+ Type: String
85
+
86
+ Example: `https://example.metricinsights.com`
87
+
88
+ Description: Defines the backend URL (Metric Insights instance) that is used for proxying requests to the MI backend
89
+
90
+ #### `portalPageId`
91
+
92
+ Type: Number
93
+
94
+ Example: `1`
95
+
96
+ Description: Defines the Portal Page Id that used to get portal page variables values.
97
+
98
+ #### `miHudLess`
99
+
100
+ Type: Boolean
101
+
102
+ Default: `false`
103
+
104
+ Example: `true`
105
+
106
+ Description: Disables Metric Insights navigation bar for local development
107
+
108
+ #### `templateLess`
109
+
110
+ Type: Boolean
111
+
112
+ Default: `false`
113
+
114
+ Example: `true`
115
+
116
+ Description: Disables template variables transforming. Used when you develop the portal page without a template
117
+
118
+ ### CLI API description
119
+
120
+ - `pp-dev help` - show CLI's help
121
+
122
+ - `pp-dev` or `pp-dev serve` or `pp-dev dev` runs application in development mode
123
+ - `pp-dev build` starts 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
124
+
13
125
  ## Migration guide from old portal page helper to new
14
126
 
15
127
  1. You need to initialize npm in your portal page repository (if you have `package.json` file in PP folder, you can skip this step):
@@ -24,8 +136,8 @@ $ npm i @metricinsights/pp-dev
24
136
  ```shell
25
137
  $ npm i @metricinsights/pp-dev
26
138
  ```
27
-
28
139
  3. You need to create two scripts in `package.json` script section.
140
+
29
141
  - `start` script: `"start": "pp-dev"`
30
142
  - `build` script: `"build": "pp-dev build"`
31
143
 
@@ -21,7 +21,7 @@
21
21
  </span>
22
22
  {% } %}
23
23
  </span>
24
- {% if (!templateLess && backendBaseURL && Number.isNaN(+portalPageId)) { %}
24
+ {% if (!templateLess && backendBaseURL && !Number.isNaN(+portalPageId)) { %}
25
25
  <button id="sync-template" class="sync-button" title="Sync template (Not implemented yet)">
26
26
  <svg
27
27
  fill="#007BFF"
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@metricinsights/pp-dev",
3
3
  "type": "module",
4
- "version": "0.0.1",
4
+ "version": "0.0.2",
5
5
  "description": "Portal Page dev build tool",
6
6
  "bin": {
7
7
  "pp-dev": "bin/pp-dev.js"
@@ -13,7 +13,8 @@
13
13
  "build": "npm run build:node && npm run build:client",
14
14
  "build:node": "tsc",
15
15
  "build:client": "rollup --config src/client/rollup.config.ts --configPlugin typescript",
16
- "test": "cd test && npm run build"
16
+ "test": "cd test && npm run build",
17
+ "version": "npm version --commit-hooks false --git-tag-version false"
17
18
  },
18
19
  "exports": {
19
20
  ".": {
@@ -64,5 +65,25 @@
64
65
  "LICENSE.md",
65
66
  "pp-dev.d.ts",
66
67
  "assets"
67
- ]
68
+ ],
69
+ "types": "./dist/index.d.ts",
70
+ "directories": {
71
+ "test": "test"
72
+ },
73
+ "repository": {
74
+ "type": "git",
75
+ "url": "git+https://github.com/mi-examples/pp-dev-js.git"
76
+ },
77
+ "keywords": [
78
+ "mi",
79
+ "metricinsights",
80
+ "pp",
81
+ "portal",
82
+ "pages",
83
+ "helper"
84
+ ],
85
+ "bugs": {
86
+ "url": "https://github.com/mi-examples/pp-dev-js/issues"
87
+ },
88
+ "homepage": "https://github.com/mi-examples/pp-dev-js#readme"
68
89
  }