@open-audio-stack/core 0.1.27 → 0.1.29

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.
@@ -12,8 +12,8 @@ export declare class ManagerLocal extends Manager {
12
12
  install(slug: string, version?: string): Promise<void | PackageVersion>;
13
13
  installAll(): Promise<Package[]>;
14
14
  installDependency(slug: string, version?: string, filePath?: string, type?: RegistryType): Promise<any>;
15
- installDependencies(filePath?: string, type?: RegistryType): Promise<any>;
16
- open(filePath?: string): void;
15
+ installDependencies(filePath: string, type?: RegistryType): Promise<any>;
16
+ open(filePath: string): void;
17
17
  uninstall(slug: string, version?: string): Promise<void | PackageVersion>;
18
18
  uninstallDependency(slug: string, version?: string, filePath?: string, type?: RegistryType): Promise<any>;
19
19
  uninstallDependencies(filePath?: string, type?: RegistryType): Promise<any>;
@@ -114,11 +114,13 @@ export class ManagerLocal extends Manager {
114
114
  scan(ext = 'json', installable = true) {
115
115
  const filePaths = dirRead(path.join(this.typeDir, '**', `index.${ext}`));
116
116
  filePaths.forEach((filePath) => {
117
- let subPath = filePath.replace(`${this.typeDir}` + path.sep, '');
117
+ let subPath = filePath.replace(`${this.typeDir}${path.sep}`, '');
118
118
  // TODO improve this code.
119
- const parts = subPath.split(path.sep);
120
- parts.shift();
121
- subPath = parts.join(path.sep);
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
124
  const pkgJson = ext === 'yaml' ? fileReadYaml(filePath) : fileReadJson(filePath);
123
125
  if (installable)
124
126
  pkgJson.installed = true;
@@ -350,7 +352,7 @@ export class ManagerLocal extends Manager {
350
352
  dirDelete(orgDir);
351
353
  });
352
354
  delete pkgVersion.installed;
353
- return this.getPackage(slug)?.getVersion(versionNum);
355
+ return pkgVersion;
354
356
  }
355
357
  async uninstallDependency(slug, version, filePath, type = RegistryType.Plugins) {
356
358
  // Get local package file.
@@ -1,3 +1,4 @@
1
+ import { GlobOptionsWithFileTypesFalse } from 'glob';
1
2
  import { PackageInterface } from '../types/Package.js';
2
3
  import { PluginFile } from '../types/Plugin.js';
3
4
  import { PresetFile } from '../types/Preset.js';
@@ -18,7 +19,7 @@ export declare function dirPackage(pkg: PackageInterface): string;
18
19
  export declare function dirPlugins(): string;
19
20
  export declare function dirPresets(): string;
20
21
  export declare function dirProjects(): string;
21
- export declare function dirRead(dir: string, options?: any): string[];
22
+ export declare function dirRead(dir: string, options?: GlobOptionsWithFileTypesFalse): string[];
22
23
  export declare function dirRename(dir: string, dirNew: string): void | boolean;
23
24
  export declare function fileCreate(filePath: string, data: string | Buffer): void;
24
25
  export declare function fileCreateJson(filePath: string, data: object): void;
@@ -127,7 +127,19 @@ export function dirRead(dir, options) {
127
127
  if (getSystem() === SystemType.Win) {
128
128
  dir = dir.replace(/\\/g, '/');
129
129
  }
130
- return globSync(dir, options);
130
+ // Ignore Mac files in Contents folders
131
+ // Filter out any paths not starting with the base directory
132
+ // This is to prevent issues with symlinks.
133
+ const baseDir = dir.includes('*') ? dir.split('*')[0] : dir;
134
+ const allPaths = globSync(dir, {
135
+ ignore: [`${baseDir}/**/*.{app,component,lv2,vst,vst3}/**/*`],
136
+ realpath: true,
137
+ ...options,
138
+ });
139
+ // Glob input paths use forward slashes.
140
+ // Glob output paths are system-specific.
141
+ const baseDirCrossPlatform = baseDir.split('/').join(path.sep);
142
+ return allPaths.filter(p => p.startsWith(baseDirCrossPlatform));
131
143
  }
132
144
  export function dirRename(dir, dirNew) {
133
145
  if (dirExists(dir)) {
@@ -208,9 +220,7 @@ export function fileMove(filePath, newPath) {
208
220
  }
209
221
  export function filesMove(dirSource, dirTarget, dirSub, formatDir) {
210
222
  // Read files from source directory, ignoring Mac Contents files.
211
- const files = dirRead(`${dirSource}/**/*.*`, {
212
- ignore: [`${dirSource}/**/Contents/**/*`],
213
- });
223
+ const files = dirRead(`${dirSource}/**/*.*`);
214
224
  const filesMoved = [];
215
225
  // For each file, move to correct folder based on type
216
226
  files.forEach((fileSource) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-audio-stack/core",
3
- "version": "0.1.27",
3
+ "version": "0.1.29",
4
4
  "description": "Open-source audio plugin management software",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",