depflow 1.0.0

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/.gitignore ADDED
@@ -0,0 +1,7 @@
1
+ # Build setting
2
+ **/node_modules/
3
+ **/build/
4
+ **/.**
5
+ **/*.log
6
+ **/*.env
7
+ !.gitignore
package/LICENCE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2025 - 2026 NetFeez
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # 🚀 Dependency Flow
2
+
3
+ This project provides a lightweight, straightforward dependency manager that leverages Git repositories. It's designed for simplicity and efficiency, allowing you to manage project dependencies directly from their source repositories without the complexity of larger package managers.
4
+
5
+ This tool is actively used in real-world projects, which ensures it is continuously improved and enhanced with practical features based on actual usage.
6
+
7
+ ---
8
+
9
+ # 💾 Installation
10
+
11
+ Install the Dependency Manager globally using **npm**:
12
+
13
+ ```console
14
+ npm install -g depflow
15
+ ```
16
+
17
+ > [!NOTE]
18
+ > A global installation (`-g`) makes the `dep` command available from any directory in your terminal.
19
+
20
+ ---
21
+
22
+ # 💻 CLI Usage
23
+
24
+ You can interact with the dependency flow in two ways:
25
+
26
+ 1. **Interactive Mode**: Run `dep` without any arguments to open an interactive command-line interface.
27
+ 2. **Direct Command**: Execute commands directly, for example: `dep list`.
28
+
29
+ ### Commands
30
+
31
+ | Command | Usage | Description |
32
+ |---|---|---|
33
+ | `list` | `dep list` | Lists all dependencies configured in `dep.NetFeez-Labs.json`. |
34
+ | `add` | `dep add <repo_url> [name]` | Adds a new dependency to your configuration. |
35
+ | `remove`| `dep remove <name_or_repo_url>` | Removes a dependency using its name or repository URL. |
36
+ | `install`| `dep install [name...]`| Clones and sets up all dependencies, or specific ones. |
37
+ | `uninstall`| `dep uninstall [name...]`| Removes the files of all, or specific, dependencies. |
38
+
39
+ ---
40
+
41
+ # ⚙️ Configuration File (`depFlow.json`)
42
+
43
+ All dependencies are defined in a `dep.NetFeez-Labs.json` file located in your project's root directory. This file contains a JSON array of dependency objects.
44
+
45
+ ## Schema and Examples
46
+
47
+ Here’s a look at the structure of a `dep.NetFeez-Labs.json` file:
48
+
49
+ ```json
50
+ [
51
+ {
52
+ "name": "my-library",
53
+ "repo": "https://github.com/user/my-library.git",
54
+ "branch": "main",
55
+ "builder": [ { "move": "libs/my-library"} ]
56
+ },
57
+ {
58
+ "name": "another-dependency",
59
+ "repo": "https://github.com/user/another.git",
60
+ "builder": [
61
+ { "run": "npm install" },
62
+ { "run": [
63
+ "npm run compile",
64
+ "npm run normalize"
65
+ ] }
66
+ {
67
+ "move": {
68
+ "out": {
69
+ "src/": "public/js/another-dep/",
70
+ "assets/css/": "public/css/"
71
+ }
72
+ }
73
+ }
74
+ ]
75
+ }
76
+ ]
77
+ ```
78
+
79
+ ## Fields Explained
80
+
81
+ * **`name`** (string): A unique identifier for the dependency. If you don't provide one with the `add` command, a name will be generated from the repository URL.
82
+ * **`repo`** (string): The full HTTPS or SSH URL for the Git repository.
83
+ * **`branch`** (string, optional): The name of the branch you want to clone. If omitted, the repository's default branch is used.
84
+ * **`build`: an array to indicate a pipeline to build the repository.
85
+ * **`builder[].run`** (string | string[]): defines a command or list of commands.
86
+ * **`builder[].move`** (string | string[] | object, optional): Defines where the dependency's files should be placed.
87
+ * **As a string**: The entire repository is cloned into this single path.
88
+ * **As a string array**: The repository content is copied to each path in the array.
89
+ * **As an object**: A map where keys are source paths within the repository and values are the destination paths in your project. You can use `'/'` as a key to refer to the repository's root.
@@ -0,0 +1,99 @@
1
+ import { ChildProcessWithoutNullStreams } from "child_process";
2
+ export declare class Dependency implements Dependency.Dependency {
3
+ static include: string[];
4
+ readonly name: string;
5
+ readonly repo: Dependency.repo;
6
+ readonly branch?: string;
7
+ readonly builder?: Dependency.Builder;
8
+ /**
9
+ * Create a new dependency
10
+ * @param dependency Dependency to create
11
+ * @param logger Logger to use
12
+ * @returns New dependency
13
+ */
14
+ constructor(dependency: Dependency.Dependency);
15
+ /** Get the folder of the dependency */
16
+ get folder(): string;
17
+ /**
18
+ * Clone a dependency
19
+ * @param options Options to use
20
+ * @returns Promise<void>
21
+ */
22
+ clone(options?: Dependency.manageOptions): Promise<string>;
23
+ /**
24
+ * Pull a dependency
25
+ * @returns Promise<void>
26
+ */
27
+ pull(): Promise<string>;
28
+ /**
29
+ * Install a dependency
30
+ * @param options Options to use
31
+ * @returns Promise<void>
32
+ */
33
+ install(): Promise<string[]>;
34
+ /**
35
+ * Uninstall a dependency
36
+ * @returns Promise<void>
37
+ */
38
+ uninstall(): Promise<string[]>;
39
+ protected build(): Promise<string[]>;
40
+ protected move(move: Dependency.Builder.MoveType): Promise<string[]>;
41
+ /**
42
+ * Execute multiple commands in a shell
43
+ * @param commands Commands to execute
44
+ * @param customShell Custom shell to use (optional)
45
+ * @returns Output of the commands
46
+ */
47
+ protected executeCommands(commands: string[], shell: ChildProcessWithoutNullStreams): Promise<string[]>;
48
+ /**
49
+ * Execute a command in a shell
50
+ * @param shell Shell to execute the command in
51
+ * @param command Command to execute
52
+ * @returns Output of the command
53
+ */
54
+ protected executeCommand(shell: ChildProcessWithoutNullStreams, command: string): Promise<string[]>;
55
+ /**
56
+ * Move files from a dependency
57
+ * @param destination Destination folder
58
+ * @param source Source folder
59
+ * @returns The output of the operation
60
+ */
61
+ protected moveFiles(destination: string | string[], source?: string): Promise<string[]>;
62
+ /**
63
+ * Get the source path of a dependency
64
+ * @param source Source path
65
+ * @returns Source path
66
+ */
67
+ static getSourcePath(folder: string, source?: string): string;
68
+ /**
69
+ * Get all folders of a dependency
70
+ * @param builder Builder to get folders from
71
+ * @returns Folders
72
+ */
73
+ static getAllOutFolders(builder: Dependency.Builder.MoveType): string[];
74
+ }
75
+ export declare namespace Dependency {
76
+ type logCallback = (messages: string[]) => void;
77
+ type repo = `https://github.com/${string}/${string}.git`;
78
+ namespace Builder {
79
+ interface Move {
80
+ [key: string]: string | string[];
81
+ }
82
+ type MoveType = string | string[] | Move;
83
+ interface Step {
84
+ run?: string | string[] | undefined;
85
+ move?: MoveType;
86
+ }
87
+ }
88
+ type Builder = Builder.Step[];
89
+ interface Dependency {
90
+ name: string;
91
+ repo: repo;
92
+ branch?: string;
93
+ builder?: Builder;
94
+ }
95
+ interface manageOptions {
96
+ force?: boolean;
97
+ }
98
+ }
99
+ export default Dependency;
@@ -0,0 +1,258 @@
1
+ /**
2
+ * @author NetFeez <codefeez.dev@gmail.com>
3
+ * @description Dependency utility.
4
+ * @license Apache-2.0
5
+ */
6
+ import { promises as FS } from "fs";
7
+ import { spawn } from "child_process";
8
+ import Git from "./Git.js";
9
+ import File from "./File.js";
10
+ export class Dependency {
11
+ static include = ['*'];
12
+ name;
13
+ repo;
14
+ branch;
15
+ builder;
16
+ /**
17
+ * Create a new dependency
18
+ * @param dependency Dependency to create
19
+ * @param logger Logger to use
20
+ * @returns New dependency
21
+ */
22
+ constructor(dependency) {
23
+ this.name = dependency.name;
24
+ this.repo = dependency.repo;
25
+ this.branch = dependency.branch;
26
+ this.builder = dependency.builder;
27
+ }
28
+ /** Get the folder of the dependency */
29
+ get folder() {
30
+ return this.name.startsWith('.') ? this.name : `.dep/${this.name}`;
31
+ }
32
+ /**
33
+ * Clone a dependency
34
+ * @param options Options to use
35
+ * @returns Promise<void>
36
+ */
37
+ async clone(options = {}) {
38
+ if (await File.exists(this.folder)) {
39
+ if (!options.force)
40
+ return await this.pull();
41
+ else
42
+ await this.uninstall();
43
+ }
44
+ return await Git.clone(this.repo, this.folder, this.branch);
45
+ }
46
+ /**
47
+ * Pull a dependency
48
+ * @returns Promise<void>
49
+ */
50
+ async pull() {
51
+ return await Git.pull(this.folder, this.branch);
52
+ }
53
+ /**
54
+ * Install a dependency
55
+ * @param options Options to use
56
+ * @returns Promise<void>
57
+ */
58
+ async install() {
59
+ const output = [];
60
+ try {
61
+ const cloneResult = await this.clone();
62
+ output.push(cloneResult);
63
+ const buildResult = await this.build();
64
+ output.push(...buildResult);
65
+ return output;
66
+ }
67
+ catch (error) {
68
+ throw error;
69
+ }
70
+ }
71
+ /**
72
+ * Uninstall a dependency
73
+ * @returns Promise<void>
74
+ */
75
+ async uninstall() {
76
+ try {
77
+ const output = [];
78
+ const moves = this.builder
79
+ ? this.builder
80
+ .map(step => step.move ? Dependency.getAllOutFolders(step.move) : [])
81
+ .reduce((acc, val) => acc.concat(val), [])
82
+ : [];
83
+ const folders = [this.folder, ...moves];
84
+ for (const folder of folders) {
85
+ if (!await File.exists(folder))
86
+ continue;
87
+ output.push(`Removing &C4${folder}`);
88
+ await FS.rm(folder, { recursive: true });
89
+ }
90
+ return output;
91
+ }
92
+ catch (error) {
93
+ throw error;
94
+ }
95
+ }
96
+ async build() {
97
+ const output = [];
98
+ if (!this.builder || this.builder.length === 0)
99
+ return output;
100
+ const shell = spawn('/bin/bash', [], {
101
+ stdio: ['pipe', 'pipe', 'pipe']
102
+ });
103
+ try {
104
+ for (const step of this.builder) {
105
+ if (step.run) {
106
+ const run = typeof step.run === 'string' ? [step.run] : step.run;
107
+ const commands = [`cd ${this.folder}`, ...run];
108
+ const results = await this.executeCommands(commands, shell);
109
+ output.push(...results);
110
+ }
111
+ if (step.move) {
112
+ const moveResults = await this.move(step.move);
113
+ output.push(...moveResults);
114
+ }
115
+ }
116
+ }
117
+ catch (error) {
118
+ throw error;
119
+ }
120
+ finally {
121
+ shell.kill();
122
+ }
123
+ return output;
124
+ }
125
+ async move(move) {
126
+ const output = [];
127
+ if (typeof move === 'string' || Array.isArray(move)) {
128
+ const moves = Array.isArray(move) ? move : [move];
129
+ for (const destination of moves) {
130
+ const moveResult = await this.moveFiles(destination);
131
+ output.push(...moveResult);
132
+ }
133
+ }
134
+ else {
135
+ for (const key in move) {
136
+ const value = move[key];
137
+ const destinations = typeof value === 'string' ? [value] : value;
138
+ for (const destination of destinations) {
139
+ const moveResult = await this.moveFiles(destination, key);
140
+ output.push(...moveResult);
141
+ }
142
+ }
143
+ }
144
+ return output;
145
+ }
146
+ /**
147
+ * Execute multiple commands in a shell
148
+ * @param commands Commands to execute
149
+ * @param customShell Custom shell to use (optional)
150
+ * @returns Output of the commands
151
+ */
152
+ async executeCommands(commands, shell) {
153
+ const output = [];
154
+ shell.stderr.on('data', data => output.push(data.toString()));
155
+ for (const command of commands) {
156
+ const result = await this.executeCommand(shell, command);
157
+ output.push(...result);
158
+ }
159
+ shell.kill();
160
+ return output;
161
+ }
162
+ /**
163
+ * Execute a command in a shell
164
+ * @param shell Shell to execute the command in
165
+ * @param command Command to execute
166
+ * @returns Output of the command
167
+ */
168
+ async executeCommand(shell, command) {
169
+ const output = [];
170
+ output.push(`&RRunning command &C4${command}`);
171
+ await new Promise((resolve, reject) => {
172
+ shell.stdin.write(command + '\n');
173
+ const marker = `__END_${Date.now()}__`;
174
+ shell.stdin.write(`echo ${marker}\n`);
175
+ let out = '';
176
+ const listener = (data) => {
177
+ if (data.toString().includes(marker)) {
178
+ shell.stdout.off('data', listener);
179
+ output.push(out.trim());
180
+ resolve();
181
+ }
182
+ else
183
+ out += data.toString().trim();
184
+ };
185
+ shell.stdout.on('data', listener);
186
+ shell.stderr.once('data', data => {
187
+ shell.stdout.off('data', listener);
188
+ output.push(data.toString().trim());
189
+ reject(new Error(`Command "${command}" failed with error: ${data.toString().trim()}`));
190
+ });
191
+ });
192
+ return output;
193
+ }
194
+ /**
195
+ * Move files from a dependency
196
+ * @param destination Destination folder
197
+ * @param source Source folder
198
+ * @returns The output of the operation
199
+ */
200
+ async moveFiles(destination, source) {
201
+ const output = [];
202
+ destination = Array.isArray(destination) ? destination : [destination];
203
+ source = Dependency.getSourcePath(this.folder, source);
204
+ for (const folder of destination) {
205
+ try {
206
+ if (!await File.exists(source))
207
+ throw new Error(`Source path ${source} does not exist.`);
208
+ if (!await File.exists(folder)) {
209
+ if (!await File.isFile(source))
210
+ await FS.mkdir(folder, { recursive: true });
211
+ else {
212
+ const toCreate = folder.slice(0, folder.lastIndexOf('/'));
213
+ if (!await File.exists(toCreate))
214
+ await FS.mkdir(toCreate, { recursive: true });
215
+ }
216
+ }
217
+ output.push(`&RMoving source &C4${source} &Rto &C4${folder}`);
218
+ await FS.cp(source, folder, { recursive: true, force: true });
219
+ }
220
+ catch (error) {
221
+ throw new Error(`Failed to move files from ${this.name} to ${folder}, \n${error}`);
222
+ }
223
+ }
224
+ return output;
225
+ }
226
+ /**
227
+ * Get the source path of a dependency
228
+ * @param source Source path
229
+ * @returns Source path
230
+ */
231
+ static getSourcePath(folder, source) {
232
+ folder = folder.endsWith('/') ? folder.slice(0, -1) : folder;
233
+ if (!source)
234
+ return folder;
235
+ source = source.startsWith('/') ? source.slice(1) : source;
236
+ return `${folder}/${source}`.replace(/ /g, '\\ ');
237
+ }
238
+ /**
239
+ * Get all folders of a dependency
240
+ * @param builder Builder to get folders from
241
+ * @returns Folders
242
+ */
243
+ static getAllOutFolders(builder) {
244
+ const folders = [];
245
+ if (typeof builder === 'string')
246
+ folders.push(builder);
247
+ else if (Array.isArray(builder))
248
+ folders.push(...builder);
249
+ else
250
+ for (const key in builder) {
251
+ const out = this.getAllOutFolders(builder[key]);
252
+ folders.push(...out);
253
+ }
254
+ return folders;
255
+ }
256
+ }
257
+ export default Dependency;
258
+ //# sourceMappingURL=Dependency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dependency.js","sourceRoot":"","sources":["../src/Dependency.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,IAAI,CAAC;AACpC,OAAO,EAAgD,KAAK,EAAE,MAAM,eAAe,CAAC;AAEpF,OAAO,GAAG,MAAM,UAAU,CAAC;AAC3B,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,MAAM,OAAO,UAAU;IACZ,MAAM,CAAC,OAAO,GAAa,CAAE,GAAG,CAAE,CAAC;IAC1B,IAAI,CAAS;IACb,IAAI,CAAkB;IACtB,MAAM,CAAU;IAChB,OAAO,CAAsB;IAC7C;;;;;OAKG;IACH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