littleuniversestudios / angular-cli-tools

Command Line Tools for Angular 2 projects
MIT License
30 stars 8 forks source link

adding 'flat' and custom file names #15

Closed stweedie closed 7 years ago

stweedie commented 7 years ago

Two changes:

  1. add support for the --flat CLI option
  2. add support for custom file names (based on template)

for that second one, I wanted to try and avoid breaking places where the logic is to just iterate over the various properties of the 'templateMap' object, so I added it as a new property at the root level of json:

"templateMap": {
    "page": {
        "component": "./templates/custom/page/page.ts",
        "html": "./templates/custom/page/page.html",
        "description": "Component that generates a report page"
    }
},
"fileNames": {
    "page": {
        "component": ".page.ts",
        "html": ".page.html",
        "style": ".page."
    }
}

which ends up in the following:

ngt g c ./test/test --flat -t:page
Using template 'page' from 'angular-cli-tools/config.json'
Created ./test/test.page.ts
Created ./test/test.page.html

I believe the second change fixes #12

I don't know if you guys are accepting PRs. If not, go ahead and close this and I'll maintain these changes in my fork.

nvitas commented 7 years ago

Will add this...tied up for the next couple of weeks but we'll get it in as soon as we can. Thanks!