Create Slice in SliceMachine UI doesn't behave the same as the CLI create-slice command
See original GitHub issueVersion
- Prismic CLI version (know it by running
prismic --version
):prismic-cli/4.0.1-alpha.10
- slice-machine-ui:
^0.1.0-alpha.5
Reproduction
-
run
yarn slicemachine
to open the builder -
create a new slice called
BuilderSlice
-
It should save it to the file system
-
Then open the terminal and run
prismic sm --create-slice
-
Leave the default slice folder
slices
-
Set the name as CliSlice
-
Press return
This should have created two new slices and the related .storybook/assets/
entries.
What is expected?
The expected behavior is that it should create the slices and then populate the @/slices/index.js
file with the new slices as:
export { default as BuilderSlice } from './BuilderSlice'
export { default as CliSlice } from './CliSlice'
What is actually happening?
The slices created via the builder do not update the index.js file under the slices library that has been defined, while the cli command still does that.
Instead what is in the file is:
export { default as CliSlice } from './CliSlice'
This is a problem as then the slices are called in the sm-resolver.js
file as:
import * as Slices from './slices'
const __allSlices = { ...Slices, }
This means it will get some, but not all.
Any additional information
Package.json
{
"dependencies": {
"essential-slices": "^1.0.4",
"next": "10.2.0",
"next-slicezone": "^0.0.15",
"next-transpile-modules": "^7.0.0",
"prismic-javascript": "^3.0.2",
"prismic-reactjs": "^1.3.3",
"react": "17.0.2",
"react-dom": "17.0.2",
"theme-ui": "^0.8.4"
},
"devDependencies": {
"@storybook/react": "^6.2.8",
"babel-loader": "^8.2.2",
"babel-plugin-react-require": "^3.1.3",
"slice-machine-ui": "^0.1.0-alpha.5"
}
}
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (2 by maintainers)
Top GitHub Comments
appears to be fixed in the alpha releases of both the cli and SM-UI.
Also was going to add the other issue of the two commands producing different storybook results but https://github.com/prismicio/prismic-cli/pull/101 fixes that it appears 👍
The
slices/index.js
file will be updated after each slice update in the upcoming builder