Skip to content

Commit 30c8d56

Browse files
committed
Bump AvalynxAlert to version 1.0.3
Upgrade references to version 1.0.3 across files, enhance `avalynx-alert.js` and its ESM counterpart for better modularity, and expand Jest tests for comprehensive functionality coverage.
1 parent 38535c9 commit 30c8d56

File tree

13 files changed

+573
-70
lines changed

13 files changed

+573
-70
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ Replace `path/to/avalynx-alert.js` and `path/to/avalynx-alert.css` with the actu
4747
AvalynxAlert is also available via [jsDelivr](https://www.jsdelivr.com/). You can include it in your project like this:
4848

4949
```html
50-
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/css/avalynx-alert.css" rel="stylesheet">
51-
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/js/avalynx-alert.js"></script>
50+
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/css/avalynx-alert.css" rel="stylesheet">
51+
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/js/avalynx-alert.js"></script>
5252
```
5353

5454
Make sure to also include Bootstrap's JS/CSS in your project to ensure AvalynxAlert displays correctly.

__tests__/avalynx-loader.test.js

Lines changed: 512 additions & 47 deletions
Large diffs are not rendered by default.

build.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ fs.readFile(filePath, 'utf8', (err, data) => {
1818
return;
1919
}
2020

21-
const result = data.replace(/class /g, 'export class ');
21+
let result = data.replace(/class AvalynxAlert /g, 'import * as bootstrap from \'bootstrap\';\n\nexport class AvalynxAlert ');
22+
23+
result = result.replace(/\n\nif \(typeof module !== 'undefined' && module\.exports\) \{\n module\.exports = AvalynxAlert;\n\}\n?$/, '');
2224

2325
fs.writeFile(filePath, result, 'utf8', err => {
2426
if (err) {

dist/js/avalynx-alert.esm.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,13 @@
2222
*
2323
*/
2424

25+
import * as bootstrap from 'bootstrap';
26+
2527
export class AvalynxAlert {
2628
constructor(message, type, options = {}) {
29+
if (options === null || typeof options !== 'object') {
30+
options = {};
31+
}
2732
this.message = message;
2833
this.type = type;
2934
this.options = {
@@ -105,7 +110,6 @@ export class AvalynxAlert {
105110
alert.classList.add('p-0');
106111
alert.classList.add('overflow-hidden');
107112
alert.classList.add('avalynx-alert');
108-
alert.role = 'alert';
109113
alert.innerHTML = `<div class="alert-content">${this.message}`;
110114
if (this.options.closeable) {
111115
alert.innerHTML += `<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>`;
@@ -114,6 +118,7 @@ export class AvalynxAlert {
114118
if (this.options.autoClose) {
115119
alert.innerHTML += `<div class="alert-timer" style="height: 5px; width: 0;"></div>`;
116120
}
121+
alert.setAttribute('role', 'alert');
117122

118123
document.getElementById('avalynx-alert-container-' + this.options.position).appendChild(alert);
119124

@@ -138,4 +143,4 @@ export class AvalynxAlert {
138143
}, this.options.duration);
139144
}
140145
}
141-
}
146+
}

dist/js/avalynx-alert.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@
2424

2525
class AvalynxAlert {
2626
constructor(message, type, options = {}) {
27+
if (options === null || typeof options !== 'object') {
28+
options = {};
29+
}
2730
this.message = message;
2831
this.type = type;
2932
this.options = {
@@ -105,7 +108,6 @@ class AvalynxAlert {
105108
alert.classList.add('p-0');
106109
alert.classList.add('overflow-hidden');
107110
alert.classList.add('avalynx-alert');
108-
alert.role = 'alert';
109111
alert.innerHTML = `<div class="alert-content">${this.message}`;
110112
if (this.options.closeable) {
111113
alert.innerHTML += `<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>`;
@@ -114,6 +116,7 @@ class AvalynxAlert {
114116
if (this.options.autoClose) {
115117
alert.innerHTML += `<div class="alert-timer" style="height: 5px; width: 0;"></div>`;
116118
}
119+
alert.setAttribute('role', 'alert');
117120

118121
document.getElementById('avalynx-alert-container-' + this.options.position).appendChild(alert);
119122

@@ -139,3 +142,7 @@ class AvalynxAlert {
139142
}
140143
}
141144
}
145+
146+
if (typeof module !== 'undefined' && module.exports) {
147+
module.exports = AvalynxAlert;
148+
}

docker/web/Dockerfile

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,21 @@
1-
FROM webdevops/php-apache-dev:8.1
1+
FROM webdevops/php-apache-dev:8.3
22

33
# Update and install
44
RUN apt-get update && apt-get install -y
5+
6+
#Nano
7+
RUN apt-get install -y nano
8+
9+
#Keyring
10+
RUN mkdir -p /etc/apt/keyrings
11+
12+
# Node.js
13+
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
14+
RUN NODE_MAJOR=18 && echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_$NODE_MAJOR.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
15+
16+
# Yarn
17+
RUN curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | gpg --dearmor | tee /usr/share/keyrings/yarnkey.gpg >/dev/null 2>&1
18+
RUN echo "deb [signed-by=/usr/share/keyrings/yarnkey.gpg] https://dl.yarnpkg.com/debian stable main" | tee /etc/apt/sources.list.d/yarn.list >/dev/null 2>&1
19+
RUN apt-get update && apt-get install -y yarn
20+
21+
USER application

examples/callback-onclose.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9/build/styles/stackoverflow-light.min.css" id="hljsTheme">
1717
<script>hljs.highlightAll();</script>
1818

19-
<!-- AvalynxAlert 1.0.2 -->
20-
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/css/avalynx-alert.min.css" rel="stylesheet">
21-
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/js/avalynx-alert.min.js"></script>
19+
<!-- AvalynxAlert 1.0.3 -->
20+
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/css/avalynx-alert.min.css" rel="stylesheet">
21+
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/js/avalynx-alert.min.js"></script>
2222

2323
<!-- Example helper -->
2424
<link href="./css/helper.css" rel="stylesheet">

examples/random-alerts-every-3s.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9/build/styles/stackoverflow-light.min.css" id="hljsTheme">
1717
<script>hljs.highlightAll();</script>
1818

19-
<!-- AvalynxAlert 1.0.2 -->
20-
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/css/avalynx-alert.min.css" rel="stylesheet">
21-
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/js/avalynx-alert.min.js"></script>
19+
<!-- AvalynxAlert 1.0.3 -->
20+
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/css/avalynx-alert.min.css" rel="stylesheet">
21+
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/js/avalynx-alert.min.js"></script>
2222

2323
<!-- Example helper -->
2424
<link href="./css/helper.css" rel="stylesheet">

examples/random-alerts.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9/build/styles/stackoverflow-light.min.css" id="hljsTheme">
1717
<script>hljs.highlightAll();</script>
1818

19-
<!-- AvalynxAlert 1.0.2 -->
20-
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/css/avalynx-alert.min.css" rel="stylesheet">
21-
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/js/avalynx-alert.min.js"></script>
19+
<!-- AvalynxAlert 1.0.3 -->
20+
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/css/avalynx-alert.min.css" rel="stylesheet">
21+
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/js/avalynx-alert.min.js"></script>
2222

2323
<!-- Example helper -->
2424
<link href="./css/helper.css" rel="stylesheet">

examples/simple-alert.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.9/build/styles/stackoverflow-light.min.css" id="hljsTheme">
1717
<script>hljs.highlightAll();</script>
1818

19-
<!-- AvalynxAlert 1.0.2 -->
20-
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/css/avalynx-alert.min.css" rel="stylesheet">
21-
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.2/dist/js/avalynx-alert.min.js"></script>
19+
<!-- AvalynxAlert 1.0.3 -->
20+
<link href="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/css/avalynx-alert.min.css" rel="stylesheet">
21+
<script src="https://cdn.jsdelivr.net/npm/avalynx-alert@1.0.3/dist/js/avalynx-alert.min.js"></script>
2222

2323
<!-- Example helper -->
2424
<link href="./css/helper.css" rel="stylesheet">

0 commit comments

Comments
 (0)