Skip to content

Commit

Permalink
Merge pull request #5 from Netcentric/feature/#1-readme-update
Browse files Browse the repository at this point in the history
Feature/#1 readme update
  • Loading branch information
easingthemes committed Sep 25, 2023
2 parents 14dac4c + e6f3afa commit 8674270
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 71 deletions.
80 changes: 10 additions & 70 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,11 @@ Description
[![semver: semantic-release](https://img.shields.io/badge/semver-semantic--release-blue.svg)](https://github.com/semantic-release/semantic-release)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)

## Table of Changes

| Problem | Solution |
|---------------------------------------------------|---------------------------------------|
| components asynchronous, not blocking event loop | async function |
| singleton vs static class vs function exports | splitted into functions |
| Registering syntax | ```loaderRegister({ component })``` |
| Used named exports vs export default | Named exports |
| configurable data attribute? | function param defaults |
| Object for component list vs Set with name inside | Object for component list |
| Mutation Observer vs AEM edit Iframe Postmessage | Mutation Observer |
| Iteration over nodes instead of components | Nodes define with components to init |


### Installation
## Installation

```npm install @netcentric/component-loader```

#### important! babel
**important!**

This module is not transpiled. If your project is excluding `node_modules` you will have to update regex to include this module.

Expand All @@ -35,19 +21,16 @@ Eg:
```javascript
// webpack babel-loader config
module.exports = {
test: /\.js$/,
exclude: /node_modules\/(?!@netcentric)/,
loader: 'babel-loader',
options: {
presets: '@babel/preset-env'
}
...
};
```

Here we are excluding node_modules, except the ones under node_modules/@netcentric/*


### Usage
## Usage

1. Register component:
```javascript
Expand All @@ -69,16 +52,16 @@ run();

### Example

#### at the component `.entry.` file you should register your component
#### in the component file you should register your component

```javascript
import { register } from '@netcentric/component-loader';
import { text } from './text.component';

class Text {
...
}
// register your component to be loaded
register({ text });
// if you want to run just this component, eg if you are using http2
// runComponent(text.name or 'text');
register({ Text });
```

#### At your main entry file you should run all registered components
Expand All @@ -89,7 +72,7 @@ import {
run
} from '@netcentric/component-loader';

// Run all registered component - used usually with http1
// Run all registered component
run();
// Optional: Use observe to initialize new components which are added to the DOM after initial run.
observe();
Expand Down Expand Up @@ -260,46 +243,3 @@ const getTitleByUUID = (uuid) => instances.title.filter(instance => instance.el.
const mytitle = getTitleByUUID('a8c405b5-1928-46ed-afa1-5a0a3f4dde6c');

```

### Docs
- LICENSE
- docs/CODE_OF_CONDUCT.md
- docs/CONTRIBUTING.md
- docs/CHANGELOG.md --> dynamically updated

### Issue template
- .github/ISSUE_TEMPLATE.md

### PR template
- .github/PULL_REQUEST_TEMPLATE.md --> automatically closes connected issue

### Workflows
- CI --> npm ci, test and build
- CodeQL --> Perform CodeQL Analysis (Security, etc.)
- Release --> semantic-release:
* Creates release notes
* Updates CHANGELOG
* Updates package.json version
* Creates Git tag/release
* Publish package to NPM
- Manual Release --> same as Release, but can be triggered manually in Actions tab

### Release
- based on Angular Commit Message Conventions in commits -
https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit-message-header
- Commit message format is used to build:
* Release notes
* Changelog updates
* NPM package semver

### Commit message Convention

```
<type>(<scope>): <short summary>
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope (optional): project|based|list
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
```
53 changes: 52 additions & 1 deletion docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,56 @@ All submissions should come in the form of pull requests and need to be reviewed
by project committers. Read [GitHub's pull request documentation](https://help.github.com/articles/about-pull-requests/)
for more information on sending pull requests.

Lastly, please follow the [pull request template](../.github/PULL_REQUEST_TEMPLATE.md) when
Please follow the [pull request template](../.github/PULL_REQUEST_TEMPLATE.md) when
submitting a pull request!

## Commit messages
- Releasew is based on Angular Commit Message Conventions in commits -
https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit-message-header
- Commit message format is used to build:
* Release notes
* Changelog updates
* NPM package semver

### Commit message Convention

```
<type>(<scope>): <short summary>
│ │ │
│ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
│ │
│ └─⫸ Commit Scope (optional): project|based|list
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
```

### Example

- Triggers `patch` version update

Appears under "Bug Fixes" header, graphite subheader, with a link to issue #28:

```
fix(graphite): stop graphite breaking when width < 0.1
Closes #28
```

- Triggers `minor` version update

Appears under "Features" header, pencil subheader:

```
feat(pencil): add 'graphiteWidth' option
```

- Triggers `major` version update

Appears under "Performance Improvements" header, and under "Breaking Changes" with the breaking change explanation:

```
perf(pencil): remove graphiteWidth option
BREAKING CHANGE: The graphiteWidth option has been removed. The default graphite width of 10mm is always used for performance reason.
```

0 comments on commit 8674270

Please sign in to comment.