slice-machine icon indicating copy to clipboard operation
slice-machine copied to clipboard

When Creating a new Slice Machine Project with a new Next project, the sm.json configuration is set to previousNext

Open Duaner opened this issue 2 years ago • 4 comments

Versions

  • slice-machine-ui: 0.4.1
  • node: 16

Reproduction

After creating a new next project from scratch with create-next-app and then running slicemachine init. The sm.json default is set to PreviousNext

{
  "_latest": "0.3.0",
  "apiEndpoint": "https://.prismic.io/api/v2",
  "libraries": [
    "@/slices"
  ],
  "framework": "previousNext",
   "localSliceSimulatorURL": "http://localhost:3000/slice-simulator"
}

Steps to reproduce

What is expected?

To default to the latest next version

What is actually happening?

See above

Duaner avatar Aug 03 '22 17:08 Duaner

Did some research, it appears this is due to this migration script still being run on new projects: https://github.com/prismicio/slice-machine/blob/HEAD/packages/slice-machine/scripts/migration/versions/0.3.0/index.ts

lihbr avatar Aug 04 '22 10:08 lihbr

OK, after further investigation it looks like 5fd2faa in [Release Branch]: v0.4.0 #473 moved the install dependencies step of @slicemachine/init after project configuration.

This prevents the "configure project" step to detect the installed version of Slice Machine (as it's now installed after), making it default to the first one relevant for migrations (0.0.41), see: https://github.com/prismicio/slice-machine/blob/master/packages/init/src/steps/configure-project.ts#L91-L93

lihbr avatar Aug 04 '22 11:08 lihbr

Did this fix it? https://github.com/prismicio/slice-machine/pull/546

MarcMcIntosh avatar Aug 04 '22 12:08 MarcMcIntosh

Looks like it does indeed! Awesome :) (I let you close when relevant)

lihbr avatar Aug 04 '22 12:08 lihbr

The fix has been released, closing this.

Heyrows avatar Aug 24 '22 12:08 Heyrows