Ideally when running CI, we want to test that the example builds with the package from the current commit.
Currently it just downloads the latest published version of the package from the npm registry (using yarn install). The most straightforward fix is to link the sources using yarn link in the /examplefolder, however this leads to problems with peerDependencies such as react and styled-components.
The solutions
It might be possible to mitigate this by linking the sources' dependencies as well, to those that are installed in the /example directory. This was originally proposed by Dan on StackOverflow
I don't think yarn support relative links, so we might have to use npm for this.
Something like:
# in project dir
yarn install
cd example
yarn install
npm link ../
cd ..
npm link ./example/node_modules/mdx-deck
npm link ./example/node_modules/styled-components
npm link ./example/node_modules/react
What is the least amount of work/commands required to do this (eg. can we make do with only linking mdx-deck?
Can we somehow cache these links on CI, they take quite a long time to execute.
An alternative solution is to just copy the /dist folder into the example's node_modules.
The problem
Ideally when running CI, we want to test that the example builds with the package from the current commit.
Currently it just downloads the latest published version of the package from the npm registry (using
yarn install
). The most straightforward fix is to link the sources usingyarn link
in the/example
folder, however this leads to problems with peerDependencies such asreact
andstyled-components
.The solutions
It might be possible to mitigate this by linking the sources' dependencies as well, to those that are installed in the
/example
directory. This was originally proposed by Dan on StackOverflowI don't think yarn support relative links, so we might have to use npm for this. Something like:
mdx-deck
?An alternative solution is to just copy the
/dist
folder into the example'snode_modules
.Something like (untested)