setupcomfyuimodels 1.0.2 → 1.1.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/dist/index.js CHANGED
@@ -12998,21 +12998,18 @@ var chalkStderr = createChalk({ level: stderrColor ? stderrColor.level : 0 });
12998
12998
  var source_default = chalk;
12999
12999
 
13000
13000
  // src/downloadAssets.ts
13001
- var { WORKSPACE, CIVITAI_TOKEN, HF_TOKEN } = process.env;
13002
- if (!WORKSPACE) {
13003
- throw new Error("WORKSPACE environment variable is not set.");
13004
- }
13001
+ var { CIVITAI_TOKEN, HF_TOKEN } = process.env;
13005
13002
  var MAX_CONCURRENT_DOWNLOADS = 8;
13006
13003
  var concurrentDownloads = 0;
13007
- var downloadAssets = async (configLocation) => {
13004
+ var downloadAssets = async (configLocation, targetFolder) => {
13008
13005
  const config = await getConfig(configLocation);
13009
13006
  const filePromises = [
13010
13007
  ...Object.entries(config.files).map(([targetLocation, url]) => {
13011
13008
  const fileName = import_path.default.basename(targetLocation), dir = import_path.default.dirname(targetLocation);
13012
- return scheduleDownload(dir, fileName, url);
13009
+ return scheduleDownload(targetFolder, dir, fileName, url);
13013
13010
  }),
13014
13011
  ...Object.entries(config.folders).flatMap(
13015
- ([folder, urls]) => urls.map((url) => scheduleDownload(folder, null, url))
13012
+ ([folder, urls]) => urls.map((url) => scheduleDownload(targetFolder, folder, null, url))
13016
13013
  )
13017
13014
  ];
13018
13015
  setTotalProgress(0, filePromises.length);
@@ -13035,7 +13032,7 @@ var downloadAssets = async (configLocation) => {
13035
13032
  };
13036
13033
  var scheduledDownloads = [];
13037
13034
  var results = [];
13038
- var scheduleDownload = async (targetLocation, targetFileName, url) => {
13035
+ var scheduleDownload = async (globalTargetLocation, targetLocation, targetFileName, url) => {
13039
13036
  scheduledDownloads.push({ targetLocation, url, targetFileName });
13040
13037
  if (concurrentDownloads < MAX_CONCURRENT_DOWNLOADS) {
13041
13038
  while (scheduledDownloads.length > 0) {
@@ -13044,6 +13041,7 @@ var scheduleDownload = async (targetLocation, targetFileName, url) => {
13044
13041
  concurrentDownloads++;
13045
13042
  try {
13046
13043
  const skipped = await downloadFile(
13044
+ globalTargetLocation,
13047
13045
  nextDownload.targetLocation,
13048
13046
  nextDownload.targetFileName,
13049
13047
  nextDownload.url
@@ -13065,10 +13063,12 @@ var scheduleDownload = async (targetLocation, targetFileName, url) => {
13065
13063
  }
13066
13064
  }
13067
13065
  };
13068
- var downloadFile = async (targetLocation, targetFileName, url) => {
13066
+ var downloadFile = async (globalTargetLocation, targetLocation, targetFileName, url) => {
13069
13067
  const getTargetId = () => import_path.default.join(targetLocation, targetFileName || "");
13070
13068
  try {
13071
- const targetDir = import_path.default.normalize(`${WORKSPACE}/models/${targetLocation}`);
13069
+ const targetDir = import_path.default.normalize(
13070
+ `${globalTargetLocation}/${targetLocation}`
13071
+ );
13072
13072
  fs.mkdirSync(targetDir, { recursive: true });
13073
13073
  if (targetFileName && fs.existsSync(import_path.default.join(targetDir, targetFileName))) {
13074
13074
  log2(`File already exists, skipping: ${getTargetId()}`);
@@ -13136,8 +13136,8 @@ var downloadFile = async (targetLocation, targetFileName, url) => {
13136
13136
  // src/index.ts
13137
13137
  var program2 = new Command();
13138
13138
  program2.name("Setup ComfyUi Models");
13139
- program2.command("download").argument("<config>", "JSON config file location").action(async (configLocation) => {
13140
- await downloadAssets(configLocation);
13139
+ program2.command("download").argument("<config>", "JSON config file location").option("-l, --location <path>", "Target download location").action(async (configLocation, options) => {
13140
+ await downloadAssets(configLocation, options.location || "./");
13141
13141
  });
13142
13142
  program2.parse();
13143
13143
  //# sourceMappingURL=index.js.map