1.0.2 • Published 6 years ago

django-apps-jest-mapper v1.0.2

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

Django Apps Jest Mapper

Open Source Love license js-semistandard-style package version install size dependecies codecov

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.

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago