refactor(tests): remove postcss deps from serializer builds #151
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.
#145 identifies and issue where
postcss
andpostcss-js
are included as dependencies in the builds for serializers such as@slate-serializers/html
and@slate-serializers/dom
.Investigation reveals that this is an issue caused by the project structure and a major refactor/reorganisation is required.
Each change detailed under headings:
Move tests that use
transformStyleObjectToString
ortransformStyleStringToObject
The
tests
package was excluded from NX usingnxignore
. See #100. Not sure about the rationale for this but I imagine thetests
library may have been causing issues with the build process (see next heading!)? Either that or I wanted to exclude a library that didn't need to be built?Either way, it is back, and all the tests that use
transformStyleObjectToString
ortransformStyleStringToObject
have been moved there. These functions are optional - they can be imported from@slate-serializers/utilities
and offer a comprehensive way to encode a style object as a string and vice versa. However, these are the functions that use thepostcss
libraries.Move tests that cause circular dependencies
Moving tests into
tests
causes build issues such as:Tests are moved into the
tests
folder that import fromtests
to resolve this.Remove any function imports from
@slate-serializers/utilities
It seems that the purpose of
@slate-serializers/utilities
is mixed/confused. On the one hand, it offers convenient pre-defined functions for style object conversion. On the other hand, it contains functions intended to be shared across serializers?The 'shared' purpose isn't really working out, and functions are moved into a more appropriate place. This refactor work means that internal dependencies on
@slate-serializers/utilities
are removed which helps achieve the end result of the NX build process excluding dependencies (i.e. thosepostcss
dependencies!) from serializer builds.Further considerations
tests
?