{"id":20186322,"url":"https://github.com/leolanese/angular-workspaces","last_synced_at":"2025-10-19T06:51:00.181Z","repository":{"id":63298027,"uuid":"566789630","full_name":"leolanese/Angular-WorkSpaces","owner":"leolanese","description":"Angular multiple workspaces","archived":false,"fork":false,"pushed_at":"2023-04-28T09:55:02.000Z","size":161,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-24T12:11:33.379Z","etag":null,"topics":["angular","angular13","cli","typescript","workspace"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leolanese.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-16T12:31:00.000Z","updated_at":"2023-05-02T22:10:27.000Z","dependencies_parsed_at":"2022-11-16T14:47:17.937Z","dependency_job_id":null,"html_url":"https://github.com/leolanese/Angular-WorkSpaces","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolanese%2FAngular-WorkSpaces","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolanese%2FAngular-WorkSpaces/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolanese%2FAngular-WorkSpaces/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leolanese%2FAngular-WorkSpaces/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leolanese","download_url":"https://codeload.github.com/leolanese/Angular-WorkSpaces/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241622594,"owners_count":19992501,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","angular13","cli","typescript","workspace"],"created_at":"2024-11-14T03:16:49.434Z","updated_at":"2025-10-19T06:51:00.099Z","avatar_url":"https://github.com/leolanese.png","language":"HTML","readme":"# Angular Workspaces (WS)\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 14.2.7.\n\n\u003e A workspace is a set of Angular applications and libraries. The angular.json file at the root level of an Angular workspace provides workspace-wide and project-specific (application or library) configuration defaults for build and development tools.\n\n#### Further information\n\n\u003e Angular also supports workspaces with multiple projects. This type of development environment is suitable for advanced users who are developing shareable libraries, and for enterprises that use a \"monorepo\" development style, with a single repository and global configuration for all Angular projects - \u003chttps://angular.io/guide/file-structure\u003e\n\n---\n\n## Creating a workspace\n\nThe `--createApplication=false` parameter avoids the creation of an initial application (default value is true).\n\n```js\n// create a workspace\nng new angularWorkspace --create-application=false --directory=angularWorkspace --interactive=false\n```\n\n\u003ca href=\"https://ibb.co/Snn7PC9\"\u003e\u003cimg src=\"https://i.ibb.co/Snn7PC9/angular-workspace.jpg\" alt=\"angular-workspace\" border=\"0\"\u003e\u003c/a\u003e\n\n```js\n// Creating an application in a workspace\ncd angularWorkspace\nng generate application first-app  --style=scss --routing=true\nng generate application second-app  --style=scss --routing=true\n```\n\nNow, on the root `angular.json` we will have:\n\n```js\n{\n  ...\n  \"projects\": {\n    \"first-app\": { ... },\n    \"second-app\": { ... },\n  }\n  ...\n} \n```\n\n## Create a Shared Service\n\n\u003e The syntax is ng generate service `service-name` and the parameter `--project` is mandatory to specify the library where to generate the service.\n\n```js\nng generate service services/test-service --project=first-app\n```\n\n## Create a Shared 3rd party service\n\n```js\nng add @angular/material --project=first-app\n```\n\n## Finally, run workspace\n\n```js\nng serve --project=first-app\nng serve first-app\n\nng serve --project=second-app\nng serve second-app\n```\n\n## Test the workspaces changes\n\n```js\n// simply change inside: `/second-app/app/app.component.html`\n// instead of\n\u003ch2\u003eResources\u003c/h2\u003e\n\n// do\n\u003ch2\u003eResources Test second workspace (and not first)\u003c/h2\u003e\n```\n\n\u003ca href=\"https://ibb.co/HH18spL\"\u003e\u003cimg src=\"https://i.ibb.co/HH18spL/test-Workspace-Second.jpg\" alt=\"test-Workspace-Second\" border=\"1\"\u003e\u003c/a\u003e\n\n## To build your application for production\n\n```js\nng build --prod --project=first-app\n```\n\n---\n\n## Development server\n\nRun `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The application will automatically reload if you change any of the source files.\n\n## Code scaffolding\n\nRun `ng generate component component-name` to generate a new component. You can also use `ng generate directive|pipe|service|class|guard|interface|enum|module`.\n\n## Build\n\nRun `ng build` to build the project. The build artifacts will be stored in the `dist/` directory.\n\n## Running unit tests\n\nRun `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io).\n\n## Running end-to-end tests\n\nRun `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.\n\n## Further help\n\nTo get more help on the Angular CLI use `ng help` or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.\n\n---\n### :100: \u003ci\u003eThanks!\u003c/i\u003e\n#### Now, don't be an stranger. Let's stay in touch!\n\n##### :radio_button: linkedin: \u003ca href=\"https://www.linkedin.com/in/leolanese/\" target=\"_blank\"\u003e@LeoLanese\u003c/a\u003e\n##### :radio_button: Twitter: \u003ca href=\"https://twitter.com/LeoLanese\" target=\"_blank\"\u003e@LeoLanese\u003c/a\u003e\n##### :radio_button: Portfolio: \u003ca href=\"https://www.leolanese.com\" target=\"_blank\"\u003ewww.leolanese.com\u003c/a\u003e\n##### :radio_button: DEV.to: \u003ca href=\"https://www.dev.to/leolanese\" target=\"_blank\"\u003edev.to/leolanese\u003c/a\u003e\n##### :radio_button: Blog: \u003ca href=\"https://www.leolanese.com/blog\" target=\"_blank\"\u003eleolanese.com/blog\u003c/a\u003e\n##### :radio_button: Questions / Suggestion / Recommendation: developer@leolanese.com\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleolanese%2Fangular-workspaces","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleolanese%2Fangular-workspaces","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleolanese%2Fangular-workspaces/lists"}