@pptb/types 1.1.3-beta.1 → 1.1.3-beta.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 +24 -24
- package/lib/validate.js +24 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,11 +4,11 @@ TypeScript type definitions for Power Platform ToolBox APIs, plus a built-in CLI
|
|
|
4
4
|
|
|
5
5
|
- [@pptb/types](#pptbtypes)
|
|
6
6
|
- [Installation](#installation)
|
|
7
|
-
- [Overview](#overview)
|
|
8
7
|
- [Tool Validation](#tool-validation)
|
|
9
8
|
- [Quick start](#quick-start)
|
|
10
9
|
- [CLI options](#cli-options)
|
|
11
10
|
- [What is validated](#what-is-validated)
|
|
11
|
+
- [Overview](#overview)
|
|
12
12
|
- [Usage](#usage)
|
|
13
13
|
- [Include all type definitions](#include-all-type-definitions)
|
|
14
14
|
- [Include specific API types](#include-specific-api-types)
|
|
@@ -55,7 +55,7 @@ Add a script to your tool's `package.json`:
|
|
|
55
55
|
```json
|
|
56
56
|
{
|
|
57
57
|
"scripts": {
|
|
58
|
-
"
|
|
58
|
+
"validate": "pptb-validate"
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
61
|
```
|
|
@@ -63,7 +63,7 @@ Add a script to your tool's `package.json`:
|
|
|
63
63
|
Then run:
|
|
64
64
|
|
|
65
65
|
```bash
|
|
66
|
-
npm run
|
|
66
|
+
npm run validate
|
|
67
67
|
```
|
|
68
68
|
|
|
69
69
|
You can also run it directly (no script entry needed once `@pptb/types` is installed):
|
|
@@ -80,32 +80,32 @@ npx pptb-validate path/to/package.json
|
|
|
80
80
|
|
|
81
81
|
### CLI options
|
|
82
82
|
|
|
83
|
-
| Option
|
|
84
|
-
|
|
85
|
-
| `--skip-url-checks` | Skip URL reachability checks (faster, works offline)
|
|
86
|
-
| `--json`
|
|
87
|
-
| `--help`, `-h`
|
|
83
|
+
| Option | Description |
|
|
84
|
+
| ------------------- | ---------------------------------------------------------- |
|
|
85
|
+
| `--skip-url-checks` | Skip URL reachability checks (faster, works offline) |
|
|
86
|
+
| `--json` | Print results as a JSON object (suitable for CI pipelines) |
|
|
87
|
+
| `--help`, `-h` | Show help information |
|
|
88
88
|
|
|
89
89
|
### What is validated
|
|
90
90
|
|
|
91
91
|
The validator checks every field that the official review pipeline inspects:
|
|
92
92
|
|
|
93
|
-
| Field
|
|
94
|
-
|
|
95
|
-
| `name`
|
|
96
|
-
| `version`
|
|
97
|
-
| `displayName`
|
|
98
|
-
| `description`
|
|
99
|
-
| `license`
|
|
100
|
-
| `contributors`
|
|
101
|
-
| `configurations.repository` | ✅
|
|
102
|
-
| `configurations.readmeUrl`
|
|
103
|
-
| `configurations.website`
|
|
104
|
-
| `configurations.funding`
|
|
105
|
-
| `icon`
|
|
106
|
-
| `cspExceptions`
|
|
107
|
-
| `features.multiConnection`
|
|
108
|
-
| `features.minAPI`
|
|
93
|
+
| Field | Required | Rules |
|
|
94
|
+
| --------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
|
|
95
|
+
| `name` | ✅ | Must be a string |
|
|
96
|
+
| `version` | ✅ | Must be a string |
|
|
97
|
+
| `displayName` | ✅ | Must be a string |
|
|
98
|
+
| `description` | ✅ | Must be a string |
|
|
99
|
+
| `license` | ✅ | Must be one of the approved OSS licenses (MIT, Apache-2.0, BSD-2-Clause, BSD-3-Clause, GPL-2.0, GPL-3.0, LGPL-3.0, ISC, AGPL-3.0-only) |
|
|
100
|
+
| `contributors` | ✅ | Non-empty array; each entry needs a `name` |
|
|
101
|
+
| `configurations.repository` | ✅ | Valid, reachable URL |
|
|
102
|
+
| `configurations.readmeUrl` | ✅ | Valid URL; must **not** be hosted on `github.com` (use `raw.githubusercontent.com`) |
|
|
103
|
+
| `configurations.website` | ❌ | Valid, reachable URL when provided |
|
|
104
|
+
| `configurations.funding` | ❌ | Valid, reachable URL when provided |
|
|
105
|
+
| `icon` | ❌ | Relative path to a `.svg` file bundled under `dist/`; must not be an HTTP URL or an absolute path |
|
|
106
|
+
| `cspExceptions` | ❌ | When present: must not be empty; only recognised directives; each directive must be a non-empty array |
|
|
107
|
+
| `features.multiConnection` | ❌\* | Required when `features` is present; must be `"required"`, `"optional"`, or `"none"` |
|
|
108
|
+
| `features.minAPI` | ❌ | Valid semver string when provided |
|
|
109
109
|
|
|
110
110
|
> \* Required only when the `features` object is present.
|
|
111
111
|
|
package/lib/validate.js
CHANGED
|
@@ -145,12 +145,12 @@ async function validatePackageJson(packageJson, options = {}) {
|
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
// Icon validation (optional, but must be a relative SVG path if provided)
|
|
148
|
-
if (packageJson.icon
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
148
|
+
if (packageJson.icon === undefined || packageJson.icon === null) {
|
|
149
|
+
warnings.push("icon is not set; consider adding a bundled SVG icon so your tool displays properly in the marketplace");
|
|
150
|
+
} else if (typeof packageJson.icon !== "string") {
|
|
151
|
+
errors.push("icon must be a string (relative path to bundled SVG under dist)");
|
|
152
|
+
} else {
|
|
153
|
+
validateIconPath("icon", packageJson.icon, errors);
|
|
154
154
|
}
|
|
155
155
|
|
|
156
156
|
// Contributors validation
|
|
@@ -192,27 +192,27 @@ async function validatePackageJson(packageJson, options = {}) {
|
|
|
192
192
|
}
|
|
193
193
|
}
|
|
194
194
|
|
|
195
|
-
// Website validation (optional)
|
|
196
|
-
if (configs.website) {
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
195
|
+
// Website validation (optional but recommended)
|
|
196
|
+
if (!configs.website) {
|
|
197
|
+
warnings.push("configurations.website is not set; consider adding a URL where users can learn more about your tool");
|
|
198
|
+
} else if (!isValidUrl(configs.website)) {
|
|
199
|
+
warnings.push("configurations.website has an invalid URL format");
|
|
200
|
+
} else if (!skipUrlChecks) {
|
|
201
|
+
const accessible = await isUrlAccessible(configs.website);
|
|
202
|
+
if (!accessible) {
|
|
203
|
+
warnings.push("configurations.website URL is not accessible");
|
|
204
204
|
}
|
|
205
205
|
}
|
|
206
206
|
|
|
207
|
-
// Funding validation (optional)
|
|
208
|
-
if (configs.funding) {
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
207
|
+
// Funding validation (optional but recommended)
|
|
208
|
+
if (!configs.funding) {
|
|
209
|
+
warnings.push("configurations.funding is not set; consider adding a sponsorship or funding URL to support contributors");
|
|
210
|
+
} else if (!isValidUrl(configs.funding)) {
|
|
211
|
+
warnings.push("configurations.funding has an invalid URL format");
|
|
212
|
+
} else if (!skipUrlChecks) {
|
|
213
|
+
const accessible = await isUrlAccessible(configs.funding);
|
|
214
|
+
if (!accessible) {
|
|
215
|
+
warnings.push("configurations.funding URL is not accessible");
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
218
|
|
package/package.json
CHANGED