Compare commits

...

12 Commits

Author SHA1 Message Date
XhmikosR d0be5bf624 Move xo config to .xo-config.json 2024-03-13 22:11:06 +02:00
XhmikosR ada602d6ed Fix the new lint issues 2024-03-13 15:05:52 +02:00
XhmikosR e5fe48e3ff Switch to using xo directly 2024-03-13 15:05:52 +02:00
XhmikosR 545a650035 docs: move fathom site to hugo config (#39781) 2024-03-13 11:43:02 +02:00
Julien Déramond 3150c6985d Docs: fix Reddit URL to avoid redirection (#39777) 2024-03-12 16:10:02 +02:00
XhmikosR ab1a765f75 examples: assorted tweaks (#39772)
* remove trailing slash
* use urls.JoinPath
* reindent
* use `imageConfig` so that we add dimensions automatically
2024-03-12 11:42:03 +02:00
XhmikosR 13f40f1791 Switch to lockfile v3 2024-03-12 09:50:25 +02:00
XhmikosR 7b8211ce64 Update globby to v14
Also:

* fix globals type
* switch to async
2024-03-12 09:50:25 +02:00
XhmikosR 2bc395b563 Update devDependencies and regenerate package-lock.json
* eslint-plugin-markdown    ^3.0.1  →    ^4.0.1
* hugo-bin                ^0.120.7  →  ^0.120.8
* rollup                   ^4.12.0  →   ^4.13.0
* terser                   ^5.27.2  →   ^5.29.1
2024-03-12 09:50:25 +02:00
Julien Déramond 6ce0c62e21 Docs: drop data-bs-scroll="true" from navbar (#39766) 2024-03-11 09:26:03 +02:00
XhmikosR 930740afbc Switch to using hugo.IsProduction (#39763) 2024-03-08 12:41:17 +02:00
Louis-Maxime Piton f545964f8f Docs: fix position of search modal to avoid interface blocking at small breakpoints (#39739)
Co-authored-by: Julien Déramond <juderamond@gmail.com>
2024-03-08 09:04:12 +01:00
23 changed files with 3640 additions and 8974 deletions
-7
View File
@@ -1,7 +0,0 @@
**/*.min.js
**/dist/
**/vendor/
/_site/
/js/coverage/
/site/static/sw.js
/site/layouts/partials/
-1
View File
@@ -1 +0,0 @@
lockfile-version=2
+24 -66
View File
@@ -1,11 +1,15 @@
{
"root": true,
"extends": [
"plugin:import/errors",
"plugin:import/warnings",
"plugin:unicorn/recommended",
"xo",
"xo/browser"
"envs": [
"browser"
],
"semicolon": false,
"space": 2,
"ignores": [
"**/*.min.js",
"**/dist/**",
"**/vendor/**",
"site/layouts/partials/",
"site/static/sw.js"
],
"rules": {
"arrow-body-style": "off",
@@ -21,36 +25,6 @@
"js": "always"
}
],
"import/first": "error",
"import/newline-after-import": "error",
"import/no-absolute-path": "error",
"import/no-amd": "error",
"import/no-cycle": [
"error",
{
"ignoreExternal": true
}
],
"import/no-duplicates": "error",
"import/no-extraneous-dependencies": "error",
"import/no-mutable-exports": "error",
"import/no-named-as-default": "error",
"import/no-named-as-default-member": "error",
"import/no-named-default": "error",
"import/no-self-import": "error",
"import/no-unassigned-import": [
"error"
],
"import/no-useless-path-segments": "error",
"import/order": "error",
"indent": [
"error",
2,
{
"MemberExpression": "off",
"SwitchCase": 1
}
],
"logical-assignment-operators": "off",
"max-params": [
"warn",
@@ -67,7 +41,6 @@
}
],
"no-console": "error",
"no-negated-condition": "off",
"object-curly-spacing": [
"error",
"always"
@@ -78,26 +51,19 @@
],
"prefer-object-has-own": "off",
"prefer-template": "error",
"semi": [
"error",
"never"
],
"strict": "error",
"unicorn/explicit-length-check": "off",
"unicorn/filename-case": "off",
"unicorn/no-array-callback-reference": "off",
"unicorn/no-array-method-this-argument": "off",
"unicorn/no-null": "off",
"unicorn/no-negated-condition": "off",
"unicorn/no-typeof-undefined": "off",
"unicorn/no-unused-properties": "error",
"unicorn/numeric-separators-style": "off",
"unicorn/prefer-array-flat": "off",
"unicorn/prefer-at": "off",
"unicorn/prefer-dom-node-dataset": "off",
"unicorn/prefer-module": "off",
"unicorn/prefer-query-selector": "off",
"unicorn/prefer-spread": "off",
"unicorn/prefer-string-replace-all": "off",
"unicorn/prevent-abbreviations": "off"
},
"overrides": [
@@ -105,10 +71,6 @@
"files": [
"build/**"
],
"env": {
"browser": false,
"node": true
},
"parserOptions": {
"sourceType": "module"
},
@@ -130,9 +92,6 @@
"js/tests/*.js",
"js/tests/integration/rollup*.js"
],
"env": {
"node": true
},
"parserOptions": {
"sourceType": "script"
}
@@ -141,9 +100,9 @@
"files": [
"js/tests/unit/**"
],
"env": {
"jasmine": true
},
"envs": [
"jasmine"
],
"rules": {
"no-console": "off",
"unicorn/consistent-function-scoping": "off",
@@ -173,9 +132,6 @@
"files": [
"scss/tests/**"
],
"env": {
"node": true
},
"parserOptions": {
"sourceType": "script"
}
@@ -184,17 +140,18 @@
"files": [
"site/**"
],
"env": {
"browser": true,
"node": false
},
"parserOptions": {
"sourceType": "script",
"ecmaVersion": 2019
},
"rules": {
"no-new": "off",
"unicorn/no-array-for-each": "off"
"strict": [
"error",
"function"
],
"unicorn/no-array-for-each": "off",
"unicorn/numeric-separators-style": "off"
}
},
{
@@ -208,9 +165,10 @@
},
{
"files": [
"**/*.md/*.js"
"**/*.md/*.js",
"**/*.md/*.mjs"
],
"extends": "plugin:markdown/recommended",
"extends": "plugin:markdown/recommended-legacy",
"parserOptions": {
"sourceType": "module"
},
+1 -1
View File
@@ -177,7 +177,7 @@ Get updates on Bootstrap's development and chat with the project maintainers and
- Follow [@getbootstrap on Twitter](https://twitter.com/getbootstrap).
- Read and subscribe to [The Official Bootstrap Blog](https://blog.getbootstrap.com/).
- Ask questions and explore [our GitHub Discussions](https://github.com/twbs/bootstrap/discussions).
- Discuss, ask questions, and more on [the community Discord](https://discord.gg/bZUvakRU3M) or [Bootstrap subreddit](https://reddit.com/r/bootstrap).
- Discuss, ask questions, and more on [the community Discord](https://discord.gg/bZUvakRU3M) or [Bootstrap subreddit](https://www.reddit.com/r/bootstrap/).
- Chat with fellow Bootstrappers in IRC. On the `irc.libera.chat` server, in the `#bootstrap` channel.
- Implementation help may be found at Stack Overflow (tagged [`bootstrap-5`](https://stackoverflow.com/questions/tagged/bootstrap-5)).
- Developers should use the keyword `bootstrap` on packages which modify or add to the functionality of Bootstrap when distributing through [npm](https://www.npmjs.com/browse/keyword/bootstrap) or similar delivery mechanisms for maximum discoverability.
+6 -2
View File
@@ -7,9 +7,10 @@
*/
import path from 'node:path'
import process from 'node:process'
import { fileURLToPath } from 'node:url'
import { babel } from '@rollup/plugin-babel'
import globby from 'globby'
import { globby } from 'globby'
import { rollup } from 'rollup'
import banner from './banner.mjs'
@@ -17,7 +18,7 @@ const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(fileURLToPath(import.meta.url))
const sourcePath = path.resolve(__dirname, '../js/src/').replace(/\\/g, '/')
const jsFiles = globby.sync(`${sourcePath}/**/*.js`)
const jsFiles = await globby(`${sourcePath}/**/*.js`)
// Array which holds the resolved plugins
const resolvedPlugins = []
@@ -37,6 +38,9 @@ for (const file of jsFiles) {
}
const build = async plugin => {
/**
* @type {import('rollup').GlobalsOption}
*/
const globals = {}
const bundle = await rollup({
+1
View File
@@ -4,6 +4,7 @@ const mapConfig = {
sourcesContent: true
}
// eslint-disable-next-line import/no-anonymous-default-export
export default context => {
return {
map: context.file.dirname.includes('examples') ? false : mapConfig,
+1
View File
@@ -7,6 +7,7 @@
*/
import { execFile, spawn } from 'node:child_process'
import process from 'node:process'
import vnu from 'vnu-jar'
execFile('java', ['-version'], (error, stdout, stderr) => {
+3
View File
@@ -67,6 +67,9 @@ params:
icons: "https://icons.getbootstrap.com/"
swag: "https://cottonbureau.com/people/bootstrap"
analytics:
fathom_site: "ITUSEYJG"
download:
source: "https://github.com/twbs/bootstrap/archive/v5.3.3.zip"
dist: "https://github.com/twbs/bootstrap/releases/download/v5.3.3/bootstrap-5.3.3-dist.zip"
+1
View File
@@ -18,6 +18,7 @@ import Tab from './src/tab.js'
import Toast from './src/toast.js'
import Tooltip from './src/tooltip.js'
// eslint-disable-next-line import/no-anonymous-default-export
export default {
Alert,
Button,
+1
View File
@@ -11,6 +11,7 @@
const elementMap = new Map()
// eslint-disable-next-line import/no-anonymous-default-export
export default {
set(element, key, instance) {
if (!elementMap.has(element)) {
+1 -1
View File
@@ -1,4 +1,4 @@
/* eslint-disable import/extensions, import/no-unassigned-import */
/* eslint-disable import/extensions, n/file-extension-in-import, import/no-unassigned-import */
import Tooltip from '../../dist/tooltip'
import '../../dist/carousel'
+1
View File
@@ -1,6 +1,7 @@
'use strict'
const path = require('node:path')
const process = require('node:process')
const ip = require('ip')
const { babel } = require('@rollup/plugin-babel')
const istanbul = require('rollup-plugin-istanbul')
+3563 -8863
View File
File diff suppressed because it is too large Load Diff
+9 -12
View File
@@ -61,7 +61,7 @@
"js-compile-standalone-esm": "rollup --environment ESM:true,BUNDLE:false --config build/rollup.config.mjs --sourcemap",
"js-compile-bundle": "rollup --environment BUNDLE:true --config build/rollup.config.mjs --sourcemap",
"js-compile-plugins": "node build/build-plugins.mjs",
"js-lint": "eslint --cache --cache-location .cache/.eslintcache --report-unused-disable-directives --ext .html,.js,.mjs,.md .",
"js-lint": "xo --extension=html --extension=md",
"js-minify": "npm-run-all --aggregate-output --parallel js-minify-*",
"js-minify-standalone": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.js.map,includeSources,url=bootstrap.min.js.map\" --output dist/js/bootstrap.min.js dist/js/bootstrap.js",
"js-minify-standalone-esm": "terser --compress passes=2 --mangle --comments \"/^!/\" --source-map \"content=dist/js/bootstrap.esm.js.map,includeSources,url=bootstrap.esm.min.js.map\" --output dist/js/bootstrap.esm.min.js dist/js/bootstrap.esm.js",
@@ -82,7 +82,7 @@
"docs-serve": "hugo server --port 9001 --disableFastRender --noHTTPCache --renderToMemory --printPathWarnings --printUnusedTemplates",
"docs-serve-only": "npx sirv-cli _site --port 9001",
"lockfile-lint": "lockfile-lint --allowed-hosts npm --allowed-schemes https: --empty-hostname false --type npm --path package-lock.json",
"update-deps": "ncu -u -x globby,jasmine,karma-browserstack-launcher,karma-rollup-preprocessor && echo Manually update site/assets/js/vendor",
"update-deps": "ncu -u -x jasmine,karma-browserstack-launcher,karma-rollup-preprocessor && echo Manually update site/assets/js/vendor",
"release": "npm-run-all dist release-sri docs-build release-zip*",
"release-sri": "node build/generate-sri.mjs",
"release-version": "node build/change-version.mjs",
@@ -115,16 +115,12 @@
"bundlewatch": "^0.3.3",
"clean-css-cli": "^5.6.3",
"cross-env": "^7.0.3",
"eslint": "^8.57.0",
"eslint-config-xo": "^0.44.0",
"eslint-plugin-html": "^8.0.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-markdown": "^3.0.1",
"eslint-plugin-unicorn": "^51.0.1",
"eslint-plugin-markdown": "^4.0.1",
"find-unused-sass-variables": "^5.0.0",
"globby": "^11.1.0",
"globby": "^14.0.1",
"hammer-simulator": "0.0.1",
"hugo-bin": "^0.120.7",
"hugo-bin": "^0.120.8",
"ip": "^2.0.1",
"jasmine": "^5.1.0",
"jquery": "^3.7.1",
@@ -142,7 +138,7 @@
"npm-run-all2": "^6.1.2",
"postcss": "^8.4.35",
"postcss-cli": "^11.0.0",
"rollup": "^4.12.0",
"rollup": "^4.13.0",
"rollup-plugin-istanbul": "^5.0.0",
"rtlcss": "^4.1.1",
"sass": "^1.71.1",
@@ -150,8 +146,9 @@
"shelljs": "^0.8.5",
"stylelint": "^16.2.1",
"stylelint-config-twbs-bootstrap": "^14.0.0",
"terser": "^5.27.2",
"vnu-jar": "23.4.11"
"terser": "^5.29.1",
"vnu-jar": "23.4.11",
"xo": "^0.54.2"
},
"files": [
"dist/{css,js}/*.{css,js,map}",
+1
View File
@@ -4,6 +4,7 @@ const path = require('node:path')
const runnerPath = path.join(__dirname, 'runner').replace(/\\/g, '/')
// eslint-disable-next-line n/no-deprecated-api
require.extensions['.scss'] = (module, filename) => {
const normalizedFilename = filename.replace(/\\/g, '/')
+1
View File
@@ -47,6 +47,7 @@
--docsearch-muted-color: var(--bs-secondary-color);
--docsearch-hit-shadow: none;
position: fixed;
z-index: 2000; // Make sure to be over all components showcased in the documentation
cursor: auto; // Needed because of [role="button"] in Algolia search modal. Remove once https://github.com/algolia/docsearch/issues/1370 is tackled.
+18 -12
View File
@@ -21,12 +21,12 @@ aliases: "/examples/"
{{ range $i, $example := $entry.examples -}}
{{- $len := len $entry.examples -}}
{{ if (eq $i 0) }}<div class="row">{{ end }}
{{ if $entry.external }}
{{ if $entry.external -}}
<div class="col-md-6 col-lg-4 mb-3 d-flex gap-3">
<svg class="bi fs-5 flex-shrink-0 mt-1"><use xlink:href="#box-seam"></use></svg>
<div>
<h3 class="h5 mb-1">
<a class="d-block link-offset-1" href="{{ $.Site.Params.github_org }}{{ $example.url }}/" target="_blank" rel="noopener">
<a class="d-block link-offset-1" href="{{ urls.JoinPath $.Site.Params.github_org $example.url }}" target="_blank" rel="noopener">
{{ $example.name }}
</a>
</h3>
@@ -43,23 +43,29 @@ aliases: "/examples/"
</p>
</div>
</div>
{{ else }}
{{ else -}}
<div class="col-sm-6 col-md-3 mb-3">
<a class="d-block link-offset-1" href="/docs/{{ $.Site.Params.docs_version }}/examples/{{ $example.name | urlize }}/"{{ if in $example.name "RTL" }} hreflang="ar"{{ end }}>
<img class="img-thumbnail mb-3" srcset="/docs/{{ $.Site.Params.docs_version }}/assets/img/examples/{{ $example.name | urlize }}.png,
/docs/{{ $.Site.Params.docs_version }}/assets/img/examples/{{ $example.name | urlize }}@2x.png 2x"
src="/docs/{{ $.Site.Params.docs_version }}/assets/img/examples/{{ $example.name | urlize }}.png"
alt=""
width="480" height="300"
loading="lazy">
<a class="d-block link-offset-1" href="{{ urls.JoinPath "/docs" $.Site.Params.docs_version "/examples" ($example.name | urlize) "/"}}"{{ if in $example.name "RTL" }} hreflang="ar"{{ end }}>
{{ $imageBasePath := urls.JoinPath "/docs" $.Site.Params.docs_version "assets/img/examples" -}}
{{- $imgPath := urls.JoinPath $imageBasePath (printf "%s%s" ($example.name | urlize) ".png") -}}
{{- $imgPath2x := urls.JoinPath $imageBasePath (printf "%s%s" ($example.name | urlize) "@2x.png") -}}
{{- with (imageConfig (path.Join "/site/static" $imgPath)) -}}
<img class="img-thumbnail mb-3"
srcset="{{ $imgPath }}, {{ $imgPath2x }} 2x"
src="{{ $imgPath }}"
alt=""
width="{{ .Width }}"
height="{{ .Height }}"
loading="lazy">
{{- end }}
<h3 class="h5 mb-1">
{{ $example.name }}
</h3>
</a>
<p class="text-body-secondary">{{ $example.description }}</p>
</div>
{{ end }}
{{ if (eq (add $i 1) $len) }}</div>{{ end }}
{{- end }}
{{ if (eq (add $i 1) $len) }}</div>{{ end -}}
{{ end -}}
</div>
{{ end -}}
+1 -1
View File
@@ -158,7 +158,7 @@
{{ .Content }}
{{- if eq hugo.Environment "production" -}}
{{- if hugo.IsProduction -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.min.js" {{ printf "integrity=%q" .Site.Params.cdn.js_bundle_hash | safeHTMLAttr }}></script>
{{- else -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script>
+1 -1
View File
@@ -1 +1 @@
<script defer src="https://cdn.usefathom.com/script.js" data-site="ITUSEYJG"></script>
<script defer src="https://cdn.usefathom.com/script.js" data-site="{{ .Site.Params.analytics.fathom_site }}"></script>
+1 -1
View File
@@ -23,7 +23,7 @@
</button>
</div>
<div class="offcanvas-lg offcanvas-end flex-grow-1" tabindex="-1" id="bdNavbar" aria-labelledby="bdNavbarOffcanvasLabel" data-bs-scroll="true">
<div class="offcanvas-lg offcanvas-end flex-grow-1" tabindex="-1" id="bdNavbar" aria-labelledby="bdNavbarOffcanvasLabel">
<div class="offcanvas-header px-4 pb-0">
<h5 class="offcanvas-title text-white" id="bdNavbarOffcanvasLabel">Bootstrap</h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="offcanvas" aria-label="Close" data-bs-target="#bdNavbar"></button>
+2 -2
View File
@@ -1,4 +1,4 @@
{{ if eq hugo.Environment "production" -}}
{{ if hugo.IsProduction -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.min.js" {{ printf "integrity=%q" .Site.Params.cdn.js_bundle_hash | safeHTMLAttr }}></script>
{{ else -}}
<script src="/docs/{{ .Site.Params.docs_version }}/dist/js/bootstrap.bundle.js"></script>
@@ -15,7 +15,7 @@
{{- $targetDocsJSPath := path.Join "/docs" .Site.Params.docs_version "assets/js/docs.js" -}}
{{- $docsJs := append $js $vendor | resources.Concat $targetDocsJSPath -}}
{{- if eq hugo.Environment "production" -}}
{{- if hugo.IsProduction -}}
{{- $docsJs = $docsJs | resources.Minify -}}
{{- end }}
+2 -2
View File
@@ -1,6 +1,6 @@
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@docsearch/css@3">
{{ if eq hugo.Environment "production" -}}
{{ if hugo.IsProduction -}}
{{ if eq .Page.Params.direction "rtl" -}}
<link href="/docs/{{ .Site.Params.docs_version }}/dist/css/bootstrap.rtl.min.css" rel="stylesheet" {{ printf "integrity=%q" .Site.Params.cdn.css_rtl_hash | safeHTMLAttr }}>
{{- else -}}
@@ -15,7 +15,7 @@
{{- $sassOptions := dict "targetPath" $targetDocsCssPath "outputStyle" "expanded" "precision" 6 -}}
{{- $postcssOptions := dict "use" "autoprefixer" "noMap" true -}}
{{ if eq hugo.Environment "production" -}}
{{ if hugo.IsProduction -}}
{{- $sassOptions = merge $sassOptions (dict "outputStyle" "compressed") -}}
{{- end -}}
+1 -2
View File
@@ -1,8 +1,7 @@
# www.robotstxt.org
{{- $isProduction := eq hugo.Environment "production" -}}
{{- $isNetlify := eq (getenv "NETLIFY") "true" -}}
{{- $allowCrawling := and (not $isNetlify) $isProduction -}}
{{- $allowCrawling := and (not $isNetlify) hugo.IsProduction -}}
{{ if $allowCrawling }}
# Allow crawling of all content