@open-audio-stack/core 0.1.29 → 0.1.31
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.
|
@@ -81,6 +81,11 @@ export class ManagerLocal extends Manager {
|
|
|
81
81
|
message: 'Website url',
|
|
82
82
|
default: `https://github.com/${pkgAnswers.org}/${pkgAnswers.package}`,
|
|
83
83
|
},
|
|
84
|
+
{
|
|
85
|
+
name: 'donate',
|
|
86
|
+
type: 'input',
|
|
87
|
+
message: 'Donation url',
|
|
88
|
+
},
|
|
84
89
|
{
|
|
85
90
|
name: 'audio',
|
|
86
91
|
type: 'input',
|
|
@@ -114,13 +119,7 @@ export class ManagerLocal extends Manager {
|
|
|
114
119
|
scan(ext = 'json', installable = true) {
|
|
115
120
|
const filePaths = dirRead(path.join(this.typeDir, '**', `index.${ext}`));
|
|
116
121
|
filePaths.forEach((filePath) => {
|
|
117
|
-
|
|
118
|
-
// TODO improve this code.
|
|
119
|
-
if (this.type === RegistryType.Plugins || this.type === RegistryType.Presets) {
|
|
120
|
-
const parts = subPath.split(path.sep);
|
|
121
|
-
parts.shift();
|
|
122
|
-
subPath = parts.join(path.sep);
|
|
123
|
-
}
|
|
122
|
+
const subPath = filePath.replace(`${this.typeDir}${path.sep}`, '');
|
|
124
123
|
const pkgJson = ext === 'yaml' ? fileReadYaml(filePath) : fileReadJson(filePath);
|
|
125
124
|
if (installable)
|
|
126
125
|
pkgJson.installed = true;
|
|
@@ -96,6 +96,7 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
96
96
|
changes: z.ZodString;
|
|
97
97
|
date: z.ZodString;
|
|
98
98
|
description: z.ZodString;
|
|
99
|
+
donate: z.ZodOptional<z.ZodString>;
|
|
99
100
|
files: z.ZodArray<z.ZodObject<{
|
|
100
101
|
architectures: z.ZodArray<z.ZodNativeEnum<typeof Architecture>, "many">;
|
|
101
102
|
sha256: z.ZodString;
|
|
@@ -169,6 +170,7 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
169
170
|
author: string;
|
|
170
171
|
changes: string;
|
|
171
172
|
description: string;
|
|
173
|
+
type: PluginType | PresetType | ProjectType;
|
|
172
174
|
files: {
|
|
173
175
|
type: FileType;
|
|
174
176
|
architectures: Architecture[];
|
|
@@ -181,18 +183,19 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
181
183
|
}[];
|
|
182
184
|
url: string;
|
|
183
185
|
}[];
|
|
184
|
-
type: PluginType | PresetType | ProjectType;
|
|
185
186
|
url: string;
|
|
186
187
|
image: string;
|
|
187
188
|
license: License;
|
|
188
189
|
name: string;
|
|
189
190
|
tags: string[];
|
|
191
|
+
donate?: string | undefined;
|
|
190
192
|
}, {
|
|
191
193
|
date: string;
|
|
192
194
|
audio: string;
|
|
193
195
|
author: string;
|
|
194
196
|
changes: string;
|
|
195
197
|
description: string;
|
|
198
|
+
type: PluginType | PresetType | ProjectType;
|
|
196
199
|
files: {
|
|
197
200
|
type: FileType;
|
|
198
201
|
architectures: Architecture[];
|
|
@@ -205,12 +208,12 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
205
208
|
}[];
|
|
206
209
|
url: string;
|
|
207
210
|
}[];
|
|
208
|
-
type: PluginType | PresetType | ProjectType;
|
|
209
211
|
url: string;
|
|
210
212
|
image: string;
|
|
211
213
|
license: License;
|
|
212
214
|
name: string;
|
|
213
215
|
tags: string[];
|
|
216
|
+
donate?: string | undefined;
|
|
214
217
|
}>;
|
|
215
218
|
export declare function packageRecommendations(pkgVersion: PackageVersion): PackageValidationRec[];
|
|
216
|
-
export declare function packageRecommendationsUrl(obj: PackageVersion | PluginFile | PresetFile | ProjectFile, recs: PackageValidationRec[], field: string): void;
|
|
219
|
+
export declare function packageRecommendationsUrl(obj: PackageVersion | PluginFile | PresetFile | ProjectFile, recs: PackageValidationRec[], field: string, domain?: string): void;
|
package/build/helpers/package.js
CHANGED
|
@@ -61,6 +61,7 @@ export const PackageVersionValidator = z.object({
|
|
|
61
61
|
changes: z.string().min(0).max(256),
|
|
62
62
|
date: z.string().datetime(),
|
|
63
63
|
description: z.string().min(0).max(256),
|
|
64
|
+
donate: z.optional(z.string().min(0).max(256).startsWith('https://')),
|
|
64
65
|
files: z.array(PackageFileValidator),
|
|
65
66
|
image: z.string().min(0).max(256).startsWith('https://'),
|
|
66
67
|
license: z.nativeEnum(License),
|
|
@@ -72,9 +73,10 @@ export const PackageVersionValidator = z.object({
|
|
|
72
73
|
// TODO refactor all this using a proper validation library.
|
|
73
74
|
export function packageRecommendations(pkgVersion) {
|
|
74
75
|
const recs = [];
|
|
75
|
-
packageRecommendationsUrl(pkgVersion, recs, 'audio');
|
|
76
|
-
packageRecommendationsUrl(pkgVersion, recs, 'image');
|
|
77
|
-
packageRecommendationsUrl(pkgVersion, recs, 'url');
|
|
76
|
+
packageRecommendationsUrl(pkgVersion, recs, 'audio', 'github');
|
|
77
|
+
packageRecommendationsUrl(pkgVersion, recs, 'image', 'github');
|
|
78
|
+
packageRecommendationsUrl(pkgVersion, recs, 'url', 'github');
|
|
79
|
+
packageRecommendationsUrl(pkgVersion, recs, 'donate');
|
|
78
80
|
// Image/audio previews
|
|
79
81
|
if (pkgVersion.image && pkgVersion.image.endsWith('png')) {
|
|
80
82
|
recs.push({
|
|
@@ -102,7 +104,7 @@ export function packageRecommendations(pkgVersion) {
|
|
|
102
104
|
});
|
|
103
105
|
const ext = pathGetExt(file.url);
|
|
104
106
|
supportedFileFormats[ext] = true;
|
|
105
|
-
packageRecommendationsUrl(file, recs, 'url');
|
|
107
|
+
packageRecommendationsUrl(file, recs, 'url', 'github');
|
|
106
108
|
// Formats which do not support headless installation.
|
|
107
109
|
if (ext === FileFormat.AppImage)
|
|
108
110
|
recs.push({ field: 'url', rec: 'requires manual installation steps, consider .deb and .rpm instead' });
|
|
@@ -170,7 +172,7 @@ export function packageRecommendations(pkgVersion) {
|
|
|
170
172
|
}
|
|
171
173
|
return recs;
|
|
172
174
|
}
|
|
173
|
-
export function packageRecommendationsUrl(obj, recs, field) {
|
|
175
|
+
export function packageRecommendationsUrl(obj, recs, field, domain) {
|
|
174
176
|
// @ts-expect-error indexing a field with multiple package types.
|
|
175
177
|
const val = obj[field];
|
|
176
178
|
if (typeof val !== 'string')
|
|
@@ -181,7 +183,7 @@ export function packageRecommendationsUrl(obj, recs, field) {
|
|
|
181
183
|
rec: 'should use https url',
|
|
182
184
|
});
|
|
183
185
|
}
|
|
184
|
-
if (!val.includes(
|
|
186
|
+
if (domain && !val.includes(`${domain}.com`) && !val.includes(`${domain}.io`)) {
|
|
185
187
|
recs.push({
|
|
186
188
|
field,
|
|
187
189
|
rec: 'should point to GitHub',
|
package/build/helpers/utils.js
CHANGED
|
@@ -26,11 +26,13 @@ export function pathGetFilename(path, sep = '/') {
|
|
|
26
26
|
}
|
|
27
27
|
export function pathGetSlug(path, sep = '/') {
|
|
28
28
|
const parts = path.split(sep);
|
|
29
|
-
|
|
29
|
+
const index = parts.findIndex(part => semver.valid(part));
|
|
30
|
+
return parts[index - 2] + '/' + parts[index - 1];
|
|
30
31
|
}
|
|
31
32
|
export function pathGetVersion(path, sep = '/') {
|
|
32
33
|
const parts = path.split(sep);
|
|
33
|
-
|
|
34
|
+
const index = parts.findIndex(part => semver.valid(part));
|
|
35
|
+
return parts[index];
|
|
34
36
|
}
|
|
35
37
|
export function toSlug(val) {
|
|
36
38
|
// @ts-expect-error slugify library issue with ESM modules
|
package/build/types/Package.d.ts
CHANGED