bs-widget 1.0.1
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/README.md +99 -0
- package/dist/bundle.js +1372 -0
- package/package.json +40 -0
package/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# bs-widget
|
|
2
|
+
|
|
3
|
+
Embeddable Beanstack goal widget bundle built with Rollup.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
Add a container element where the widget should render:
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<div id="bs-widget"></div>
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Load the bundle (local build):
|
|
14
|
+
|
|
15
|
+
```html
|
|
16
|
+
<script src="dist/bundle.js"></script>
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or load it from a CDN (after publishing to npm):
|
|
20
|
+
|
|
21
|
+
```html
|
|
22
|
+
<script src="https://unpkg.com/bs-widget@latest/dist/bundle.js"></script>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```html
|
|
26
|
+
<script src="https://cdn.jsdelivr.net/npm/bs-widget@latest/dist/bundle.js"></script>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Initialize the widget (same example as `index.html`):
|
|
30
|
+
|
|
31
|
+
```html
|
|
32
|
+
<script>
|
|
33
|
+
let widget = new BSWidget({
|
|
34
|
+
microsite: 6,
|
|
35
|
+
container: "#bs-widget",
|
|
36
|
+
color: "purple",
|
|
37
|
+
styled: true,
|
|
38
|
+
});
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Requirements
|
|
43
|
+
|
|
44
|
+
- Node.js 18+
|
|
45
|
+
- Yarn 1.x
|
|
46
|
+
|
|
47
|
+
## Development
|
|
48
|
+
|
|
49
|
+
- Install dependencies:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
yarn install
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
- Start local preview with watch support (recommended):
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
yarn dev
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
This runs Rollup in watch mode and serves the project at `http://localhost:8080`.
|
|
62
|
+
|
|
63
|
+
- Start local preview and auto-open in browser:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
yarn dev:open
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
- Start only Rollup in watch mode:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
yarn start
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
- Build once:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
yarn build
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Testing
|
|
82
|
+
|
|
83
|
+
- Run smoke test (build + verification):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
yarn test
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The smoke test checks that `dist/bundle.js` is generated and includes the `BSWidget` global constructor.
|
|
90
|
+
|
|
91
|
+
## Release checks
|
|
92
|
+
|
|
93
|
+
- Run all checks before publishing:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
yarn verify
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
`prepublishOnly` runs the same verification automatically to prevent publishing without a fresh passing build.
|