jussi-kalliokoski / gulp-awspublish-router

A router for defining file-specific rules with gulp-awspublish

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Use array instead of object of the routes

tomyam1 opened this issue · comments

The current implementation actually support using an array instead of an object for the routes configuration, but it's not documented.
Using an object is not ideal because the order of the keys is not deterministic (it will usually be the order of their appearance on the code but it's not promised).
I'd suggest that using an array will be the recommended configuration.

Here, we can't tell which route will be evaluated first, the first or the second

routes: {
    ".+a/b\\.html$": {
        ...
    },
    ".+b\\.html$": {
        ...
    },    
    "^.+$": "$&"
}

Now, we can deterministic tell which route will be evaluated first

routes: [
    {
        routeMatcher: /.+a/b\.html$/
        ...
    },
    {
        routeMathcher: /.+b\.html$/
        ...
    },    
    {
        routeMatcher: /^.+$/
    }
]

:+19099999999999999999999