{"id":22962147,"url":"https://github.com/actionanand/angular-lib-demo","last_synced_at":"2025-06-12T16:34:15.686Z","repository":{"id":37027682,"uuid":"500035265","full_name":"actionanand/angular-lib-demo","owner":"actionanand","description":"It's an angular workspace where simple angular app and angular library are used.","archived":false,"fork":false,"pushed_at":"2022-07-08T11:33:39.000Z","size":606,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-07T18:17:38.915Z","etag":null,"topics":["angular-libraries","angular-library","angular13","monorepo"],"latest_commit_sha":null,"homepage":"https://actionanand.github.io/angular-lib-demo/","language":"TypeScript","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/actionanand.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-06-05T07:58:55.000Z","updated_at":"2022-06-19T19:46:45.000Z","dependencies_parsed_at":"2022-07-11T15:22:44.236Z","dependency_job_id":null,"html_url":"https://github.com/actionanand/angular-lib-demo","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/actionanand%2Fangular-lib-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actionanand%2Fangular-lib-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actionanand%2Fangular-lib-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/actionanand%2Fangular-lib-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/actionanand","download_url":"https://codeload.github.com/actionanand/angular-lib-demo/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246748454,"owners_count":20827312,"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-libraries","angular-library","angular13","monorepo"],"created_at":"2024-12-14T19:15:29.901Z","updated_at":"2025-04-02T03:24:11.010Z","avatar_url":"https://github.com/actionanand.png","language":"TypeScript","readme":"# AngularLibDemo\n\nThis project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.1.0. \n\n### Libraries in this repo\n\nCode for the library(ies) of [@ng-ar/md-input](https://www.npmjs.com/package/@ng-ar/md-input), [@ng-ar/svg-icon](https://www.npmjs.com/package/@ng-ar/svg-icon), [@ng-ar/input](https://www.npmjs.com/package/@ng-ar/input) and [@ng-ar/bg-svg](https://www.npmjs.com/package/@ng-ar/bg-svg) is(are) included in this repo.\n\n## Creating angular workspace without angular app\n\n```bash\n$ ng new my-workspace --no-create-application\n$ cd my-workspace\n$ ng generate library my-lib\n```\n\n\u003e we can create libraries with angular app also\n\n```bash\n$ cd my-workspace\n$ ng generate library my-lib --prefix demo \n```\n\n```bash\nng g lib my-lib --prefix demo\n```\n\n\u003e This adds a `projects` directory containing a `my-lib` directory(library folder) for our newly generated `my-workspace` Angular workspace.\n\n```bash\nng generate application my-app\n```\n\n\u003e This adds a `my-app` directory(application folder) in the `projects` directory\n\n### Generating component, directives, etc. to lib and app\n\n```bash\nng g d \u003cdirective-name\u003e --project=\u003cproject-name\u003e\n```\n\none example\n\n```bash\nng g d directives/input-ref --project=md-input --dry-run\n```\n\n`--dry-run` flag won't generate anything, but will show in console. \n\n### testing library in dev\n\n```bash\n$ ng build my-lib --configuration development\n$ ng test my-lib\n$ ng lint my-lib\n```\n\n### Building library\n\n```bash\nng build my-lib\n```\n\n### Serving our appliaction\n\n```bash\nng serve my-app\n```\n\n### Publishing your library\n\n```bash\n$ ng build my-lib\n$ cd dist/my-lib\n$ npm publish\n```\n\nWhwn publishing first time to the public repo of npm, please use the below command.\n\n```bash\nnpm publish --access public\n```\n\n### Managing assets in a library\n\nWhen including additional assets like Sass mixins or pre-compiled CSS. You need to add these manually to the conditional `exports` in the package.json of the primary entrypoint.\n\n[ng-packagr](https://www.npmjs.com/package/ng-packagr) will merge handwritten `exports` with the auto-generated ones, allowing for library authors to configure additional export subpaths, or custom conditions.\n\n```json\n\"exports\": {\n  \".\": {\n    \"sass\": \"./_index.scss\",\n  },\n  \"./theming\": {\n    \"sass\": \"./_theming.scss\"\n  },\n  \"./prebuilt-themes/indigo-pink.css\": {\n    \"style\": \"./prebuilt-themes/indigo-pink.css\"\n  }\n}\n```\n\n### Building and rebuilding your library\n\n```bash\nng build my-lib --watch\n```\n\n### Linking already built with watch mode to Angular app\n\n```bash\n$ cd dist/my-lib\n$ npm link\n```\n\nNow open the seperate angular app where you want to test it\n\n```bash\nnpm link my-lib\n```\n\nIf you already have `my-lib` it installed through npm\n\n```bash\nnpm uninstall my-lib\n```\n\nadd the following to the root `package.json` file\n\n```json\n\"scripts\": {\n  ...\n  \"build_lib\": \"ng build my-lib\",\n  \"npm_pack\": \"cd dist/my-lib \u0026\u0026 npm pack\",\n  \"package\": \"npm run build_lib \u0026\u0026 npm run npm_pack\"\n},\n```\n\n```\nnpm install ../angular-lib-demo/dist/my-lib/my-lib-0.0.1.tgz\n```\n\n```typescript\nimport { AngularLibDemoModule } from 'my-lib';\n```\n\n## Deploy to GitHub Pages\n\n1. To begin, add the `angular-cli-ghpages` builder.\n\n```bash\nng add angular-cli-ghpages\n```\n\n2. If you’re deploying the project to a Github project page you’ll need to set the `baseHref` property as the repository name. The `baseHref` will be used for all relative URLs on your site. You could specify the `baseHref` as part of the project architect deploy options in the `angular.json` file. Or just pass it as the `--base-href` flag to the `ng deploy` command. If you’re deploying the project to a Github user page, you do not need to set this option.\n\n```bash\nng deploy --base-href=/\u003crepository-name\u003e/\n```\n\nGitHub will automatically enable Pages when you push a gh-pages branch. There is no need to enable Pages from the repository settings.\n\n```bash\nng deploy --base-href=/angular-lib-demo/\n```\n\n### Support Docs\n\n- [Creating libraries - Official](https://angular.io/guide/creating-libraries)\n- [The Angular Library Series - Creating a Library with Angular CLI](https://medium.com/angular-in-depth/creating-a-library-in-angular-6-87799552e7e5)\n- [Create your Angular Library and linking](https://medium.com/@prajramesh93/create-your-angular-library-f2cf273fd8a5)\n- [Material Icons' Symbols](https://fonts.google.com/icons)\n- [Material Icons Guide](https://developers.google.com/fonts/docs/material_icons)\n- ['angular-svg-icon' repo](https://github.com/czeckd/angular-svg-icon)\n- [Angular: Using custom made SVG icons through Angular Material](https://dev.to/elasticrash/using-custom-made-svg-icons-through-the-angular-material-library-2pif)\n- [Material Icon - custom icons](https://material.angular.io/components/icon/examples)\n- [Free Svg Repo](https://www.svgrepo.com/)\n- [Hex Color To CSS Filter Converter](https://isotropic.co/tool/hex-color-to-css-filter/)\n- [Free svg background - heazy](https://app.heazy.studio/)\n- [Free svg background - haikei](https://app.haikei.app/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factionanand%2Fangular-lib-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Factionanand%2Fangular-lib-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Factionanand%2Fangular-lib-demo/lists"}