Skip to content

Commit

Permalink
Merge branch 'master' into master-xmr-docs-hugo-safeHTMLAttr
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR committed May 5, 2020
2 parents c82a1e3 + a9fdecf commit 5db61e7
Show file tree
Hide file tree
Showing 29 changed files with 455 additions and 456 deletions.
43 changes: 12 additions & 31 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,25 @@ name: "Code Scanning - Action"
on:
push:
schedule:
- cron: '0 0 * * 0'
- cron: "0 0 * * 0"

jobs:
CodeQL-Build:

runs-on: ubuntu-latest
strategy:
fail-fast: false


# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below).
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
- name: Checkout repository
uses: actions/checkout@v2

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: javascript

#- run: |
# make bootstrap
# make release
- name: Autobuild
uses: github/codeql-action/autobuild@v1

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
3 changes: 2 additions & 1 deletion build/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
},
"extends": "../.eslintrc.json",
"rules": {
"no-console": "off"
"no-console": "off",
"strict": "error"
}
}
14 changes: 14 additions & 0 deletions build/babel-helpers.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
'use strict'

// These are the babel helpers we whitelist
const helpers = [
'createClass',
'createSuper',
'defineProperties',
'defineProperty',
'getPrototypeOf',
'inheritsLoose',
'objectSpread2'
]

module.exports = helpers
12 changes: 3 additions & 9 deletions build/build-plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,14 @@ const path = require('path')
const rollup = require('rollup')
const babel = require('rollup-plugin-babel')
const banner = require('./banner.js')
const babelHelpers = require('./babel-helpers.js')

const plugins = [
babel({
// Only transpile our source code
exclude: 'node_modules/**',
// Include only required helpers
externalHelpersWhitelist: [
'createClass',
'createSuper',
'defineProperties',
'defineProperty',
'getPrototypeOf',
'inheritsLoose',
'objectSpread2'
]
externalHelpersWhitelist: babelHelpers
})
]
const bsPlugins = {
Expand Down Expand Up @@ -179,6 +172,7 @@ function build(plugin) {
.then(() => console.log(`Building ${plugin} plugin... Done!`))
.catch(error => console.error(`${plugin}: ${error}`))
})
.catch(error => console.error(`${plugin}: ${error}`))
}

Object.keys(bsPlugins)
Expand Down
11 changes: 2 additions & 9 deletions build/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ const path = require('path')
const babel = require('rollup-plugin-babel')
const resolve = require('@rollup/plugin-node-resolve')
const banner = require('./banner.js')
const babelHelpers = require('./babel-helpers.js')

const BUNDLE = process.env.BUNDLE === 'true'
const ESM = process.env.ESM === 'true'
Expand All @@ -15,15 +16,7 @@ const plugins = [
// Only transpile our source code
exclude: 'node_modules/**',
// Include only required helpers
externalHelpersWhitelist: [
'createClass',
'createSuper',
'defineProperties',
'defineProperty',
'getPrototypeOf',
'inheritsLoose',
'objectSpread2'
]
externalHelpersWhitelist: babelHelpers
})
]
const globals = {
Expand Down
51 changes: 51 additions & 0 deletions build/zip-examples.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env node

/*!
* Script to create the built examples zip archive;
* requires the `zip` command to be present!
* Copyright 2020 The Bootstrap Authors
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
*/

'use strict'

const path = require('path')
const sh = require('shelljs')

const { version, version_short: versionShort } = require('../package.json')

const folderName = `bootstrap-${version}-examples`

sh.config.fatal = true

if (!sh.test('-d', '_gh_pages')) {
throw new Error('The _gh_pages folder does not exist, did you forget building the docs?')
}

// switch to the root dir
sh.cd(path.join(__dirname, '..'))

// remove any previously created folder with the same name
sh.rm('-rf', folderName)
sh.mkdir('-p', folderName)

// copy the examples and dist folders; for the examples we use `*`
// so that its content are copied to the root dist dir
sh.cp('-Rf', [
`_gh_pages/docs/${versionShort}/examples/*`,
`_gh_pages/docs/${versionShort}/dist/`
], folderName)
sh.rm(`${folderName}/index.html`)

// sed-fu
sh.find(`${folderName}/**/*.html`).forEach(file => {
sh.sed('-i', new RegExp(`"/docs/${versionShort}/`, 'g'), '"../', file)
sh.sed('-i', /(<link href="\.\.\/.*) integrity=".*>/g, '$1>', file)
sh.sed('-i', /(<script src="\.\.\/.*) integrity=".*>/g, '$1></script>', file)
})

// create the zip file
sh.exec(`zip -r9 "${folderName}.zip" "${folderName}"`, { fatal: true })

// remove the folder we created
sh.rm('-rf', folderName)
1 change: 1 addition & 0 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ params:
download:
source: "https://github.com/twbs/bootstrap/archive/v4.3.1.zip"
dist: "https://github.com/twbs/bootstrap/releases/download/v4.3.1/bootstrap-4.3.1-dist.zip"
dist_examples: "https://github.com/twbs/bootstrap/releases/download/v4.3.1/bootstrap-4.3.1-examples.zip"

cdn:
# See https://www.srihash.org for info on how to generate the hashes
Expand Down
5 changes: 3 additions & 2 deletions js/src/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -442,8 +442,9 @@ class Modal {
}

_checkScrollbar() {
const rect = document.body.getBoundingClientRect()
this._isBodyOverflowing = rect.left + rect.right < window.innerWidth
const { left, right } = document.body.getBoundingClientRect()

this._isBodyOverflowing = Math.floor(left + right) < window.innerWidth
this._scrollbarWidth = this._getScrollbarWidth()
}

Expand Down
3 changes: 1 addition & 2 deletions js/src/scrollspy.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,7 @@ class ScrollSpy {
return
}

const offsetLength = this._offsets.length
for (let i = offsetLength; i--;) {
for (let i = this._offsets.length; i--;) {
const isActiveTarget = this._activeTarget !== this._targets[i] &&
scrollTop >= this._offsets[i] &&
(typeof this._offsets[i + 1] === 'undefined' ||
Expand Down
15 changes: 7 additions & 8 deletions js/tests/karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
browsers,
browsersKeys
} = require('./browsers')
const babelHelpers = require('../../build/babel-helpers.js')

const { env } = process
const browserStack = env.BROWSER === 'true'
Expand Down Expand Up @@ -72,14 +73,7 @@ const conf = {
// Only transpile our source code
exclude: 'node_modules/**',
// Include only required helpers
externalHelpersWhitelist: [
'defineProperties',
'createClass',
'createSuper',
'inheritsLoose',
'defineProperty',
'objectSpread2'
],
externalHelpersWhitelist: babelHelpers,
plugins: [
'@babel/plugin-proposal-object-rest-spread'
]
Expand All @@ -106,6 +100,11 @@ if (browserStack) {
plugins.push('karma-browserstack-launcher', 'karma-jasmine-html-reporter')
conf.customLaunchers = browsers
conf.browsers = browsersKeys
conf.captureTimeout = 300000
conf.browserDisconnectTolerance = 0
conf.browserDisconnectTimeout = 300000
conf.browserSocketTimeout = 120000
conf.browserNoActivityTimeout = 300000
reporters.push('BrowserStack', 'kjhtml')
} else {
frameworks.push('detectBrowsers')
Expand Down
4 changes: 3 additions & 1 deletion js/tests/unit/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
],
"overrides": [
{
"files": ["**/*.spec.js"],
"files": [
"**/*.spec.js"
],
"env": {
"jasmine": true
}
Expand Down

0 comments on commit 5db61e7

Please sign in to comment.