@astralkit/cli 4.8.0 → 4.8.1

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.
@@ -78,7 +78,7 @@ export async function updateCommand(componentSlug, options) {
78
78
  }
79
79
  const filePath = path.resolve(dir, file.path);
80
80
  fs.mkdirSync(path.dirname(filePath), { recursive: true });
81
- fs.writeFileSync(filePath, file.content);
81
+ fs.writeFileSync(filePath, file.encoding === 'base64' ? Buffer.from(file.content, 'base64') : file.content);
82
82
  }
83
83
 
84
84
  // A newer version of a component can ask for stylesheets the older one carried in its own file
@@ -202,7 +202,8 @@ export function writeFiles(baseDir, files, opts = {}) {
202
202
  }
203
203
  const filePath = path.resolve(baseDir, file.path);
204
204
  fs.mkdirSync(path.dirname(filePath), { recursive: true });
205
- fs.writeFileSync(filePath, file.content);
205
+ // a binary file (a workflow's images, video, fonts) arrives as base64 and is written as bytes
206
+ fs.writeFileSync(filePath, file.encoding === 'base64' ? Buffer.from(file.content, 'base64') : file.content);
206
207
  count++;
207
208
  }
208
209
  return count;