# Contributing to ajsf ajsf is an open project and welcomes contributions. These guidelines are provided to help you understand how the project works and to make contributing smooth and fun for everybody involved. There are two main forms of contribution: reporting issues and performing code changes. ## Reporting Issues If you find a problem with ajsf, report it using [GitHub issues](https://github.com/hamzahamidi/ajsf/issues/new). A security vulnerability is the exception: report it privately as [SECURITY.md](./SECURITY.md) describes, not in a public issue. Before reporting a new issue, please take a moment to check whether it has already been reported [here](https://github.com/hamzahamidi/ajsf/issues). If this is the case, please: - Read all the comments to confirm that it's the same issue you're having. - Refrain from adding "same thing here" or "+1" comments. Just hit the "subscribe" button to get notifications for this issue. - Add a comment only if you can provide helpful information that has not been provided in the discussion yet. When creating a new issue, make sure you include: 1. As much detail as possible about your setup/environment 1. Steps to reproduce the issue/bug 1. What you expected to happen 1. What happened instead This information will help to determine the cause and prepare a fix as fast as possible. ## Code Changes Code contributions come in various forms and sizes, from simple bug fixes to implementation of new features. To send your code change, use GitHub pull requests. The workflow is as follows: 1. Fork the project. 1. Create a branch based on `main`. 1. Implement your change, including tests and documentation. 1. Run tests to make sure your change didn't break anything. 1. Publish the branch and create a pull request. 1. ajsf developers will review your change and possibly point out issues. Adapt the code under their guidance until all issues are resolved. 1. Finally, the pull request will get merged or rejected. See also [GitHub's guide on contributing](https://help.github.com/articles/fork-a-repo). If you want to do multiple unrelated changes, use separate branches and pull requests. ### Prerequisites This project pins its Node version in `.nvmrc`. Use it, because the Angular version in use does not support every Node release: ```bash $ nvm use ``` If `nvm use` leaves you on the wrong version, source nvm with `--no-use` first (`. "$NVM_DIR/nvm.sh" --no-use`) and run it again. Otherwise the shell keeps your default Node and installs or builds silently run on the wrong version. The repository has a `package-lock.json` and no `yarn.lock`, so use npm. CI installs with `npm ci`. ### Start the development environment Let's first generate all the bundles we need to start the demo: ```bash $ cd ajsf $ npm install $ npm start ``` You can stop the demo application. The tricky part now is to run concurrently both the demo application & the library in watch mode. So, first choose which library you want to change then run `$ ng build @ajsf/core --watch` for example to build in watch mode the `@ajsf/core`. Now let's start the demo application in watch mode too. So, open a new terminal and run `$ ng serve` and there you go. This method is tricky but it works perfectly in all environments (I tried other methods like npm-run-all or concurrently packages but angular-cli build doesn't restart after a failed build). If you have a better method please send a PR. ### Running the tests The library tests run on Vitest through Angular's unit-test builder, in jsdom, so they need no browser: ```bash $ npm run test:core -- --no-watch ``` Substitute `test:bs3`, `test:bs4`, `test:bs5`, `test:material` or `test:primeng` for the other packages. Leave `--browsers` out, because its absence is what selects jsdom. `npm run test:scripts` runs the tests for the files in `scripts/`. It is plain jasmine with no browser, so it takes about a second, and CI runs it too. ### Commits Each commit in the pull request should do only one thing, which is clearly described by its commit message. Especially avoid mixing formatting changes and functional changes into one commit. When writing commit messages, adhere to [Angular Conventional Commit](https://github.com/angular/angular/blob/master/CONTRIBUTING.md#-commit-message-guidelines). #### Commit Message Format Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**: ``` ():