I appreciate you coming here and taking the time to read this document.
Welcome to the BeSpunky open-source community! โจ
This project, as well as other open-source projects by BeSpunky, is shared with the community with the following main goals:
To keep those in motion and create a safe space for developers to contribute, please follow our general code of conduct.
Contribution is welcome in any form (as long as it follows the code of conduct). Below are common ways you could contribute, but if you come up with another way of helping, feel free to offer...
Report bugs using the ๐ bug report template.
The title of bug reports must start with '๐ ' (bug emoji + a single space).
Search the issue list and the web for similar issues before reporting to prevent duplicates.
Attempt to reduce the problem as much as possible before submitting an issue so you can provide as detailed information and pin-point the problem.
Issues with insufficient information might end-up being closed.
You are welcome and encouraged to improve the project yourself. ๐ช
If you need help navigating the code, you may contact me at us@bespunky.io.
For small features and improvements, you can go ahead and develop them.
If, however, you would like to add a big feature or make breaking changes, please discuss it first in a feature request and state that you would like to take-on the task.
๐ The rule of thumb: When in doubt, discuss it first.
Whatever you do, when working on pull requests please follow the specifications below.
If your pull request doesn't follow the specs you will probably be asked to improve it before merging.
development
branch.<emoji>/<module>/<name-of-feature-or-fix>
. Example:
โ/core/loading-automation
See emojis.
lodash
, rxjs
)@angular/core
, @angular/router
)@ngx-translate/core
, @angular/flex-layout
)import { Subject } from 'rxjs';
import { OnChanges, Input, OnDestroy } from '@angular/core';
import { promiseLater } from '@bespunky/angular-zen/async';
import { GoogleMapsComponentApiService } from '../../api/google-maps-component-api.service';
import { EmittingWrapper } from '../types/abstraction';
You can use one of Better Align, Align by RegEx or Align-Vertically for bracket alignment.
Use 4 space for indentations, except for .json
files.
Use 2 spaces for .json
file indentations.
Align object properties and assignment expressions:
const someValue = 1;
const anotherValue = 2;
const config = {
someKey : 'value',
anotherKey: 'anotherValue'
};
Place opening braces on a new line: ```ts function doMagic(): void { if (somethingCoolHappend) { sparkTheAir(); return; }
goToSleep();
}
* Avoid switch statements when possible. Use a mapping object instead:
```ts
enum Color { Black, White, ... }
// Much cleaner, especially if there are many colors
class NoSwitchHere
{
private handlers = {
[Color.Black]: this.handleBlack.bind(this),
[Color.White]: this.handleWhite.bind(this),
...
};
public doMagic(color: Color): void
{
this.handlers[color]();
}
public handleBlack(...): void { ... }
public handleWhite(...): void { ... }
}
Separate lines into groups. Commonly grouped lines:
return
statementStrong type your variables whenever possible.
Always state the return type of a function or a method.
Break complex functions into smaller ones and give them meaningful and explanatory names.
function doMagic(trick: 'pigeon' | 'rabbit'): string
{
const pauseDuration = Math.random() * 10;
const isPegion = trick === 'pigeon';
// โคต
waveToTheCrowd();
takeOffTheHat();
pauseForTension(pauseDuration);
// โคต
if (isPegion)
{
const pigeon = pullPigeonOutOfHat();
// โคต
setPigeonFree(pigeon);
bow();
// โคต
return pigeon.name;
}
// โคต
const rabbit = pullRabbitOutOfHat();
// โคต
giveRabbitToBirthdayKid();
takeAPicture();
// โคต
return rabbit.name;
}
Examples:
โ Implemented automatic module loading
๐ Fixed module loading automation fails in SSR
If your pull request doesn't include the relevant tests you will be asked to add them before merging.
If you like this project and enjoy working on it continuously, you can become an official maintainer.
In addition to developing, the role of a maintainer includes, but is not limited to, the following:
Becoming a maintainer requires:
To apply, please send your request to us@bespunky.io.
Prefer using the emoji dialog rather than typing the :emoji_name:
version as some version control software don't deal with them correctly.
On Windows, press Ctrl + .
to launch the emoji dialog.
If you know how to do that on Mac and Linux, please update this doc.
Emoji | Name | Use when you have... |
---|---|---|
โจ | sparkles | Scaffolded a new component, service or module |
๐ | bug | Fixed a bug |
โ | plus sign | Added files or new feature implementations |
โ | minus sign | Removed files or feature implementations |
โป | recycling symbol | Refactored code |
๐ | open file folder | Changed folder structures without refactoring code |
๐จ | artist palette | Improved code layout, order or structure without refactoring |
โก | high voltage | Optimized code performance, imports or package size |
๐ | page with curl | Added or modified wiki documentation, inline comments or other .md files |
๐ | rocket | Made deployment related changes (e.g. version bump, pipeline config...) |
๐ง | wrench | Added or modified a configuration file |
๐ | lipstick | Improved UI, styling or visual layout of components |
๐ฑ | mobile phone | Improved responsiveness |
๐ฆ | package | Installed, updated or downgraded a dependency |
โ | check mark button | Added or modified unit tests |