@open-audio-stack/core 0.0.5 → 0.0.7
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 +1 -0
- package/build/Config.d.ts +1 -1
- package/build/Config.js +1 -1
- package/build/Registry.d.ts +3 -2
- package/build/Registry.js +66 -2
- package/build/helpers/file.js +2 -2
- package/build/types/Package.d.ts +4 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
# open-audio-stack-core
|
|
2
2
|
|
|
3
|
+

|
|
3
4
|

|
|
4
5
|
|
|
5
6
|
Common methods package shared across Open Audio Stack compatible registries, command-line tools, apps and websites for handling installing DAW VST plugin dependencies.
|
package/build/Config.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ import { ProjectType } from './types/ProjectType.js';
|
|
|
12
12
|
import { SystemType } from './types/SystemType.js';
|
|
13
13
|
export declare class Config {
|
|
14
14
|
config: ConfigInterface;
|
|
15
|
-
constructor(config
|
|
15
|
+
constructor(config?: ConfigInterface);
|
|
16
16
|
get(): ConfigInterface;
|
|
17
17
|
architecture(type: Architecture): import("./types/Architecture.js").ArchitectureOption;
|
|
18
18
|
architectures(): import("./types/Architecture.js").ArchitectureOption[];
|
package/build/Config.js
CHANGED
package/build/Registry.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { PackageInterface, PackageValidationError, PackageVersions, PackageVersionType } from './types/Package.js';
|
|
1
|
+
import { PackageInterface, PackageValidationError, PackageValidationRec, PackageVersions, PackageVersionType } from './types/Package.js';
|
|
2
2
|
import { RegistryInterface, RegistryPackages } from './types/Registry.js';
|
|
3
3
|
import { PluginType } from './types/PluginType.js';
|
|
4
4
|
import { PresetType } from './types/PresetType.js';
|
|
5
5
|
import { ProjectType } from './types/ProjectType.js';
|
|
6
6
|
export declare class Registry {
|
|
7
7
|
registry: RegistryInterface;
|
|
8
|
-
constructor(registry
|
|
8
|
+
constructor(registry?: RegistryInterface);
|
|
9
9
|
packageAdd(slug: string): {
|
|
10
10
|
slug: string;
|
|
11
11
|
version: string;
|
|
@@ -24,4 +24,5 @@ export declare class Registry {
|
|
|
24
24
|
packageRemove(slug: string): void;
|
|
25
25
|
packageVersionRemove(slug: string, version: string): void;
|
|
26
26
|
packageVersionValidate(pkgVersion: PackageVersionType): PackageValidationError[];
|
|
27
|
+
packageVersionRecommendations(pkgVersion: PackageVersionType): PackageValidationRec[];
|
|
27
28
|
}
|
package/build/Registry.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import * as semver from 'semver';
|
|
2
2
|
import { PackageValidation, } from './types/Package.js';
|
|
3
|
+
import { License } from './index-browser.js';
|
|
3
4
|
export class Registry {
|
|
4
5
|
registry;
|
|
5
6
|
constructor(registry) {
|
|
6
|
-
this.registry = registry;
|
|
7
|
+
this.registry = Object.assign({}, registry);
|
|
7
8
|
}
|
|
8
9
|
packageAdd(slug) {
|
|
9
10
|
return (this.registry.packages[slug] = {
|
|
@@ -91,7 +92,7 @@ export class Registry {
|
|
|
91
92
|
const errors = [];
|
|
92
93
|
fields.forEach((field) => {
|
|
93
94
|
const versionField = pkgVersion[field.name];
|
|
94
|
-
if (
|
|
95
|
+
if (versionField === undefined) {
|
|
95
96
|
errors.push({
|
|
96
97
|
field: field.name,
|
|
97
98
|
error: PackageValidation.MISSING_FIELD,
|
|
@@ -110,4 +111,67 @@ export class Registry {
|
|
|
110
111
|
});
|
|
111
112
|
return errors;
|
|
112
113
|
}
|
|
114
|
+
// TODO refactor all this using a proper validation library.
|
|
115
|
+
packageVersionRecommendations(pkgVersion) {
|
|
116
|
+
const recs = [];
|
|
117
|
+
// Urls
|
|
118
|
+
if (!pkgVersion.url.startsWith('https://')) {
|
|
119
|
+
recs.push({
|
|
120
|
+
field: 'url',
|
|
121
|
+
rec: 'should use https url',
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
if (!pkgVersion.url.includes('github.com') && !pkgVersion.url.includes('github.io')) {
|
|
125
|
+
recs.push({
|
|
126
|
+
field: 'url',
|
|
127
|
+
rec: 'should point to GitHub',
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
// Image/audio previews
|
|
131
|
+
if (pkgVersion.image && pkgVersion.image.includes('png')) {
|
|
132
|
+
recs.push({
|
|
133
|
+
field: 'image',
|
|
134
|
+
rec: 'should use the jpg format',
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
if (pkgVersion.audio && pkgVersion.audio.includes('wav')) {
|
|
138
|
+
recs.push({
|
|
139
|
+
field: 'audio',
|
|
140
|
+
rec: 'should use the flac format',
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
// Architectures/systems
|
|
144
|
+
const supportedArchitectures = {};
|
|
145
|
+
const supportedSystems = {};
|
|
146
|
+
pkgVersion.files.forEach(file => {
|
|
147
|
+
file.architectures.forEach(architecture => {
|
|
148
|
+
supportedArchitectures[architecture] = true;
|
|
149
|
+
});
|
|
150
|
+
file.systems.forEach(system => {
|
|
151
|
+
supportedSystems[system.type] = true;
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
if (!supportedArchitectures.arm64)
|
|
155
|
+
recs.push({ field: 'architectures', rec: 'should support Arm64' });
|
|
156
|
+
if (!supportedArchitectures.bit64)
|
|
157
|
+
recs.push({ field: 'architectures', rec: 'should support Bit64' });
|
|
158
|
+
if (!supportedSystems.linux)
|
|
159
|
+
recs.push({ field: 'systems', rec: 'should support Linux' });
|
|
160
|
+
if (!supportedSystems.mac)
|
|
161
|
+
recs.push({ field: 'systems', rec: 'should support Mac' });
|
|
162
|
+
if (!supportedSystems.win)
|
|
163
|
+
recs.push({ field: 'systems', rec: 'should support Windows' });
|
|
164
|
+
// Tags
|
|
165
|
+
const pluginTags = pkgVersion.tags.map(tag => tag.toLowerCase());
|
|
166
|
+
if (pluginTags.length < 2)
|
|
167
|
+
recs.push({ field: 'tags', rec: 'should have more items' });
|
|
168
|
+
// Licence
|
|
169
|
+
if (!Object.values(License).includes(pkgVersion.license)) {
|
|
170
|
+
recs.push({ field: 'license', rec: 'should be from the supported list' });
|
|
171
|
+
}
|
|
172
|
+
else if (pkgVersion.license === License.Other) {
|
|
173
|
+
recs.push({ field: 'license', rec: 'should be more specific' });
|
|
174
|
+
}
|
|
175
|
+
return recs;
|
|
176
|
+
}
|
|
113
177
|
}
|
package/build/helpers/file.js
CHANGED
|
@@ -51,9 +51,9 @@ export function dirOpen(dir) {
|
|
|
51
51
|
if (process.env.CI)
|
|
52
52
|
return new Buffer('');
|
|
53
53
|
if (process.platform === 'win32')
|
|
54
|
-
command = 'open';
|
|
55
|
-
else if (process.platform === 'darwin')
|
|
56
54
|
command = 'start ""';
|
|
55
|
+
else if (process.platform === 'darwin')
|
|
56
|
+
command = 'open';
|
|
57
57
|
else
|
|
58
58
|
command = 'xdg-open';
|
|
59
59
|
console.log('⎋', `${command} "${dir}"`);
|
package/build/types/Package.d.ts
CHANGED