https://github.com/marinko-peso/django-apps-jest-mapper
:snake: Automatically discovery django apps and map jest names for them.
https://github.com/marinko-peso/django-apps-jest-mapper
Last synced: 27 days ago
JSON representation
:snake: Automatically discovery django apps and map jest names for them.
- Host: GitHub
- URL: https://github.com/marinko-peso/django-apps-jest-mapper
- Owner: marinko-peso
- License: mit
- Created: 2018-06-14T11:56:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-03-03T03:13:30.000Z (about 2 years ago)
- Last Synced: 2025-03-14T02:40:01.532Z (about 2 months ago)
- Language: JavaScript
- Homepage:
- Size: 1000 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 10
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Django Apps Jest Mapper
[](https://github.com/ellerbrock/open-source-badges/)
[](https://github.com/marinko-peso/django-apps-jest-mapper/blob/master/LICENSE)
[](https://github.com/Flet/semistandard)
[](https://npm.im/django-apps-jest-mapper)
[](https://packagephobia.now.sh/result?p=django-apps-jest-mapper)
[](https://david-dm.org/marinko-peso/django-apps-jest-mapper)
[](https://codecov.io/gh/marinko-peso/django-apps-jest-mapper)Automatically discovery django apps and map jest names for them.
## Why?
If you need to start using Jest combined with Webpack on a Django organized project this package can work great together with [django-apps-webpack-alias](https://npm.im/django-apps-webpack-alias). Static files are usually organized per Django app, and communication between them using relative paths can soon become messy.
This way you can generate same Webpack alias for all Django apps automatically and follow the same naming in the jest configuration.## Install
```ssh
npm i -D django-apps-jest-mapper
```## Running
```js
const djangoAppsMapper = require('django-apps-jest-mapper');// in jest moduleNameMapper config just spread it (or Object.assign with other entries)
moduleNameMapper: {
...djangoAppsMapper({ options })
},
```Available options:
- dir [default 'apps'] path to directory holding the apps
- prefix [default '@app:'] each app prefix, for instance for auth app it will generate ``` @app:auth ```All mappings point to app/static/app/js directory for each app.
## License
MIT.