@open-audio-stack/core 0.1.38 → 0.1.40
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/ManagerLocal.d.ts +1 -1
- package/build/classes/ManagerLocal.js +43 -8
- package/build/helpers/configLocal.js +2 -1
- package/build/helpers/file.d.ts +1 -0
- package/build/helpers/file.js +7 -0
- package/build/helpers/package.d.ts +5 -5
- package/build/helpers/package.js +1 -1
- package/build/types/Config.d.ts +1 -0
- package/build/types/File.d.ts +1 -0
- package/build/types/Package.d.ts +1 -1
- package/build/types/Project.d.ts +0 -1
- package/build/types/Registry.d.ts +2 -0
- package/build/types/Registry.js +1 -0
- package/package.json +1 -1
|
@@ -14,7 +14,7 @@ export declare class ManagerLocal extends Manager {
|
|
|
14
14
|
installAll(): Promise<Package[]>;
|
|
15
15
|
installDependency(slug: string, version?: string, filePath?: string, type?: RegistryType): Promise<any>;
|
|
16
16
|
installDependencies(filePath: string, type?: RegistryType): Promise<any>;
|
|
17
|
-
open(
|
|
17
|
+
open(slug: string, version?: string, options?: string[]): boolean;
|
|
18
18
|
uninstall(slug: string, version?: string): Promise<void | PackageVersion>;
|
|
19
19
|
uninstallDependency(slug: string, version?: string, filePath?: string, type?: RegistryType): Promise<any>;
|
|
20
20
|
uninstallDependencies(filePath?: string, type?: RegistryType): Promise<any>;
|
|
@@ -105,9 +105,6 @@ export class ManagerLocal extends Manager {
|
|
|
105
105
|
{ name: 'date', type: 'input', message: 'Date released', default: new Date().toISOString() },
|
|
106
106
|
{ name: 'changes', type: 'input', message: 'List of changes' },
|
|
107
107
|
];
|
|
108
|
-
if (this.type === RegistryType.Projects) {
|
|
109
|
-
pkgVersionQuestions.push({ name: 'open', type: 'input', message: 'File to open' });
|
|
110
|
-
}
|
|
111
108
|
const pkgVersionAnswers = await inquirer.prompt(pkgVersionQuestions);
|
|
112
109
|
// TODO prompt for each file.
|
|
113
110
|
pkgVersionAnswers.files = [];
|
|
@@ -317,11 +314,49 @@ export class ManagerLocal extends Manager {
|
|
|
317
314
|
pkgFile.installed = true;
|
|
318
315
|
return pkgFile;
|
|
319
316
|
}
|
|
320
|
-
open(
|
|
321
|
-
|
|
322
|
-
//
|
|
323
|
-
|
|
324
|
-
|
|
317
|
+
open(slug, version, options = []) {
|
|
318
|
+
this.log('open', slug, version, options);
|
|
319
|
+
// Get package information
|
|
320
|
+
const pkg = this.getPackage(slug);
|
|
321
|
+
if (!pkg) {
|
|
322
|
+
this.log(`Package ${slug} not found`);
|
|
323
|
+
return false;
|
|
324
|
+
}
|
|
325
|
+
const versionNum = version || pkg.latestVersion();
|
|
326
|
+
const pkgVersion = pkg.getVersion(versionNum);
|
|
327
|
+
if (!pkgVersion) {
|
|
328
|
+
this.log(`Package ${slug} version ${versionNum} not found`);
|
|
329
|
+
return false;
|
|
330
|
+
}
|
|
331
|
+
// Check if package is installed
|
|
332
|
+
if (!this.isPackageInstalled(slug, versionNum)) {
|
|
333
|
+
this.log(`Package ${slug} version ${versionNum} not installed`);
|
|
334
|
+
return false;
|
|
335
|
+
}
|
|
336
|
+
// Filter compatible files and find one with open field
|
|
337
|
+
const files = packageCompatibleFiles(pkgVersion, [getArchitecture()], [getSystem()], []);
|
|
338
|
+
const openableFile = files.find(file => file.open);
|
|
339
|
+
if (!openableFile) {
|
|
340
|
+
this.log(`Package ${slug} has no compatible file with open command defined`);
|
|
341
|
+
return false;
|
|
342
|
+
}
|
|
343
|
+
try {
|
|
344
|
+
const openPath = openableFile.open;
|
|
345
|
+
const packageDir = path.join(this.typeDir, slug, versionNum);
|
|
346
|
+
const fullPath = path.isAbsolute(openPath) ? openPath : path.join(packageDir, openPath);
|
|
347
|
+
const command = `"${fullPath}" ${options.join(' ')}`;
|
|
348
|
+
this.log(`Running: ${command}`);
|
|
349
|
+
if (isTests()) {
|
|
350
|
+
this.log(`Would run: ${command}`);
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
fileOpen(fullPath);
|
|
354
|
+
}
|
|
355
|
+
return true;
|
|
356
|
+
}
|
|
357
|
+
catch (error) {
|
|
358
|
+
this.log(`Error opening package ${slug}:`, error);
|
|
359
|
+
return false;
|
|
325
360
|
}
|
|
326
361
|
}
|
|
327
362
|
async uninstall(slug, version) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { configDefaults } from './config.js';
|
|
2
|
-
import { dirApp, dirPlugins, dirPresets, dirProjects } from './file.js';
|
|
2
|
+
import { dirApp, dirApps, dirPlugins, dirPresets, dirProjects } from './file.js';
|
|
3
3
|
export function configDefaultsLocal() {
|
|
4
4
|
return {
|
|
5
5
|
...configDefaults(),
|
|
6
6
|
appDir: dirApp(),
|
|
7
|
+
appsDir: dirApps(),
|
|
7
8
|
pluginsDir: dirPlugins(),
|
|
8
9
|
presetsDir: dirPresets(),
|
|
9
10
|
projectsDir: dirProjects(),
|
package/build/helpers/file.d.ts
CHANGED
|
@@ -19,6 +19,7 @@ export declare function dirPackage(pkg: PackageInterface): string;
|
|
|
19
19
|
export declare function dirPlugins(): string;
|
|
20
20
|
export declare function dirPresets(): string;
|
|
21
21
|
export declare function dirProjects(): string;
|
|
22
|
+
export declare function dirApps(): string;
|
|
22
23
|
export declare function dirRead(dir: string, options?: GlobOptionsWithFileTypesFalse): string[];
|
|
23
24
|
export declare function dirRename(dir: string, dirNew: string): void | boolean;
|
|
24
25
|
export declare function fileCreate(filePath: string, data: string | Buffer): void;
|
package/build/helpers/file.js
CHANGED
|
@@ -141,6 +141,13 @@ export function dirProjects() {
|
|
|
141
141
|
return path.join(os.homedir(), 'Documents', 'Audio');
|
|
142
142
|
return path.join(os.homedir(), 'Documents', 'Audio');
|
|
143
143
|
}
|
|
144
|
+
export function dirApps() {
|
|
145
|
+
if (getSystem() === SystemType.Win)
|
|
146
|
+
return path.join(os.homedir(), 'AppData', 'Local', 'Programs');
|
|
147
|
+
else if (getSystem() === SystemType.Mac)
|
|
148
|
+
return path.join('/Applications');
|
|
149
|
+
return path.join('/usr', 'local', 'bin');
|
|
150
|
+
}
|
|
144
151
|
export function dirRead(dir, options) {
|
|
145
152
|
log('⌕', dir);
|
|
146
153
|
// Glob now expects forward slashes on Windows
|
|
@@ -91,7 +91,7 @@ export declare const PackageTypeObj: {
|
|
|
91
91
|
Tool: PluginType.Tool;
|
|
92
92
|
};
|
|
93
93
|
export declare const PackageVersionValidator: z.ZodObject<{
|
|
94
|
-
audio: z.ZodString
|
|
94
|
+
audio: z.ZodOptional<z.ZodString>;
|
|
95
95
|
author: z.ZodString;
|
|
96
96
|
changes: z.ZodString;
|
|
97
97
|
date: z.ZodString;
|
|
@@ -166,11 +166,10 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
166
166
|
url: z.ZodString;
|
|
167
167
|
}, "strip", z.ZodTypeAny, {
|
|
168
168
|
date: string;
|
|
169
|
-
|
|
169
|
+
type: PluginType | PresetType | ProjectType;
|
|
170
170
|
author: string;
|
|
171
171
|
changes: string;
|
|
172
172
|
description: string;
|
|
173
|
-
type: PluginType | PresetType | ProjectType;
|
|
174
173
|
url: string;
|
|
175
174
|
files: {
|
|
176
175
|
type: FileType;
|
|
@@ -188,14 +187,14 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
188
187
|
license: License;
|
|
189
188
|
name: string;
|
|
190
189
|
tags: string[];
|
|
190
|
+
audio?: string | undefined;
|
|
191
191
|
donate?: string | undefined;
|
|
192
192
|
}, {
|
|
193
193
|
date: string;
|
|
194
|
-
|
|
194
|
+
type: PluginType | PresetType | ProjectType;
|
|
195
195
|
author: string;
|
|
196
196
|
changes: string;
|
|
197
197
|
description: string;
|
|
198
|
-
type: PluginType | PresetType | ProjectType;
|
|
199
198
|
url: string;
|
|
200
199
|
files: {
|
|
201
200
|
type: FileType;
|
|
@@ -213,6 +212,7 @@ export declare const PackageVersionValidator: z.ZodObject<{
|
|
|
213
212
|
license: License;
|
|
214
213
|
name: string;
|
|
215
214
|
tags: string[];
|
|
215
|
+
audio?: string | undefined;
|
|
216
216
|
donate?: string | undefined;
|
|
217
217
|
}>;
|
|
218
218
|
export declare const SemverValidator: z.ZodString;
|
package/build/helpers/package.js
CHANGED
|
@@ -57,7 +57,7 @@ export const PackageFileValidator = z.object({
|
|
|
57
57
|
});
|
|
58
58
|
export const PackageTypeObj = { ...PluginType, ...PresetType, ...ProjectType };
|
|
59
59
|
export const PackageVersionValidator = z.object({
|
|
60
|
-
audio: z.string().min(8).max(256).startsWith('https://'),
|
|
60
|
+
audio: z.optional(z.string().min(8).max(256).startsWith('https://')),
|
|
61
61
|
author: z.string().min(1).max(256),
|
|
62
62
|
changes: z.string().min(1).max(256),
|
|
63
63
|
date: z.string().datetime(),
|
package/build/types/Config.d.ts
CHANGED
package/build/types/File.d.ts
CHANGED
package/build/types/Package.d.ts
CHANGED
package/build/types/Project.d.ts
CHANGED
|
@@ -3,11 +3,13 @@ export interface RegistryInterface {
|
|
|
3
3
|
name: string;
|
|
4
4
|
url: string;
|
|
5
5
|
version: string;
|
|
6
|
+
[RegistryType.Apps]?: RegistryPackages;
|
|
6
7
|
[RegistryType.Plugins]?: RegistryPackages;
|
|
7
8
|
[RegistryType.Presets]?: RegistryPackages;
|
|
8
9
|
[RegistryType.Projects]?: RegistryPackages;
|
|
9
10
|
}
|
|
10
11
|
export declare enum RegistryType {
|
|
12
|
+
Apps = "apps",
|
|
11
13
|
Plugins = "plugins",
|
|
12
14
|
Presets = "presets",
|
|
13
15
|
Projects = "projects"
|
package/build/types/Registry.js
CHANGED