@startinblox/boilerplate 4.3.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitlab-ci.yml +3 -3
- package/README.md +79 -32
- package/biome.json +1 -1
- package/dist/index.js +238 -305
- package/package.json +13 -13
- package/src/helpers/components/orbitComponent.ts +43 -13
- package/src/index.ts +2 -2
package/.gitlab-ci.yml
CHANGED
|
@@ -10,7 +10,7 @@ cache:
|
|
|
10
10
|
- .npm/
|
|
11
11
|
|
|
12
12
|
default:
|
|
13
|
-
image: node:
|
|
13
|
+
image: node:24
|
|
14
14
|
|
|
15
15
|
stages:
|
|
16
16
|
- prepare
|
|
@@ -19,7 +19,7 @@ stages:
|
|
|
19
19
|
|
|
20
20
|
prepare:
|
|
21
21
|
stage: prepare
|
|
22
|
-
image: node:
|
|
22
|
+
image: node:24
|
|
23
23
|
before_script:
|
|
24
24
|
- npm ci --cache .npm --prefer-offline
|
|
25
25
|
- npm install -g semantic-release@24 @semantic-release/gitlab@13
|
|
@@ -37,7 +37,7 @@ prepare:
|
|
|
37
37
|
test:
|
|
38
38
|
stage: test
|
|
39
39
|
image:
|
|
40
|
-
name: cypress/included:15.
|
|
40
|
+
name: cypress/included:15.9.0
|
|
41
41
|
entrypoint: [""]
|
|
42
42
|
before_script:
|
|
43
43
|
- npm ci --cache .npm --prefer-offline
|
package/README.md
CHANGED
|
@@ -2,48 +2,57 @@
|
|
|
2
2
|
|
|
3
3
|
## Introduction
|
|
4
4
|
|
|
5
|
-
This repository provides a boilerplate for developing Startin'blox web components. It streamlines the creation and deployment of web components, whether used
|
|
5
|
+
This repository provides a boilerplate for developing Startin'blox web components. It streamlines the creation and deployment of web components, whether used standalone or integrated within the Startin'blox ecosystem (Lit, Startin'blox Core, Store, Router, and Orbit). The primary objective is to enable developers to concentrate on web component logic by abstracting common complexities and providing essential functionalities out-of-the-box.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
9
|
This boilerplate includes:
|
|
10
10
|
|
|
11
|
-
* **Localization:**
|
|
11
|
+
* **Localization:** Supports internationalization with platforms like Weblate, powered by [`@lit/localize`](https://www.npmjs.com/package/@lit/localize).
|
|
12
12
|
* **Data Management:** A comprehensive wrapper around the Startin'blox Store for simplified property handling (RDF or named).
|
|
13
13
|
* **Component Awareness:** Mechanisms to manage race conditions and inheritance across external components.
|
|
14
14
|
* **Helper Utilities:** Functions for data reactivity, filtering, and sorting.
|
|
15
15
|
* **Development Tools:**
|
|
16
|
-
* **Storybook:** For component
|
|
16
|
+
* **Storybook:** For isolated component development and documentation, reducing the need for a heavy local environment.
|
|
17
17
|
* **Cypress:** For component testing.
|
|
18
18
|
* **Unpluggin Icons:** Access to a vast library of icons from [Iconify](https://icon-sets.iconify.design/).
|
|
19
19
|
* **Lit Integration:** Pre-made component classes to accelerate development.
|
|
20
|
-
* **Vite-powered:** Typescript, SASS, PostCSS
|
|
21
|
-
* **BiomeJS:**
|
|
20
|
+
* **Vite-powered:** Typescript, SASS, PostCSS and Autoprefixer, allowing you to focus on component logic rather than build configurations.
|
|
21
|
+
* **BiomeJS:** Preconfigured for Startin'blox JS styling, using the most [reasonable one](https://github.com/airbnb/javascript), for linting and formatting. Integrate [Biome](https://biomejs.dev/fr/) with your preferred editor.
|
|
22
22
|
|
|
23
|
-
##
|
|
23
|
+
## Quick Start for Developers
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
This section guides you through setting up the local development environment and using the boilerplate to create and test web components.
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
### Local Development Setup
|
|
28
|
+
|
|
29
|
+
To get started with local development:
|
|
28
30
|
|
|
29
|
-
1. Clone
|
|
30
|
-
2. Rename the `origin` remote to `upstream`:
|
|
31
|
+
1. **Clone the repository:**
|
|
31
32
|
|
|
32
33
|
```bash
|
|
33
|
-
git
|
|
34
|
+
git clone https://git.startinblox.com/components/your-component-name.git
|
|
35
|
+
cd your-component-name
|
|
34
36
|
```
|
|
35
37
|
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
6. Add the new repository as the `origin` remote:
|
|
38
|
+
*Note: If you are starting a new project from this boilerplate, refer to the "Developping new components from the boilerplate" section below.*
|
|
39
|
+
|
|
40
|
+
2. **Install dependencies:**
|
|
40
41
|
|
|
41
42
|
```bash
|
|
42
|
-
|
|
43
|
+
npm install
|
|
43
44
|
```
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
3. **Run Storybook:**
|
|
47
|
+
Storybook is the primary development environment for isolated component development and documentation.
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
npm run storybook
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This will open Storybook in your browser, typically at `http://localhost:6006`.
|
|
54
|
+
|
|
55
|
+
### Using Your Components
|
|
47
56
|
|
|
48
57
|
For production usage, components can be served via a CDN like JSDelivr or self-hosted.
|
|
49
58
|
|
|
@@ -60,18 +69,58 @@ For production usage, components can be served via a CDN like JSDelivr or self-h
|
|
|
60
69
|
<!-- etc. -->
|
|
61
70
|
```
|
|
62
71
|
|
|
63
|
-
|
|
72
|
+
## Developping new components from the boilerplate
|
|
64
73
|
|
|
65
|
-
|
|
74
|
+
### Creating a New Component Repository
|
|
66
75
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
76
|
+
To initialize a new component repository from this boilerplate:
|
|
77
|
+
|
|
78
|
+
1. **Clone this repository:**
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
git clone https://git.startinblox.com/components/solid-boilerplate.git your-new-component-name
|
|
82
|
+
cd your-new-component-name
|
|
83
|
+
```
|
|
71
84
|
|
|
72
|
-
|
|
85
|
+
2. **Rename the `origin` remote to `upstream`:**
|
|
73
86
|
|
|
74
|
-
|
|
87
|
+
```bash
|
|
88
|
+
git remote rename origin upstream
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
3. **Update project details:**
|
|
92
|
+
Modify the `name`, `description`, and `repository.url` fields in [`package.json`](package.json) to reflect your new component.
|
|
93
|
+
|
|
94
|
+
4. **Initial commit:**
|
|
95
|
+
Commit the changes with a `major: Initial commit` message.
|
|
96
|
+
|
|
97
|
+
5. **Create a new repository:**
|
|
98
|
+
Create a new repository on [git.startinblox.com/components](https://git.startinblox.com/components/).
|
|
99
|
+
|
|
100
|
+
6. **Add the new repository as the `origin` remote:**
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git remote add origin https://git.startinblox.com/components/your-component-name.git
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
7. **Configure Gitlab settings:**
|
|
107
|
+
Set up branch protection rules, enforce FF merge only, and configure cloning instead of fetching in your new repository's Gitlab settings.
|
|
108
|
+
|
|
109
|
+
8. **Push to `origin master`:**
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
git push -u origin master
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Important Considerations
|
|
116
|
+
|
|
117
|
+
This boilerplate is designed as a **library** for multiple web components and intentionally **does not include** a default `index.html` file. Developers should use Storybook for isolated component development.
|
|
118
|
+
|
|
119
|
+
* **Avoid Blind Copy-Pasting:** Do not simply copy files without understanding their purpose. This boilerplate includes specific configurations and integrations (e.g., Orbit, localization) that may not be relevant to all projects. Always review and adapt the code to your specific needs.
|
|
120
|
+
* **Understand Core Concepts:** Familiarize yourself with the "Core Concepts" section to understand how data management, component awareness, and helper utilities are implemented.
|
|
121
|
+
* **Orbit Integration:** The `import @src/initializer;` statement is **only required if your component will be integrated with Startin'blox Orbit**. If you are not using Orbit, you **do not need** this import.
|
|
122
|
+
|
|
123
|
+
## Development Environment
|
|
75
124
|
|
|
76
125
|
**Storybook** is the primary development environment for isolated component development and documentation. **Cypress** is integrated for component testing.
|
|
77
126
|
|
|
@@ -236,15 +285,13 @@ npm run build-storybook
|
|
|
236
285
|
npm run build
|
|
237
286
|
```
|
|
238
287
|
|
|
239
|
-
## Orbit
|
|
288
|
+
## Orbit Integration
|
|
240
289
|
|
|
241
290
|
Components built with this boilerplate are designed to work seamlessly with Orbit without requiring specific configurations.
|
|
242
291
|
|
|
243
|
-
To prevent potential race conditions, include `import @src/initializer;` at the top of your component's file, before the `@customElement` declaration.
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
Note that without a complete Orbit environment, interactions with external components (e.g., route management, component deduplication, global localization, conditional component display) may be limited.
|
|
292
|
+
* **Initializer:** To prevent potential race conditions when integrating with Orbit, include `import @src/initializer;` at the top of your component's file, before the `@customElement` declaration. **This import is only necessary if your component will be used within an Orbit environment.**
|
|
293
|
+
* **Performance Optimization:** Application performance can be optimized by utilizing the `gatekeeper` method within your `OrbitComponent`'s render methods.
|
|
294
|
+
* **Limitations without Orbit:** Without a complete Orbit environment, interactions with external components (e.g., route management, component deduplication, global localization, conditional component display) may be limited.
|
|
248
295
|
|
|
249
296
|
## Best practices
|
|
250
297
|
|