@@ -8,25 +8,11 @@ Description
8
8
[ ![ semver: semantic-release] ( https://img.shields.io/badge/semver-semantic--release-blue.svg )] ( https://github.com/semantic-release/semantic-release )
9
9
[ ![ License] ( https://img.shields.io/badge/License-Apache%202.0-blue.svg )] ( https://opensource.org/licenses/Apache-2.0 )
10
10
11
- ## Table of Changes
12
-
13
- | Problem | Solution |
14
- | ---------------------------------------------------| ---------------------------------------|
15
- | components asynchronous, not blocking event loop | async function |
16
- | singleton vs static class vs function exports | splitted into functions |
17
- | Registering syntax | ``` loaderRegister({ component }) ``` |
18
- | Used named exports vs export default | Named exports |
19
- | configurable data attribute? | function param defaults |
20
- | Object for component list vs Set with name inside | Object for component list |
21
- | Mutation Observer vs AEM edit Iframe Postmessage | Mutation Observer |
22
- | Iteration over nodes instead of components | Nodes define with components to init |
23
-
24
-
25
- ### Installation
11
+ ## Installation
26
12
27
13
``` npm install @netcentric/component-loader ```
28
14
29
- #### important! babel
15
+ ** important!**
30
16
31
17
This module is not transpiled. If your project is excluding ` node_modules ` you will have to update regex to include this module.
32
18
35
21
``` javascript
36
22
// webpack babel-loader config
37
23
module .exports = {
38
- test: / \. js$ / ,
39
24
exclude: / node_modules\/ (?!@netcentric)/ ,
40
25
loader: ' babel-loader' ,
41
- options: {
42
- presets: ' @babel/preset-env'
43
- }
26
+ ...
44
27
};
45
28
```
46
29
47
30
Here we are excluding node_modules, except the ones under node_modules/@netcentric /*
48
31
49
32
50
- ### Usage
33
+ ## Usage
51
34
52
35
1 . Register component:
53
36
``` javascript
@@ -69,16 +52,16 @@ run();
69
52
70
53
### Example
71
54
72
- #### at the component ` .entry. ` file you should register your component
55
+ #### in the component file you should register your component
73
56
74
57
``` javascript
75
58
import { register } from ' @netcentric/component-loader' ;
76
- import { text } from ' ./text.component' ;
77
59
60
+ class Text {
61
+ ...
62
+ }
78
63
// register your component to be loaded
79
- register ({ text });
80
- // if you want to run just this component, eg if you are using http2
81
- // runComponent(text.name or 'text');
64
+ register ({ Text });
82
65
```
83
66
84
67
#### At your main entry file you should run all registered components
@@ -89,7 +72,7 @@ import {
89
72
run
90
73
} from ' @netcentric/component-loader' ;
91
74
92
- // Run all registered component - used usually with http1
75
+ // Run all registered component
93
76
run ();
94
77
// Optional: Use observe to initialize new components which are added to the DOM after initial run.
95
78
observe ();
@@ -260,46 +243,3 @@ const getTitleByUUID = (uuid) => instances.title.filter(instance => instance.el.
260
243
const mytitle = getTitleByUUID (' a8c405b5-1928-46ed-afa1-5a0a3f4dde6c' );
261
244
262
245
```
263
-
264
- ### Docs
265
- - LICENSE
266
- - docs/CODE_OF_CONDUCT.md
267
- - docs/CONTRIBUTING.md
268
- - docs/CHANGELOG.md --> dynamically updated
269
-
270
- ### Issue template
271
- - .github/ISSUE_TEMPLATE.md
272
-
273
- ### PR template
274
- - .github/PULL_REQUEST_TEMPLATE.md --> automatically closes connected issue
275
-
276
- ### Workflows
277
- - CI --> npm ci, test and build
278
- - CodeQL --> Perform CodeQL Analysis (Security, etc.)
279
- - Release --> semantic-release:
280
- * Creates release notes
281
- * Updates CHANGELOG
282
- * Updates package.json version
283
- * Creates Git tag/release
284
- * Publish package to NPM
285
- - Manual Release --> same as Release, but can be triggered manually in Actions tab
286
-
287
- ### Release
288
- - based on Angular Commit Message Conventions in commits -
289
- https://github.com/angular/angular/blob/master/CONTRIBUTING.md#commit-message-header
290
- - Commit message format is used to build:
291
- * Release notes
292
- * Changelog updates
293
- * NPM package semver
294
-
295
- ### Commit message Convention
296
-
297
- ```
298
- <type>(<scope>): <short summary>
299
- │ │ │
300
- │ │ └─⫸ Summary in present tense. Not capitalized. No period at the end.
301
- │ │
302
- │ └─⫸ Commit Scope (optional): project|based|list
303
- │
304
- └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|test
305
- ```
0 commit comments