import modules automagically based on your configuration
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
example
.gitignore
README.md
autoImport.json
package-lock.json
package.json

README.md

auto-import-cli

import modules automagically based on your configuration

Usage

Install with npm

npm i auto-import-cli

You should then setup a configuration file: auto-import-cli.json

After that, you can run auto-import-cli on your project like this:

$ autoimport

Configuration

[
    {
        "extname": ".vue",
        "from": "example/pages",
        "to": "example/router/index.js",
        "template": "const moduleName = () => import(modulePath)",
        "ignored": [
            "example/pages/login.vue",
            "example/pages/overall/**"
        ]
    }
]

extname : the type of file that may be a module.

from : the directory which contains modules.

to : the file which uses modules.

template : the way importing modules. moduleName and modulePath will be replace when tool is working.

"import moduleName from modulePath"
"const moduleName = require(modulePath)"
"const moduleName = () => import(modulePath)"

ignored : the files that should be ignored, suport anymatch

The config option is an array. You can make many rules as you want.