Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save DaanDeSmedt/0dabda8ead6dbc66442157543b381647 to your computer and use it in GitHub Desktop.

Select an option

Save DaanDeSmedt/0dabda8ead6dbc66442157543b381647 to your computer and use it in GitHub Desktop.
Create an Angular workspace with a buildable library and demo application

Create an Angular workspace with a buildable library and demo application

Boilerplate an Angular workspace with a buildable library and a servable application.

Generate the Angular workspace

ng new my-workspace-name-here --createApplication=false

Create a new initial application project in the 'src' folder of the new workspace. When false, creates an empty workspace with no initial application. You can then use the generate application command so that all applications are created in the projects folder.

Generate the Angular library

cd my-workspace-name-here

ng generate library my-library-name-here

Generate the demo app

ng generate application my-demo-application-name-here

Add package.json scripts

"scripts": {
    "build-lib": "ng build my-library-name-here",
    "watch-lib": "ng build my-library-name-here --watch --configuration development",
    "start-demo" : "ng serve my-demo-application-name-here --open"
    ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment