PatrickJS / NG6-starter

:ng: An AngularJS Starter repo for AngularJS + ES6 + Webpack
https://angularclass.github.io/NG6-starter
Apache License 2.0
1.91k stars 1.35k forks source link

Improved name param processing for gulp task `component` #219

Closed thematho closed 7 years ago

thematho commented 7 years ago

This pull request contains updates for the cap function in the gulp component task. Now we can create components with names containing - and _.

Example: Running: npm run component -- --name my-component Will generate:

/client/app/components/my-component
/client/app/components/my-component/my-component.component.js
/client/app/components/my-component/my-component.controller.js
/client/app/components/my-component/my-component.html
/client/app/components/my-component/my-component.js
/client/app/components/my-component/my-component.scss
/client/app/components/my-component/my-component.spec.js

And the controller name will be:

class MyComponentController {
  constructor() {
    this.name = 'myComponent';
  }
}

export default MyComponentController;

Changelog:

fesor commented 7 years ago

thanks, @thematho.

How do you think, should we leave usage of gulp component or maybe it would be better to use special code generation tools like plop? I already prepared #191 which also handles naming.

thematho commented 7 years ago

@fesor Thanks for your comment, I think plop is much better so I'll discharge this pull request. I'm going to merge your branch with mine, and add some features like service, factory and ngMocks generators. when your pull request gets merged I'll send another one.

Regards.