BackstopJS icon indicating copy to clipboard operation
BackstopJS copied to clipboard

Use any config files: backstop.json, backstop.js - Version 2

Open klodoma opened this issue 9 months ago • 2 comments

Use any config files: backstop.json, backstop.js whichever is found first.

Discussion here: https://github.com/garris/BackstopJS/issues/1482

Changes:

  • by default look for backstop.js or backstop.json
  • adjusted the init function to handle properly the initialization
    • also added the option to init with --js flag
  • updated readme

klodoma avatar May 01 '24 07:05 klodoma

I am not inclined to add another file format generation to init -- I don't think this moves the objectives forward.

@garris

Imo I think this project should switch from .json to .js config file. We'll keep the "backward" compatibility through the require feature.

So, my proposal would be:

  • we keep the config as it is, this will work for both .json and .js
  • init will generate a .js file by default - so almost going back to the current code
  • we update the documentation so that .js is by default used
  • old projects that use the .json format will still work.
  • everybody's happy and this would be a "evolution"

klodoma avatar May 02 '24 06:05 klodoma

Any consideration for using https://github.com/cosmiconfig/cosmiconfig? It might be nice to offload the work to a separate well-tested, fully-featured library and allow backdrop to give end-users the flexibility that they might expect coming from other ecosystem packages that use cosmiconfig.

solomonhawk avatar May 02 '24 15:05 solomonhawk

@garris @klodoma Just wondering if any version of this solution can be merged.

maxfenton avatar May 21 '24 16:05 maxfenton

@maxfenton I would be willing to merge a PR for just this change. It opens up possibilities with the lightest touch.

image

garris avatar May 21 '24 19:05 garris

@garris That would be the second PR.

I didn't hat time anymore I'll have a second look and let you know.

klodoma avatar May 22 '24 07:05 klodoma

I just made the change. Hope this is helpful. Will go out in next release. https://github.com/garris/BackstopJS/commit/944884bcd785a3cd0715a90371eb39a62855ec58

garris avatar May 23 '24 06:05 garris