@open-audio-stack/core 0.0.1
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/LICENSE +121 -0
- package/README.md +43 -0
- package/build/Config.d.ts +39 -0
- package/build/Config.js +93 -0
- package/build/FileSystem.d.ts +33 -0
- package/build/FileSystem.js +201 -0
- package/build/Registry.d.ts +22 -0
- package/build/Registry.js +98 -0
- package/build/index-browser.d.ts +21 -0
- package/build/index-browser.js +27 -0
- package/build/index.d.ts +22 -0
- package/build/index.js +28 -0
- package/build/types/Architecture.d.ts +12 -0
- package/build/types/Architecture.js +29 -0
- package/build/types/Config.d.ts +2 -0
- package/build/types/Config.js +1 -0
- package/build/types/File.d.ts +13 -0
- package/build/types/File.js +1 -0
- package/build/types/FileFormat.d.ts +15 -0
- package/build/types/FileFormat.js +47 -0
- package/build/types/FileType.d.ts +10 -0
- package/build/types/FileType.js +17 -0
- package/build/types/License.d.ts +56 -0
- package/build/types/License.js +293 -0
- package/build/types/Package.d.ts +38 -0
- package/build/types/Package.js +6 -0
- package/build/types/Plugin.d.ts +11 -0
- package/build/types/Plugin.js +1 -0
- package/build/types/PluginFormat.d.ts +20 -0
- package/build/types/PluginFormat.js +77 -0
- package/build/types/PluginType.d.ts +13 -0
- package/build/types/PluginType.js +35 -0
- package/build/types/Preset.d.ts +15 -0
- package/build/types/Preset.js +1 -0
- package/build/types/PresetFormat.d.ts +13 -0
- package/build/types/PresetFormat.js +35 -0
- package/build/types/PresetType.d.ts +9 -0
- package/build/types/PresetType.js +12 -0
- package/build/types/Project.d.ts +15 -0
- package/build/types/Project.js +1 -0
- package/build/types/ProjectFormat.d.ts +17 -0
- package/build/types/ProjectFormat.js +59 -0
- package/build/types/ProjectType.d.ts +15 -0
- package/build/types/ProjectType.js +47 -0
- package/build/types/Registry.d.ts +10 -0
- package/build/types/Registry.js +1 -0
- package/build/types/System.d.ts +6 -0
- package/build/types/System.js +1 -0
- package/build/types/SystemType.d.ts +11 -0
- package/build/types/SystemType.js +23 -0
- package/package.json +64 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Creative Commons Legal Code
|
|
2
|
+
|
|
3
|
+
CC0 1.0 Universal
|
|
4
|
+
|
|
5
|
+
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
|
6
|
+
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
|
7
|
+
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
|
8
|
+
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
|
9
|
+
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
|
10
|
+
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
|
11
|
+
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
|
12
|
+
HEREUNDER.
|
|
13
|
+
|
|
14
|
+
Statement of Purpose
|
|
15
|
+
|
|
16
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
17
|
+
exclusive Copyright and Related Rights (defined below) upon the creator
|
|
18
|
+
and subsequent owner(s) (each and all, an "owner") of an original work of
|
|
19
|
+
authorship and/or a database (each, a "Work").
|
|
20
|
+
|
|
21
|
+
Certain owners wish to permanently relinquish those rights to a Work for
|
|
22
|
+
the purpose of contributing to a commons of creative, cultural and
|
|
23
|
+
scientific works ("Commons") that the public can reliably and without fear
|
|
24
|
+
of later claims of infringement build upon, modify, incorporate in other
|
|
25
|
+
works, reuse and redistribute as freely as possible in any form whatsoever
|
|
26
|
+
and for any purposes, including without limitation commercial purposes.
|
|
27
|
+
These owners may contribute to the Commons to promote the ideal of a free
|
|
28
|
+
culture and the further production of creative, cultural and scientific
|
|
29
|
+
works, or to gain reputation or greater distribution for their Work in
|
|
30
|
+
part through the use and efforts of others.
|
|
31
|
+
|
|
32
|
+
For these and/or other purposes and motivations, and without any
|
|
33
|
+
expectation of additional consideration or compensation, the person
|
|
34
|
+
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
|
35
|
+
is an owner of Copyright and Related Rights in the Work, voluntarily
|
|
36
|
+
elects to apply CC0 to the Work and publicly distribute the Work under its
|
|
37
|
+
terms, with knowledge of his or her Copyright and Related Rights in the
|
|
38
|
+
Work and the meaning and intended legal effect of CC0 on those rights.
|
|
39
|
+
|
|
40
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
41
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
42
|
+
Related Rights"). Copyright and Related Rights include, but are not
|
|
43
|
+
limited to, the following:
|
|
44
|
+
|
|
45
|
+
i. the right to reproduce, adapt, distribute, perform, display,
|
|
46
|
+
communicate, and translate a Work;
|
|
47
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
48
|
+
iii. publicity and privacy rights pertaining to a person's image or
|
|
49
|
+
likeness depicted in a Work;
|
|
50
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
51
|
+
subject to the limitations in paragraph 4(a), below;
|
|
52
|
+
v. rights protecting the extraction, dissemination, use and reuse of data
|
|
53
|
+
in a Work;
|
|
54
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
55
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
56
|
+
protection of databases, and under any national implementation
|
|
57
|
+
thereof, including any amended or successor version of such
|
|
58
|
+
directive); and
|
|
59
|
+
vii. other similar, equivalent or corresponding rights throughout the
|
|
60
|
+
world based on applicable law or treaty, and any national
|
|
61
|
+
implementations thereof.
|
|
62
|
+
|
|
63
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention
|
|
64
|
+
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
|
65
|
+
irrevocably and unconditionally waives, abandons, and surrenders all of
|
|
66
|
+
Affirmer's Copyright and Related Rights and associated claims and causes
|
|
67
|
+
of action, whether now known or unknown (including existing as well as
|
|
68
|
+
future claims and causes of action), in the Work (i) in all territories
|
|
69
|
+
worldwide, (ii) for the maximum duration provided by applicable law or
|
|
70
|
+
treaty (including future time extensions), (iii) in any current or future
|
|
71
|
+
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
|
72
|
+
including without limitation commercial, advertising or promotional
|
|
73
|
+
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
|
74
|
+
member of the public at large and to the detriment of Affirmer's heirs and
|
|
75
|
+
successors, fully intending that such Waiver shall not be subject to
|
|
76
|
+
revocation, rescission, cancellation, termination, or any other legal or
|
|
77
|
+
equitable action to disrupt the quiet enjoyment of the Work by the public
|
|
78
|
+
as contemplated by Affirmer's express Statement of Purpose.
|
|
79
|
+
|
|
80
|
+
3. Public License Fallback. Should any part of the Waiver for any reason
|
|
81
|
+
be judged legally invalid or ineffective under applicable law, then the
|
|
82
|
+
Waiver shall be preserved to the maximum extent permitted taking into
|
|
83
|
+
account Affirmer's express Statement of Purpose. In addition, to the
|
|
84
|
+
extent the Waiver is so judged Affirmer hereby grants to each affected
|
|
85
|
+
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
|
86
|
+
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
|
87
|
+
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
|
88
|
+
maximum duration provided by applicable law or treaty (including future
|
|
89
|
+
time extensions), (iii) in any current or future medium and for any number
|
|
90
|
+
of copies, and (iv) for any purpose whatsoever, including without
|
|
91
|
+
limitation commercial, advertising or promotional purposes (the
|
|
92
|
+
"License"). The License shall be deemed effective as of the date CC0 was
|
|
93
|
+
applied by Affirmer to the Work. Should any part of the License for any
|
|
94
|
+
reason be judged legally invalid or ineffective under applicable law, such
|
|
95
|
+
partial invalidity or ineffectiveness shall not invalidate the remainder
|
|
96
|
+
of the License, and in such case Affirmer hereby affirms that he or she
|
|
97
|
+
will not (i) exercise any of his or her remaining Copyright and Related
|
|
98
|
+
Rights in the Work or (ii) assert any associated claims and causes of
|
|
99
|
+
action with respect to the Work, in either case contrary to Affirmer's
|
|
100
|
+
express Statement of Purpose.
|
|
101
|
+
|
|
102
|
+
4. Limitations and Disclaimers.
|
|
103
|
+
|
|
104
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
105
|
+
surrendered, licensed or otherwise affected by this document.
|
|
106
|
+
b. Affirmer offers the Work as-is and makes no representations or
|
|
107
|
+
warranties of any kind concerning the Work, express, implied,
|
|
108
|
+
statutory or otherwise, including without limitation warranties of
|
|
109
|
+
title, merchantability, fitness for a particular purpose, non
|
|
110
|
+
infringement, or the absence of latent or other defects, accuracy, or
|
|
111
|
+
the present or absence of errors, whether or not discoverable, all to
|
|
112
|
+
the greatest extent permissible under applicable law.
|
|
113
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
114
|
+
that may apply to the Work or any use thereof, including without
|
|
115
|
+
limitation any person's Copyright and Related Rights in the Work.
|
|
116
|
+
Further, Affirmer disclaims responsibility for obtaining any necessary
|
|
117
|
+
consents, permissions or other rights required for any use of the
|
|
118
|
+
Work.
|
|
119
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a
|
|
120
|
+
party to this document and has no duty or obligation with respect to
|
|
121
|
+
this CC0 or use of the Work.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# open-audio-stack-core
|
|
2
|
+
|
|
3
|
+
Open-source audio plugin management software using:
|
|
4
|
+
|
|
5
|
+
- NodeJS 20.x
|
|
6
|
+
- TypeScript 5.x
|
|
7
|
+
- eslint 9.x
|
|
8
|
+
- prettier 3.x
|
|
9
|
+
- vitest 1.x
|
|
10
|
+
|
|
11
|
+
## Installation
|
|
12
|
+
|
|
13
|
+
Install dependencies using:
|
|
14
|
+
|
|
15
|
+
npm install
|
|
16
|
+
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
Run dev commands using:
|
|
20
|
+
|
|
21
|
+
npm run lint
|
|
22
|
+
npm run format
|
|
23
|
+
npm run dev
|
|
24
|
+
npm test
|
|
25
|
+
|
|
26
|
+
Create a build using:
|
|
27
|
+
|
|
28
|
+
npm run build
|
|
29
|
+
|
|
30
|
+
## Deployment
|
|
31
|
+
|
|
32
|
+
This package is versioned using git tags:
|
|
33
|
+
|
|
34
|
+
npm version patch
|
|
35
|
+
git push && git push origin --tags
|
|
36
|
+
|
|
37
|
+
GitHub Actions will automatically publish the package to npm:
|
|
38
|
+
|
|
39
|
+
https://www.npmjs.com/package/@open-audio-stack/core
|
|
40
|
+
|
|
41
|
+
## Contact
|
|
42
|
+
|
|
43
|
+
For more information please contact kmturley
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Architecture } from './types/Architecture.js';
|
|
2
|
+
import { ConfigInterface } from './types/Config.js';
|
|
3
|
+
import { FileFormat } from './types/FileFormat.js';
|
|
4
|
+
import { FileType } from './types/FileType.js';
|
|
5
|
+
import { License } from './types/License.js';
|
|
6
|
+
import { PluginFormat } from './types/PluginFormat.js';
|
|
7
|
+
import { PluginType } from './types/PluginType.js';
|
|
8
|
+
import { PresetFormat } from './types/PresetFormat.js';
|
|
9
|
+
import { PresetType } from './types/PresetType.js';
|
|
10
|
+
import { ProjectFormat } from './types/ProjectFormat.js';
|
|
11
|
+
import { ProjectType } from './types/ProjectType.js';
|
|
12
|
+
import { SystemType } from './types/SystemType.js';
|
|
13
|
+
export default class Config {
|
|
14
|
+
config: ConfigInterface;
|
|
15
|
+
constructor(config: ConfigInterface);
|
|
16
|
+
get(): ConfigInterface;
|
|
17
|
+
architecture(type: Architecture): import("./types/Architecture.js").ArchitectureOption;
|
|
18
|
+
architectures(): import("./types/Architecture.js").ArchitectureOption[];
|
|
19
|
+
fileFormat(format: FileFormat): import("./types/FileFormat.js").FileFormatOption;
|
|
20
|
+
fileFormats(): import("./types/FileFormat.js").FileFormatOption[];
|
|
21
|
+
fileType(type: FileType): import("./types/FileType.js").FileTypeOption;
|
|
22
|
+
fileTypes(): import("./types/FileType.js").FileTypeOption[];
|
|
23
|
+
license(type: License): import("./types/License.js").LicenseOption;
|
|
24
|
+
licenses(): import("./types/License.js").LicenseOption[];
|
|
25
|
+
pluginFormat(format: PluginFormat): import("./types/PluginFormat.js").PluginFormatOption;
|
|
26
|
+
pluginFormats(): import("./types/PluginFormat.js").PluginFormatOption[];
|
|
27
|
+
pluginType(type: PluginType): import("./types/PluginType.js").PluginTypeOption;
|
|
28
|
+
pluginTypes(): import("./types/PluginType.js").PluginTypeOption[];
|
|
29
|
+
presetFormat(format: PresetFormat): import("./types/PresetFormat.js").PresetFormatOption;
|
|
30
|
+
presetFormats(): import("./types/PresetFormat.js").PresetFormatOption[];
|
|
31
|
+
presetType(type: PresetType): import("./types/PresetType.js").PresetTypeOption;
|
|
32
|
+
presetTypes(): import("./types/PresetType.js").PresetTypeOption[];
|
|
33
|
+
projectFormat(format: ProjectFormat): import("./types/ProjectFormat.js").ProjectFormatOption;
|
|
34
|
+
projectFormats(): import("./types/ProjectFormat.js").ProjectFormatOption[];
|
|
35
|
+
projectType(type: ProjectType): import("./types/ProjectType.js").ProjectTypeOption;
|
|
36
|
+
projectTypes(): import("./types/ProjectType.js").ProjectTypeOption[];
|
|
37
|
+
system(type: SystemType): import("./types/SystemType.js").SystemTypeOption;
|
|
38
|
+
systems(): import("./types/SystemType.js").SystemTypeOption[];
|
|
39
|
+
}
|
package/build/Config.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { architectures } from './types/Architecture.js';
|
|
2
|
+
import { fileFormats } from './types/FileFormat.js';
|
|
3
|
+
import { fileTypes } from './types/FileType.js';
|
|
4
|
+
import { licenses } from './types/License.js';
|
|
5
|
+
import { pluginFormats } from './types/PluginFormat.js';
|
|
6
|
+
import { pluginTypes } from './types/PluginType.js';
|
|
7
|
+
import { presetFormats } from './types/PresetFormat.js';
|
|
8
|
+
import { presetTypes } from './types/PresetType.js';
|
|
9
|
+
import { projectFormats } from './types/ProjectFormat.js';
|
|
10
|
+
import { projectTypes } from './types/ProjectType.js';
|
|
11
|
+
import { systemTypes } from './types/SystemType.js';
|
|
12
|
+
export default class Config {
|
|
13
|
+
config;
|
|
14
|
+
constructor(config) {
|
|
15
|
+
this.config = config;
|
|
16
|
+
}
|
|
17
|
+
get() {
|
|
18
|
+
return this.config;
|
|
19
|
+
}
|
|
20
|
+
// Architectures.
|
|
21
|
+
architecture(type) {
|
|
22
|
+
return architectures.filter(architecture => type === architecture.value)[0];
|
|
23
|
+
}
|
|
24
|
+
architectures() {
|
|
25
|
+
return architectures;
|
|
26
|
+
}
|
|
27
|
+
// File formats and types.
|
|
28
|
+
fileFormat(format) {
|
|
29
|
+
return fileFormats.filter(fileFormat => format === fileFormat.value)[0];
|
|
30
|
+
}
|
|
31
|
+
fileFormats() {
|
|
32
|
+
return fileFormats;
|
|
33
|
+
}
|
|
34
|
+
fileType(type) {
|
|
35
|
+
return fileTypes.filter(fileType => type === fileType.value)[0];
|
|
36
|
+
}
|
|
37
|
+
fileTypes() {
|
|
38
|
+
return fileTypes;
|
|
39
|
+
}
|
|
40
|
+
// Licenses
|
|
41
|
+
license(type) {
|
|
42
|
+
return licenses.filter(license => type === license.value)[0];
|
|
43
|
+
}
|
|
44
|
+
licenses() {
|
|
45
|
+
return licenses;
|
|
46
|
+
}
|
|
47
|
+
// Plugin formats and types.
|
|
48
|
+
pluginFormat(format) {
|
|
49
|
+
return pluginFormats.filter(pluginFormat => format === pluginFormat.value)[0];
|
|
50
|
+
}
|
|
51
|
+
pluginFormats() {
|
|
52
|
+
return pluginFormats;
|
|
53
|
+
}
|
|
54
|
+
pluginType(type) {
|
|
55
|
+
return pluginTypes.filter(pluginType => type === pluginType.value)[0];
|
|
56
|
+
}
|
|
57
|
+
pluginTypes() {
|
|
58
|
+
return pluginTypes;
|
|
59
|
+
}
|
|
60
|
+
// Preset formats and types.
|
|
61
|
+
presetFormat(format) {
|
|
62
|
+
return presetFormats.filter(presetFormat => format === presetFormat.value)[0];
|
|
63
|
+
}
|
|
64
|
+
presetFormats() {
|
|
65
|
+
return presetFormats;
|
|
66
|
+
}
|
|
67
|
+
presetType(type) {
|
|
68
|
+
return presetTypes.filter(presetType => type === presetType.value)[0];
|
|
69
|
+
}
|
|
70
|
+
presetTypes() {
|
|
71
|
+
return presetTypes;
|
|
72
|
+
}
|
|
73
|
+
// Project formats and types.
|
|
74
|
+
projectFormat(format) {
|
|
75
|
+
return projectFormats.filter(projectFormat => format === projectFormat.value)[0];
|
|
76
|
+
}
|
|
77
|
+
projectFormats() {
|
|
78
|
+
return projectFormats;
|
|
79
|
+
}
|
|
80
|
+
projectType(type) {
|
|
81
|
+
return projectTypes.filter(projectType => type === projectType.value)[0];
|
|
82
|
+
}
|
|
83
|
+
projectTypes() {
|
|
84
|
+
return projectTypes;
|
|
85
|
+
}
|
|
86
|
+
// Systems.
|
|
87
|
+
system(type) {
|
|
88
|
+
return systemTypes.filter(system => type === system.value)[0];
|
|
89
|
+
}
|
|
90
|
+
systems() {
|
|
91
|
+
return systemTypes;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { PackageInterface } from '../src/types/Package.js';
|
|
2
|
+
export default class FileSystem {
|
|
3
|
+
constructor();
|
|
4
|
+
dirApp(): string;
|
|
5
|
+
dirCreate(dir: string): string | false;
|
|
6
|
+
dirDelete(dir: string): false | void;
|
|
7
|
+
dirEmpty(dir: string): boolean;
|
|
8
|
+
dirExists(dir: string): boolean;
|
|
9
|
+
dirIs(dir: string): boolean;
|
|
10
|
+
dirMove(dir: string, dirNew: string): void | boolean;
|
|
11
|
+
dirOpen(dir: string): Buffer;
|
|
12
|
+
dirPackage(pkg: PackageInterface): string;
|
|
13
|
+
dirPlugins(): string;
|
|
14
|
+
dirPresets(): string;
|
|
15
|
+
dirProjects(): string;
|
|
16
|
+
dirRead(dir: string, options?: any): string[];
|
|
17
|
+
dirRename(dir: string, dirNew: string): void | boolean;
|
|
18
|
+
fileCreate(filePath: string, data: string | Buffer): void;
|
|
19
|
+
fileDate(filePath: string): Date;
|
|
20
|
+
fileDelete(filePath: string): boolean | void;
|
|
21
|
+
fileExec(filePath: string): void;
|
|
22
|
+
fileExists(filePath: string): boolean;
|
|
23
|
+
fileJsonCreate(filePath: string, data: object): void;
|
|
24
|
+
fileMove(filePath: string, newPath: string): void | boolean;
|
|
25
|
+
fileOpen(filePath: string): Buffer;
|
|
26
|
+
fileRead(filePath: string): Buffer;
|
|
27
|
+
fileReadJson(filePath: string): any;
|
|
28
|
+
fileReadString(filePath: string): string;
|
|
29
|
+
fileReadYaml(filePath: string): unknown;
|
|
30
|
+
fileSize(filePath: string): number;
|
|
31
|
+
zipCreate(filesPath: string, zipPath: string): void;
|
|
32
|
+
zipExtract(content: any, dirPath: string): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
import AdmZip from 'adm-zip';
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, unlinkSync, writeFileSync, } from 'fs';
|
|
4
|
+
import { globSync } from 'glob';
|
|
5
|
+
import { moveSync } from 'fs-extra/esm';
|
|
6
|
+
import os from 'os';
|
|
7
|
+
import path from 'path';
|
|
8
|
+
import yaml from 'js-yaml';
|
|
9
|
+
export default class FileSystem {
|
|
10
|
+
constructor() { }
|
|
11
|
+
dirApp() {
|
|
12
|
+
if (process.platform === 'win32')
|
|
13
|
+
return process.env.APPDATA || os.homedir();
|
|
14
|
+
else if (process.platform === 'darwin')
|
|
15
|
+
return path.join(os.homedir(), 'Library', 'Preferences');
|
|
16
|
+
return path.join(os.homedir(), '.local', 'share');
|
|
17
|
+
}
|
|
18
|
+
dirCreate(dir) {
|
|
19
|
+
if (!this.dirExists(dir)) {
|
|
20
|
+
console.log('+', dir);
|
|
21
|
+
mkdirSync(dir, { recursive: true });
|
|
22
|
+
return dir;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
dirDelete(dir) {
|
|
27
|
+
if (this.dirExists(dir)) {
|
|
28
|
+
console.log('-', dir);
|
|
29
|
+
return rmSync(dir, { recursive: true });
|
|
30
|
+
}
|
|
31
|
+
return false;
|
|
32
|
+
}
|
|
33
|
+
dirEmpty(dir) {
|
|
34
|
+
const files = readdirSync(dir);
|
|
35
|
+
return files.length === 0 || (files.length === 1 && files[0] === '.DS_Store');
|
|
36
|
+
}
|
|
37
|
+
dirExists(dir) {
|
|
38
|
+
return existsSync(dir);
|
|
39
|
+
}
|
|
40
|
+
dirIs(dir) {
|
|
41
|
+
return statSync(dir).isDirectory();
|
|
42
|
+
}
|
|
43
|
+
dirMove(dir, dirNew) {
|
|
44
|
+
if (this.dirExists(dir)) {
|
|
45
|
+
console.log('-', dir);
|
|
46
|
+
console.log('+', dirNew);
|
|
47
|
+
return moveSync(dir, dirNew, { overwrite: true });
|
|
48
|
+
}
|
|
49
|
+
return false;
|
|
50
|
+
}
|
|
51
|
+
dirOpen(dir) {
|
|
52
|
+
let command = '';
|
|
53
|
+
if (process.env.CI)
|
|
54
|
+
return new Buffer('');
|
|
55
|
+
if (process.platform === 'win32')
|
|
56
|
+
command = 'open';
|
|
57
|
+
else if (process.platform === 'darwin')
|
|
58
|
+
command = 'start ""';
|
|
59
|
+
else
|
|
60
|
+
command = 'xdg-open';
|
|
61
|
+
console.log('⎋', `${command} "${dir}"`);
|
|
62
|
+
return execSync(`${command} "${dir}"`);
|
|
63
|
+
}
|
|
64
|
+
dirPackage(pkg) {
|
|
65
|
+
const parts = pkg.slug.split('/');
|
|
66
|
+
parts.push(pkg.version);
|
|
67
|
+
return path.join(...parts);
|
|
68
|
+
}
|
|
69
|
+
dirPlugins() {
|
|
70
|
+
if (process.platform === 'win32')
|
|
71
|
+
return path.join('Program Files', 'Common Files');
|
|
72
|
+
else if (process.platform === 'darwin')
|
|
73
|
+
return path.join(os.homedir(), 'Library', 'Audio', 'Plug-ins');
|
|
74
|
+
return path.join('usr', 'local', 'lib');
|
|
75
|
+
}
|
|
76
|
+
dirPresets() {
|
|
77
|
+
if (process.platform === 'win32')
|
|
78
|
+
return path.join(os.homedir(), 'Documents', 'VST3 Presets');
|
|
79
|
+
else if (process.platform === 'darwin')
|
|
80
|
+
return path.join(os.homedir(), 'Library', 'Audio', 'Presets');
|
|
81
|
+
return path.join(os.homedir(), '.vst3', 'presets');
|
|
82
|
+
}
|
|
83
|
+
dirProjects() {
|
|
84
|
+
// Windows throws permissions errors if you scan hidden folders
|
|
85
|
+
// Therefore set to a more specific path than Documents
|
|
86
|
+
if (process.platform === 'win32')
|
|
87
|
+
return path.join(os.homedir(), 'Documents', 'Audio');
|
|
88
|
+
else if (process.platform === 'darwin')
|
|
89
|
+
return path.join(os.homedir(), 'Documents', 'Audio');
|
|
90
|
+
return path.join(os.homedir(), 'Documents', 'Audio');
|
|
91
|
+
}
|
|
92
|
+
dirRead(dir, options) {
|
|
93
|
+
console.log('⌕', dir);
|
|
94
|
+
// Glob now expects forward slashes on Windows
|
|
95
|
+
// Convert backslashes from path.join() to forwardslashes
|
|
96
|
+
if (process.platform === 'win32') {
|
|
97
|
+
dir = dir.replace(/\\/g, '/');
|
|
98
|
+
}
|
|
99
|
+
return globSync(dir, options);
|
|
100
|
+
}
|
|
101
|
+
dirRename(dir, dirNew) {
|
|
102
|
+
if (this.dirExists(dir)) {
|
|
103
|
+
return moveSync(dir, dirNew, { overwrite: true });
|
|
104
|
+
}
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
fileCreate(filePath, data) {
|
|
108
|
+
console.log('+', filePath);
|
|
109
|
+
return writeFileSync(filePath, data);
|
|
110
|
+
}
|
|
111
|
+
fileDate(filePath) {
|
|
112
|
+
return statSync(filePath).mtime;
|
|
113
|
+
}
|
|
114
|
+
fileDelete(filePath) {
|
|
115
|
+
if (this.fileExists(filePath)) {
|
|
116
|
+
console.log('-', filePath);
|
|
117
|
+
return unlinkSync(filePath);
|
|
118
|
+
}
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
fileExec(filePath) {
|
|
122
|
+
return chmodSync(filePath, '755');
|
|
123
|
+
}
|
|
124
|
+
fileExists(filePath) {
|
|
125
|
+
return existsSync(filePath);
|
|
126
|
+
}
|
|
127
|
+
fileJsonCreate(filePath, data) {
|
|
128
|
+
return this.fileCreate(filePath, JSON.stringify(data, null, 2));
|
|
129
|
+
}
|
|
130
|
+
fileMove(filePath, newPath) {
|
|
131
|
+
if (this.fileExists(filePath)) {
|
|
132
|
+
console.log('-', filePath);
|
|
133
|
+
console.log('+', newPath);
|
|
134
|
+
return moveSync(filePath, newPath, { overwrite: true });
|
|
135
|
+
}
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
fileOpen(filePath) {
|
|
139
|
+
let command = '';
|
|
140
|
+
if (process.env.CI)
|
|
141
|
+
return new Buffer('');
|
|
142
|
+
if (process.platform === 'win32')
|
|
143
|
+
command = 'open';
|
|
144
|
+
else if (process.platform === 'darwin')
|
|
145
|
+
command = 'start ""';
|
|
146
|
+
else
|
|
147
|
+
command = 'xdg-open';
|
|
148
|
+
console.log('⎋', `${command} "${filePath}"`);
|
|
149
|
+
return execSync(`${command} "${filePath}"`);
|
|
150
|
+
}
|
|
151
|
+
fileRead(filePath) {
|
|
152
|
+
console.log('⎋', filePath);
|
|
153
|
+
return readFileSync(filePath);
|
|
154
|
+
}
|
|
155
|
+
fileReadJson(filePath) {
|
|
156
|
+
if (this.fileExists(filePath)) {
|
|
157
|
+
console.log('⎋', filePath);
|
|
158
|
+
return JSON.parse(readFileSync(filePath).toString());
|
|
159
|
+
}
|
|
160
|
+
return false;
|
|
161
|
+
}
|
|
162
|
+
fileReadString(filePath) {
|
|
163
|
+
console.log('⎋', filePath);
|
|
164
|
+
return readFileSync(filePath).toString();
|
|
165
|
+
}
|
|
166
|
+
fileReadYaml(filePath) {
|
|
167
|
+
const file = this.fileReadString(filePath);
|
|
168
|
+
return yaml.load(file);
|
|
169
|
+
}
|
|
170
|
+
fileSize(filePath) {
|
|
171
|
+
return statSync(filePath).size;
|
|
172
|
+
}
|
|
173
|
+
zipCreate(filesPath, zipPath) {
|
|
174
|
+
if (this.fileExists(zipPath)) {
|
|
175
|
+
unlinkSync(zipPath);
|
|
176
|
+
}
|
|
177
|
+
const zip = new AdmZip();
|
|
178
|
+
const pathList = this.dirRead(filesPath);
|
|
179
|
+
pathList.forEach(pathItem => {
|
|
180
|
+
console.log('⎋', pathItem);
|
|
181
|
+
try {
|
|
182
|
+
if (this.dirIs(pathItem)) {
|
|
183
|
+
zip.addLocalFolder(pathItem, path.basename(pathItem));
|
|
184
|
+
}
|
|
185
|
+
else {
|
|
186
|
+
zip.addLocalFile(pathItem);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
console.log(error);
|
|
191
|
+
}
|
|
192
|
+
});
|
|
193
|
+
console.log('+', zipPath);
|
|
194
|
+
return zip.writeZip(zipPath);
|
|
195
|
+
}
|
|
196
|
+
zipExtract(content, dirPath) {
|
|
197
|
+
console.log('⎋', dirPath);
|
|
198
|
+
const zip = new AdmZip(content);
|
|
199
|
+
return zip.extractAllTo(dirPath);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { PackageInterface, PackageValidationError, PackageVersions, PackageVersionType } from './types/Package.js';
|
|
2
|
+
import { RegistryInterface } from './types/Registry.js';
|
|
3
|
+
export default class Registry {
|
|
4
|
+
registry: RegistryInterface;
|
|
5
|
+
constructor(registry: RegistryInterface);
|
|
6
|
+
packageAdd(slug: string): {
|
|
7
|
+
slug: string;
|
|
8
|
+
version: string;
|
|
9
|
+
versions: {};
|
|
10
|
+
};
|
|
11
|
+
packageVersionAdd(slug: string, version: string, pkgVersion: PackageVersionType): void;
|
|
12
|
+
package(slug: string): PackageInterface;
|
|
13
|
+
packages(): import("./types/Registry.js").RegistryPackages;
|
|
14
|
+
packageVersionLatest(versions: PackageVersions): string;
|
|
15
|
+
get(): RegistryInterface;
|
|
16
|
+
name(): string;
|
|
17
|
+
url(): string;
|
|
18
|
+
version(): string;
|
|
19
|
+
packageRemove(slug: string): void;
|
|
20
|
+
packageVersionRemove(slug: string, version: string): void;
|
|
21
|
+
packageVersionValidate(pkgVersion: PackageVersionType): PackageValidationError[];
|
|
22
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as semver from 'semver';
|
|
2
|
+
import { PackageValidation, } from './types/Package.js';
|
|
3
|
+
export default class Registry {
|
|
4
|
+
registry;
|
|
5
|
+
constructor(registry) {
|
|
6
|
+
this.registry = registry;
|
|
7
|
+
}
|
|
8
|
+
packageAdd(slug) {
|
|
9
|
+
return (this.registry.packages[slug] = {
|
|
10
|
+
slug,
|
|
11
|
+
version: '',
|
|
12
|
+
versions: {},
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
packageVersionAdd(slug, version, pkgVersion) {
|
|
16
|
+
let pkg = this.package(slug);
|
|
17
|
+
if (!pkg) {
|
|
18
|
+
pkg = this.packageAdd(slug);
|
|
19
|
+
}
|
|
20
|
+
pkg.versions[version] = pkgVersion;
|
|
21
|
+
pkg.version = this.packageVersionLatest(pkg.versions);
|
|
22
|
+
}
|
|
23
|
+
package(slug) {
|
|
24
|
+
return this.registry.packages[slug];
|
|
25
|
+
}
|
|
26
|
+
packages() {
|
|
27
|
+
return this.registry.packages;
|
|
28
|
+
}
|
|
29
|
+
packageVersionLatest(versions) {
|
|
30
|
+
let latest = '0.0.0';
|
|
31
|
+
Object.keys(versions).forEach((version) => {
|
|
32
|
+
if (semver.gt(version, latest)) {
|
|
33
|
+
latest = version;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
return latest;
|
|
37
|
+
}
|
|
38
|
+
get() {
|
|
39
|
+
return this.registry;
|
|
40
|
+
}
|
|
41
|
+
name() {
|
|
42
|
+
return this.registry.name;
|
|
43
|
+
}
|
|
44
|
+
url() {
|
|
45
|
+
return this.registry.url;
|
|
46
|
+
}
|
|
47
|
+
version() {
|
|
48
|
+
return this.registry.version;
|
|
49
|
+
}
|
|
50
|
+
packageRemove(slug) {
|
|
51
|
+
delete this.registry.packages[slug];
|
|
52
|
+
}
|
|
53
|
+
packageVersionRemove(slug, version) {
|
|
54
|
+
const pkg = this.package(slug);
|
|
55
|
+
if (pkg && pkg.versions[version]) {
|
|
56
|
+
delete pkg.versions[version];
|
|
57
|
+
pkg.version = this.packageVersionLatest(pkg.versions);
|
|
58
|
+
}
|
|
59
|
+
if (!Object.keys(pkg.versions).length) {
|
|
60
|
+
this.packageRemove(slug);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
packageVersionValidate(pkgVersion) {
|
|
64
|
+
const fields = [
|
|
65
|
+
{ name: 'author', type: 'string' },
|
|
66
|
+
{ name: 'changes', type: 'string' },
|
|
67
|
+
{ name: 'date', type: 'string' },
|
|
68
|
+
{ name: 'description', type: 'string' },
|
|
69
|
+
{ name: 'files', type: 'object' },
|
|
70
|
+
{ name: 'license', type: 'string' },
|
|
71
|
+
{ name: 'name', type: 'string' },
|
|
72
|
+
{ name: 'tags', type: 'object' },
|
|
73
|
+
{ name: 'type', type: 'string' },
|
|
74
|
+
{ name: 'url', type: 'string' },
|
|
75
|
+
];
|
|
76
|
+
const errors = [];
|
|
77
|
+
fields.forEach((field) => {
|
|
78
|
+
const versionField = pkgVersion[field.name];
|
|
79
|
+
if (!versionField) {
|
|
80
|
+
errors.push({
|
|
81
|
+
field: field.name,
|
|
82
|
+
error: PackageValidation.MISSING_FIELD,
|
|
83
|
+
valueExpected: field.type,
|
|
84
|
+
valueReceived: 'undefined',
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
else if (typeof versionField !== field.type) {
|
|
88
|
+
errors.push({
|
|
89
|
+
field: field.name,
|
|
90
|
+
error: PackageValidation.INVALID_TYPE,
|
|
91
|
+
valueExpected: field.type,
|
|
92
|
+
valueReceived: typeof versionField,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
});
|
|
96
|
+
return errors;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export * from './Config.js';
|
|
2
|
+
export * from './Registry.js';
|
|
3
|
+
export * from './types/Architecture.js';
|
|
4
|
+
export * from './types/Config.js';
|
|
5
|
+
export * from './types/File.js';
|
|
6
|
+
export * from './types/FileFormat.js';
|
|
7
|
+
export * from './types/FileType.js';
|
|
8
|
+
export * from './types/License.js';
|
|
9
|
+
export * from './types/Package.js';
|
|
10
|
+
export * from './types/Plugin.js';
|
|
11
|
+
export * from './types/PluginFormat.js';
|
|
12
|
+
export * from './types/PluginType.js';
|
|
13
|
+
export * from './types/Preset.js';
|
|
14
|
+
export * from './types/PresetFormat.js';
|
|
15
|
+
export * from './types/PresetType.js';
|
|
16
|
+
export * from './types/Project.js';
|
|
17
|
+
export * from './types/ProjectFormat.js';
|
|
18
|
+
export * from './types/ProjectType.js';
|
|
19
|
+
export * from './types/Registry.js';
|
|
20
|
+
export * from './types/System.js';
|
|
21
|
+
export * from './types/SystemType.js';
|