@open-audio-stack/core 0.1.1 → 0.1.2

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.
@@ -2,7 +2,8 @@ import path from 'path';
2
2
  import { Package } from './Package.js';
3
3
  import { Manager } from './Manager.js';
4
4
  import { archiveExtract, dirCreate, dirDelete, dirEmpty, dirRead, fileCreate, fileCreateJson, fileExists, fileHash, fileOpen, fileReadJson, filesMove, isAdmin, runCliAsAdmin, } from '../helpers/file.js';
5
- import { isTests, pathGetSlug, pathGetVersion } from '../helpers/utils.js';
5
+ import { pathGetSlug, pathGetVersion } from '../helpers/utils.js';
6
+ import { getArchitecture, getSystem, isTests } from '../helpers/utilsLocal.js';
6
7
  import { apiBuffer } from '../helpers/api.js';
7
8
  import { FileType } from '../types/FileType.js';
8
9
  import { RegistryType } from '../types/Registry.js';
@@ -53,7 +54,7 @@ export class ManagerLocal extends Manager {
53
54
  const dirDownloads = path.join(this.config.get('appDir'), 'downloads', this.type, slug, versionNum);
54
55
  dirCreate(dirDownloads);
55
56
  // Filter for compatible files and download.
56
- const files = packageCompatibleFiles(pkgVersion);
57
+ const files = packageCompatibleFiles(pkgVersion, [getArchitecture()], [getSystem()]);
57
58
  if (!files.length)
58
59
  return console.error(`Error: No compatible files found for ${slug}`);
59
60
  for (const key in files) {
@@ -14,7 +14,8 @@ import { ZodIssueCode } from 'zod';
14
14
  import { SystemType } from '../types/SystemType.js';
15
15
  import { fileURLToPath } from 'url';
16
16
  import sudoPrompt from '@vscode/sudo-prompt';
17
- import { getSystem, log } from './utils.js';
17
+ import { log } from './utils.js';
18
+ import { getSystem } from './utilsLocal.js';
18
19
  export async function archiveExtract(filePath, dirPath) {
19
20
  console.log('⎋', dirPath);
20
21
  const ext = path.extname(filePath).trim().toLowerCase();
@@ -11,7 +11,7 @@ import { ProjectFile } from '../types/Project.js';
11
11
  import { ProjectType } from '../types/ProjectType.js';
12
12
  import { SystemType } from '../types/SystemType.js';
13
13
  import { PackageInterface, PackageValidationRec, PackageVersion } from '../types/Package.js';
14
- export declare function packageCompatibleFiles(pkg: PackageVersion): (PluginFile | PresetFile | ProjectFile)[];
14
+ export declare function packageCompatibleFiles(pkg: PackageVersion, arch: Architecture[], sys: SystemType[]): (PluginFile | PresetFile | ProjectFile)[];
15
15
  export declare function packageVersionLatest(pkg: PackageInterface): string;
16
16
  export declare const PackageSystemValidator: z.ZodObject<{
17
17
  max: z.ZodOptional<z.ZodNumber>;
@@ -170,8 +170,8 @@ export declare const PackageVersionValidator: z.ZodObject<{
170
170
  }>;
171
171
  url: z.ZodString;
172
172
  }, "strip", z.ZodTypeAny, {
173
- date: string;
174
173
  type: PluginType | PresetType | ProjectType;
174
+ date: string;
175
175
  url: string;
176
176
  audio: string;
177
177
  author: string;
@@ -195,8 +195,8 @@ export declare const PackageVersionValidator: z.ZodObject<{
195
195
  name: string;
196
196
  tags: string[];
197
197
  }, {
198
- date: string;
199
198
  type: PluginType | PresetType | ProjectType;
199
+ date: string;
200
200
  url: string;
201
201
  audio: string;
202
202
  author: string;
@@ -8,14 +8,13 @@ import { PluginType } from '../types/PluginType.js';
8
8
  import { PresetType } from '../types/PresetType.js';
9
9
  import { ProjectType } from '../types/ProjectType.js';
10
10
  import { SystemType } from '../types/SystemType.js';
11
- import { getArchitecture, getSystem } from './utils.js';
12
- export function packageCompatibleFiles(pkg) {
11
+ export function packageCompatibleFiles(pkg, arch, sys) {
13
12
  return pkg.files.filter((file) => {
14
13
  const archMatches = file.architectures.filter(architecture => {
15
- return architecture === getArchitecture();
14
+ return arch.includes(architecture);
16
15
  });
17
16
  const sysMatches = file.systems.filter(system => {
18
- return system.type === getSystem();
17
+ return sys.includes(system.type);
19
18
  });
20
19
  return archMatches.length && sysMatches.length;
21
20
  });
@@ -1,11 +1,6 @@
1
1
  import { PackageValidationRec } from '../types/Package.js';
2
2
  import { ZodIssue } from 'zod';
3
- import { SystemType } from '../types/SystemType.js';
4
- import { Architecture } from '../types/Architecture.js';
5
- export declare function getArchitecture(): Architecture;
6
- export declare function getSystem(): SystemType;
7
3
  export declare function inputGetParts(input: string): string[];
8
- export declare function isTests(): boolean;
9
4
  export declare function log(...args: any): boolean;
10
5
  export declare function logEnable(): boolean;
11
6
  export declare function logDisable(): boolean;
@@ -1,31 +1,8 @@
1
1
  import chalk from 'chalk';
2
- import { SystemType } from '../types/SystemType.js';
3
- import { Architecture } from '../types/Architecture.js';
4
2
  let LOGGING_ENABLED = false;
5
- export function getArchitecture() {
6
- if (process.arch === 'arm')
7
- return Architecture.Arm32;
8
- if (process.arch === 'arm64')
9
- return Architecture.Arm64;
10
- if (process.arch === 'ia32')
11
- return Architecture.X32;
12
- return Architecture.X64;
13
- }
14
- export function getSystem() {
15
- if (process.platform === 'win32')
16
- return SystemType.Windows;
17
- else if (process.platform === 'darwin')
18
- return SystemType.Macintosh;
19
- return SystemType.Linux;
20
- }
21
3
  export function inputGetParts(input) {
22
4
  return input.split('@');
23
5
  }
24
- export function isTests() {
25
- const jest = process.env.JEST_WORKER_ID !== undefined;
26
- const vitest = process.env.VITEST_WORKER_ID !== undefined;
27
- return jest || vitest;
28
- }
29
6
  export function log(...args) {
30
7
  if (LOGGING_ENABLED) {
31
8
  console.log(...args);
@@ -0,0 +1,5 @@
1
+ import { SystemType } from '../types/SystemType.js';
2
+ import { Architecture } from '../types/Architecture.js';
3
+ export declare function getArchitecture(): Architecture;
4
+ export declare function getSystem(): SystemType;
5
+ export declare function isTests(): boolean;
@@ -0,0 +1,23 @@
1
+ import { SystemType } from '../types/SystemType.js';
2
+ import { Architecture } from '../types/Architecture.js';
3
+ export function getArchitecture() {
4
+ if (process.arch === 'arm')
5
+ return Architecture.Arm32;
6
+ if (process.arch === 'arm64')
7
+ return Architecture.Arm64;
8
+ if (process.arch === 'ia32')
9
+ return Architecture.X32;
10
+ return Architecture.X64;
11
+ }
12
+ export function getSystem() {
13
+ if (process.platform === 'win32')
14
+ return SystemType.Windows;
15
+ else if (process.platform === 'darwin')
16
+ return SystemType.Macintosh;
17
+ return SystemType.Linux;
18
+ }
19
+ export function isTests() {
20
+ const jest = process.env.JEST_WORKER_ID !== undefined;
21
+ const vitest = process.env.VITEST_WORKER_ID !== undefined;
22
+ return jest || vitest;
23
+ }
@@ -18,6 +18,7 @@ export * from './helpers/config.js';
18
18
  export * from './helpers/package.js';
19
19
  export * from './helpers/registry.js';
20
20
  export * from './helpers/utils.js';
21
+ // export * from './helpers/utilsLocal.js';
21
22
  // Types
22
23
  export * from './types/Architecture.js';
23
24
  export * from './types/Config.js';
package/build/index.d.ts CHANGED
@@ -11,6 +11,7 @@ export * from './helpers/file.js';
11
11
  export * from './helpers/package.js';
12
12
  export * from './helpers/registry.js';
13
13
  export * from './helpers/utils.js';
14
+ export * from './helpers/utilsLocal.js';
14
15
  export * from './types/Architecture.js';
15
16
  export * from './types/Config.js';
16
17
  export * from './types/File.js';
package/build/index.js CHANGED
@@ -18,6 +18,7 @@ export * from './helpers/file.js';
18
18
  export * from './helpers/package.js';
19
19
  export * from './helpers/registry.js';
20
20
  export * from './helpers/utils.js';
21
+ export * from './helpers/utilsLocal.js';
21
22
  // Types
22
23
  export * from './types/Architecture.js';
23
24
  export * from './types/Config.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-audio-stack/core",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "Open-source audio plugin management software",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",