setupcomfyuimodels 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/#index.js# +4 -0
- package/dist/src/downloadAssets.js +170 -0
- package/dist/src/downloadAssets.js.map +1 -0
- package/dist/src/getConfig.js +11 -0
- package/dist/src/getConfig.js.map +1 -0
- package/dist/src/index.js +15 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/progressbar.js +99 -0
- package/dist/src/progressbar.js.map +1 -0
- package/eslint.config.mjs +95 -0
- package/package.json +43 -0
- package/package.json~ +39 -0
- package/src/config.ts +139 -0
- package/src/config.ts~ +96 -0
- package/src/downloadAssets.ts +188 -0
- package/src/downloadAssets.ts~ +0 -0
- package/src/getConfig.ts +11 -0
- package/src/getConfig.ts~ +0 -0
- package/src/index.ts +13 -0
- package/src/index.ts~ +0 -0
- package/src/progressbar.ts +125 -0
- package/src/progressbar.ts~ +0 -0
- package/tsconfig.json +20 -0
- package/tsconfig.json~ +21 -0
package/#index.js#
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.downloadAssets = void 0;
|
|
40
|
+
const fs = __importStar(require("fs"));
|
|
41
|
+
const path_1 = __importDefault(require("path"));
|
|
42
|
+
const stream_1 = require("stream");
|
|
43
|
+
const progressbar_1 = require("./progressbar");
|
|
44
|
+
const getConfig_1 = require("./getConfig");
|
|
45
|
+
const chalk_1 = __importDefault(require("chalk"));
|
|
46
|
+
const { WORKSPACE, CIVITAI_TOKEN, HF_TOKEN } = process.env;
|
|
47
|
+
if (!WORKSPACE) {
|
|
48
|
+
throw new Error("WORKSPACE environment variable is not set.");
|
|
49
|
+
}
|
|
50
|
+
const MAX_CONCURRENT_DOWNLOADS = 8;
|
|
51
|
+
let concurrentDownloads = 0;
|
|
52
|
+
const downloadAssets = async (configLocation) => {
|
|
53
|
+
const config = await (0, getConfig_1.getConfig)(configLocation);
|
|
54
|
+
const filePromises = [
|
|
55
|
+
...Object.entries(config.files).map(([targetLocation, url]) => {
|
|
56
|
+
const fileName = path_1.default.basename(targetLocation), dir = path_1.default.dirname(targetLocation);
|
|
57
|
+
return scheduleDownload(dir, fileName, url);
|
|
58
|
+
}),
|
|
59
|
+
...Object.entries(config.folders).flatMap(([folder, urls]) => urls.map((url) => scheduleDownload(folder, null, url))),
|
|
60
|
+
];
|
|
61
|
+
(0, progressbar_1.setTotalProgress)(0, filePromises.length);
|
|
62
|
+
await Promise.all(filePromises);
|
|
63
|
+
(0, progressbar_1.stopProgressBar)();
|
|
64
|
+
console.log(chalk_1.default.bgWhite("Skipped downloads:\n"), results
|
|
65
|
+
.filter((r) => r.skipped)
|
|
66
|
+
.map((r) => `${r.targetLocation}/${r.targetFileName || ""} from ${r.url}`)
|
|
67
|
+
.join("\n"));
|
|
68
|
+
console.log(chalk_1.default.bgWhite("Successful downloads:\n"), results
|
|
69
|
+
.filter((r) => r.downloaded)
|
|
70
|
+
.map((r) => `${r.targetLocation}/${r.targetFileName || ""} from ${r.url}`)
|
|
71
|
+
.join("\n"));
|
|
72
|
+
console.log(chalk_1.default.bgWhite("Download errors:\n"), results
|
|
73
|
+
.filter((r) => r.error)
|
|
74
|
+
.map((r) => `${r.targetLocation}/${r.targetFileName || ""} from ${r.url} had error: ${r.error}`)
|
|
75
|
+
.join("\n"));
|
|
76
|
+
};
|
|
77
|
+
exports.downloadAssets = downloadAssets;
|
|
78
|
+
const scheduledDownloads = [];
|
|
79
|
+
const results = [];
|
|
80
|
+
const scheduleDownload = async (targetLocation, targetFileName, url) => {
|
|
81
|
+
scheduledDownloads.push({ targetLocation, url, targetFileName });
|
|
82
|
+
if (concurrentDownloads < MAX_CONCURRENT_DOWNLOADS) {
|
|
83
|
+
while (scheduledDownloads.length > 0) {
|
|
84
|
+
const nextDownload = scheduledDownloads.shift();
|
|
85
|
+
if (nextDownload) {
|
|
86
|
+
concurrentDownloads++;
|
|
87
|
+
try {
|
|
88
|
+
const skipped = await downloadFile(nextDownload.targetLocation, nextDownload.targetFileName, nextDownload.url);
|
|
89
|
+
results.push({
|
|
90
|
+
...nextDownload,
|
|
91
|
+
skipped,
|
|
92
|
+
downloaded: !skipped,
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
results.push({
|
|
97
|
+
...nextDownload,
|
|
98
|
+
error: error.message,
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
(0, progressbar_1.incrementTotalProgress)();
|
|
102
|
+
concurrentDownloads--;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
const downloadFile = async (targetLocation, targetFileName, url) => {
|
|
108
|
+
const getTargetId = () => path_1.default.join(targetLocation, targetFileName || "");
|
|
109
|
+
try {
|
|
110
|
+
const targetDir = path_1.default.normalize(`${WORKSPACE}/models/${targetLocation}`);
|
|
111
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
112
|
+
if (targetFileName && fs.existsSync(path_1.default.join(targetDir, targetFileName))) {
|
|
113
|
+
(0, progressbar_1.log)(`File already exists, skipping: ${getTargetId()}`);
|
|
114
|
+
return true;
|
|
115
|
+
}
|
|
116
|
+
const isCivitAi = url.match(/https:\/\/civitai.com/);
|
|
117
|
+
const isHugging = url.match(/https:\/\/huggingface.co/);
|
|
118
|
+
const headers = {};
|
|
119
|
+
if (isCivitAi && CIVITAI_TOKEN) {
|
|
120
|
+
headers["Authorization"] = `Bearer ${CIVITAI_TOKEN}`;
|
|
121
|
+
}
|
|
122
|
+
if (isHugging && HF_TOKEN) {
|
|
123
|
+
headers["Authorization"] = `Bearer ${HF_TOKEN}`;
|
|
124
|
+
}
|
|
125
|
+
const response = await fetch(url, { headers });
|
|
126
|
+
if (!response.ok || !response.body) {
|
|
127
|
+
(0, progressbar_1.log)(`Error for url: ${url}`);
|
|
128
|
+
throw new Error(`Failed to download ${url}: ${response.status} ${response.statusText}`);
|
|
129
|
+
}
|
|
130
|
+
const total = Number(response.headers.get("content-length"));
|
|
131
|
+
const contentDisposition = response.headers.get("content-disposition");
|
|
132
|
+
if (!targetFileName) {
|
|
133
|
+
const fileNameMatch = contentDisposition?.match(/filename="?(.+?)"?($|;)/);
|
|
134
|
+
if (fileNameMatch) {
|
|
135
|
+
targetFileName = fileNameMatch[1];
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
(0, progressbar_1.log)(`Error for url: ${url}`);
|
|
139
|
+
throw new Error(`Failed to extract filename from content-disposition for ${url}. Provide filename.`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
const filePath = path_1.default.join(targetDir, targetFileName);
|
|
143
|
+
if (fs.existsSync(filePath)) {
|
|
144
|
+
(0, progressbar_1.log)(`File already exists, skipping: ${getTargetId()}`);
|
|
145
|
+
response.body?.cancel();
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
(0, progressbar_1.log)(`Downloading ${getTargetId()} from ${url}`);
|
|
149
|
+
(0, progressbar_1.updateKey)(getTargetId(), 0, total);
|
|
150
|
+
const readableNodeStream = stream_1.Readable.fromWeb(response.body);
|
|
151
|
+
const fileStream = fs.createWriteStream(filePath + ".part");
|
|
152
|
+
let current = 0;
|
|
153
|
+
await new Promise((resolve, reject) => {
|
|
154
|
+
readableNodeStream.on("data", (chunk) => {
|
|
155
|
+
current += chunk.length;
|
|
156
|
+
(0, progressbar_1.updateKey)(getTargetId(), current, total);
|
|
157
|
+
});
|
|
158
|
+
readableNodeStream.pipe(fileStream);
|
|
159
|
+
readableNodeStream.on("error", reject);
|
|
160
|
+
fileStream.on("finish", resolve);
|
|
161
|
+
});
|
|
162
|
+
fs.renameSync(filePath + ".part", filePath);
|
|
163
|
+
(0, progressbar_1.log)(`Done downloading: ${url}`);
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
finally {
|
|
167
|
+
(0, progressbar_1.removeKey)(getTargetId());
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
//# sourceMappingURL=downloadAssets.js.map
|
|
@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C,MAAM,CAAC;gBACxB,IAAA,uBAAS,EAAC,WAAW,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;YACH,kBAAkB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACpC,kBAAkB,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;YACvC,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,EAAE,CAAC,UAAU,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,CAAC,CAAC;QAC5C,IAAA,iBAAG,EAAC,qBAAqB,GAAG,EAAE,CAAC,CAAC;QAChC,OAAO,KAAK,CAAC;IACf,CAAC;YAAS,CAAC;QACT,IAAA,uBAAS,EAAC,WAAW,EAAE,CAAC,CAAC;IAC3B,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConfig = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const comment_json_1 = require("comment-json");
|
|
6
|
+
const getConfig = async (configLocation) => {
|
|
7
|
+
const fileContent = (0, fs_1.readFileSync)(configLocation, "utf-8");
|
|
8
|
+
return (0, comment_json_1.parse)(fileContent);
|
|
9
|
+
};
|
|
10
|
+
exports.getConfig = getConfig;
|
|
11
|
+
//# sourceMappingURL=getConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getConfig.js","sourceRoot":"","sources":["../../src/getConfig.ts"],"names":[],"mappings":";;;AAAA,2BAAkC;AAClC,+CAAqC;AAE9B,MAAM,SAAS,GAAG,KAAK,EAAE,cAAsB,EAAE,EAAE;IACxD,MAAM,WAAW,GAAG,IAAA,iBAAY,EAAC,cAAc,EAAE,OAAO,CAAC,CAAC;IAE1D,OAAO,IAAA,oBAAK,EAAC,WAAW,CAGvB,CAAC;AACJ,CAAC,CAAC;AAPW,QAAA,SAAS,aAOpB"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const extra_typings_1 = require("@commander-js/extra-typings");
|
|
5
|
+
const downloadAssets_1 = require("./downloadAssets");
|
|
6
|
+
const program = new extra_typings_1.Command();
|
|
7
|
+
program.name("Setup ComfyUi Models");
|
|
8
|
+
program
|
|
9
|
+
.command("download")
|
|
10
|
+
.argument("<config>", "JSON config file location")
|
|
11
|
+
.action(async (configLocation) => {
|
|
12
|
+
await (0, downloadAssets_1.downloadAssets)(configLocation);
|
|
13
|
+
});
|
|
14
|
+
program.parse();
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AACA,+DAAsD;AACtD,qDAAkD;AAElD,MAAM,OAAO,GAAG,IAAI,uBAAO,EAAE,CAAC;AAC9B,OAAO,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;AACrC,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,QAAQ,CAAC,UAAU,EAAE,2BAA2B,CAAC;KACjD,MAAM,CAAC,KAAK,EAAE,cAAsB,EAAE,EAAE;IACvC,MAAM,IAAA,+BAAc,EAAC,cAAc,CAAC,CAAC;AACvC,CAAC,CAAC,CAAC;AACL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.stopProgressBar = exports.removeKey = exports.updateKey = exports.incrementTotalProgress = exports.setTotalProgress = exports.log = void 0;
|
|
7
|
+
const cli_progress_1 = __importDefault(require("cli-progress"));
|
|
8
|
+
const pretty_bytes_1 = __importDefault(require("pretty-bytes"));
|
|
9
|
+
function autopadding(value, length) {
|
|
10
|
+
return String(value).padStart(length);
|
|
11
|
+
}
|
|
12
|
+
const formatValue = (v, _options, type) => {
|
|
13
|
+
switch (type) {
|
|
14
|
+
case "percentage":
|
|
15
|
+
return autopadding(v, 3);
|
|
16
|
+
case "value":
|
|
17
|
+
return (0, pretty_bytes_1.default)(v, { fixedWidth: 10 });
|
|
18
|
+
default:
|
|
19
|
+
return v;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const multibar = new cli_progress_1.default.MultiBar({
|
|
23
|
+
fps: 2,
|
|
24
|
+
clearOnComplete: false,
|
|
25
|
+
hideCursor: false,
|
|
26
|
+
autopadding: true,
|
|
27
|
+
align: "left",
|
|
28
|
+
format: "{value} {speed} {eta_formatted} {bar} {percentage}% - {filename}",
|
|
29
|
+
formatValue,
|
|
30
|
+
formatTime: (t, options, roundToMultipleOf) => autopadding(cli_progress_1.default.Format.TimeFormat(t, options, roundToMultipleOf) || "", 8),
|
|
31
|
+
}, cli_progress_1.default.Presets.shades_classic);
|
|
32
|
+
const log = (...ps) => multibar.log(ps
|
|
33
|
+
.map((p) => (typeof p === "string" ? p : JSON.stringify(p)))
|
|
34
|
+
.join(" ") + "\n");
|
|
35
|
+
exports.log = log;
|
|
36
|
+
const totalBar = multibar.create(1, 0, {}, {
|
|
37
|
+
autopadding: true,
|
|
38
|
+
format: "{value} {bar} {percentage}% - Files Downloaded",
|
|
39
|
+
formatValue: (v, _, type) => type === "percentage"
|
|
40
|
+
? autopadding(String(v), 3)
|
|
41
|
+
: autopadding(String(v), 30),
|
|
42
|
+
});
|
|
43
|
+
const setTotalProgress = (value, maxValue) => {
|
|
44
|
+
if (maxValue) {
|
|
45
|
+
totalBar.setTotal(maxValue);
|
|
46
|
+
}
|
|
47
|
+
totalBar.update(value);
|
|
48
|
+
};
|
|
49
|
+
exports.setTotalProgress = setTotalProgress;
|
|
50
|
+
const incrementTotalProgress = () => {
|
|
51
|
+
totalBar.increment();
|
|
52
|
+
};
|
|
53
|
+
exports.incrementTotalProgress = incrementTotalProgress;
|
|
54
|
+
const bars = {};
|
|
55
|
+
const updateKey = (key, value, maxValue) => {
|
|
56
|
+
if (!bars[key]) {
|
|
57
|
+
bars[key] = {
|
|
58
|
+
bar: multibar.create(maxValue || value / 0.99 + 1, value, {
|
|
59
|
+
filename: key,
|
|
60
|
+
speed: (0, pretty_bytes_1.default)(0, { fixedWidth: 8 }) + "/s",
|
|
61
|
+
}),
|
|
62
|
+
maxValue: maxValue || 0,
|
|
63
|
+
valuesBuffer: [value],
|
|
64
|
+
timesBuffer: [Date.now()],
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
bars[key].valuesBuffer.push(value);
|
|
69
|
+
bars[key].timesBuffer.push(Date.now());
|
|
70
|
+
// keep only last 10 entries
|
|
71
|
+
let speed = 0;
|
|
72
|
+
if (bars[key].valuesBuffer.length > 100) {
|
|
73
|
+
const firstValue = bars[key].valuesBuffer.shift();
|
|
74
|
+
const firstTime = bars[key].timesBuffer.shift();
|
|
75
|
+
const lastTime = bars[key].timesBuffer[bars[key].timesBuffer.length - 1];
|
|
76
|
+
const lastValue = bars[key].valuesBuffer[bars[key].valuesBuffer.length - 1];
|
|
77
|
+
const timeDiff = Math.max(1, lastTime - firstTime) / 1000; // in seconds
|
|
78
|
+
const valueDiff = lastValue - firstValue;
|
|
79
|
+
speed = valueDiff / timeDiff;
|
|
80
|
+
}
|
|
81
|
+
bars[key].bar.setTotal(bars[key].maxValue || value / 0.99);
|
|
82
|
+
bars[key].bar.update(value, {
|
|
83
|
+
speed: (0, pretty_bytes_1.default)(speed, { fixedWidth: 8 }) + "/s",
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
exports.updateKey = updateKey;
|
|
88
|
+
const removeKey = (key) => {
|
|
89
|
+
if (bars[key]) {
|
|
90
|
+
multibar.remove(bars[key].bar);
|
|
91
|
+
delete bars[key];
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
exports.removeKey = removeKey;
|
|
95
|
+
const stopProgressBar = () => {
|
|
96
|
+
multibar.stop();
|
|
97
|
+
};
|
|
98
|
+
exports.stopProgressBar = stopProgressBar;
|
|
99
|
+
//# sourceMappingURL=progressbar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"progressbar.js","sourceRoot":"","sources":["../../src/progressbar.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAuC;AACvC,gEAAuC;AAEvC,SAAS,WAAW,CAAC,KAAa,EAAE,MAAc;IAChD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,WAAW,GAAG,CAClB,CAAM,EACN,QAAmC,EACnC,IAAY,EACZ,EAAE;IACF,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,YAAY;YACf,OAAO,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;QAC3B,KAAK,OAAO;YACV,OAAO,IAAA,sBAAW,EAAC,CAAC,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAAC;QAE5C;YACE,OAAO,CAAC,CAAC;IACb,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,QAAQ,GAAG,IAAI,sBAAW,CAAC,QAAQ,CACvC;IACE,GAAG,EAAE,CAAC;IACN,eAAe,EAAE,KAAK;IACtB,UAAU,EAAE,KAAK;IACjB,WAAW,EAAE,IAAI;IACjB,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,kEAAkE;IAC1E,WAAW;IACX,UAAU,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,iBAAiB,EAAE,EAAE,CAC5C,WAAW,CACT,sBAAW,CAAC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"@eslint/js";
|
|
4
|
+
import tseslint from "typescript-eslint";
|
|
5
|
+
import eslintConfigPrettier from "eslint-config-prettier";
|
|
6
|
+
|
|
7
|
+
export default tseslint.config(
|
|
8
|
+
js.configs.recommended,
|
|
9
|
+
tseslint.configs.strictTypeChecked,
|
|
10
|
+
{
|
|
11
|
+
languageOptions: {
|
|
12
|
+
parserOptions: {
|
|
13
|
+
projectService: true,
|
|
14
|
+
tsconfigRootDir: import.meta.dirname,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
eslintConfigPrettier,
|
|
19
|
+
{
|
|
20
|
+
files: [
|
|
21
|
+
"*.test.ts",
|
|
22
|
+
"*.test.js",
|
|
23
|
+
"*-test.js",
|
|
24
|
+
"**/mock*.ts",
|
|
25
|
+
"**/mock*.js",
|
|
26
|
+
"**/__mocks__/**",
|
|
27
|
+
"**/tests/**",
|
|
28
|
+
"**/fakeData/**",
|
|
29
|
+
],
|
|
30
|
+
plugins: { vitest },
|
|
31
|
+
rules: {
|
|
32
|
+
"vitest/no-disabled-tests": "warn",
|
|
33
|
+
"vitest/no-focused-tests": "error",
|
|
34
|
+
"vitest/no-identical-title": "error",
|
|
35
|
+
"vitest/prefer-to-have-length": "warn",
|
|
36
|
+
"vitest/valid-expect": "error",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
files: ["**/*.js", "**/*.ts"],
|
|
41
|
+
languageOptions: {
|
|
42
|
+
ecmaVersion: 2022,
|
|
43
|
+
sourceType: "module",
|
|
44
|
+
globals: {
|
|
45
|
+
...globals.node,
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
rules: {
|
|
49
|
+
"no-var": "error",
|
|
50
|
+
"prefer-const": "error",
|
|
51
|
+
"no-unneeded-ternary": "error",
|
|
52
|
+
"prefer-arrow-callback": "error",
|
|
53
|
+
"no-lonely-if": "error",
|
|
54
|
+
// consistent-return not needed due to noImplicitReturns enabled in tsconfig
|
|
55
|
+
"consistent-return": "off",
|
|
56
|
+
curly: "error",
|
|
57
|
+
indent: "off",
|
|
58
|
+
"@typescript-eslint/indent": "off",
|
|
59
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
60
|
+
"@typescript-eslint/no-unused-vars": "off",
|
|
61
|
+
"@typescript-eslint/ban-ts-comment": "off",
|
|
62
|
+
"@typescript-eslint/no-non-null-assertion": "off",
|
|
63
|
+
"@typescript-eslint/no-unsafe-call": "off",
|
|
64
|
+
"@typescript-eslint/no-unsafe-assignment": "off",
|
|
65
|
+
"@typescript-eslint/no-unsafe-argument": "off",
|
|
66
|
+
"@typescript-eslint/only-throw-error": "off",
|
|
67
|
+
"@typescript-eslint/no-unnecessary-condition": "off",
|
|
68
|
+
"@typescript-eslint/no-confusing-void-expression": "off",
|
|
69
|
+
"@typescript-eslint/require-await": "off",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
files: ["**/*.js"],
|
|
74
|
+
languageOptions: {
|
|
75
|
+
ecmaVersion: 2022,
|
|
76
|
+
sourceType: "module",
|
|
77
|
+
globals: {
|
|
78
|
+
...globals.node,
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
rules: {
|
|
82
|
+
"@typescript-eslint/no-require-imports": "off",
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
ignores: [
|
|
87
|
+
"dist/*",
|
|
88
|
+
"build/*",
|
|
89
|
+
"config/*",
|
|
90
|
+
"eslint-ci.config.mjs",
|
|
91
|
+
"eslint.config.mjs",
|
|
92
|
+
"src/customLib.d.ts",
|
|
93
|
+
],
|
|
94
|
+
},
|
|
95
|
+
);
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "setupcomfyuimodels",
|
|
3
|
+
"bin": {
|
|
4
|
+
"setupcomfyuimodels": "dist/src/index.js"
|
|
5
|
+
},
|
|
6
|
+
"version": "1.0.0",
|
|
7
|
+
"description": "",
|
|
8
|
+
"main": "src/index.ts",
|
|
9
|
+
"scripts": {
|
|
10
|
+
"clean": "rimraf coverage build",
|
|
11
|
+
"build": "npm run clean && mkdir -p dist && run-p build:*",
|
|
12
|
+
"build:tsc": "tsc -p tsconfig.json",
|
|
13
|
+
"prepackage": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@eslint/js": "^9.20.0",
|
|
17
|
+
"@tsconfig/node22": "^22.0.0",
|
|
18
|
+
"@types/cli-progress": "^3.11.6",
|
|
19
|
+
"@types/node": "^22.18.1",
|
|
20
|
+
"eslint": "^9.20.1",
|
|
21
|
+
"eslint-config-prettier": "^10.0.1",
|
|
22
|
+
"npm-run-all": "^4.1.5",
|
|
23
|
+
"prettier": "^3.3.3",
|
|
24
|
+
"rimraf": "^6.0.1",
|
|
25
|
+
"ts-node": "^10.9.1",
|
|
26
|
+
"tsutils": "^3.21.0",
|
|
27
|
+
"typescript": "^5.7.3",
|
|
28
|
+
"typescript-eslint": "^8.24.1"
|
|
29
|
+
},
|
|
30
|
+
"author": "",
|
|
31
|
+
"license": "ISC",
|
|
32
|
+
"volta": {
|
|
33
|
+
"node": "22.14.0",
|
|
34
|
+
"npm": "10.9.2"
|
|
35
|
+
},
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
38
|
+
"chalk": "^5.6.2",
|
|
39
|
+
"cli-progress": "^3.12.0",
|
|
40
|
+
"comment-json": "^4.4.1",
|
|
41
|
+
"pretty-bytes": "^7.1.0"
|
|
42
|
+
}
|
|
43
|
+
}
|
package/package.json~
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "setupjs",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"clean": "rimraf coverage build",
|
|
8
|
+
"build": "npm run clean && mkdir -p dist && run-p build:*",
|
|
9
|
+
"build:tsc": "tsc -p tsconfig.json"
|
|
10
|
+
},
|
|
11
|
+
"devDependencies": {
|
|
12
|
+
"@eslint/js": "^9.20.0",
|
|
13
|
+
"@tsconfig/node22": "^22.0.0",
|
|
14
|
+
"@types/cli-progress": "^3.11.6",
|
|
15
|
+
"@types/node": "^22.18.1",
|
|
16
|
+
"eslint": "^9.20.1",
|
|
17
|
+
"eslint-config-prettier": "^10.0.1",
|
|
18
|
+
"npm-run-all": "^4.1.5",
|
|
19
|
+
"prettier": "^3.3.3",
|
|
20
|
+
"rimraf": "^6.0.1",
|
|
21
|
+
"ts-node": "^10.9.1",
|
|
22
|
+
"tsutils": "^3.21.0",
|
|
23
|
+
"typescript": "^5.7.3",
|
|
24
|
+
"typescript-eslint": "^8.24.1"
|
|
25
|
+
},
|
|
26
|
+
"author": "",
|
|
27
|
+
"license": "ISC",
|
|
28
|
+
"volta": {
|
|
29
|
+
"node": "22.14.0",
|
|
30
|
+
"npm": "10.9.2"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
34
|
+
"chalk": "^5.6.2",
|
|
35
|
+
"cli-progress": "^3.12.0",
|
|
36
|
+
"comment-json": "^4.4.1",
|
|
37
|
+
"pretty-bytes": "^7.1.0"
|
|
38
|
+
}
|
|
39
|
+
}
|
package/src/config.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
export const config = {
|
|
2
|
+
files: {
|
|
3
|
+
// IpAdapter models
|
|
4
|
+
"clip_vision/CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors":
|
|
5
|
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/model.safetensors",
|
|
6
|
+
"clip_vision/CLIP-ViT-bigG-14-laion2B-39B-b160k.safetensors":
|
|
7
|
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/image_encoder/model.safetensors",
|
|
8
|
+
"ipadapter/ip-adapter-plus_sdxl_vit-h.safetensors":
|
|
9
|
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter-plus_sdxl_vit-h.safetensors",
|
|
10
|
+
"ipadapter/ip-adapter-plus-face_sdxl_vit-h.safetensors":
|
|
11
|
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter-plus-face_sdxl_vit-h.safetensors",
|
|
12
|
+
|
|
13
|
+
// SD 1.5 Controlnets
|
|
14
|
+
// Overview here: https://huggingface.co/lllyasviel/control_v11f1e_sd15_tile
|
|
15
|
+
// Tile:
|
|
16
|
+
"controlnet/control_v11f1e_sd15_tile.bin":
|
|
17
|
+
"https://huggingface.co/lllyasviel/control_v11f1e_sd15_tile/resolve/main/diffusion_pytorch_model.bin",
|
|
18
|
+
},
|
|
19
|
+
folders: {
|
|
20
|
+
// checkpoints: [
|
|
21
|
+
// // "https://huggingface.co/runwayml/stable-diffusion-v1-5/resolve/main/v1-5-pruned-emaonly.ckpt",
|
|
22
|
+
// // "https://huggingface.co/stabilityai/stable-diffusion-2-1/resolve/main/v2-1_768-ema-pruned.ckpt",
|
|
23
|
+
// // "https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0/resolve/main/sd_xl_base_1.0.safetensors",
|
|
24
|
+
// // "https://huggingface.co/stabilityai/stable-diffusion-xl-refiner-1.0/resolve/main/sd_xl_refiner_1.0.safetensors",
|
|
25
|
+
|
|
26
|
+
// // Juggernaut XL v9: 832*1216, Sampler: DPM++ 2M SDE; Steps: 30-40; CFG: 3-6 (less is a bit more realistic)
|
|
27
|
+
// "https://huggingface.co/RunDiffusion/Juggernaut-XL-v9/resolve/main/Juggernaut-XL_v9_RunDiffusionPhoto_v2.safetensors",
|
|
28
|
+
// // Big Lust
|
|
29
|
+
// "https://civitai.com/api/download/models/1081768?type=Model&format=SafeTensor&size=full&fp=fp16",
|
|
30
|
+
// // Juggernaut XL inpainting:
|
|
31
|
+
// "https://civitai.com/api/download/models/456538?type=Model&format=SafeTensor&size=pruned&fp=fp16",
|
|
32
|
+
|
|
33
|
+
// // Lustify; Sampler: DPM++ 2M SDE/DPM++ 3M SDE; Steps: 30; Cfg: 2.5-4.5
|
|
34
|
+
// "https://civitai.com/api/download/models/1569593?type=Model&format=SafeTensor&size=pruned&fp=fp16",
|
|
35
|
+
|
|
36
|
+
// // Photon (SD 1.5) Size: 512x768 or 768x512; Sampler: DPM++ 2M Karras | Steps: 20 | CFG Scale: 6
|
|
37
|
+
// "https://civitai.com/api/download/models/90072?type=Model&format=SafeTensor&size=pruned&fp=fp16",
|
|
38
|
+
|
|
39
|
+
// // SD 1.5
|
|
40
|
+
// // "https://civitai.com/models/132632/epicphotogasm"
|
|
41
|
+
// ],
|
|
42
|
+
// diffusion_models: [
|
|
43
|
+
// // Flux-Fill FP8
|
|
44
|
+
// "https://huggingface.co/jackzheng/flux-fill-FP8/resolve/main/fluxFillFP8_v10.safetensors",
|
|
45
|
+
// ],
|
|
46
|
+
inpaint: [
|
|
47
|
+
// for https://github.com/Acly/comfyui-inpaint-nodes
|
|
48
|
+
"https://huggingface.co/lllyasviel/fooocus_inpaint/resolve/main/fooocus_inpaint_head.pth",
|
|
49
|
+
"https://huggingface.co/lllyasviel/fooocus_inpaint/resolve/main/inpaint_v26.fooocus.patch",
|
|
50
|
+
],
|
|
51
|
+
loras: [
|
|
52
|
+
"https://huggingface.co/ali-vilab/ACE_Plus/resolve/main/portrait/comfyui_portrait_lora64.safetensors",
|
|
53
|
+
"https://huggingface.co/ali-vilab/ACE_Plus/resolve/main/subject/comfyui_subject_lora16.safetensors",
|
|
54
|
+
"https://huggingface.co/ali-vilab/ACE_Plus/resolve/main/local_editing/comfyui_local_lora16.safetensors",
|
|
55
|
+
"https://civitai.com/api/download/models/871108?type=Model&format=SafeTensor",
|
|
56
|
+
|
|
57
|
+
// Better Freckles Quality Lora SD 1.5:
|
|
58
|
+
// https://civitai.com/models/457839/better-freckles-quality-lora-sd-15
|
|
59
|
+
"https://civitai.com/api/download/models/509603?type=Model&format=SafeTensor",
|
|
60
|
+
|
|
61
|
+
// Detail Tweaker LoRA SD 1.5:
|
|
62
|
+
// https://civitai.com/models/58390/detail-tweaker-lora-lora
|
|
63
|
+
"https://civitai.com/api/download/models/62833?type=Model&format=SafeTensor",
|
|
64
|
+
|
|
65
|
+
// Flux.1-Turbo-Alpha
|
|
66
|
+
"https://huggingface.co/alimama-creative/FLUX.1-Turbo-Alpha/resolve/main/diffusion_pytorch_model.safetensors",
|
|
67
|
+
// "https://civitai.com/api/download/models/981081?type=Model&format=SafeTensor" ,
|
|
68
|
+
],
|
|
69
|
+
vae: [
|
|
70
|
+
"https://huggingface.co/stabilityai/sd-vae-ft-ema-original/resolve/main/vae-ft-ema-560000-ema-pruned.safetensors",
|
|
71
|
+
"https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors",
|
|
72
|
+
"https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors",
|
|
73
|
+
"https://huggingface.co/Comfy-Org/Lumina_Image_2.0_Repackaged/resolve/main/split_files/vae/ae.safetensors",
|
|
74
|
+
// "https://huggingface.co/lovis93/testllm/resolve/ed9cf1af7465cebca4649157f118e331cf2a084f/ae.safetensors",
|
|
75
|
+
],
|
|
76
|
+
esrgan: [
|
|
77
|
+
"https://huggingface.co/ai-forever/Real-ESRGAN/resolve/main/RealESRGAN_x4.pth",
|
|
78
|
+
"https://huggingface.co/FacehugmanIII/4x_foolhardy_Remacri/resolve/main/4x_foolhardy_Remacri.pth",
|
|
79
|
+
"https://huggingface.co/Akumetsu971/SD_Anime_Futuristic_Armor/resolve/main/4x_NMKD-Siax_200k.pth",
|
|
80
|
+
],
|
|
81
|
+
upscale_models: [
|
|
82
|
+
// Clear Reality
|
|
83
|
+
"https://huggingface.co/skbhadra/ClearRealityV1/resolve/main/4x-ClearRealityV1.pth",
|
|
84
|
+
// Ultrasharp
|
|
85
|
+
"https://civitai.com/api/download/models/125843?type=Model&format=PickleTensor",
|
|
86
|
+
// Skin Detailer (Upscaler)
|
|
87
|
+
"https://huggingface.co/uwg/upscaler/resolve/main/ESRGAN/1x-ITF-SkinDiffDetail-Lite-v1.pth",
|
|
88
|
+
],
|
|
89
|
+
controlnet: [
|
|
90
|
+
"https://huggingface.co/hr16/ControlNet-HandRefiner-pruned/resolve/main/control_sd15_inpaint_depth_hand_fp16.safetensors",
|
|
91
|
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/diffusers_xl_canny_mid.safetensors",
|
|
92
|
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/diffusers_xl_depth_mid.safetensors?download",
|
|
93
|
+
"https://huggingface.co/lllyasviel/sd_control_collection/resolve/main/t2i-adapter_diffusers_xl_openpose.safetensors",
|
|
94
|
+
"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_canny-fp16.safetensors",
|
|
95
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_depth-fp16.safetensors",
|
|
96
|
+
"https://huggingface.co/kohya-ss/ControlNet-diff-modules/resolve/main/diff_control_sd15_depth_fp16.safetensors",
|
|
97
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_hed-fp16.safetensors",
|
|
98
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_mlsd-fp16.safetensors",
|
|
99
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_normal-fp16.safetensors",
|
|
100
|
+
"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_openpose-fp16.safetensors",
|
|
101
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_scribble-fp16.safetensors",
|
|
102
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/control_seg-fp16.safetensors",
|
|
103
|
+
"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_canny-fp16.safetensors",
|
|
104
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_color-fp16.safetensors",
|
|
105
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_depth-fp16.safetensors",
|
|
106
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_keypose-fp16.safetensors",
|
|
107
|
+
"https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_openpose-fp16.safetensors",
|
|
108
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_seg-fp16.safetensors",
|
|
109
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_sketch-fp16.safetensors",
|
|
110
|
+
// "https://huggingface.co/webui/ControlNet-modules-safetensors/resolve/main/t2iadapter_style-fp16.safetensors",
|
|
111
|
+
"https://huggingface.co/xinsir/controlnet-union-sdxl-1.0/resolve/main/diffusion_pytorch_model_promax.safetensors",
|
|
112
|
+
],
|
|
113
|
+
insightface: [
|
|
114
|
+
// https://github.com/Gourieff/ComfyUI-ReActor/ manchmal ist inswapper broken, deshalb manueller download
|
|
115
|
+
"https://huggingface.co/ezioruan/inswapper_128.onnx/resolve/main/inswapper_128.onnx",
|
|
116
|
+
],
|
|
117
|
+
"xlabs/controlnets": [
|
|
118
|
+
// Flux Controlnet
|
|
119
|
+
// "https://huggingface.co/XLabs-AI/flux-controlnet-collections/resolve/main/flux-depth-controlnet-v3.safetensors"
|
|
120
|
+
],
|
|
121
|
+
"ultralytics/bbox": [
|
|
122
|
+
// Feet, hand, face, hair, skin detectors
|
|
123
|
+
"https://huggingface.co/AunyMoons/loras-pack/resolve/main/foot-yolov8l.pt",
|
|
124
|
+
"https://huggingface.co/AunyMoons/loras-pack/resolve/main/hand_yolov8s.pt",
|
|
125
|
+
"https://huggingface.co/AunyMoons/loras-pack/resolve/main/face_yolov8m.pt",
|
|
126
|
+
"https://github.com/hben35096/assets/releases/download/yolo8/hair_yolov8n-seg_60.pt",
|
|
127
|
+
"https://github.com/hben35096/assets/releases/download/yolo8/skin_yolov8m-seg_400.pt",
|
|
128
|
+
],
|
|
129
|
+
sams: [
|
|
130
|
+
// Hand Detailer flow https://www.reddit.com/media?url=https%3A%2F%2Fpreview.redd.it%2Fhand-detailer-v0-3038v38j29cc1.png%3Fwidth%3D2724%26format%3Dpng%26auto%3Dwebp%26s%3D89d31b07eb3f125d869a0a08425af56c2d56b692
|
|
131
|
+
"https://huggingface.co/HCMUE-Research/SAM-vit-h/resolve/main/sam_vit_h_4b8939.pth",
|
|
132
|
+
],
|
|
133
|
+
clip: [
|
|
134
|
+
"https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors",
|
|
135
|
+
"https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors",
|
|
136
|
+
"https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors",
|
|
137
|
+
],
|
|
138
|
+
},
|
|
139
|
+
};
|
package/src/config.ts~
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
export const config = {
|
|
2
|
+
files: {
|
|
3
|
+
// IpAdapter models
|
|
4
|
+
"clip_vision/CLIP-ViT-H-14-laion2B-s32B-b79K.safetensors":
|
|
5
|
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/models/image_encoder/model.safetensors",
|
|
6
|
+
"clip_vision/CLIP-ViT-bigG-14-laion2B-39B-b160k.safetensors":
|
|
7
|
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/image_encoder/model.safetensors",
|
|
8
|
+
"ipadapter/ip-adapter-plus_sdxl_vit-h.safetensors":
|
|
9
|
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter-plus_sdxl_vit-h.safetensors",
|
|
10
|
+
"ipadapter/ip-adapter-plus-face_sdxl_vit-h.safetensors":
|
|
11
|
+
"https://huggingface.co/h94/IP-Adapter/resolve/main/sdxl_models/ip-adapter-plus-face_sdxl_vit-h.safetensors",
|
|
12
|
+
|
|
13
|
+
// SD 1.5 Controlnets
|
|
14
|
+
// Overview here: https://huggingface.co/lllyasviel/control_v11f1e_sd15_tile
|
|
15
|
+
// Tile:
|
|
16
|
+
"controlnet/control_v11f1e_sd15_tile.bin":
|
|
17
|
+
"https://huggingface.co/lllyasviel/control_v11f1e_sd15_tile/resolve/main/diffusion_pytorch_model.bin",
|
|
18
|
+
},
|
|
19
|
+
folders: {
|
|
20
|
+
diffusion_models: [
|
|
21
|
+
// Flux-Fill FP8
|
|
22
|
+
"https://huggingface.co/jackzheng/flux-fill-FP8/resolve/main/fluxFillFP8_v10.safetensors",
|
|
23
|
+
],
|
|
24
|
+
inpaint: [
|
|
25
|
+
// for https://github.com/Acly/comfyui-inpaint-nodes
|
|
26
|
+
"https://huggingface.co/lllyasviel/fooocus_inpaint/resolve/main/fooocus_inpaint_head.pth",
|
|
27
|
+
"https://huggingface.co/lllyasviel/fooocus_inpaint/resolve/main/inpaint_v26.fooocus.patch",
|
|
28
|
+
],
|
|
29
|
+
loras: [
|
|
30
|
+
"https://huggingface.co/ali-vilab/ACE_Plus/resolve/main/portrait/comfyui_portrait_lora64.safetensors",
|
|
31
|
+
"https://huggingface.co/ali-vilab/ACE_Plus/resolve/main/subject/comfyui_subject_lora16.safetensors",
|
|
32
|
+
"https://huggingface.co/ali-vilab/ACE_Plus/resolve/main/local_editing/comfyui_local_lora16.safetensors",
|
|
33
|
+
"https://civitai.com/api/download/models/871108?type=Model&format=SafeTensor",
|
|
34
|
+
|
|
35
|
+
// Better Freckles Quality Lora SD 1.5:
|
|
36
|
+
// https://civitai.com/models/457839/better-freckles-quality-lora-sd-15
|
|
37
|
+
"https://civitai.com/api/download/models/509603?type=Model&format=SafeTensor",
|
|
38
|
+
|
|
39
|
+
// Detail Tweaker LoRA SD 1.5:
|
|
40
|
+
// https://civitai.com/models/58390/detail-tweaker-lora-lora
|
|
41
|
+
"https://civitai.com/api/download/models/62833?type=Model&format=SafeTensor",
|
|
42
|
+
|
|
43
|
+
// Flux.1-Turbo-Alpha
|
|
44
|
+
"https://huggingface.co/alimama-creative/FLUX.1-Turbo-Alpha/resolve/main/diffusion_pytorch_model.safetensors",
|
|
45
|
+
// "https://civitai.com/api/download/models/981081?type=Model&format=SafeTensor" ,
|
|
46
|
+
],
|
|
47
|
+
vae: [
|
|
48
|
+
"https://huggingface.co/stabilityai/sd-vae-ft-ema-original/resolve/main/vae-ft-ema-560000-ema-pruned.safetensors",
|
|
49
|
+
"https://huggingface.co/stabilityai/sd-vae-ft-mse-original/resolve/main/vae-ft-mse-840000-ema-pruned.safetensors",
|
|
50
|
+
"https://huggingface.co/stabilityai/sdxl-vae/resolve/main/sdxl_vae.safetensors",
|
|
51
|
+
"https://huggingface.co/Comfy-Org/Lumina_Image_2.0_Repackaged/resolve/main/split_files/vae/ae.safetensors",
|
|
52
|
+
// "https://huggingface.co/lovis93/testllm/resolve/ed9cf1af7465cebca4649157f118e331cf2a084f/ae.safetensors",
|
|
53
|
+
],
|
|
54
|
+
esrgan: [
|
|
55
|
+
"https://huggingface.co/ai-forever/Real-ESRGAN/resolve/main/RealESRGAN_x4.pth",
|
|
56
|
+
"https://huggingface.co/FacehugmanIII/4x_foolhardy_Remacri/resolve/main/4x_foolhardy_Remacri.pth",
|
|
57
|
+
"https://huggingface.co/Akumetsu971/SD_Anime_Futuristic_Armor/resolve/main/4x_NMKD-Siax_200k.pth",
|
|
58
|
+
],
|
|
59
|
+
upscale_models: [
|
|
60
|
+
// Clear Reality
|
|
61
|
+
"https://huggingface.co/skbhadra/ClearRealityV1/resolve/main/4x-ClearRealityV1.pth",
|
|
62
|
+
// Ultrasharp
|
|
63
|
+
"https://civitai.com/api/download/models/125843?type=Model&format=PickleTensor",
|
|
64
|
+
// Skin Detailer (Upscaler)
|
|
65
|
+
"https://huggingface.co/uwg/upscaler/resolve/main/ESRGAN/1x-ITF-SkinDiffDetail-Lite-v1.pth",
|
|
66
|
+
],
|
|
67
|
+
controlnet: [
|
|
68
|
+
"https://huggingface.co/hr16/ControlNet-HandRefiner-pruned/resolve/main/control_sd15_inpaint_depth_hand_fp16.safetensors",
|
|
69
|
+
],
|
|
70
|
+
insightface: [
|
|
71
|
+
// https://github.com/Gourieff/ComfyUI-ReActor/ manchmal ist inswapper broken, deshalb manueller download
|
|
72
|
+
"https://huggingface.co/ezioruan/inswapper_128.onnx/resolve/main/inswapper_128.onnx",
|
|
73
|
+
],
|
|
74
|
+
"xlabs/controlnets": [
|
|
75
|
+
// Flux Controlnet
|
|
76
|
+
// "https://huggingface.co/XLabs-AI/flux-controlnet-collections/resolve/main/flux-depth-controlnet-v3.safetensors"
|
|
77
|
+
],
|
|
78
|
+
"ultralytics/bbox": [
|
|
79
|
+
// Feet, hand, face, hair, skin detectors
|
|
80
|
+
"https://huggingface.co/AunyMoons/loras-pack/resolve/main/foot-yolov8l.pt",
|
|
81
|
+
"https://huggingface.co/AunyMoons/loras-pack/resolve/main/hand_yolov8s.pt",
|
|
82
|
+
"https://huggingface.co/AunyMoons/loras-pack/resolve/main/face_yolov8m.pt",
|
|
83
|
+
"https://github.com/hben35096/assets/releases/download/yolo8/hair_yolov8n-seg_60.pt",
|
|
84
|
+
"https://github.com/hben35096/assets/releases/download/yolo8/skin_yolov8m-seg_400.pt",
|
|
85
|
+
],
|
|
86
|
+
sams: [
|
|
87
|
+
// Hand Detailer flow https://www.reddit.com/media?url=https%3A%2F%2Fpreview.redd.it%2Fhand-detailer-v0-3038v38j29cc1.png%3Fwidth%3D2724%26format%3Dpng%26auto%3Dwebp%26s%3D89d31b07eb3f125d869a0a08425af56c2d56b692
|
|
88
|
+
"https://huggingface.co/HCMUE-Research/SAM-vit-h/resolve/main/sam_vit_h_4b8939.pth",
|
|
89
|
+
],
|
|
90
|
+
clip: [
|
|
91
|
+
"https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp16.safetensors",
|
|
92
|
+
"https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/t5xxl_fp8_e4m3fn.safetensors",
|
|
93
|
+
"https://huggingface.co/comfyanonymous/flux_text_encoders/resolve/main/clip_l.safetensors",
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
};
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import * as fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { Readable } from "stream";
|
|
4
|
+
import {
|
|
5
|
+
incrementTotalProgress,
|
|
6
|
+
log,
|
|
7
|
+
removeKey,
|
|
8
|
+
setTotalProgress,
|
|
9
|
+
stopProgressBar,
|
|
10
|
+
updateKey,
|
|
11
|
+
} from "./progressbar";
|
|
12
|
+
import { getConfig } from "./getConfig";
|
|
13
|
+
import chalk from "chalk";
|
|
14
|
+
|
|
15
|
+
const { WORKSPACE, CIVITAI_TOKEN, HF_TOKEN } = process.env;
|
|
16
|
+
|
|
17
|
+
if (!WORKSPACE) {
|
|
18
|
+
throw new Error("WORKSPACE environment variable is not set.");
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const MAX_CONCURRENT_DOWNLOADS = 8;
|
|
22
|
+
let concurrentDownloads = 0;
|
|
23
|
+
|
|
24
|
+
export const downloadAssets = async (configLocation: string) => {
|
|
25
|
+
const config = await getConfig(configLocation);
|
|
26
|
+
const filePromises = [
|
|
27
|
+
...Object.entries(config.files).map(([targetLocation, url]) => {
|
|
28
|
+
const fileName = path.basename(targetLocation),
|
|
29
|
+
dir = path.dirname(targetLocation);
|
|
30
|
+
return scheduleDownload(dir, fileName, url);
|
|
31
|
+
}),
|
|
32
|
+
...Object.entries(config.folders).flatMap(([folder, urls]) =>
|
|
33
|
+
urls.map((url) => scheduleDownload(folder, null, url)),
|
|
34
|
+
),
|
|
35
|
+
];
|
|
36
|
+
setTotalProgress(0, filePromises.length);
|
|
37
|
+
await Promise.all(filePromises);
|
|
38
|
+
stopProgressBar();
|
|
39
|
+
console.log(
|
|
40
|
+
chalk.bgWhite("Skipped downloads:\n"),
|
|
41
|
+
results
|
|
42
|
+
.filter((r) => r.skipped)
|
|
43
|
+
.map((r) => `${r.targetLocation}/${r.targetFileName || ""} from ${r.url}`)
|
|
44
|
+
.join("\n"),
|
|
45
|
+
);
|
|
46
|
+
console.log(
|
|
47
|
+
chalk.bgWhite("Successful downloads:\n"),
|
|
48
|
+
results
|
|
49
|
+
.filter((r) => r.downloaded)
|
|
50
|
+
.map((r) => `${r.targetLocation}/${r.targetFileName || ""} from ${r.url}`)
|
|
51
|
+
.join("\n"),
|
|
52
|
+
);
|
|
53
|
+
console.log(
|
|
54
|
+
chalk.bgWhite("Download errors:\n"),
|
|
55
|
+
results
|
|
56
|
+
.filter((r) => r.error)
|
|
57
|
+
.map(
|
|
58
|
+
(r) =>
|
|
59
|
+
`${r.targetLocation}/${r.targetFileName || ""} from ${r.url} had error: ${r.error}`,
|
|
60
|
+
)
|
|
61
|
+
.join("\n"),
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const scheduledDownloads = [] as {
|
|
66
|
+
targetLocation: string;
|
|
67
|
+
targetFileName: string | null;
|
|
68
|
+
url: string;
|
|
69
|
+
}[];
|
|
70
|
+
const results = [] as {
|
|
71
|
+
targetLocation: string;
|
|
72
|
+
targetFileName: string | null;
|
|
73
|
+
url: string;
|
|
74
|
+
skipped?: boolean;
|
|
75
|
+
downloaded?: boolean;
|
|
76
|
+
error?: string;
|
|
77
|
+
}[];
|
|
78
|
+
const scheduleDownload = async (
|
|
79
|
+
targetLocation: string,
|
|
80
|
+
targetFileName: string | null,
|
|
81
|
+
url: string,
|
|
82
|
+
) => {
|
|
83
|
+
scheduledDownloads.push({ targetLocation, url, targetFileName });
|
|
84
|
+
if (concurrentDownloads < MAX_CONCURRENT_DOWNLOADS) {
|
|
85
|
+
while (scheduledDownloads.length > 0) {
|
|
86
|
+
const nextDownload = scheduledDownloads.shift();
|
|
87
|
+
if (nextDownload) {
|
|
88
|
+
concurrentDownloads++;
|
|
89
|
+
try {
|
|
90
|
+
const skipped = await downloadFile(
|
|
91
|
+
nextDownload.targetLocation,
|
|
92
|
+
nextDownload.targetFileName,
|
|
93
|
+
nextDownload.url,
|
|
94
|
+
);
|
|
95
|
+
results.push({
|
|
96
|
+
...nextDownload,
|
|
97
|
+
skipped,
|
|
98
|
+
downloaded: !skipped,
|
|
99
|
+
});
|
|
100
|
+
} catch (error) {
|
|
101
|
+
results.push({
|
|
102
|
+
...nextDownload,
|
|
103
|
+
error: (error as Error).message,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
incrementTotalProgress();
|
|
107
|
+
concurrentDownloads--;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const downloadFile = async (
|
|
114
|
+
targetLocation: string,
|
|
115
|
+
targetFileName: string | null,
|
|
116
|
+
url: string,
|
|
117
|
+
) => {
|
|
118
|
+
const getTargetId = () => path.join(targetLocation, targetFileName || "");
|
|
119
|
+
try {
|
|
120
|
+
const targetDir = path.normalize(`${WORKSPACE}/models/${targetLocation}`);
|
|
121
|
+
|
|
122
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
123
|
+
if (targetFileName && fs.existsSync(path.join(targetDir, targetFileName))) {
|
|
124
|
+
log(`File already exists, skipping: ${getTargetId()}`);
|
|
125
|
+
return true;
|
|
126
|
+
}
|
|
127
|
+
const isCivitAi = url.match(/https:\/\/civitai.com/);
|
|
128
|
+
const isHugging = url.match(/https:\/\/huggingface.co/);
|
|
129
|
+
|
|
130
|
+
const headers: Record<string, string> = {};
|
|
131
|
+
if (isCivitAi && CIVITAI_TOKEN) {
|
|
132
|
+
headers["Authorization"] = `Bearer ${CIVITAI_TOKEN}`;
|
|
133
|
+
}
|
|
134
|
+
if (isHugging && HF_TOKEN) {
|
|
135
|
+
headers["Authorization"] = `Bearer ${HF_TOKEN}`;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
const response = await fetch(url, { headers });
|
|
139
|
+
if (!response.ok || !response.body) {
|
|
140
|
+
log(`Error for url: ${url}`);
|
|
141
|
+
throw new Error(
|
|
142
|
+
`Failed to download ${url}: ${response.status} ${response.statusText}`,
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
const total = Number(response.headers.get("content-length"));
|
|
146
|
+
const contentDisposition = response.headers.get("content-disposition");
|
|
147
|
+
if (!targetFileName) {
|
|
148
|
+
const fileNameMatch = contentDisposition?.match(
|
|
149
|
+
/filename="?(.+?)"?($|;)/,
|
|
150
|
+
);
|
|
151
|
+
if (fileNameMatch) {
|
|
152
|
+
targetFileName = fileNameMatch[1];
|
|
153
|
+
} else {
|
|
154
|
+
log(`Error for url: ${url}`);
|
|
155
|
+
throw new Error(
|
|
156
|
+
`Failed to extract filename from content-disposition for ${url}. Provide filename.`,
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const filePath = path.join(targetDir, targetFileName);
|
|
161
|
+
if (fs.existsSync(filePath)) {
|
|
162
|
+
log(`File already exists, skipping: ${getTargetId()}`);
|
|
163
|
+
response.body?.cancel();
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
log(`Downloading ${getTargetId()} from ${url}`);
|
|
167
|
+
|
|
168
|
+
updateKey(getTargetId(), 0, total);
|
|
169
|
+
const readableNodeStream = Readable.fromWeb(response.body);
|
|
170
|
+
const fileStream = fs.createWriteStream(filePath + ".part");
|
|
171
|
+
|
|
172
|
+
let current = 0;
|
|
173
|
+
await new Promise<void>((resolve, reject) => {
|
|
174
|
+
readableNodeStream.on("data", (chunk: Buffer) => {
|
|
175
|
+
current += chunk.length;
|
|
176
|
+
updateKey(getTargetId(), current, total);
|
|
177
|
+
});
|
|
178
|
+
readableNodeStream.pipe(fileStream);
|
|
179
|
+
readableNodeStream.on("error", reject);
|
|
180
|
+
fileStream.on("finish", resolve);
|
|
181
|
+
});
|
|
182
|
+
fs.renameSync(filePath + ".part", filePath);
|
|
183
|
+
log(`Done downloading: ${url}`);
|
|
184
|
+
return false;
|
|
185
|
+
} finally {
|
|
186
|
+
removeKey(getTargetId());
|
|
187
|
+
}
|
|
188
|
+
};
|
|
File without changes
|
package/src/getConfig.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
import { parse } from "comment-json";
|
|
3
|
+
|
|
4
|
+
export const getConfig = async (configLocation: string) => {
|
|
5
|
+
const fileContent = readFileSync(configLocation, "utf-8");
|
|
6
|
+
|
|
7
|
+
return parse(fileContent) as unknown as {
|
|
8
|
+
files: Record<string, string>;
|
|
9
|
+
folders: Record<string, string[]>;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
File without changes
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "@commander-js/extra-typings";
|
|
3
|
+
import { downloadAssets } from "./downloadAssets";
|
|
4
|
+
|
|
5
|
+
const program = new Command();
|
|
6
|
+
program.name("Setup ComfyUi Models");
|
|
7
|
+
program
|
|
8
|
+
.command("download")
|
|
9
|
+
.argument("<config>", "JSON config file location")
|
|
10
|
+
.action(async (configLocation: string) => {
|
|
11
|
+
await downloadAssets(configLocation);
|
|
12
|
+
});
|
|
13
|
+
program.parse();
|
package/src/index.ts~
ADDED
|
File without changes
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import progressBar from "cli-progress";
|
|
2
|
+
import prettyBytes from "pretty-bytes";
|
|
3
|
+
|
|
4
|
+
function autopadding(value: string, length: number) {
|
|
5
|
+
return String(value).padStart(length);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const formatValue = (
|
|
9
|
+
v: any,
|
|
10
|
+
_options: { autopadding?: boolean },
|
|
11
|
+
type: string,
|
|
12
|
+
) => {
|
|
13
|
+
switch (type) {
|
|
14
|
+
case "percentage":
|
|
15
|
+
return autopadding(v, 3);
|
|
16
|
+
case "value":
|
|
17
|
+
return prettyBytes(v, { fixedWidth: 10 });
|
|
18
|
+
|
|
19
|
+
default:
|
|
20
|
+
return v;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const multibar = new progressBar.MultiBar(
|
|
25
|
+
{
|
|
26
|
+
fps: 2,
|
|
27
|
+
clearOnComplete: false,
|
|
28
|
+
hideCursor: false,
|
|
29
|
+
autopadding: true,
|
|
30
|
+
align: "left",
|
|
31
|
+
format: "{value} {speed} {eta_formatted} {bar} {percentage}% - {filename}",
|
|
32
|
+
formatValue,
|
|
33
|
+
formatTime: (t, options, roundToMultipleOf) =>
|
|
34
|
+
autopadding(
|
|
35
|
+
progressBar.Format.TimeFormat(t, options, roundToMultipleOf) || "",
|
|
36
|
+
8,
|
|
37
|
+
),
|
|
38
|
+
},
|
|
39
|
+
progressBar.Presets.shades_classic,
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
export const log = (...ps: any) =>
|
|
43
|
+
multibar.log(
|
|
44
|
+
ps
|
|
45
|
+
.map((p: any) => (typeof p === "string" ? p : JSON.stringify(p)))
|
|
46
|
+
.join(" ") + "\n",
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const totalBar = multibar.create(
|
|
50
|
+
1,
|
|
51
|
+
0,
|
|
52
|
+
{},
|
|
53
|
+
{
|
|
54
|
+
autopadding: true,
|
|
55
|
+
format: "{value} {bar} {percentage}% - Files Downloaded",
|
|
56
|
+
formatValue: (v, _, type) =>
|
|
57
|
+
type === "percentage"
|
|
58
|
+
? autopadding(String(v), 3)
|
|
59
|
+
: autopadding(String(v), 30),
|
|
60
|
+
},
|
|
61
|
+
);
|
|
62
|
+
export const setTotalProgress = (value: number, maxValue?: number) => {
|
|
63
|
+
if (maxValue) {
|
|
64
|
+
totalBar.setTotal(maxValue);
|
|
65
|
+
}
|
|
66
|
+
totalBar.update(value);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export const incrementTotalProgress = () => {
|
|
70
|
+
totalBar.increment();
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
const bars = {} as Record<
|
|
74
|
+
string,
|
|
75
|
+
{
|
|
76
|
+
bar: progressBar.SingleBar;
|
|
77
|
+
maxValue: number;
|
|
78
|
+
valuesBuffer: number[];
|
|
79
|
+
timesBuffer: number[];
|
|
80
|
+
}
|
|
81
|
+
>;
|
|
82
|
+
export const updateKey = (key: string, value: number, maxValue?: number) => {
|
|
83
|
+
if (!bars[key]) {
|
|
84
|
+
bars[key] = {
|
|
85
|
+
bar: multibar.create(maxValue || value / 0.99 + 1, value, {
|
|
86
|
+
filename: key,
|
|
87
|
+
speed: prettyBytes(0, { fixedWidth: 8 }) + "/s",
|
|
88
|
+
}),
|
|
89
|
+
maxValue: maxValue || 0,
|
|
90
|
+
valuesBuffer: [value],
|
|
91
|
+
timesBuffer: [Date.now()],
|
|
92
|
+
};
|
|
93
|
+
} else {
|
|
94
|
+
bars[key].valuesBuffer.push(value);
|
|
95
|
+
bars[key].timesBuffer.push(Date.now());
|
|
96
|
+
// keep only last 10 entries
|
|
97
|
+
let speed = 0;
|
|
98
|
+
if (bars[key].valuesBuffer.length > 100) {
|
|
99
|
+
const firstValue = bars[key].valuesBuffer.shift()!;
|
|
100
|
+
const firstTime = bars[key].timesBuffer.shift()!;
|
|
101
|
+
const lastTime = bars[key].timesBuffer[bars[key].timesBuffer.length - 1];
|
|
102
|
+
const lastValue =
|
|
103
|
+
bars[key].valuesBuffer[bars[key].valuesBuffer.length - 1];
|
|
104
|
+
const timeDiff = Math.max(1, lastTime - firstTime) / 1000; // in seconds
|
|
105
|
+
const valueDiff = lastValue - firstValue;
|
|
106
|
+
speed = valueDiff / timeDiff;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
bars[key].bar.setTotal(bars[key].maxValue || value / 0.99);
|
|
110
|
+
bars[key].bar.update(value, {
|
|
111
|
+
speed: prettyBytes(speed, { fixedWidth: 8 }) + "/s",
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export const removeKey = (key: string) => {
|
|
117
|
+
if (bars[key]) {
|
|
118
|
+
multibar.remove(bars[key].bar);
|
|
119
|
+
delete bars[key];
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
export const stopProgressBar = () => {
|
|
124
|
+
multibar.stop();
|
|
125
|
+
};
|
|
File without changes
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./dist/",
|
|
4
|
+
"baseUrl": "./",
|
|
5
|
+
"rootDir": "./",
|
|
6
|
+
|
|
7
|
+
"strict": true,
|
|
8
|
+
"alwaysStrict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"noImplicitAny": true,
|
|
13
|
+
"noImplicitReturns": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"sourceMap": true
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/index.ts", "src/**/*.test.ts"],
|
|
19
|
+
"extends": "@tsconfig/node22/tsconfig.json"
|
|
20
|
+
}
|
package/tsconfig.json~
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"outDir": "./dist/",
|
|
4
|
+
"baseUrl": "./",
|
|
5
|
+
"rootDir": "./",
|
|
6
|
+
|
|
7
|
+
"strict": true,
|
|
8
|
+
"alwaysStrict": true,
|
|
9
|
+
"esModuleInterop": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"strictNullChecks": true,
|
|
12
|
+
"noImplicitAny": true,
|
|
13
|
+
"noImplicitReturns": true,
|
|
14
|
+
"resolveJsonModule": true,
|
|
15
|
+
"forceConsistentCasingInFileNames": true,
|
|
16
|
+
"sourceMap": true,
|
|
17
|
+
"types": ["vitest/globals"]
|
|
18
|
+
},
|
|
19
|
+
"include": ["src/index.ts", "src/**/*.test.ts"],
|
|
20
|
+
"extends": "@tsconfig/node22/tsconfig.json"
|
|
21
|
+
}
|