GithubHelp home page GithubHelp logo

babybeet / angular-library-template Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 138 KB

A template for creating Angular libraries

License: MIT License

Shell 50.98% HTML 9.76% TypeScript 35.13% SCSS 4.14%
angular angular-library angular-library- angular-library-template

angular-library-template's Introduction

angular-library-template

This template includes the following features:

  • ESLint for both TypeScript and HTML templates.
  • Husky.
  • lint-staged that will run ESLint, Prettier and a custom script to automatically re-generate the table of contents on every commit.
  • Prettier.
  • CI/CD with CircleCI. The pipeline has been set up to lint the source code, run all tests, build, then deploy the final package to NPM registry.

Table of contents

How to use

Configurations

  • Find-and-replace all instances of angular-library-template with your library's name.
  • Rename folder angular-library-template inside projects to the your library name.
  • Update all component prefixes from bbb to your own choosing.
  • Within your CircleCI's Organization Settings, add a new context named npm, and add an environment variable named NPM_TOKEN to that context to publish the built package to npm.
  • Add an SSH user key to your CircleCI project so that version commits can be pushed into your remote repository.
  • Create a project level environment variable named GH_KEY that contains the fingerprint for the SSH user key created above so that CircleCI can commit back to your repository on Github when the versioning job runs.

Development

To develop your library code, just add changes to lib folder.

Be sure to add anything that you'd like to export to public-api.ts file, or else, nothing can be imported from your library.

Testing

Unit testing

Execute pnpm test to run all of your unit tests in watch mode, or pnpm test:ci to run it in non-watch mode.

Visual testing

To visually check your components/directives, you can import them into projects/visual-test app and use the imported symbols as normal. Changes made to your library code will also cause the visual app to auto-reload after running pnpm start at the root of the product directory which will start a regular Angular app on http://localhost:4200.

Building and publishing

Before you publish your library, you should update your README file (Be sure to not change the ## Table of contents section as this is updated automatically by a script that runs on every commit hook) and choose an appropriate software license. Anything added to README.md file will be copied to the final distribution inside dist/your-library-name folder to be published to the npm registry, additionally, the LICENSE file and package.json file inside projects/your-library-name folder will also be copied to distribution folder, so make sure you configure your package.json accordingly.

angular-library-template's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.