So you're thinking about contributing to Fhi.Frontend.Demo, and or its submodule? Great! Maintaining and enhancing Fhi.Frontend.Demo (and submodule) is a big job, so the community's help is really appreciated. Helping out isn't just writing code, it also includes submitting issues, helping confirm issues and improving the documentation.
- Git submodule
- Submitting Issues
- Fixing Bugs and Adding Features
- Coding conventions
- Documentation
- License
There is a submodule in this repo:
./Fhi.Frontend.Style
, Github repo Fhi.Frontend.Style
The information in this file refers to this repo but also the submodule.
Requests for new features and bug reports keep the project moving forward.
- Ensure you are running the latest version of Fhi.Frontend.Demo and its submodule.
- Search the issue lists (including closed issues) to make sure it hasn't already been reported.
- Give the issue a short, clear title that describes the bug or feature request
- Include steps to reproduce the issue
- If possible, include a short code example that reproduces the issue
- Use markdown formatting as appropriate to make the issue and code more readable.
Before we work on issues, we must confirm them and be able to reproduce them. Confirming issues takes up a great deal of the team's time, so making that job easier is really appreciated.
Issues that need confirmation will have the confirm label or be unlabeled and have no milestone. You can help us to confirm issues by;
- Add steps to reproduce the issue
- Test issues and provide feedback
We love pull requests, but would prefer that new contributors start with smaller issues and let us know before you contribute to prevent duplication of work.
It is also a good idea to add a comment to an issue that you are working on to let everyone know. If you stop working on it, also please let us know.
These are just examples. Feel free to find workflows that suites you. For more info about git submodules see: https://git-scm.com/book/en/v2/Git-Tools-Submodules
- Create a new branch in this repo (from
dev
), and a new branch with the same name in the git submodule./Fhi.Frontend.Style
(frommain
). - Run
npm start
- Work on both parent and submodule code, and commit changes in both repos.
- When ready
- Run
git push
in this repo - Run
git push --recurse-submodules=check
in the submodule repo
- Run
When making changes to the icon file set, run npm run generate-icon-list
.
- Create a new branch in this repo (from
dev
) - Run
ng build @folkehelseinstituttet/[project] --watch
- In a new consol, run
npm start
- Work on both library and app code simultanously
- When ready, run
git push
and follow the pull request guidelines
- Run
ng generate module fhi-[name] --project @folkehelseinstituttet/[project]
to generate a new module - Add new module to
FhiAngularComponentsModule
- Run
ng generate component fhi-[name] --project @folkehelseinstituttet/[project]
to generate a new component - Add new component to
exports
in new module - Add both the new module and the new component to the public API Surface of fhi-angular-components
You can also use ng generate directive|pipe|service|class|guard|interface|enum --project @folkehelseinstituttet/[project]
.
Note: Don't forget to add option
--project
or else it will be added to the default project in yourangular.json
file.
- Create a new branch from
main
. - Prefix your branch name with either
new/
,enhancement/
orbugfix/
. - Before pull request, remember to update
CHANGELOG.md
, and if this is the first pull request after a release, add an extra hash to the existing "version number heading", add a new heading called# Unreleased
, a date, and then list your changes. - Push feature branch, create pull request with a good name, and a comment if necessary
- After approved review, squash and merge to
main
, and delete your feature branch.
- Create a new branch from
main
. - Name it
release/x.x.x
, wherex.x.x
is the version you're releasing. - Change text
# Unreleased
to# x.x.x
iCHANGELOG.md
- Run
npm version [patch, minor, major]
to upgradepackage.json
and automatically create a new commit. - Push release branch and create pull request from release branch into
main
- After approved review, squash and merge to
main
(deploy), delete the release branch for the previous release, but keep the latest release branch.
A library project is an Angular concept for organising code that are going to be made into a npm package. A library project is defined in ./angular.json
, and the files are located in ./projects/fhi-[project]
- Create a new branch from
dev
. - Prefix your branch name with either
new/
,enhancement/
orbugfix/
. - Before pull request, remember to also push any changes made to the submodule
Fhi.Frontend.Style
so that the branch with changes are available to the reviewer.
Before creating a release branch
- Check that all peerDependencies are updated
- Check that
@folkehelseinstituttet/*
is already released if listed in peerDependencies- Check that the dependency matrix is updated, and has "Unreleased" as latest version.
- Check that the CHANGELOG.md is updated, and has "Unreleased" as latest version.
If one or more of the checks above is not OK; create a branch, fix, and create a new pull request.
If everything is OK; create a release branch
- When creating a release branch, follow the instructions below to the letter!
- Create a new branch from
dev
. - Name it
release/fhi-[project]/x.x.x
, wherex.x.x
is the version you're releasing. - Update the following and commit:
- text
# Unreleased
to# x.x.x
in the CHANGELOG for the project:./projects/fhi-[project]/CHANGELOG.md
- text
Unreleased
tox.x.x
in the dependency matrix for the project:./projects/fhi-[project]/README.md
(if a new line was added). - version in
./projects/fhi-[project]/package.json
tox.x.x
manually.It's cumbersome to use
npm version
sincepackage.json
is in another directory than the git directory. And since there is nopackage-lock.json
, and no need for a tag in the current workflow, doing it manually is faster. A better, and more automated, solution may come in the future.
- text
- Create PR into
dev
fromrelease/fhi-[project]/x.x.x
, and when approved, make sure commit message is Release/fhi-[project]/x.x.x, and then merge (ie. deploy).NB! Automated release job only runs if
Release/fhi-[project]/
is present in commit message since this isn't a release for everything in the repo, just a particular library.
Almost same procedure as described under Release branches for library projects, but there are some minor differences:
- Create a new branch from
fhi-[project]/vx
, whereX
is the major version you're patching (remember ref. to correct git submodule). - Name it
release/fhi-[project]/x.x.x
, wherex.x.x
is the version you're releasing. - Update the following and commit:
- Add
# x.x.x
in beginning of the CHANGELOG for the project:./projects/fhi-[project]/CHANGELOG.md
- Add and extra
#
to the previous version number. - NB! when updating version in
./projects/fhi-[project]/package.json
tox.x.x
, ALSO updatepublishConfig.tag
tov[x]
where[x]
is the major version you're patching.
- Add
- Create PR into
fhi-[project]/vx
fromrelease/fhi-[project]/x.x.x
, and when approved, make sure commit message is Release/fhi-[project]/x.x.x, and then merge (ie. deploy). - Create PR into
dev
fromrelease/fhi-[project]/x.x.x
to merge relevant changes from the patch back intodev
, and when approved, make sure commit message is Release/fhi-[project]/x.x.x, and then merge AND delte branchrelease
.NB! This PR will probably have conflicts, so just merge
dev
intorelease
before creating PR, and fix conflicts. Ask someone if in doubt about any conflicts, but here are a few things to remember when merging:- ALWAYS merge changes to CHANGELOG (in chronological order based on date, not version)
- Sometimes merge changes to the code
- NEVER merge any changes to
publishConfig.tag
in./projects/fhi-[project]/package.json
- Remember correct git submodule ref.
There is no need for a release branch, since the branch dev
represents the "truth". Therefore we do not create a pull request with main as base either, we just:
- Check that
package.json
is up to date with the latest versions of@folkehelseinstituttet/style
- If not: create a feature branch named
enhancement/update-dependencies
, and fix it. - Create PR, and merge
enhancement/update-dependencies
todev
when approved.
- If not: create a feature branch named
- Merge
main
intodev
and fix merge conflicts if any. - Merge
dev
intomain
- Push to origin (which will trigger the release)
The project is using
- SASS with the SCSS syntax
- BEM, but only in the folder
fhi/blocks
- And some custom rules
Read more about how we (try to) organize the CSS code.
The project has also some custom rules for how we write markup: HTML example file
When it comes to TypeScript we adhere to Angular coding style guide TypeScript example file
Great documentation is essential for any open source project and Fhi.Frontend.Demo is no exception. In addition to READMEs in the repos, https://designsystem.fhi.no is where we document our frontend library, but often we lag behind the features that have been implemented or would benefit from better examples, so help is really appreciated!
Fhi.Frontend.Demo is under the MIT license. By contributing to Fhi.Frontend.Demo, you assert that:
- The contribution is your own original work.
- You have the right to assign the copyright for the work (it is not owned by your employer, or you have been given copyright assignment in writing).