@prosopo/datasets-fs 3.0.34 → 3.0.38
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/CHANGELOG.md +53 -0
- package/package.json +9 -9
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/clover.xml +0 -1397
- package/coverage/coverage-final.json +0 -18
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -161
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/coverage/src/cli/cli.ts.html +0 -334
- package/coverage/src/cli/cliCommand.ts.html +0 -289
- package/coverage/src/cli/cliCommandComposite.ts.html +0 -247
- package/coverage/src/cli/index.html +0 -146
- package/coverage/src/cli.ts.html +0 -235
- package/coverage/src/commands/flatten.ts.html +0 -547
- package/coverage/src/commands/generate.ts.html +0 -739
- package/coverage/src/commands/generateV1.ts.html +0 -904
- package/coverage/src/commands/generateV2.ts.html +0 -952
- package/coverage/src/commands/get.ts.html +0 -430
- package/coverage/src/commands/index.html +0 -221
- package/coverage/src/commands/labels.ts.html +0 -319
- package/coverage/src/commands/relocate.ts.html +0 -412
- package/coverage/src/commands/resize.ts.html +0 -598
- package/coverage/src/dummy.ts.html +0 -241
- package/coverage/src/index.html +0 -146
- package/coverage/src/index.ts.html +0 -127
- package/coverage/src/utils/index.html +0 -146
- package/coverage/src/utils/input.ts.html +0 -259
- package/coverage/src/utils/inputOutput.ts.html +0 -172
- package/coverage/src/utils/output.ts.html +0 -343
- package/dist/cli/cli.d.ts +0 -9
- package/dist/cli/cli.d.ts.map +0 -1
- package/dist/cli/cli.js.map +0 -1
- package/dist/cli/cliCommand.d.ts +0 -17
- package/dist/cli/cliCommand.d.ts.map +0 -1
- package/dist/cli/cliCommand.js +0 -31
- package/dist/cli/cliCommand.js.map +0 -1
- package/dist/cli/cliCommandComposite.d.ts +0 -14
- package/dist/cli/cliCommandComposite.d.ts.map +0 -1
- package/dist/cli/cliCommandComposite.js +0 -32
- package/dist/cli/cliCommandComposite.js.map +0 -1
- package/dist/cli.d.ts +0 -2
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -34
- package/dist/cli.js.map +0 -1
- package/dist/commands/flatten.d.ts +0 -59
- package/dist/commands/flatten.d.ts.map +0 -1
- package/dist/commands/flatten.js +0 -97
- package/dist/commands/flatten.js.map +0 -1
- package/dist/commands/generate.d.ts +0 -115
- package/dist/commands/generate.d.ts.map +0 -1
- package/dist/commands/generate.js +0 -150
- package/dist/commands/generate.js.map +0 -1
- package/dist/commands/generateV1.d.ts +0 -179
- package/dist/commands/generateV1.d.ts.map +0 -1
- package/dist/commands/generateV1.js +0 -169
- package/dist/commands/generateV1.js.map +0 -1
- package/dist/commands/generateV2.d.ts +0 -189
- package/dist/commands/generateV2.d.ts.map +0 -1
- package/dist/commands/generateV2.js +0 -200
- package/dist/commands/generateV2.js.map +0 -1
- package/dist/commands/get.d.ts +0 -35
- package/dist/commands/get.d.ts.map +0 -1
- package/dist/commands/get.js +0 -92
- package/dist/commands/get.js.map +0 -1
- package/dist/commands/labels.d.ts +0 -47
- package/dist/commands/labels.d.ts.map +0 -1
- package/dist/commands/labels.js +0 -48
- package/dist/commands/labels.js.map +0 -1
- package/dist/commands/relocate.d.ts +0 -71
- package/dist/commands/relocate.d.ts.map +0 -1
- package/dist/commands/relocate.js +0 -81
- package/dist/commands/relocate.js.map +0 -1
- package/dist/commands/resize.d.ts +0 -69
- package/dist/commands/resize.d.ts.map +0 -1
- package/dist/commands/resize.js +0 -112
- package/dist/commands/resize.js.map +0 -1
- package/dist/dummy.d.ts +0 -2
- package/dist/dummy.d.ts.map +0 -1
- package/dist/dummy.js +0 -28
- package/dist/dummy.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/tests/lodash.unit.test.d.ts +0 -2
- package/dist/tests/lodash.unit.test.d.ts.map +0 -1
- package/dist/tests/lodash.unit.test.js +0 -29
- package/dist/tests/lodash.unit.test.js.map +0 -1
- package/dist/tests/mocked.unit.test.d.ts +0 -2
- package/dist/tests/mocked.unit.test.d.ts.map +0 -1
- package/dist/tests/mocked.unit.test.js +0 -253
- package/dist/tests/mocked.unit.test.js.map +0 -1
- package/dist/tests/utils.d.ts +0 -35
- package/dist/tests/utils.d.ts.map +0 -1
- package/dist/tests/utils.js +0 -101
- package/dist/tests/utils.js.map +0 -1
- package/dist/utils/input.d.ts +0 -24
- package/dist/utils/input.d.ts.map +0 -1
- package/dist/utils/input.js +0 -35
- package/dist/utils/input.js.map +0 -1
- package/dist/utils/inputOutput.d.ts +0 -21
- package/dist/utils/inputOutput.d.ts.map +0 -1
- package/dist/utils/inputOutput.js +0 -10
- package/dist/utils/inputOutput.js.map +0 -1
- package/dist/utils/output.d.ts +0 -36
- package/dist/utils/output.d.ts.map +0 -1
- package/dist/utils/output.js +0 -62
- package/dist/utils/output.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lodash.unit.test.js","sourceRoot":"","sources":["../../src/tests/lodash.unit.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAcvD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAEhD,QAAQ,CAAC,KAAK,EAAE,GAAG,EAAE;IACpB,IAAI,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAClD,MAAM,IAAI,GAAG,CAAC,CAAC;QACf,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACvB,MAAM,QAAQ,GAAG;YAChB,CAAC,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,SAAS;YACpE,QAAQ;SACR,CAAC;QACF,KAAK,IAAI,CAAC,GA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,0 @@
|
|
|
1
|
-
{"version":3,"file":"mocked.unit.test.d.ts","sourceRoot":"","sources":["../../src/tests/mocked.unit.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,253 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import path from "node:path";
|
|
3
|
-
import { blake2b } from "@noble/hashes/blake2b";
|
|
4
|
-
import { CaptchasContainerSchema, DataSchema } from "@prosopo/types";
|
|
5
|
-
import { u8aToHex } from "@prosopo/util";
|
|
6
|
-
import { getRootDir, getTestResultsDir } from "@prosopo/workspace";
|
|
7
|
-
import sharp from "sharp";
|
|
8
|
-
import { afterAll, beforeAll, describe, test } from "vitest";
|
|
9
|
-
import { Flatten } from "../commands/flatten.js";
|
|
10
|
-
import { GenerateV1 } from "../commands/generateV1.js";
|
|
11
|
-
import { GenerateV2 } from "../commands/generateV2.js";
|
|
12
|
-
import { Labels } from "../commands/labels.js";
|
|
13
|
-
import { Relocate } from "../commands/relocate.js";
|
|
14
|
-
import { Resize } from "../commands/resize.js";
|
|
15
|
-
import { captchasEqFs, fsEq, fsWalk, restoreRepoDir, substituteRepoDir, } from "./utils.js";
|
|
16
|
-
describe("dataset commands", () => {
|
|
17
|
-
const pkgDir = path.relative(getRootDir(), __dirname);
|
|
18
|
-
const pkgInternalPath = pkgDir.replace(`${__dirname}/`, "");
|
|
19
|
-
const testResultsDir = `${getTestResultsDir()}/${pkgInternalPath}`;
|
|
20
|
-
beforeAll(() => {
|
|
21
|
-
substituteRepoDir();
|
|
22
|
-
fs.mkdirSync(`${testResultsDir}`, { recursive: true });
|
|
23
|
-
});
|
|
24
|
-
afterAll(() => {
|
|
25
|
-
restoreRepoDir();
|
|
26
|
-
if (fs.existsSync(`${testResultsDir}`)) {
|
|
27
|
-
fs.rmdirSync(`${testResultsDir}`, { recursive: true });
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
test("labels", async () => {
|
|
31
|
-
const input = `${__dirname}/data/flat_resized/data.json`;
|
|
32
|
-
const output = `${testResultsDir}/labels.json`;
|
|
33
|
-
const labels = new Labels();
|
|
34
|
-
labels.logger.setLogLevel("error");
|
|
35
|
-
await labels.exec({
|
|
36
|
-
input,
|
|
37
|
-
output,
|
|
38
|
-
});
|
|
39
|
-
fsEq(output, `${__dirname}/data/flat_resized/labels.json`);
|
|
40
|
-
const content = fs.readFileSync(output).toString();
|
|
41
|
-
const labelsJson = JSON.parse(content.toString());
|
|
42
|
-
const foundLabels = labelsJson.labels;
|
|
43
|
-
const categories = fs.readdirSync(`${__dirname}/data/hierarchical`);
|
|
44
|
-
if (JSON.stringify(foundLabels) !== JSON.stringify(categories)) {
|
|
45
|
-
throw new Error(`expected ${categories} but found ${foundLabels}`);
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
test("generate v2", async () => {
|
|
49
|
-
const input = `${__dirname}/data/flat_resized/data.json`;
|
|
50
|
-
const output = `${testResultsDir}/captchas_v2.json`;
|
|
51
|
-
const minIncorrect = 1;
|
|
52
|
-
const minCorrect = 1;
|
|
53
|
-
const minLabelled = 2;
|
|
54
|
-
const maxLabelled = 7;
|
|
55
|
-
const generate = new GenerateV2();
|
|
56
|
-
generate.logger.setLogLevel("error");
|
|
57
|
-
await generate.exec({
|
|
58
|
-
labelled: input,
|
|
59
|
-
unlabelled: input,
|
|
60
|
-
overwrite: true,
|
|
61
|
-
output,
|
|
62
|
-
count: 100,
|
|
63
|
-
seed: 0,
|
|
64
|
-
minIncorrect,
|
|
65
|
-
minCorrect,
|
|
66
|
-
minLabelled,
|
|
67
|
-
maxLabelled,
|
|
68
|
-
allowDuplicates: true,
|
|
69
|
-
});
|
|
70
|
-
if (!captchasEqFs(output, `${__dirname}/data/flat_resized/captchas_v2.json`)) {
|
|
71
|
-
throw new Error("captchas not equal");
|
|
72
|
-
}
|
|
73
|
-
const content = fs.readFileSync(output).toString();
|
|
74
|
-
const captchasJson = JSON.parse(content.toString());
|
|
75
|
-
const captchas = CaptchasContainerSchema.parse(captchasJson);
|
|
76
|
-
for (const captcha of captchas.captchas) {
|
|
77
|
-
const solutions = captcha.solution;
|
|
78
|
-
const unlabelled = captcha.unlabelled;
|
|
79
|
-
if (solutions === undefined || unlabelled === undefined) {
|
|
80
|
-
console.log(captcha);
|
|
81
|
-
throw new Error("solutions or unlabelled array is undefined");
|
|
82
|
-
}
|
|
83
|
-
for (const solution of solutions) {
|
|
84
|
-
if (unlabelled.includes(solution)) {
|
|
85
|
-
throw new Error(`solution ${solution} is also in unlabelled array`);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const nCorrect = solutions.length;
|
|
89
|
-
const nUnlabelled = unlabelled.length;
|
|
90
|
-
const nIncorrect = 9 - nCorrect - nUnlabelled;
|
|
91
|
-
const nLabelled = nCorrect + nIncorrect;
|
|
92
|
-
if (nCorrect < minCorrect) {
|
|
93
|
-
throw new Error(`expected at least ${minCorrect} correct but found ${nCorrect}`);
|
|
94
|
-
}
|
|
95
|
-
if (nIncorrect < minIncorrect) {
|
|
96
|
-
throw new Error(`expected at least ${minIncorrect} incorrect but found ${nIncorrect}`);
|
|
97
|
-
}
|
|
98
|
-
if (nLabelled < minLabelled) {
|
|
99
|
-
throw new Error(`expected at least ${minLabelled} labelled but found ${nLabelled}`);
|
|
100
|
-
}
|
|
101
|
-
if (nLabelled > maxLabelled) {
|
|
102
|
-
throw new Error(`expected at most ${maxLabelled} labelled but found ${nLabelled}`);
|
|
103
|
-
}
|
|
104
|
-
if (nUnlabelled !== 9 - nLabelled) {
|
|
105
|
-
throw new Error(`expected ${9 - nLabelled} unlabelled but found ${nUnlabelled}`);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
test("generate v1", async () => {
|
|
110
|
-
const input = `${__dirname}/data/flat_resized/data.json`;
|
|
111
|
-
const output = `${testResultsDir}/captchas_v1.json`;
|
|
112
|
-
const generate = new GenerateV1();
|
|
113
|
-
generate.logger.setLogLevel("error");
|
|
114
|
-
await generate.exec({
|
|
115
|
-
labelled: input,
|
|
116
|
-
unlabelled: input,
|
|
117
|
-
overwrite: true,
|
|
118
|
-
output,
|
|
119
|
-
solved: 50,
|
|
120
|
-
unsolved: 50,
|
|
121
|
-
seed: 0,
|
|
122
|
-
minCorrect: 1,
|
|
123
|
-
maxCorrect: 6,
|
|
124
|
-
allowDuplicates: true,
|
|
125
|
-
});
|
|
126
|
-
if (!captchasEqFs(output, `${__dirname}/data/flat_resized/captchas_v1.json`)) {
|
|
127
|
-
throw new Error("captchas not equal");
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
test("resizes data", async () => {
|
|
131
|
-
const input = `${__dirname}/data/flat/data.json`;
|
|
132
|
-
const output = `${testResultsDir}/flat_resized`;
|
|
133
|
-
const resize = new Resize();
|
|
134
|
-
resize.logger.setLogLevel("error");
|
|
135
|
-
await resize.exec({
|
|
136
|
-
input,
|
|
137
|
-
output,
|
|
138
|
-
overwrite: true,
|
|
139
|
-
square: true,
|
|
140
|
-
size: 128,
|
|
141
|
-
});
|
|
142
|
-
const expected = `${__dirname}/data/flat_resized`;
|
|
143
|
-
fsEq(output, expected);
|
|
144
|
-
for (const pth of fsWalk(output)) {
|
|
145
|
-
if (!pth.endsWith(".jpg") &&
|
|
146
|
-
!pth.endsWith(".jpeg") &&
|
|
147
|
-
!pth.endsWith(".png")) {
|
|
148
|
-
continue;
|
|
149
|
-
}
|
|
150
|
-
const image = sharp(pth);
|
|
151
|
-
const metadata = await image.metadata();
|
|
152
|
-
if (metadata.width !== 128 || metadata.height !== 128) {
|
|
153
|
-
throw new Error(`image ${pth} is not 128x128`);
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
test("relocates data", async () => {
|
|
158
|
-
const input = `${__dirname}/data/flat_resized/data.json`;
|
|
159
|
-
const output = `${testResultsDir}/relocated_data.json`;
|
|
160
|
-
const relocate = new Relocate();
|
|
161
|
-
relocate.logger.setLogLevel("error");
|
|
162
|
-
await relocate.exec({
|
|
163
|
-
input,
|
|
164
|
-
output,
|
|
165
|
-
overwrite: true,
|
|
166
|
-
to: "newwebsite.com",
|
|
167
|
-
from: "${repo}",
|
|
168
|
-
});
|
|
169
|
-
const expected = `${__dirname}/data/flat_resized/relocated_data.json`;
|
|
170
|
-
fsEq(output, expected);
|
|
171
|
-
});
|
|
172
|
-
test("flattens hierarchical data", async () => {
|
|
173
|
-
const input = `${__dirname}/data/hierarchical`;
|
|
174
|
-
const output = `${testResultsDir}/flat`;
|
|
175
|
-
const flatten = new Flatten();
|
|
176
|
-
flatten.logger.setLogLevel("error");
|
|
177
|
-
await flatten.exec({
|
|
178
|
-
input,
|
|
179
|
-
output,
|
|
180
|
-
overwrite: true,
|
|
181
|
-
});
|
|
182
|
-
const expected = `${__dirname}/data/flat`;
|
|
183
|
-
fsEq(output, expected);
|
|
184
|
-
const content = fs.readFileSync(`${output}/data.json`).toString();
|
|
185
|
-
const dataJson = JSON.parse(content.toString());
|
|
186
|
-
const data = DataSchema.parse(dataJson);
|
|
187
|
-
let hierCount = 0;
|
|
188
|
-
for (const pth of fsWalk(input)) {
|
|
189
|
-
if (!pth.endsWith(".jpg") &&
|
|
190
|
-
!pth.endsWith(".jpeg") &&
|
|
191
|
-
!pth.endsWith(".png")) {
|
|
192
|
-
continue;
|
|
193
|
-
}
|
|
194
|
-
hierCount++;
|
|
195
|
-
const category = pth.split("/").slice(-2)[0];
|
|
196
|
-
const content = fs.readFileSync(pth);
|
|
197
|
-
let name = "";
|
|
198
|
-
for (const pth2 of fsWalk(output)) {
|
|
199
|
-
if (!fs.statSync(pth2).isFile()) {
|
|
200
|
-
continue;
|
|
201
|
-
}
|
|
202
|
-
const content2 = fs.readFileSync(pth2);
|
|
203
|
-
if (content.equals(content2)) {
|
|
204
|
-
const str = pth2.split("/").slice(-1)[0];
|
|
205
|
-
if (str === undefined) {
|
|
206
|
-
throw new Error(`unable to parse ${pth2}`);
|
|
207
|
-
}
|
|
208
|
-
name = str;
|
|
209
|
-
break;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
if (!name) {
|
|
213
|
-
throw new Error(`unable to find image ${pth} in output`);
|
|
214
|
-
}
|
|
215
|
-
const item = data.items.find((item) => {
|
|
216
|
-
const name2 = item.data.split("/").slice(-1)[0];
|
|
217
|
-
if (name2 !== name) {
|
|
218
|
-
return false;
|
|
219
|
-
}
|
|
220
|
-
return true;
|
|
221
|
-
});
|
|
222
|
-
if (item === undefined) {
|
|
223
|
-
throw new Error(`unable to find image ${pth} in data.json`);
|
|
224
|
-
}
|
|
225
|
-
if (item.label !== category) {
|
|
226
|
-
throw new Error(`expected ${category} but found ${item.label}`);
|
|
227
|
-
}
|
|
228
|
-
if (item.type !== "image") {
|
|
229
|
-
throw new Error(`expected image type but found ${item.type}`);
|
|
230
|
-
}
|
|
231
|
-
if (item.hash !== name.split(".")[0]) {
|
|
232
|
-
throw new Error(`expected ${name.split(".")[0]} hash but found ${item.hash}`);
|
|
233
|
-
}
|
|
234
|
-
const hash = u8aToHex(blake2b(content));
|
|
235
|
-
if (item.hash !== hash) {
|
|
236
|
-
throw new Error(`expected ${hash} hash but found ${item.hash}`);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
let flatCount = 0;
|
|
240
|
-
for (const pth of fsWalk(output)) {
|
|
241
|
-
if (!pth.endsWith(".jpg") &&
|
|
242
|
-
!pth.endsWith(".jpeg") &&
|
|
243
|
-
!pth.endsWith(".png")) {
|
|
244
|
-
continue;
|
|
245
|
-
}
|
|
246
|
-
flatCount++;
|
|
247
|
-
}
|
|
248
|
-
if (hierCount !== flatCount) {
|
|
249
|
-
throw new Error(`expected ${hierCount} images but found ${flatCount}`);
|
|
250
|
-
}
|
|
251
|
-
});
|
|
252
|
-
});
|
|
253
|
-
//# sourceMappingURL=mocked.unit.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mocked.unit.test.js","sourceRoot":"","sources":["../../src/tests/mocked.unit.test.ts"],"names":[],"mappings":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import { type CaptchasContainer } from "@prosopo/types";
|
|
2
|
-
export declare function fsWalk(pth: string, options?: {
|
|
3
|
-
filesFirst?: boolean;
|
|
4
|
-
}): Generator<string>;
|
|
5
|
-
export declare const fsEq: (pth1: string, pth2: string) => boolean;
|
|
6
|
-
export declare const readDataJson: (pth: string) => {
|
|
7
|
-
items: {
|
|
8
|
-
hash: string;
|
|
9
|
-
data: string;
|
|
10
|
-
type: import("@prosopo/types").CaptchaItemTypes;
|
|
11
|
-
label?: string | undefined;
|
|
12
|
-
}[];
|
|
13
|
-
};
|
|
14
|
-
export declare const readCaptchasJson: (pth: string) => {
|
|
15
|
-
captchas: {
|
|
16
|
-
items: {
|
|
17
|
-
hash: string;
|
|
18
|
-
data: string;
|
|
19
|
-
type: import("@prosopo/types").CaptchaItemTypes;
|
|
20
|
-
}[];
|
|
21
|
-
salt: string;
|
|
22
|
-
target: string;
|
|
23
|
-
captchaId?: string | undefined;
|
|
24
|
-
captchaContentId?: string | undefined;
|
|
25
|
-
solution?: number[] | undefined;
|
|
26
|
-
unlabelled?: number[] | undefined;
|
|
27
|
-
timeLimit?: number | undefined;
|
|
28
|
-
}[];
|
|
29
|
-
format: import("@prosopo/types").CaptchaTypes;
|
|
30
|
-
};
|
|
31
|
-
export declare const captchasEqFs: (pth1: string, pth2: string) => boolean;
|
|
32
|
-
export declare const captchasEq: (first: CaptchasContainer, second: CaptchasContainer) => boolean;
|
|
33
|
-
export declare const substituteRepoDir: () => void;
|
|
34
|
-
export declare const restoreRepoDir: () => void;
|
|
35
|
-
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/tests/utils.ts"],"names":[],"mappings":"AAcA,OAAO,EACN,KAAK,iBAAiB,EAGtB,MAAM,gBAAgB,CAAC;AAIxB,wBAAiB,MAAM,CACtB,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;IACT,UAAU,CAAC,EAAE,OAAO,CAAC;CACrB,GACC,SAAS,CAAC,MAAM,CAAC,CAcnB;AAGD,eAAO,MAAM,IAAI,SAAU,MAAM,QAAQ,MAAM,YAiC9C,CAAC;AAEF,eAAO,MAAM,YAAY,QAAS,MAAM;;;;;aAyE+sb,CAAC;;CAlEvvb,CAAC;AAEF,eAAO,MAAM,gBAAgB,QAAS,MAAM;;;;;;;;;iBAgE4oiB,CAAC;wBAA8C,CAAC;gBAAsC,CAAC;kBAA0C,CAAC;iBAAyC,CAAC;;;CA3Dn2iB,CAAC;AAEF,eAAO,MAAM,YAAY,SAAU,MAAM,QAAQ,MAAM,YAItD,CAAC;AAEF,eAAO,MAAM,UAAU,UACf,iBAAiB,UAChB,iBAAiB,YAoBzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,YAe7B,CAAC;AAEF,eAAO,MAAM,cAAc,YAS1B,CAAC"}
|
package/dist/tests/utils.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import { CaptchasContainerSchema, DataSchema, } from "@prosopo/types";
|
|
3
|
-
import { at } from "@prosopo/util";
|
|
4
|
-
export function* fsWalk(pth, options) {
|
|
5
|
-
const isDir = fs.existsSync(pth) && fs.statSync(pth).isDirectory();
|
|
6
|
-
let subpaths = isDir ? fs.readdirSync(pth) : [];
|
|
7
|
-
subpaths = subpaths.map((f) => `${pth}/${f}`);
|
|
8
|
-
if (!options?.filesFirst) {
|
|
9
|
-
yield pth;
|
|
10
|
-
}
|
|
11
|
-
for (const subpath of subpaths) {
|
|
12
|
-
yield* fsWalk(subpath, options);
|
|
13
|
-
}
|
|
14
|
-
if (options?.filesFirst) {
|
|
15
|
-
yield pth;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
export const fsEq = (pth1, pth2) => {
|
|
19
|
-
const it1 = fsWalk(pth1);
|
|
20
|
-
const it2 = fsWalk(pth2);
|
|
21
|
-
const files1 = [...it1].map((f) => f.slice(pth1.length));
|
|
22
|
-
const files2 = [...it2].map((f) => f.slice(pth2.length));
|
|
23
|
-
if (files1.length !== files2.length) {
|
|
24
|
-
return false;
|
|
25
|
-
}
|
|
26
|
-
files1.sort();
|
|
27
|
-
files2.sort();
|
|
28
|
-
if (!files1.every((f, i) => f === files2[i])) {
|
|
29
|
-
return false;
|
|
30
|
-
}
|
|
31
|
-
for (let i = 0; i < files1.length; i++) {
|
|
32
|
-
const file1 = pth1 + at(files1, i);
|
|
33
|
-
const file2 = pth2 + at(files2, i);
|
|
34
|
-
const stat1 = fs.statSync(file1);
|
|
35
|
-
if (stat1.isDirectory()) {
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
const content1 = fs.readFileSync(file1);
|
|
39
|
-
const content2 = fs.readFileSync(file2);
|
|
40
|
-
if (!content1.equals(content2)) {
|
|
41
|
-
return false;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
return true;
|
|
45
|
-
};
|
|
46
|
-
export const readDataJson = (pth) => {
|
|
47
|
-
let content = fs.readFileSync(pth).toString();
|
|
48
|
-
content = content.replaceAll("${repo}", `${__dirname}/../../../..`);
|
|
49
|
-
const dataJson = JSON.parse(content.toString());
|
|
50
|
-
const data = DataSchema.parse(dataJson);
|
|
51
|
-
return data;
|
|
52
|
-
};
|
|
53
|
-
export const readCaptchasJson = (pth) => {
|
|
54
|
-
const content = fs.readFileSync(pth).toString();
|
|
55
|
-
const dataJson = JSON.parse(content);
|
|
56
|
-
const captchas = CaptchasContainerSchema.parse(dataJson);
|
|
57
|
-
return captchas;
|
|
58
|
-
};
|
|
59
|
-
export const captchasEqFs = (pth1, pth2) => {
|
|
60
|
-
const data1 = readCaptchasJson(pth1);
|
|
61
|
-
const data2 = readCaptchasJson(pth2);
|
|
62
|
-
return captchasEq(data1, data2);
|
|
63
|
-
};
|
|
64
|
-
export const captchasEq = (first, second) => {
|
|
65
|
-
if (first.captchas.length !== second.captchas.length) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
for (let i = 0; i < first.captchas.length; i++) {
|
|
69
|
-
const captcha1 = at(first.captchas, i);
|
|
70
|
-
const captcha2 = at(second.captchas, i);
|
|
71
|
-
if (captcha1.salt === captcha2.salt) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
const { salt: salt1, ...rest1 } = captcha1;
|
|
75
|
-
const { salt: salt2, ...rest2 } = captcha2;
|
|
76
|
-
if (JSON.stringify(rest1) !== JSON.stringify(rest2)) {
|
|
77
|
-
return false;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return true;
|
|
81
|
-
};
|
|
82
|
-
export const substituteRepoDir = () => {
|
|
83
|
-
for (const pth of fsWalk(`${__dirname}/data`)) {
|
|
84
|
-
if (!pth.endsWith(".json")) {
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
fs.copyFileSync(pth, `${pth}.bak`);
|
|
88
|
-
let content = fs.readFileSync(pth).toString();
|
|
89
|
-
content = content.replaceAll("${repo}", `${__dirname}/../../../..`);
|
|
90
|
-
fs.writeFileSync(pth, content);
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
export const restoreRepoDir = () => {
|
|
94
|
-
for (const pth of fsWalk(`${__dirname}/data`)) {
|
|
95
|
-
if (!pth.endsWith(".json")) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
fs.renameSync(`${pth}.bak`, pth);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/tests/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/tests/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AAczB,OAAO,EAEN,uBAAuB,EACvB,UAAU,GACV,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,EAAE,EAAE,MAAM,eAAe,CAAC;AAGnC,MAAM,SAAS,CAAC,C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AAC;QAED,EAAE,CAAC,UAAU,CAAC,GAAG,GAAG,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,CAAC;AACF,CAAC,CAAC"}
|
package/dist/utils/input.d.ts
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import * as z from "zod";
|
|
2
|
-
import { CliCommand } from "../cli/cliCommand.js";
|
|
3
|
-
export declare const InputArgsSchema: z.ZodObject<{
|
|
4
|
-
input: z.ZodString;
|
|
5
|
-
}, "strip", z.ZodTypeAny, {
|
|
6
|
-
input: string;
|
|
7
|
-
}, {
|
|
8
|
-
input: string;
|
|
9
|
-
}>;
|
|
10
|
-
export type InputArgs = z.infer<typeof InputArgsSchema>;
|
|
11
|
-
export declare class InputCliCommand<T extends typeof InputArgsSchema> extends CliCommand<T> {
|
|
12
|
-
getArgSchema(): T;
|
|
13
|
-
getDescription(): string;
|
|
14
|
-
getOptions(): {
|
|
15
|
-
input: {
|
|
16
|
-
string: boolean;
|
|
17
|
-
alias: string;
|
|
18
|
-
demand: boolean;
|
|
19
|
-
description: string;
|
|
20
|
-
};
|
|
21
|
-
};
|
|
22
|
-
_check(args: InputArgs): Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=input.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/utils/input.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,eAAO,MAAM,eAAe;;;;;;EAE1B,CAAC;AAEH,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,qBAAa,eAAe,CAC3B,CAAC,SAAS,OAAO,eAAe,CAC/B,SAAQ,UAAU,CAAC,CAAC,CAAC;IACN,YAAY,IAAI,CAAC;IAGjB,cAAc,IAAI,MAAM;IAGxB,UAAU;;;;;;;;IAWJ,MAAM,CAAC,IAAI,EAAE,SAAS;CAa5C"}
|
package/dist/utils/input.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import fs from "node:fs";
|
|
2
|
-
import { ProsopoDatasetError, ProsopoError } from "@prosopo/common";
|
|
3
|
-
import * as z from "zod";
|
|
4
|
-
import { CliCommand } from "../cli/cliCommand.js";
|
|
5
|
-
export const InputArgsSchema = z.object({
|
|
6
|
-
input: z.string(),
|
|
7
|
-
});
|
|
8
|
-
export class InputCliCommand extends CliCommand {
|
|
9
|
-
getArgSchema() {
|
|
10
|
-
throw new ProsopoError("DEVELOPER.METHOD_NOT_IMPLEMENTED");
|
|
11
|
-
}
|
|
12
|
-
getDescription() {
|
|
13
|
-
throw new ProsopoError("DEVELOPER.METHOD_NOT_IMPLEMENTED");
|
|
14
|
-
}
|
|
15
|
-
getOptions() {
|
|
16
|
-
return {
|
|
17
|
-
input: {
|
|
18
|
-
string: true,
|
|
19
|
-
alias: "in",
|
|
20
|
-
demand: true,
|
|
21
|
-
description: "The input path",
|
|
22
|
-
},
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
async _check(args) {
|
|
26
|
-
this.logger.debug(() => ({ msg: "input _check" }));
|
|
27
|
-
await super._check(args);
|
|
28
|
-
if (!fs.existsSync(args.input)) {
|
|
29
|
-
throw new ProsopoDatasetError(new Error(`input path does not exist: ${args.input}`), {
|
|
30
|
-
translationKey: "FS.FILE_NOT_FOUND",
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=input.js.map
|
package/dist/utils/input.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"input.js","sourceRoot":"","sources":["../../src/utils/input.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAcpE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC;IACvC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CACjB,CAAC,CAAC;AAIH,MAAM,OAAO,eAEX,SAAQ,UAAa;IACN,YAAY;QAC3B,MAAM,IAAI,YAAY,CAAC,kCAAkC,CAAC,CAAC;IAC5D,CAAC;IACe,cAAc;QAC7B,MAAM,IAAI,YAAY,CAAC,kCAAkC,CAAC,CAAC;IAC5D,CAAC;IACe,UAAU;QACzB,OAAO;YACN,KAAK,EAAE;gBACN,MAAM,EAAE,IAAI;gBACZ,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,IAAI;gBACZ,WAAW,EAAE,gBAAgB;aAC7B;SACD,CAAC;IACH,CAAC;IAEe,KAAK,CAAC,MAAM,CAAC,IAAe;QAC3C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC;QACnD,MAAM,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAEzB,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,mBAAmB,CAC5B,IAAI,KAAK,CAAC,8BAA8B,IAAI,CAAC,KAAK,EAAE,CAAC,EACrD;gBACC,cAAc,EAAE,mBAAmB;aACnC,CACD,CAAC;QACH,CAAC;IACF,CAAC;CACD"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type * as z from "zod";
|
|
2
|
-
import { CliCommandComposite } from "../cli/cliCommandComposite.js";
|
|
3
|
-
export declare const InputOutputArgsSchema: z.ZodObject<z.objectUtil.extendShape<{
|
|
4
|
-
input: z.ZodString;
|
|
5
|
-
}, {
|
|
6
|
-
output: z.ZodString;
|
|
7
|
-
overwrite: z.ZodOptional<z.ZodBoolean>;
|
|
8
|
-
}>, "strip", z.ZodTypeAny, {
|
|
9
|
-
input: string;
|
|
10
|
-
output: string;
|
|
11
|
-
overwrite?: boolean | undefined;
|
|
12
|
-
}, {
|
|
13
|
-
input: string;
|
|
14
|
-
output: string;
|
|
15
|
-
overwrite?: boolean | undefined;
|
|
16
|
-
}>;
|
|
17
|
-
export type InputOutputArgs = z.infer<typeof InputOutputArgsSchema>;
|
|
18
|
-
export declare abstract class InputOutputCliCommand<T extends typeof InputOutputArgsSchema> extends CliCommandComposite<T> {
|
|
19
|
-
constructor();
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=inputOutput.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inputOutput.d.ts","sourceRoot":"","sources":["../../src/utils/inputOutput.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,KAAK,CAAC,MAAM,KAAK,CAAC;AAC9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIpE,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;EAA0C,CAAC;AAE7E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,8BAAsB,qBAAqB,CAC1C,CAAC,SAAS,OAAO,qBAAqB,CACrC,SAAQ,mBAAmB,CAAC,CAAC,CAAC;;CAI/B"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { CliCommandComposite } from "../cli/cliCommandComposite.js";
|
|
2
|
-
import { InputArgsSchema, InputCliCommand } from "./input.js";
|
|
3
|
-
import { OutputArgsSchema, OutputCliCommand } from "./output.js";
|
|
4
|
-
export const InputOutputArgsSchema = InputArgsSchema.merge(OutputArgsSchema);
|
|
5
|
-
export class InputOutputCliCommand extends CliCommandComposite {
|
|
6
|
-
constructor() {
|
|
7
|
-
super([new InputCliCommand(), new OutputCliCommand()]);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=inputOutput.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"inputOutput.js","sourceRoot":"","sources":["../../src/utils/inputOutput.ts"],"names":[],"mappings":"AAcA,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,CAAC,MAAM,qBAAqB,GAAG,eAAe,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;AAI7E,MAAM,OAAgB,qBAEpB,SAAQ,mBAAsB;IAC/B;QACC,KAAK,CAAC,CAAC,IAAI,eAAe,EAAK,EAAE,IAAI,gBAAgB,EAAK,CAAC,CAAC,CAAC;IAC9D,CAAC;CACD"}
|
package/dist/utils/output.d.ts
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { type infer as zInfer } from "zod";
|
|
2
|
-
import { CliCommand } from "../cli/cliCommand.js";
|
|
3
|
-
export declare const OutputArgsSchema: import("zod").ZodObject<{
|
|
4
|
-
output: import("zod").ZodString;
|
|
5
|
-
overwrite: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
6
|
-
}, "strip", import("zod").ZodTypeAny, {
|
|
7
|
-
output: string;
|
|
8
|
-
overwrite?: boolean | undefined;
|
|
9
|
-
}, {
|
|
10
|
-
output: string;
|
|
11
|
-
overwrite?: boolean | undefined;
|
|
12
|
-
}>;
|
|
13
|
-
export type OutputArgs = zInfer<typeof OutputArgsSchema>;
|
|
14
|
-
export declare class OutputCliCommand<T extends typeof OutputArgsSchema> extends CliCommand<T> {
|
|
15
|
-
#private;
|
|
16
|
-
outputExists(): boolean;
|
|
17
|
-
getArgSchema(): T;
|
|
18
|
-
getDescription(): string;
|
|
19
|
-
getOptions(): {
|
|
20
|
-
[key: string]: import("yargs").Options;
|
|
21
|
-
} & {
|
|
22
|
-
output: {
|
|
23
|
-
alias: string;
|
|
24
|
-
string: boolean;
|
|
25
|
-
demand: boolean;
|
|
26
|
-
description: string;
|
|
27
|
-
};
|
|
28
|
-
overwrite: {
|
|
29
|
-
boolean: boolean;
|
|
30
|
-
description: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
33
|
-
_check(args: OutputArgs): Promise<void>;
|
|
34
|
-
_run(args: OutputArgs): Promise<void>;
|
|
35
|
-
}
|
|
36
|
-
//# sourceMappingURL=output.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAGA,OAAO,EAA2B,KAAK,KAAK,IAAI,MAAM,EAAE,MAAM,KAAK,CAAC;AAcpE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,eAAO,MAAM,gBAAgB;;;;;;;;;EAG3B,CAAC;AAEH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEzD,qBAAa,gBAAgB,CAC5B,CAAC,SAAS,OAAO,gBAAgB,CAChC,SAAQ,UAAU,CAAC,CAAC,CAAC;;IAGf,YAAY;IAIH,YAAY,IAAI,CAAC;IAGjB,cAAc,IAAI,MAAM;IAGxB,UAAU;;;;;;;;;;;;;;IAeJ,MAAM,CAAC,IAAI,EAAE,UAAU;IAoBvB,IAAI,CAAC,IAAI,EAAE,UAAU;CAS3C"}
|
package/dist/utils/output.js
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
var _OutputCliCommand_outputExists;
|
|
2
|
-
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
|
|
3
|
-
import fs from "node:fs";
|
|
4
|
-
import { ProsopoEnvError, ProsopoError } from "@prosopo/common";
|
|
5
|
-
import { lodash } from "@prosopo/util/lodash";
|
|
6
|
-
import { boolean, object, string } from "zod";
|
|
7
|
-
import { CliCommand } from "../cli/cliCommand.js";
|
|
8
|
-
export const OutputArgsSchema = object({
|
|
9
|
-
output: string(),
|
|
10
|
-
overwrite: boolean().optional(),
|
|
11
|
-
});
|
|
12
|
-
export class OutputCliCommand extends CliCommand {
|
|
13
|
-
constructor() {
|
|
14
|
-
super(...arguments);
|
|
15
|
-
_OutputCliCommand_outputExists.set(this, false);
|
|
16
|
-
}
|
|
17
|
-
outputExists() {
|
|
18
|
-
return __classPrivateFieldGet(this, _OutputCliCommand_outputExists, "f");
|
|
19
|
-
}
|
|
20
|
-
getArgSchema() {
|
|
21
|
-
throw new ProsopoError("DEVELOPER.METHOD_NOT_IMPLEMENTED");
|
|
22
|
-
}
|
|
23
|
-
getDescription() {
|
|
24
|
-
throw new ProsopoError("DEVELOPER.METHOD_NOT_IMPLEMENTED");
|
|
25
|
-
}
|
|
26
|
-
getOptions() {
|
|
27
|
-
return lodash().merge(super.getOptions(), {
|
|
28
|
-
output: {
|
|
29
|
-
alias: "out",
|
|
30
|
-
string: true,
|
|
31
|
-
demand: true,
|
|
32
|
-
description: "The output path",
|
|
33
|
-
},
|
|
34
|
-
overwrite: {
|
|
35
|
-
boolean: true,
|
|
36
|
-
description: "Overwrite files in the output path if they already exist",
|
|
37
|
-
},
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
async _check(args) {
|
|
41
|
-
this.logger.debug(() => ({ msg: "Output _check" }));
|
|
42
|
-
await super._check(args);
|
|
43
|
-
__classPrivateFieldSet(this, _OutputCliCommand_outputExists, fs.existsSync(args.output), "f");
|
|
44
|
-
if (this.outputExists()) {
|
|
45
|
-
if (!args.overwrite) {
|
|
46
|
-
throw new ProsopoEnvError(new Error(`output path already exists: ${args.output}`), {
|
|
47
|
-
translationKey: "FS.FILE_ALREADY_EXISTS",
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
async _run(args) {
|
|
53
|
-
this.logger.debug(() => ({ msg: "Output run" }));
|
|
54
|
-
await super._run(args);
|
|
55
|
-
if (args.overwrite && this.outputExists()) {
|
|
56
|
-
this.logger.info(() => ({ msg: "cleaning output directory..." }));
|
|
57
|
-
fs.rmSync(args.output, { recursive: true });
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
_OutputCliCommand_outputExists = new WeakMap();
|
|
62
|
-
//# sourceMappingURL=output.js.map
|