Absolute screenshotPaths generate in .slicemachine/libraries-states.json

Hi,

the paths to the screenshots for the slices are referenced in .slicemachine/libraries.-states.json, but slicemachine uses absolute paths in the JSON.

e.g.:

"screenshotPaths": {
  "default-slice": {
    "path": "/Users/xxx/yyy/src/slices/CallToAction/default-slice/preview.png",
    "width": 300,
    "height": 50
  }
}

This is problematic for us, as we commit this directory and of course not all of our developers share the same root filesystem :slight_smile:

Is there any configuration option to use relative paths?

Thanks in advance for any hints!

Best regards,
Adrian

1 Like

Hello @adrian.marte

Thanks for reaching out to us.

I am not sure if we can configure a relative path instead of an absolute one. I have passed this query to my SM team. I will let you know once I get a response from them.

Thanks,
Priyanka

Hello @adrian.marte

I have received an update from the SM team and we added it to the backlog, but I don't have an ETA.

Thanks,
Priyanka

1 Like

Also getting this issue, always in conflict with every merge.

Resorting to .gitignore the file.

Hey @webadmin, thanks for sharing your case.
That's the current workaround that we can recommend since we're not modifying the structure of Slice Machine projects yet.

Just an FYI — It's a damned if you do, damned if you don't situation to add this file to .gitignore. On one hand, it get's it out of the merge conflict zone. Getting it into .prettierignore helps prettier checks on it to. The flip side is we have TypeScript set to check that import's resolve in our CI — but our CI never has the file because it never runs yarn slicemachine. So, we get CI errors like [app]/pages/slice-simulator.tsx(4,19): error TS2307: Cannot find module '../.slicemachine/libraries-state.json' or its corresponding type declarations.

1 Like