Angular-cli ng generate library does not work

1

I have a project in version 5 of Angular, which generates a library using the rollup and works correctly. However I'm migrating from version 5 to version 6 of angular and wanted to use angular-cli, which already generates a library in the same pattern as the rollup. However when copying the code into src / app and running the ng generate library command, only a new project folder with a generic project is created, none of my files are automatically copied to the project folder. I would like to know how to do so that a new library is generated, using angular-cli in version 6, with the files that are within src / app.

    
asked by anonymous 13.06.2018 / 15:23

1 answer

1

The solution to the above problem is found on this site: Angular-cli library . This site describes step-by-step how to transform a functional library into angular 6 with angular-cli.

1 - create a project with ng new.

2 - use the ng generate library command.

3 - import your project files into the projects // lib folder

4 - Change the public_api.ts file name to index.ts.

5 - Inside the ng-pakage.json file change the name public_api to index.

6 - In the tsconfig.json file, modify within path -> add path / src.

7 - Run the library with the ng build command.

If everything is set up correctly, a library will be generated within dist. This can be imported into other projects.

    
14.06.2018 / 18:04