@open-audio-stack/core 0.1.30 → 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.
@@ -119,13 +119,7 @@ export class ManagerLocal extends Manager {
119
119
  scan(ext = 'json', installable = true) {
120
120
  const filePaths = dirRead(path.join(this.typeDir, '**', `index.${ext}`));
121
121
  filePaths.forEach((filePath) => {
122
- let subPath = filePath.replace(`${this.typeDir}${path.sep}`, '');
123
- // TODO improve this code.
124
- if (this.type === RegistryType.Plugins || this.type === RegistryType.Presets) {
125
- const parts = subPath.split(path.sep);
126
- parts.shift();
127
- subPath = parts.join(path.sep);
128
- }
122
+ const subPath = filePath.replace(`${this.typeDir}${path.sep}`, '');
129
123
  const pkgJson = ext === 'yaml' ? fileReadYaml(filePath) : fileReadJson(filePath);
130
124
  if (installable)
131
125
  pkgJson.installed = true;
@@ -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
- return parts[0] + '/' + parts[1];
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
- return parts[parts.length - 2];
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-audio-stack/core",
3
- "version": "0.1.30",
3
+ "version": "0.1.31",
4
4
  "description": "Open-source audio plugin management software",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",