-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add pre-configured code transform + Replace Vite Library Mode by raw Rollup #47
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
4fb509e
feat: add cssTransform pre config
nvh95 5291ef3
feat: Add rollup for multiple entries
nvh95 6ce35ca
feat: add preconfig transform
nvh95 5bdc50a
feat: Use rollup to bundle code instead of Vite Library Mode
nvh95 88c0e3b
chore: Update config to use preconfig transform
nvh95 907155a
docs: Update README.md about pre-configured code transform
nvh95 c5bd7f0
chore: Update README.md
nvh95 eceb1c1
chore: Update file format in READMEs
nvh95 8a34516
fix: Use fileCRA for CRA
nvh95 47aa0c2
Merge branch 'main' into pre-config
nvh95 d50d8fc
chore: Release 0.1.2-alpha.0
nvh95 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,3 +23,7 @@ dist-ssr | |
*.sln | ||
*.sw? | ||
.npmrc | ||
|
||
build | ||
presets | ||
transforms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,18 +8,20 @@ jest is setup with create-react-app by default, we don't need to do anything mor | |
|
||
## Installation and Usage | ||
|
||
Please refer to [Installation](../../README.md#installation) and [Usage](../../README.md#usage). | ||
Except for step 2 of installation: Create `fileTransform.js`: | ||
|
||
- Because `create-react-app` allows user to [use svg files as React components](https://create-react-app.dev/docs/adding-images-fonts-and-files/#adding-svgs), `jest-preview` therefore needs to support that, so we use the below config: | ||
Please refer to [Installation](../../README.md#installation) and [Usage](../../README.md#installation). | ||
Except for step 2 of installation: **Configure jest's transform to transform CSS and files** | ||
|
||
- Because `create-react-app` allows user to [use svg files as React components](https://create-react-app.dev/docs/adding-images-fonts-and-files/#adding-svgs), `jest-preview` therefore needs to support that, we update Jest's configuration in `package.json` as follow: | ||
|
||
```json | ||
{ | ||
"transform": { | ||
// Other transforms | ||
"^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "jest-preview/transforms/file" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be |
||
} | ||
} | ||
``` | ||
|
||
```javascript | ||
// config/jest/fileTransform.js | ||
const { processFileCRA } = require('jest-preview'); | ||
## Caveats | ||
|
||
module.exports = { | ||
process(src, filename) { | ||
return processFileCRA(src, filename); | ||
}, | ||
}; | ||
``` | ||
Even though `jest-preview` itself supports CSS Modules, it doesn't support `create-react-app` without ejecting yet. The support will land in the next version. |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be
jest-preview/transforms/fileCRA