@open-audio-stack/core 0.1.36 → 0.1.37
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/build/classes/Package.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as semver from 'semver';
|
|
2
|
-
import { packageErrors, packageRecommendations } from '../helpers/package.js';
|
|
2
|
+
import { packageErrors, packageIsVerified, packageRecommendations } from '../helpers/package.js';
|
|
3
3
|
import { isValidSlug } from '../helpers/utils.js';
|
|
4
4
|
import { Base } from './Base.js';
|
|
5
5
|
export class Package extends Base {
|
|
@@ -29,6 +29,7 @@ export class Package extends Base {
|
|
|
29
29
|
this.reports.set(num, report);
|
|
30
30
|
if (errors.length > 0)
|
|
31
31
|
return this.log(`Package ${version.name} version ${num} errors`, errors);
|
|
32
|
+
version.verified = packageIsVerified(this.slug, version);
|
|
32
33
|
this.versions.set(num, version);
|
|
33
34
|
this.version = this.latestVersion();
|
|
34
35
|
}
|
|
@@ -220,3 +220,4 @@ export declare function packageRecommendations(pkgVersion: PackageVersion): Pack
|
|
|
220
220
|
export declare function packageRecommendationsUrl(obj: PackageVersion | PluginFile | PresetFile | ProjectFile, recs: PackageValidationRec[], field: string, domain?: string): void;
|
|
221
221
|
export declare function packageJsToYaml(pkgVersion: PackageVersion): string;
|
|
222
222
|
export declare function packageYamlToJs(pkgYaml: string): PackageVersion;
|
|
223
|
+
export declare function packageIsVerified(slug: string, pkgVersion: PackageVersion): boolean;
|
package/build/helpers/package.js
CHANGED
|
@@ -200,3 +200,16 @@ export function packageJsToYaml(pkgVersion) {
|
|
|
200
200
|
export function packageYamlToJs(pkgYaml) {
|
|
201
201
|
return yaml.load(pkgYaml);
|
|
202
202
|
}
|
|
203
|
+
export function packageIsVerified(slug, pkgVersion) {
|
|
204
|
+
const org = slug.split('/')[0];
|
|
205
|
+
let verified = true;
|
|
206
|
+
pkgVersion.files.forEach(file => {
|
|
207
|
+
const url = file.url.toLowerCase();
|
|
208
|
+
const root = url.startsWith('https://github.com/') ? 'https://github.com/' + org + '/' : `https://${org}.`;
|
|
209
|
+
if (!url.startsWith(root)) {
|
|
210
|
+
verified = false;
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
});
|
|
214
|
+
return verified;
|
|
215
|
+
}
|
package/build/types/Package.d.ts
CHANGED