@open-audio-stack/core 0.1.19 → 0.1.21
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.
|
@@ -13,7 +13,7 @@ export declare class Manager extends Base {
|
|
|
13
13
|
filter(method: (pkgVersion: PackageVersion, pkg: Package) => boolean): Package[];
|
|
14
14
|
getPackage(slug: string): Package | undefined;
|
|
15
15
|
getReport(): any;
|
|
16
|
-
listPackages(): Package[];
|
|
16
|
+
listPackages(installed?: boolean): Package[];
|
|
17
17
|
removePackage(slug: string): void;
|
|
18
18
|
reset(): void;
|
|
19
19
|
search(query: string): Package[];
|
package/build/classes/Manager.js
CHANGED
|
@@ -44,7 +44,18 @@ export class Manager extends Base {
|
|
|
44
44
|
}
|
|
45
45
|
return reports;
|
|
46
46
|
}
|
|
47
|
-
listPackages() {
|
|
47
|
+
listPackages(installed) {
|
|
48
|
+
if (installed !== undefined) {
|
|
49
|
+
const packagesFiltered = [];
|
|
50
|
+
Array.from(this.packages.values()).forEach(pkg => {
|
|
51
|
+
Array.from(pkg.versions.values()).forEach(pkgVersion => {
|
|
52
|
+
if ((installed === true && pkgVersion.installed) || (installed === false && !pkgVersion.installed)) {
|
|
53
|
+
packagesFiltered.push(pkg);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
return packagesFiltered;
|
|
58
|
+
}
|
|
48
59
|
return Array.from(this.packages.values());
|
|
49
60
|
}
|
|
50
61
|
removePackage(slug) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
2
|
import { Package } from './Package.js';
|
|
3
3
|
import { Manager } from './Manager.js';
|
|
4
|
-
import { archiveExtract, dirCreate, dirDelete, dirEmpty, dirRead, fileCreate, fileCreateJson, fileCreateYaml, fileExists, fileHash, fileInstall, fileOpen, fileReadJson, fileReadYaml, filesMove, isAdmin, runCliAsAdmin, } from '../helpers/file.js';
|
|
4
|
+
import { archiveExtract, dirCreate, dirDelete, dirEmpty, dirMove, dirRead, fileCreate, fileCreateJson, fileCreateYaml, fileExists, fileHash, fileInstall, fileOpen, fileReadJson, fileReadYaml, filesMove, isAdmin, runCliAsAdmin, } from '../helpers/file.js';
|
|
5
5
|
import { isValidVersion, pathGetSlug, pathGetVersion, toSlug } from '../helpers/utils.js';
|
|
6
6
|
import { commandExists, getArchitecture, getSystem, isTests } from '../helpers/utilsLocal.js';
|
|
7
7
|
import { apiBuffer } from '../helpers/api.js';
|
|
@@ -14,7 +14,7 @@ import { presetFormatDir } from '../types/PresetFormat.js';
|
|
|
14
14
|
import { projectFormatDir } from '../types/ProjectFormat.js';
|
|
15
15
|
import { FileFormat } from '../types/FileFormat.js';
|
|
16
16
|
import { licenses } from '../types/License.js';
|
|
17
|
-
import { pluginTypes } from '../types/PluginType.js';
|
|
17
|
+
import { PluginType, pluginTypes } from '../types/PluginType.js';
|
|
18
18
|
import { presetTypes } from '../types/PresetType.js';
|
|
19
19
|
import { projectTypes } from '../types/ProjectType.js';
|
|
20
20
|
import { SystemType } from '../types/SystemType.js';
|
|
@@ -214,12 +214,21 @@ export class ManagerLocal extends Manager {
|
|
|
214
214
|
if (this.type === RegistryType.Projects)
|
|
215
215
|
formatDir = projectFormatDir;
|
|
216
216
|
archiveExtract(filePath, dirSource);
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
217
|
+
// Move entire directory, maintaining the same folder structure.
|
|
218
|
+
if (pkgVersion.type === PluginType.Sampler) {
|
|
219
|
+
const dirTarget = path.join(this.typeDir, PluginType.Sampler, dirSub);
|
|
220
|
+
dirCreate(dirTarget);
|
|
221
|
+
dirMove(dirSource, dirTarget);
|
|
222
|
+
fileCreateJson(path.join(dirTarget, 'index.json'), pkgVersion);
|
|
223
|
+
}
|
|
224
|
+
else {
|
|
225
|
+
// Move only supported file extensions into their respective installation directories.
|
|
226
|
+
const filesMoved = filesMove(dirSource, this.typeDir, dirSub, formatDir);
|
|
227
|
+
filesMoved.forEach((fileMoved) => {
|
|
228
|
+
const fileJson = path.join(path.dirname(fileMoved), 'index.json');
|
|
229
|
+
fileCreateJson(fileJson, pkgVersion);
|
|
230
|
+
});
|
|
231
|
+
}
|
|
223
232
|
}
|
|
224
233
|
}
|
|
225
234
|
pkgVersion.installed = true;
|