Skip to content

Commit

Permalink
Merge branch 'main' into discord-reddit-bootstrap
Browse files Browse the repository at this point in the history
  • Loading branch information
julien-deramond authored Sep 13, 2023
2 parents 07b68a3 + fca9c82 commit ebd8d7d
Show file tree
Hide file tree
Showing 160 changed files with 2,961 additions and 1,986 deletions.
4 changes: 2 additions & 2 deletions .bundlewatch.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
},
{
"path": "./dist/js/bootstrap.bundle.min.js",
"maxSize": "23.15 kB"
"maxSize": "23.25 kB"
},
{
"path": "./dist/js/bootstrap.esm.js",
Expand All @@ -54,7 +54,7 @@
},
{
"path": "./dist/js/bootstrap.min.js",
"maxSize": "16.1 kB"
"maxSize": "16.25 kB"
}
],
"ci": {
Expand Down
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
"node": true
},
"parserOptions": {
"sourceType": "script"
"sourceType": "module"
},
"rules": {
"no-console": "off",
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/calibreapp-image-actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,18 @@ on:
- '**.png'
- '**.webp'

permissions:
contents: read

jobs:
build:
# Only run on Pull Requests within the same repository, and not from forks.
if: github.event.pull_request.head.repo.full_name == github.repository
name: calibreapp/image-actions
runs-on: ubuntu-latest
permissions:
# allow calibreapp/image-actions to update PRs
pull-requests: write
steps:
- name: Checkout Repo
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cspell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
persist-credentials: false

- name: Run cspell
uses: streetsidesoftware/cspell-action@v2
uses: streetsidesoftware/cspell-action@v3
with:
config: ".cspell.json"
files: "**/*.md"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ Our default branch is for development of our Bootstrap 5 release. Head to the [`

Several quick start options are available:

- [Download the latest release](https://github.com/twbs/bootstrap/archive/v5.3.0.zip)
- [Download the latest release](https://github.com/twbs/bootstrap/archive/v5.3.1.zip)
- Clone the repo: `git clone https://github.com/twbs/bootstrap.git`
- Install with [npm](https://www.npmjs.com/): `npm install [email protected].0`
- Install with [yarn](https://yarnpkg.com/): `yarn add [email protected].0`
- Install with [Composer](https://getcomposer.org/): `composer require twbs/bootstrap:5.3.0`
- Install with [npm](https://www.npmjs.com/): `npm install [email protected].1`
- Install with [yarn](https://yarnpkg.com/): `yarn add [email protected].1`
- Install with [Composer](https://getcomposer.org/): `composer require twbs/bootstrap:5.3.1`
- Install with [NuGet](https://www.nuget.org/): CSS: `Install-Package bootstrap` Sass: `Install-Package bootstrap.sass`

Read the [Getting started page](https://getbootstrap.com/docs/5.3/getting-started/introduction/) for information on the framework contents, templates, examples, and more.
Expand Down
11 changes: 8 additions & 3 deletions build/banner.js → build/banner.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
'use strict'
import fs from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const pkg = require('../package.json')
const __dirname = path.dirname(fileURLToPath(import.meta.url))

const pkgJson = path.join(__dirname, '../package.json')
const pkg = JSON.parse(await fs.readFile(pkgJson, 'utf8'))

const year = new Date().getFullYear()

Expand All @@ -12,4 +17,4 @@ function getBanner(pluginFilename) {
*/`
}

module.exports = getBanner
export default getBanner
16 changes: 9 additions & 7 deletions build/build-plugins.js → build/build-plugins.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

'use strict'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import { babel } from '@rollup/plugin-babel'
import globby from 'globby'
import { rollup } from 'rollup'
import banner from './banner.mjs'

const path = require('node:path')
const rollup = require('rollup')
const globby = require('globby')
const { babel } = require('@rollup/plugin-babel')
const banner = require('./banner.js')
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`)
Expand All @@ -37,7 +39,7 @@ for (const file of jsFiles) {
const build = async plugin => {
const globals = {}

const bundle = await rollup.rollup({
const bundle = await rollup({
input: plugin.src,
plugins: [
babel({
Expand Down
44 changes: 28 additions & 16 deletions build/change-version.js → build/change-version.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,22 @@
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

'use strict'

const fs = require('node:fs').promises
const path = require('node:path')
const globby = require('globby')
import { execFile } from 'node:child_process'
import fs from 'node:fs/promises'
import process from 'node:process'

const VERBOSE = process.argv.includes('--verbose')
const DRY_RUN = process.argv.includes('--dry') || process.argv.includes('--dry-run')

// These are the filetypes we only care about replacing the version
const GLOB = [
'**/*.{css,html,js,json,md,scss,txt,yml}'
// These are the files we only care about replacing the version
const FILES = [
'README.md',
'hugo.yml',
'js/src/base-component.js',
'package.js',
'scss/mixins/_banner.scss',
'site/data/docs-versions.yml'
]
const GLOBBY_OPTIONS = {
cwd: path.join(__dirname, '..'),
gitignore: true
}

// Blame TC39... https://github.com/benjamingr/RegExp.escape/issues/37
function regExpQuote(string) {
Expand Down Expand Up @@ -53,7 +52,7 @@ async function replaceRecursively(file, oldVersion, newVersion) {
}

if (VERBOSE) {
console.log(`FILE: ${file}`)
console.log(`Found ${oldVersion} in ${file}`)
}

if (DRY_RUN) {
Expand All @@ -63,6 +62,19 @@ async function replaceRecursively(file, oldVersion, newVersion) {
await fs.writeFile(file, newString, 'utf8')
}

function bumpNpmVersion(newVersion) {
if (DRY_RUN) {
return
}

execFile('npm', ['version', newVersion, '--no-git-tag'], { shell: true }, error => {
if (error) {
console.error(error)
process.exit(1)
}
})
}

function showUsage(args) {
console.error('USAGE: change-version old_version new_version [--verbose] [--dry[-run]]')
console.error('Got arguments:', args)
Expand All @@ -86,11 +98,11 @@ async function main(args) {
showUsage(args)
}

try {
const files = await globby(GLOB, GLOBBY_OPTIONS)
bumpNpmVersion(newVersion)

try {
await Promise.all(
files.map(file => replaceRecursively(file, oldVersion, newVersion))
FILES.map(file => replaceRecursively(file, oldVersion, newVersion))
)
} catch (error) {
console.error(error)
Expand Down
17 changes: 9 additions & 8 deletions build/generate-sri.js → build/generate-sri.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

'use strict'
import crypto from 'node:crypto'
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import sh from 'shelljs'

const crypto = require('node:crypto')
const fs = require('node:fs')
const path = require('node:path')
const sh = require('shelljs')
const __dirname = path.dirname(fileURLToPath(import.meta.url))

sh.config.fatal = true

Expand Down Expand Up @@ -52,9 +53,9 @@ for (const { file, configPropertyName } of files) {
throw error
}

const algo = 'sha384'
const hash = crypto.createHash(algo).update(data, 'utf8').digest('base64')
const integrity = `${algo}-${hash}`
const algorithm = 'sha384'
const hash = crypto.createHash(algorithm).update(data, 'utf8').digest('base64')
const integrity = `${algorithm}-${hash}`

console.log(`${configPropertyName}: ${integrity}`)

Expand Down
4 changes: 1 addition & 3 deletions build/postcss.config.js → build/postcss.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
'use strict'

const mapConfig = {
inline: false,
annotation: true,
sourcesContent: true
}

module.exports = context => {
export default context => {
return {
map: context.file.dirname.includes('examples') ? false : mapConfig,
plugins: {
Expand Down
22 changes: 12 additions & 10 deletions build/rollup.config.js → build/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
'use strict'
import path from 'node:path'
import process from 'node:process'
import { fileURLToPath } from 'node:url'
import { babel } from '@rollup/plugin-babel'
import { nodeResolve } from '@rollup/plugin-node-resolve'
import replace from '@rollup/plugin-replace'
import banner from './banner.mjs'

const path = require('node:path')
const { babel } = require('@rollup/plugin-babel')
const { nodeResolve } = require('@rollup/plugin-node-resolve')
const replace = require('@rollup/plugin-replace')
const banner = require('./banner.js')
const __dirname = path.dirname(fileURLToPath(import.meta.url))

const BUNDLE = process.env.BUNDLE === 'true'
const ESM = process.env.ESM === 'true'

let fileDestination = `bootstrap${ESM ? '.esm' : ''}`
let destinationFile = `bootstrap${ESM ? '.esm' : ''}`
const external = ['@popperjs/core']
const plugins = [
babel({
Expand All @@ -24,7 +26,7 @@ const globals = {
}

if (BUNDLE) {
fileDestination += '.bundle'
destinationFile += '.bundle'
// Remove last entry in external array to bundle Popper
external.pop()
delete globals['@popperjs/core']
Expand All @@ -41,7 +43,7 @@ const rollupConfig = {
input: path.resolve(__dirname, `../js/index.${ESM ? 'esm' : 'umd'}.js`),
output: {
banner: banner(),
file: path.resolve(__dirname, `../dist/js/${fileDestination}.js`),
file: path.resolve(__dirname, `../dist/js/${destinationFile}.js`),
format: ESM ? 'esm' : 'umd',
globals,
generatedCode: 'es2015'
Expand All @@ -54,4 +56,4 @@ if (!ESM) {
rollupConfig.output.name = 'bootstrap'
}

module.exports = rollupConfig
export default rollupConfig
6 changes: 2 additions & 4 deletions build/vnu-jar.js → build/vnu-jar.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

'use strict'

const { execFile, spawn } = require('node:child_process')
const vnu = require('vnu-jar')
import { execFile, spawn } from 'node:child_process'
import vnu from 'vnu-jar'

execFile('java', ['-version'], (error, stdout, stderr) => {
if (error) {
Expand Down
11 changes: 7 additions & 4 deletions build/zip-examples.js → build/zip-examples.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/

'use strict'
import fs from 'node:fs/promises'
import path from 'node:path'
import { fileURLToPath } from 'node:url'
import sh from 'shelljs'

const path = require('node:path')
const sh = require('shelljs')
const __dirname = path.dirname(fileURLToPath(import.meta.url))

const pkg = require('../package.json')
const pkgJson = path.join(__dirname, '../package.json')
const pkg = JSON.parse(await fs.readFile(pkgJson, 'utf8'))

const versionShort = pkg.config.version_short
const distFolder = `bootstrap-${pkg.version}-examples`
Expand Down
2 changes: 1 addition & 1 deletion dist/css/bootstrap-grid.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-grid.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-grid.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-grid.min.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-grid.rtl.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-grid.rtl.css.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-grid.rtl.min.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-grid.rtl.min.css.map

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions dist/css/bootstrap-reboot.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/bootstrap-reboot.css.map

Large diffs are not rendered by default.

Loading

0 comments on commit ebd8d7d

Please sign in to comment.