feat: allows evergreen documentation #186
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
chore(package.json): new script, build:for-docs
chore(docs/package.json): local reference to anchor build
fix(docs/Page, docs/index): ThemeProvider pulled from xstyled
Before submitting a pull request, please make sure the following is done:
I have done all of the following:
'.anchor-[COMPONENT NAME]'
.npm test
) and passed coverage thresholds.npm test -- -u
).npm run pretty
) on my code.Outline your feature or bug-fix below
What?
Makes the
@retailmenot/anchor
reference in thedocs
site point to a local build, making it possible for the doc site to be synced with Anchor.How?
yarn build
works as before, except as a last step it also calls a new script,build:for-docs
. This copies theesm
,commonjs
,ts
folders, andpackage.json
into an untracked folder,for-docs
. Runningyarn
within thedocs
folder will then pull in this local build of Anchor from thefor-docs
folder.Why?
I tried a lot before landing on this solution. Trying to locally add Anchor from docs did not work without the intermediate step of copying the npm files to the
for-docs
folder. Gatsby would always choke and die because the entire contents of Anchor would be imported rather than just the necessaryesm
,commonjs
,ts
andpackage.json
.I tried modifying our build process in Anchor to output to a
build
folder and instead pull that in, but that approach doesn't work becausepackage.json
would still need to exist in thatbuild
folder, and the pathing would get messed up (i.e. within Anchor it would correctly point to/build/esm/
etc, but within thebuild
folder the copiedpackage.json
would not have abuild/esm
path.).Creating an untracked
for-docs
lets us keep the current build process and make everything transparent. The only step to remember to take is when done working on a component, runningyarn build
before going intodocs
and runninggatsby develop/build
.Gotchas
The lint step on Travis is failing because the
for-docs
folder is untracked which causes theyarn build
process w/in thedocs
folder to fail. Adding steps to runbuild
from Anchor first should take care of that, I think.The only other one I've run into so far is that somehow this local reference is causing some small TypeScript highlight warnings/errors w/in the doc site. They're very minor and it doesn't prevent building. With a little more time, we can probably sort that out.