We are planning on moving to a monorepo approach — Nx — for our marketing sites. Any time we want to start Slicemachine for a different site, we have to edit sm.json to change the apiEndpoint and libraries path.
Are there any solutions for this? For example: the ability to pass a flag to start-slicemachine to specify the path to sm.json.
Hello @jerry.nummi, thanks for reaching out. I'm not familiar with the monorepo environment but from what I can see online it's a strategy to structure your project that isn't fixed to one technology.
You should make sure that the command line is pointing to the correct location in your machine when you run the npm run slicemachine command. So if you wanna run site-1 your console should be in apps > site-1 and so on.
$ cd apps/site-1; start-slicemachine
`[slice-machine] An unexpected error occurred. Exiting...
Full error: Error: [api/env]: Unrecoverable error. Could not find package.json. Exiting..
Hey there, I asked around and our DevX team also recommends trating each app/site as its own Slice Machine installation. Here are examples of how to initiate the project with Yarn, pnpm, or npm 7/8.
You can target a specific app from the root level, like this:
This is the hack because Nx allows you to have one package.json at the root but the Slicemachine start script is expecting package.json to be in the same current working directory. (this script I believe)