Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
417279f
Merge pull request #336 from palcarazm/v5
palcarazm Jun 28, 2026
64929f8
ci: enhance Coveralls integration and add code change detection for s…
palcarazm Jun 28, 2026
ad3e5f9
ci: update code change detection regex and remove pull request trigge…
palcarazm Jun 28, 2026
c872513
ci: improve code change detection logic in CI workflow
palcarazm Jun 28, 2026
123538d
ci: enhance code change detection by using changed-files action
palcarazm Jun 28, 2026
ccdf1f3
ci: add workflow for publishing package to npmJS on release
palcarazm Jun 28, 2026
f4ea3c7
ci: update deploy workflow to trigger on release instead of push
palcarazm Jun 28, 2026
8ace681
ci(deps): bump the minor-and-patch-updates group with 2 updates
dependabot[bot] Jul 3, 2026
a3f935a
ci(deps): bump actions/checkout from 6 to 7
dependabot[bot] Jul 3, 2026
8c2df84
chore(docs): bump the version-updates group in /docs with 2 updates
dependabot[bot] Jul 3, 2026
68e7d6c
ci(deps): bump actions/github-script from 7 to 9
dependabot[bot] Jul 3, 2026
1a025fc
Merge pull request #338 from palcarazm/dependabot/github_actions/mino…
palcarazm Jul 6, 2026
8cc5643
Merge pull request #339 from palcarazm/dependabot/github_actions/acti…
palcarazm Jul 6, 2026
3a30c93
Merge pull request #340 from palcarazm/dependabot/npm_and_yarn/docs/v…
palcarazm Jul 6, 2026
1022ed2
Merge pull request #341 from palcarazm/dependabot/github_actions/acti…
palcarazm Jul 6, 2026
6128aaf
chore(docs): bump @fortawesome/fontawesome-free
dependabot[bot] Jul 17, 2026
e5d1c81
ci(deps): bump actions/setup-node from 6 to 7
dependabot[bot] Jul 17, 2026
27641c8
ci(deps): bump the minor-and-patch-updates group across 1 directory w…
dependabot[bot] Aug 7, 2026
42c4955
Merge pull request #348 from palcarazm/dependabot/github_actions/mino…
palcarazm Aug 13, 2026
0649673
Merge pull request #346 from palcarazm/dependabot/github_actions/acti…
palcarazm Aug 13, 2026
cd95a28
Merge pull request #344 from palcarazm/dependabot/npm_and_yarn/docs/v…
palcarazm Aug 13, 2026
0f66b62
chore(docs): bump @highlightjs/cdn-assets
dependabot[bot] Aug 21, 2026
c029c5f
ci(deps): bump cypress-io/github-action
dependabot[bot] Aug 21, 2026
c145635
Merge pull request #349 from palcarazm/dependabot/npm_and_yarn/docs/v…
palcarazm Aug 22, 2026
74ae59b
Merge pull request #350 from palcarazm/dependabot/github_actions/mino…
palcarazm Aug 22, 2026
3e26d3c
ci(deps): bump cypress-io/github-action
dependabot[bot] Aug 28, 2026
2a3a585
Merge pull request #351 from palcarazm/dependabot/github_actions/mino…
palcarazm Aug 28, 2026
fd01929
chore(deps-dev): bump postcss-cli from 11.0.1 to 12.0.0
dependabot[bot] Sep 11, 2026
ed76254
chore(docs): bump the version-updates group across 1 directory with 2…
dependabot[bot] Sep 11, 2026
f33a2c4
chore(deps-dev): bump cypress from 15.21.1 to 16.0.0
dependabot[bot] Sep 11, 2026
266a214
Merge pull request #357 from palcarazm/dependabot/npm_and_yarn/cypres…
palcarazm Sep 11, 2026
5ee9afd
Merge pull request #355 from palcarazm/dependabot/npm_and_yarn/docs/v…
palcarazm Sep 11, 2026
07670ce
chore(deps-dev): bump cssnano from 8.0.10 to 9.0.4
dependabot[bot] Sep 11, 2026
e23576c
Merge pull request #356 from palcarazm/dependabot/npm_and_yarn/cssnan…
palcarazm Sep 11, 2026
f6bb93c
Merge pull request #354 from palcarazm/dependabot/npm_and_yarn/postcs…
palcarazm Sep 11, 2026
af7c850
feat: integrate component-lifecycle library into Toggle component (#371)
palcarazm Oct 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 78 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
node-version: [22.x, 24.x]
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v7
with:
node-version: ${{ matrix.node-version }}
- name: Install dependencies
Expand All @@ -43,10 +43,11 @@ jobs:
path: coverage
- name: Upload coverage report to Coveralls
#v2.3.7
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329
with:
flag-name: coverage-report-${{ matrix.node-version }}
parallel: true
continue-on-error: true

coverage-finished:
name: Publish coverage report to Coveralls
Expand All @@ -55,11 +56,51 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
id: coveralls
#v2.3.7
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329
with:
parallel-finished: true
carryforward: "coverage-report-22.x,coverage-report-24.x"
continue-on-error: true

- name: Check Coveralls status
id: check-status
if: always()
run: |
if [ "${{ steps.coveralls.outcome }}" == "success" ]; then
echo "✅ Coveralls report submitted successfully"
echo "status=success" >> $GITHUB_OUTPUT
elif [ "${{ steps.coveralls.outcome }}" == "failure" ]; then
echo "⚠️ Coveralls service is temporarily unavailable"
echo "status=neutral" >> $GITHUB_OUTPUT
else
echo "❓ Coveralls status unknown: ${{ steps.coveralls.outcome }}"
echo "status=neutral" >> $GITHUB_OUTPUT
fi

- name: Set neutral status (if needed)
if: steps.check-status.outputs.status == 'neutral'
uses: actions/github-script@v9
with:
script: |
const { context } = require('@actions/github');
const owner = context.repo.owner;
const repo = context.repo.repo;
const sha = context.sha;

await github.rest.checks.create({
owner,
repo,
name: 'Coveralls / Coverage Report',
head_sha: sha,
status: 'completed',
conclusion: 'neutral',
output: {
title: 'Coveralls service temporarily unavailable',
summary: '⚠️ Coveralls is currently experiencing issues. The coverage report will be submitted when the service is available again.\n\nThis check is marked as neutral and does not block the PR.'
}
});

cypress:
name: Run e2e tests with Cypress
Expand All @@ -70,14 +111,14 @@ jobs:
options: --user 1001
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Install dependencies
run: npm install
- name: Build project
run: npm run build
- name: Cypress run
#v6.10.8
uses: cypress-io/github-action@948d67d3074f1bbb6379c8bdbb04e95d2f8e593f
uses: cypress-io/github-action@09090944bd8aaa2a517cefb6e38bf1aae336b42b
with:
browser: chrome

Expand All @@ -91,7 +132,7 @@ jobs:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Initialize CodeQL
uses: github/codeql-action/init@v4
with:
Expand All @@ -107,18 +148,46 @@ jobs:
needs: build-and-test
steps:
- name: Checkout repository
uses: actions/checkout@v6
uses: actions/checkout@v7
with:
fetch-depth: 0

- name: Get changed files
id: changed-files
#47.0.6
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96
with:
files: |
**
files_ignore: |
package.json
.npmrc
**/*.md
.github/**
.gitignore

- name: Check if code changes exist
id: check-changes
run: |
if [ "${{ steps.changed-files.outputs.any_changed }}" == "true" ]; then
echo "has_code_changes=true" >> $GITHUB_OUTPUT
echo "📝 Code changes detected in:"
echo "${{ steps.changed-files.outputs.all_changed_files }}"
else
echo "has_code_changes=false" >> $GITHUB_OUTPUT
echo "📦 Only dependency, documentation or CI/CD files changed"
fi

- name: Download coverage artifact
if: steps.check-changes.outputs.has_code_changes == 'true'
uses: actions/download-artifact@v8
with:
name: coverage-report-22.x
path: coverage

- name: SonarQube Scan
if: steps.check-changes.outputs.has_code_changes == 'true'
# v7.0.0
uses: SonarSource/sonarqube-scan-action@59db25f34e16620e48ab4bb9e4a5dce155cb5432
uses: SonarSource/sonarqube-scan-action@22918119ff8e1ca75a623e15c8296b6ea4fbe28f
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
10 changes: 4 additions & 6 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: Deploy documentation

on:
push:
branches: [ "v5" ]
pull_request:
branches: [ "v5" ]
release:
types: [published]
workflow_dispatch:

permissions:
Expand All @@ -24,9 +22,9 @@ jobs:
working-directory: docs
steps:
- name: Checkout
uses: actions/checkout@v6
uses: actions/checkout@v7
- name: Use Node.js
uses: actions/setup-node@v6
uses: actions/setup-node@v7
with:
node-version: 24.x
- name: Install dependencies
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Publish Package to npmJS

on:
release:
types: [published]

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: '24.x'

- name: Install dependencies
run: npm install

Check warning on line 21 in .github/workflows/publish.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Using dependencies without locking resolved versions is security-sensitive.

See more on https://sonarcloud.io/project/issues?id=palcarazm_bootstrap5-toggle&issues=AaFP5uXqzI2nLJqFVT0i&open=AaFP5uXqzI2nLJqFVT0i&pullRequest=337

Check warning on line 21 in .github/workflows/publish.yml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Omitting "--ignore-scripts" allows lifecycle scripts to run during package installation.

See more on https://sonarcloud.io/project/issues?id=palcarazm_bootstrap5-toggle&issues=AaFP5uXqzI2nLJqFVT0h&open=AaFP5uXqzI2nLJqFVT0h&pullRequest=337
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment thread
palcarazm marked this conversation as resolved.
Dismissed
Comment thread
palcarazm marked this conversation as resolved.
Dismissed

- name: Determine npm tag
id: npm-tag
run: |
RELEASE_NAME="${{ github.event.release.name }}"
RELEASE_TAG="${{ github.event.release.tag_name }}"

echo "📦 Release name: $RELEASE_NAME"
echo "🏷️ Release tag: $RELEASE_TAG"

if [ "${{ github.event.release.prerelease }}" == "true" ]; then
echo "🔬 Prerelease detected - using 'next' tag"
echo "tag=next" >> $GITHUB_OUTPUT
else
echo "🚀 Full release detected - using 'latest' tag"
echo "tag=latest" >> $GITHUB_OUTPUT
fi

- name: Publish to npm
run: |
npm publish --provenance --access public --tag ${{ steps.npm-tag.outputs.tag }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10 changes: 5 additions & 5 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,24 +29,24 @@
}
},
"dependencies": {
"@fortawesome/fontawesome-free": "7.2.0",
"@highlightjs/cdn-assets": "11.11.1",
"@fortawesome/fontawesome-free": "7.3.1",
"@highlightjs/cdn-assets": "11.12.0",
"bootstrap": "5.3.8",
"bootstrap5-toggle": "5.4.1",
"bs-darkmode-toggle": "1.0.0",
"bs-darkmode-toggle": "1.1.0",
"highlightjs-badge": "0.1.9",
"jquery": "4.0.0"
},
"devDependencies": {
"@rollup/plugin-terser": "^1.0.0",
"cssnano": "^8.0.2",
"cssnano": "^9.0.3",
"grunt": "^1.6.1",
"grunt-contrib-clean": "^2.0.1",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-watch": "^1.1.0",
"grunt-exec": "^3.0.0",
"postcss": "^8.5.6",
"postcss-cli": "^11.0.1",
"postcss-cli": "^12.0.0",
"rollup": "^4.59.0"
}
}
15 changes: 12 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
"devDependencies": {
"@commitlint/cli": "^21.0.2",
"@commitlint/config-conventional": "^21.0.2",
"@rollup/plugin-commonjs": "^29.0.3",
"@rollup/plugin-node-resolve": "^16.0.3",
"@rollup/plugin-terser": "^1.0.0",
"@types/bootstrap": "^5.2.10",
"@types/jest": "^30.0.0",
Expand All @@ -93,8 +95,8 @@
"@typescript-eslint/parser": "^8.58.0",
"commitlint": "^21.0.2",
"concurrently": "^10.0.3",
"cssnano": "^8.0.2",
"cypress": "^15.8.1",
"cssnano": "^9.0.4",
"cypress": "^16.0.0",
"cypress-plugin-tab": "^2.0.0",
"doctoc": "^2.2.0",
"dompurify": "^3.0.0",
Expand All @@ -105,7 +107,7 @@
"jest-environment-jsdom": "^30.2.0",
"postcss": "^8.5.6",
"postcss-banner": "^4.0.1",
"postcss-cli": "^11.0.1",
"postcss-cli": "^12.0.0",
"rimraf": "^6.1.3",
"rollup": "^4.54.0",
"rollup-plugin-dts": "^6.4.1",
Expand All @@ -122,5 +124,12 @@
},
"optionalDependencies": {
"jquery": "^4.0.0"
},
"dependencies": {
"component-lifecycle": "^2.0.0"
},
"allowScripts": {
"cypress@16.2.0": true,
"unrs-resolver@1.11.1": true
}
}
5 changes: 5 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import terser from "@rollup/plugin-terser";
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "@rollup/plugin-commonjs";
import dts from "rollup-plugin-dts";
import { bannerContent } from "./scripts/package-banner.js";

Expand All @@ -23,6 +25,7 @@ const umdECMAS = {
banner,
},
],
plugins: [nodeResolve(), commonjs()],
};

const umdJquery = {
Expand All @@ -49,10 +52,12 @@ const umdJquery = {
banner,
},
],
plugins: [nodeResolve(), commonjs()],
};

const mainConfig = {
input: "src/main/js/index.js",
external: ["component-lifecycle"],
output: [
{
file: "dist/bootstrap5-toggle.cjs",
Expand Down
13 changes: 9 additions & 4 deletions src/main/js/index.jquery.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,24 @@ import { ToggleMethods as Methods } from "./types/ToggleMethods";
const optArg = Array.prototype.slice.call(arguments, 1)[0];

return ( this ).each(function () {
const $this = $(this);
let _bsToggle = this.bsToggle || new Toggle(this, (options && typeof options !== "string") ? options : {});
let _bsToggle = this.bsToggle;

if (!_bsToggle) {
_bsToggle = new Toggle(this, (options && typeof options !== "string") ? options : {});
void _bsToggle.init().then(() => _bsToggle.attach());
return;
}

if (options && typeof options === "string") {
switch (options.toLowerCase()) {
case Methods.TOGGLE:
_bsToggle.toggle(silent);
break;
case Methods.ON:
_bsToggle.on(silent);
_bsToggle.toggleOn(silent);
break;
case Methods.OFF:
_bsToggle.off(silent);
_bsToggle.toggleOff(silent);
break;
case Methods.INDETERMINATE:
_bsToggle.indeterminate(silent);
Expand Down
Loading
Loading