depflow 3.0.0-dev.4 → 3.0.0-dev.6
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/build/config/schemas.d.ts +2014 -859
- package/build/config/schemas.js +34 -13
- package/build/config/schemas.js.map +1 -1
- package/build/support/Builder/Builder.d.ts +10 -0
- package/build/support/Builder/Builder.js +50 -26
- package/build/support/Builder/Builder.js.map +1 -1
- package/package.json +3 -3
package/build/config/schemas.js
CHANGED
|
@@ -11,19 +11,40 @@ export const TsConfig = Schema.fromObject({
|
|
|
11
11
|
paths: { type: 'object', allowAdditionalProperties: { type: 'array', items: { type: 'string' } } }
|
|
12
12
|
}, allowAdditionalProperties: true }
|
|
13
13
|
}, true);
|
|
14
|
+
export const Transform = new Schema({ type: 'union', union: [
|
|
15
|
+
{ type: 'string' },
|
|
16
|
+
{ type: 'object', properties: {
|
|
17
|
+
search: { type: 'string', required: true },
|
|
18
|
+
flags: { type: 'string', default: 'g', pattern: /^[gimsuy]*$/ },
|
|
19
|
+
replace: { type: 'string', required: true }
|
|
20
|
+
} }
|
|
21
|
+
] });
|
|
22
|
+
export const GlobalTransform = new Schema({ type: 'object', properties: {
|
|
23
|
+
glob: { type: 'string', required: true },
|
|
24
|
+
search: { type: 'string', required: true },
|
|
25
|
+
flags: { type: 'string', default: 'g', pattern: /^[gimsuy]*$/ },
|
|
26
|
+
replace: { type: 'string', required: true }
|
|
27
|
+
} });
|
|
14
28
|
export const ExtractorEntry = Schema.fromObject({
|
|
15
29
|
from: { type: 'string', required: true },
|
|
16
30
|
to: { type: 'string', required: true },
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
replace: { type: 'string', required: true }
|
|
20
|
-
} }], nullable: true }
|
|
21
|
-
});
|
|
22
|
-
export const BuilderEntry = Schema.fromObject({
|
|
23
|
-
maxTimeMs: { type: 'number', default: 60000 },
|
|
24
|
-
run: { type: 'union', union: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }] },
|
|
25
|
-
extract: { type: 'union', union: [{ type: 'string' }, { type: 'array', items: ExtractorEntry.root }] }
|
|
31
|
+
pathReplacer: Transform.root,
|
|
32
|
+
transform: Transform.root
|
|
26
33
|
});
|
|
34
|
+
export const BuilderEntry = new Schema({ type: 'union', required: true, union: [
|
|
35
|
+
{ type: 'object', properties: {
|
|
36
|
+
maxTimeMs: { type: 'number', default: 60000, minimum: -1 },
|
|
37
|
+
allowFails: { type: 'boolean', default: false },
|
|
38
|
+
run: { type: 'union', required: true, union: [{ type: 'string' }, { type: 'array', items: { type: 'string' } }] }
|
|
39
|
+
} },
|
|
40
|
+
{ type: 'object', properties: {
|
|
41
|
+
extract: { type: 'union', required: true, union: [{ type: 'string' }, { type: 'array', items: ExtractorEntry.root }] }
|
|
42
|
+
} },
|
|
43
|
+
{ type: 'object', properties: {
|
|
44
|
+
transform: GlobalTransform.root
|
|
45
|
+
} }
|
|
46
|
+
] });
|
|
47
|
+
export const Builder = new Schema({ type: 'array', default: [], items: BuilderEntry.root });
|
|
27
48
|
export const ResolverEntry = Schema.fromObject({
|
|
28
49
|
alias: { type: 'string', required: true },
|
|
29
50
|
target: { type: 'union', union: [
|
|
@@ -39,13 +60,13 @@ export const GitDependency = Schema.fromObject({
|
|
|
39
60
|
name: { type: 'string', required: true },
|
|
40
61
|
repo: { type: 'string', required: true },
|
|
41
62
|
tag: { type: 'string', default: 'main' },
|
|
42
|
-
builder:
|
|
63
|
+
builder: Builder.root,
|
|
43
64
|
resolver: { type: 'array', nullable: true, default: [], items: ResolverEntry.root }
|
|
44
65
|
});
|
|
45
66
|
export const NpmDependency = Schema.fromObject({
|
|
46
67
|
name: { type: 'string', required: true },
|
|
47
68
|
version: { type: 'string', required: true },
|
|
48
|
-
builder:
|
|
69
|
+
builder: Builder.root,
|
|
49
70
|
resolver: { type: 'array', nullable: true, default: [], items: ResolverEntry.root }
|
|
50
71
|
});
|
|
51
72
|
export const Config = Schema.fromObject({
|
|
@@ -54,7 +75,7 @@ export const Config = Schema.fromObject({
|
|
|
54
75
|
outDir: { type: 'string', default: 'dist' },
|
|
55
76
|
tsconfig: { type: 'string', nullable: true, default: null },
|
|
56
77
|
importmap: { type: 'string', nullable: true, default: null },
|
|
57
|
-
actions: { type: 'object', allowAdditionalProperties:
|
|
78
|
+
actions: { type: 'object', allowAdditionalProperties: Builder.root, default: {} },
|
|
58
79
|
resolver: { type: 'array', default: [], items: ResolverEntry.root },
|
|
59
80
|
dependencies: { type: 'array', default: [], items: GitDependency.root },
|
|
60
81
|
npmDependencies: { type: 'array', default: [], items: NpmDependency.root }
|
|
@@ -62,7 +83,7 @@ export const Config = Schema.fromObject({
|
|
|
62
83
|
export const Schemas = {
|
|
63
84
|
Config,
|
|
64
85
|
TsConfig, ImportMap,
|
|
65
|
-
BuilderEntry, ResolverEntry,
|
|
86
|
+
Builder, BuilderEntry, ResolverEntry,
|
|
66
87
|
GitDependency, NpmDependency
|
|
67
88
|
};
|
|
68
89
|
export default Schemas;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/config/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,CAAC;IACvC,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,yBAAyB,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;IACzE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,yBAAyB,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE;CAC3E,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG,MAAM,CAAC,UAAU,CAAC;IACtC,eAAe,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE;YAC3C,OAAO,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC3B,OAAO,EAAE,E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only logger: Logger | null;
|
|
7
7
|
constructor(info: Builder.Info);
|
|
8
8
|
run(): Promise<void>;
|
|
9
|
+
protected runGlobalTransform(options: Schemas.GlobalTransform['infer']): Promise<void>;
|
|
9
10
|
/**
|
|
10
11
|
* Runs the extraction process based on the provided entry configuration, which can be either a string or an array of extraction entries.
|
|
11
12
|
* It handles the copying of files from the specified source to the target location, applying any necessary path transformations based on the provided replacer configuration.
|
|
@@ -23,8 +24,17 @@ export declare class Builder {
|
|
|
23
24
|
* @throws Will throw an error if any issues occur during the execution of the commands, such as problems with spawning the child process or if any command returns a non-zero exit code.
|
|
24
25
|
*/
|
|
25
26
|
protected runTask(commands: string[], cwd: string, maxTimeMs: number): Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a string replacement function based on the provided replacer configuration, which can be either a simple string or an object defining a search pattern and replacement string. This method is used to generate a function that can be applied to strings for dynamic transformations during the build process, allowing for flexible and customizable string manipulation as defined in the builder configuration.
|
|
29
|
+
* @param replacer A configuration for string replacement, which can be either a string (used as a regex pattern) or an object containing a search pattern and a replacement string.
|
|
30
|
+
* @returns A function that takes a string as input and returns a new string with the specified replacements applied, based on the provided replacer configuration.
|
|
31
|
+
* @throws Will throw an error if the provided replacer configuration is invalid, such as if it is neither a string nor an object with the required properties.
|
|
32
|
+
*/
|
|
33
|
+
protected static replacer(replacer: Schemas.Transform['infer']): Builder.ReplacerAction;
|
|
26
34
|
}
|
|
27
35
|
export declare namespace Builder {
|
|
36
|
+
type Replacer = Schemas.Transform['infer'];
|
|
37
|
+
type ReplacerAction = (str: string) => string;
|
|
28
38
|
type BuilderEntry = Schemas.BuilderEntry['infer'];
|
|
29
39
|
type Extractor = Schemas.ExtractorEntry['infer'];
|
|
30
40
|
interface Info {
|
|
@@ -14,30 +14,31 @@ export class Builder {
|
|
|
14
14
|
async run() {
|
|
15
15
|
this.logger?.group(Utils.newGroup('#00FFB4'));
|
|
16
16
|
for (const step of this.pipeline) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
ranTask = true;
|
|
28
|
-
}
|
|
29
|
-
if (step.extract)
|
|
30
|
-
try {
|
|
31
|
-
if (ranTask)
|
|
32
|
-
this.logger?.line();
|
|
33
|
-
await this.runExtractor(step.extract);
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
this.logger?.error(`&C1[Extract] &C7${error}`);
|
|
37
|
-
}
|
|
17
|
+
if ('run' in step && step.run) {
|
|
18
|
+
const commands = typeof step.run === 'string' ? [step.run] : step.run;
|
|
19
|
+
await this.runTask(commands, this.cwd, step.maxTimeMs ?? 60000);
|
|
20
|
+
}
|
|
21
|
+
if ('extract' in step && step.extract) {
|
|
22
|
+
await this.runExtractor(step.extract);
|
|
23
|
+
}
|
|
24
|
+
if ('transform' in step && step.transform) {
|
|
25
|
+
await this.runGlobalTransform(step.transform);
|
|
26
|
+
}
|
|
38
27
|
}
|
|
39
28
|
this.logger?.groupEnd();
|
|
40
29
|
}
|
|
30
|
+
async runGlobalTransform(options) {
|
|
31
|
+
this.logger?.log(`&C7Applying global transformation in &C3${this.cwd}&C7...`);
|
|
32
|
+
const transformAction = Builder.replacer(options);
|
|
33
|
+
const glob = options.glob;
|
|
34
|
+
await File.smartProcess('glob', this.cwd, {
|
|
35
|
+
cwd: this.cwd,
|
|
36
|
+
}, async ({ src, dest }) => {
|
|
37
|
+
const content = await File.read(src);
|
|
38
|
+
const transformedContent = transformAction(content);
|
|
39
|
+
await File.write(dest, transformedContent);
|
|
40
|
+
});
|
|
41
|
+
}
|
|
41
42
|
/**
|
|
42
43
|
* Runs the extraction process based on the provided entry configuration, which can be either a string or an array of extraction entries.
|
|
43
44
|
* It handles the copying of files from the specified source to the target location, applying any necessary path transformations based on the provided replacer configuration.
|
|
@@ -49,14 +50,18 @@ export class Builder {
|
|
|
49
50
|
async runExtractor(entry) {
|
|
50
51
|
const extractor = typeof entry === 'string' ? [{ from: '**/*', to: entry }] : entry;
|
|
51
52
|
for (const entry of extractor) {
|
|
52
|
-
const { from, to: toEntry,
|
|
53
|
-
const
|
|
54
|
-
const
|
|
53
|
+
const { from, to: toEntry, pathReplacer, transform } = entry;
|
|
54
|
+
const pathReplacerAction = Builder.replacer(pathReplacer);
|
|
55
|
+
const replacerAction = Builder.replacer(transform);
|
|
55
56
|
const to = Path.isAbsolute(toEntry) ? toEntry : Path.join(Path.cwd, toEntry);
|
|
56
57
|
this.logger?.log(`&C7Extracting &C3${from}&C7 to &C3${to}&C7...`);
|
|
57
|
-
await File.
|
|
58
|
+
await File.smartProcess(from, to, {
|
|
58
59
|
cwd: this.cwd,
|
|
59
|
-
map:
|
|
60
|
+
map: pathReplacerAction,
|
|
61
|
+
}, async ({ src, dest }) => {
|
|
62
|
+
const content = await File.read(src);
|
|
63
|
+
const transformedContent = replacerAction(content);
|
|
64
|
+
await File.write(dest, transformedContent);
|
|
60
65
|
});
|
|
61
66
|
}
|
|
62
67
|
}
|
|
@@ -84,6 +89,25 @@ export class Builder {
|
|
|
84
89
|
return () => { pollito.stop(); };
|
|
85
90
|
}, maxTimeMs);
|
|
86
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Creates a string replacement function based on the provided replacer configuration, which can be either a simple string or an object defining a search pattern and replacement string. This method is used to generate a function that can be applied to strings for dynamic transformations during the build process, allowing for flexible and customizable string manipulation as defined in the builder configuration.
|
|
94
|
+
* @param replacer A configuration for string replacement, which can be either a string (used as a regex pattern) or an object containing a search pattern and a replacement string.
|
|
95
|
+
* @returns A function that takes a string as input and returns a new string with the specified replacements applied, based on the provided replacer configuration.
|
|
96
|
+
* @throws Will throw an error if the provided replacer configuration is invalid, such as if it is neither a string nor an object with the required properties.
|
|
97
|
+
*/
|
|
98
|
+
static replacer(replacer) {
|
|
99
|
+
if (typeof replacer === 'string') {
|
|
100
|
+
return (str) => str.replace(new RegExp(replacer, 'g'), '');
|
|
101
|
+
}
|
|
102
|
+
else if (replacer !== null && typeof replacer === 'object') {
|
|
103
|
+
const flags = replacer.flags || 'g';
|
|
104
|
+
const search = new RegExp(replacer.search, flags);
|
|
105
|
+
const replace = replacer.replace || '';
|
|
106
|
+
return (str) => str.replace(search, replace);
|
|
107
|
+
}
|
|
108
|
+
else
|
|
109
|
+
return (str) => str;
|
|
110
|
+
}
|
|
87
111
|
}
|
|
88
112
|
export default Builder;
|
|
89
113
|
//# sourceMappingURL=Builder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Builder.js","sourceRoot":"","sources":["../../../src/support/Builder/Builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,OAAO,OAAO;IACG,QAAQ,GAA2B,EAAE,CAAC;IACtC,GAAG,GAAW,OAAO,CAAC,GAAG,EAAE,CAAC;IAC5B,MAAM,CAAgB;IAEzC,YAAmB,IAAkB;QACjC,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC9B,IAAI,CAAC,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC;IACtC,CAAC;
|
|
1
|
+
{"version":3,"file":"Builder.js","sourceRoot":"","sources":["../../../src/support/Builder/Builder.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAI7C,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,IAAI,MAAM,iBAAiB,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,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
3
3
|
"description": "is a simple dependency manager based on github repositories",
|
|
4
|
-
"version": "3.0.0-dev.
|
|
4
|
+
"version": "3.0.0-dev.6",
|
|
5
5
|
"main": "build/bin/bin.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"README.md"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@netfeez/common": "^
|
|
36
|
-
"@netfeez/common-node": "^3.
|
|
35
|
+
"@netfeez/common": "^4.1.0",
|
|
36
|
+
"@netfeez/common-node": "^3.2.0",
|
|
37
37
|
"@netfeez/vterm": "^1.1.0"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|