django-apps-jest-mapper
v1.0.2
Published
Automatically discovery django apps and map jest names for them.
Downloads
47
Maintainers
Readme
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. 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
npm i -D django-apps-jest-mapper
Running
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.