jadjoubran / laravel-ng-artisan-generators

Laravel artisan AngularJS generators
MIT License
90 stars 23 forks source link

ng:component command error #34

Closed yazfield closed 7 years ago

yazfield commented 7 years ago

When I execute artisan ng:component my_component I get this error:

[ErrorException]                                                                                                                                                
  file_put_contents(./tests/angular/app/components/my_component.component.spec.js): fail                                         
  ed to open stream: No such file or directory

This shows up because the subfolders angular/app/components are not created. I fixed this by creating the folders in Console/Commands/AngularComponent.php:

if (!$this->option('no-spec') && config('generators.tests.enable.components')) {
    //create spec folder
    if (!File::exists($spec_folder)) {
        File::makeDirectory($spec_folder, 0775, true);
    }

    //create spec file (.component.spec.js)
    File::put($spec_folder.'/'.$name.'.component.spec.js', $spec);
}

I'm not sure if this is a bug or I'm missing something that's why I didn't make a pull request.

jadjoubran commented 7 years ago

Thanks @yazfield This is indeed a bug, would be able to send a PR with the fix?

yazfield commented 7 years ago

Yes sure :)