Plasmic Sync cli update error

hey we’re having an issue on plasmic sync where its asking to update the cli and then asking us if we want to overwrite a component, and if we say n it errors, if it says yes it overrides our code to a simple plasmic generated component and we lose our work. Any work arounds on this?

Following up in a separate thread for details!

@yang This is where the error happens:

async function writeFileContentRaw(filePath, content, opts) {
  opts = opts || {};
  if (existsBuffered(filePath) && !opts.force) {
    const overwrite = await confirmWithUser(
      `File ${filePath} already exists. Do you want to overwrite?`,
      opts.yes
    );
    if (!overwrite) {
      throw new HandledError(
        `Cannot write to ${filePath}; file already exists.`
      );
    }
  }
  import_fs.default.mkdirSync(import_upath3.default.dirname(filePath), { recursive: true });
  writeFileText(filePath, content);
}

I fixed it by:

async function writeFileContentRaw(filePath, content, opts) {
  opts = opts || {};
  if (existsBuffered(filePath) && !opts.force) {
    const overwrite = await confirmWithUser(
      `File ${filePath} already exists. Do you want to overwrite?`,
      opts.yes
    );
    if (!overwrite) {
      return;
    }
  }
  import_fs.default.mkdirSync(import_upath3.default.dirname(filePath), { recursive: true });
  writeFileText(filePath, content);
}

not throwing an error, but just returning if the user is not interested in overwriting

not sure what implications are down the road, but that’s a fix that works for us at the moment at the plasmicapp/cli