Skip to content

Commit

Permalink
Merge pull request #1 from ISLEcode/bootstrap-v5
Browse files Browse the repository at this point in the history
Bootstrap v5
  • Loading branch information
marcastel authored Aug 20, 2020
2 parents 76093ab + 86e93c5 commit 933370d
Show file tree
Hide file tree
Showing 2 changed files with 329 additions and 147 deletions.
245 changes: 98 additions & 147 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#! @revision 2020-08-17 (Mon) 09:46:58
#! @brief Makefile port of Bootstrap 4's _npm_ build
#! @revision Thu Aug 20 03:09:04 CEST 2020
#! @brief Makefile port of Bootstrap 5.0's npm(1) build

SHELL = /bin/ksh

NAME = bootstrap
DESCRIPTION = The most popular front-end framework for developing responsive, mobile first projects on the web.
VERSION = 4.5.2
VERSION_SHORT = 4.5
TARBALL = v$(VERSION).tar.gz
SOURCEURL = https://github.com/twbs/bootstrap/archive/$(TARBALL)
VERSION = 5.0.0-alpha1
VERSION_SHORT = 5.0
LICENSE = MIT

TARBALL = v\$(VERSION).tar.gz
SOURCEURL = https://github.com/twbs/bootstrap/archive/\$(TARBALL)
SOURCEDIR = $(NAME)-$(VERSION)
HOMEPAGE = https://getbootstrap.com/
AUTHOR = The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
Expand All @@ -17,265 +19,214 @@ SASS = scss/bootstrap.scss
MAIN = dist/js/bootstrap.js
GITURL = git+https://github.com/twbs/bootstrap.git
ISSUESURL = https://github.com/twbs/bootstrap/issues
LICENSE = MIT

DISTFILES = dist/{css,js}/*.{css,js,map}
JSFILES = js/{src,dist}/**/*.{js,map}
SCSSFILES = scss/**/*.scss

DOCS_PREFIX = site/docs/$(VERSION_SHORT)
DOCS_DISTDIR = $(DOCS_PREFIX)/dist
DOCS_ASSETSDIR = $(DOCS_PREFIX)/assets

NODEBIN = node_modules/.bin
BUNDLEWATCH = $(NODEBIN)/bundlewatch
CLEANCSS = $(NODEBIN)/cleancss
CLEANCSS_OPTS = --level 1 --format breakWith=lf --source-map --source-map-inline-sources
ESLINT = $(NODEBIN)/eslint
ESLINT_OPTS = eslint --report-unused-disable-directives --cache --cache-location .cache/.eslintcache
ESLINT_OPTS = --report-unused-disable-directives --cache --cache-location .cache/.eslintcache
FUSV = $(NODEBIN)/fusv
FUSV_OPTS =
HUGO = $(NODEBIN)/hugo
KARMA = $(NODEBIN)/karma
KARMA_OPTS =
LINKINATOR = $(NODEBIN)/linkinator
LOCKLINT = $(NODEBIN)/lockfile-lint
LOCKLINT_OPTS = --allowed-hosts npm --allowed-schemes https: --empty-hostname false --type npm
NODE = /usr/local/bin/node
NODEMON = $(NODEBIN)/ṅodemon
NODEMON_OPTS =
NPM = /usr/local/bin/npm
POSTCSS = $(NODEBIN)/postcss
POSTCSS_OPTS = --config build/postcss.config.js
ROLLUP = $(NODEBIN)/rollup
ROLLUP_OPTS =
SASSC = $(NODEBIN)/node-sass
SASSC_OPTS = --output-style expanded --source-map true --source-map-contents true --precision 6
SIRV = $(NODEBIN)/sirv
STYLELINT = $(NODEBIN)/stylelint
STYLELINT_OPTS = --cache --cache-location .cache/.stylelintcache
TERSER = $(NODEBIN)/terser
TERSER_OPTS = --compress typeofs=false --mangle --comments "/^!/"

TERSER_OPTS = --compress typeofs=false --mangle --comments /^!/

all: dist

bundlewatch:
$(BUNDLEWATCH) --config .bundlewatch.config.json
remake:
@source ./Makefuncs; jsontomakefile package.json > Makefile.new

clean:
@[[ -d dist ]] && rm -rf dist; true
package.json:
@[[ -f $(TARBALL) ]] || curl -SsLO $(SOURCEURL)
@[[ -d $(SOURCEDIR) ]] || tar xf $(TARBALL)
@[[ -d $(SOURCEDIR)/.git ]] && rm -rf $(SOURCEDIR)/.git; true
@[[ -f package.json ]] || mv -n $(SOURCEDIR)/* $(SOURCEDIR)/.* .
@[[ -d $(SOURCEDIR) ]] && rm -rf $(SOURCEDIR); true
@[[ -f $(TARBALL) ]] && rm $(TARBALL); true

css: css-compile css-prefix css-minify css-copy
init: package.json
@npm install

css-compile: css-compile-main css-compile-docs
clean:
@[[ -d dist ]] && rm -rf dist; true

css-compile-main:
@$(SASSC) $(SASSC_OPTS) scss/ -o dist/css/ && make css-copy
realclean: clean
@rm -rf node_modules

css-compile-docs: $(DOCS_ASSETSDIR)/scss/docs.scss $(DOCS_ASSETSDIR)/css/docs.min.css
@$(SASSC) $(SASSC_OPTS) $^
distclean: realclean
@rm -rf $$(ls -1a | egrep -v '^(\.|\.\.|\.git|Make.*|README.md)$$'); true

css-copy:
@[[ -d $(DOCS_DISTDIR) ]] || mkdir -p $(DOCS_DISTDIR)
@cp -r dist/css/ $(DOCS_DISTDIR)
bundlewatch:
@$(BUNDLEWATCH) $(BUNDLEWATCH_OPTS) --config .bundlewatch.config.json

css-docs: css-compile-docs css-prefix-docs css-minify-docs
css: css-compile css-prefix css-minify

css-lint: css-lint-main css-lint-docs
css-compile:
@$(SASSC) $(SASSC_OPTS) scss/ -o dist/css/

css-lint-main:
@$(STYLELINT) $(STYLELINT_OPTS) "scss/**/*.scss"
css-lint: css-lint-$(STYLELINT) $(STYLELINT_OPTS) css-lint-vars

css-lint-docs:
@$(STYLELINT) $(STYLELINT_OPTS) "site/docs/**/assets/scss/*.scss" "site/docs/**/*.css"
css-lint-stylelint:
@$(STYLELINT) $(STYLELINT_OPTS) "**/*.{css,scss}"-location .cache/.stylelintcache

css-lint-vars:
@$(FUSV) $(FUSV_OPTS) scss/ site/docs/

css-main:
@npm-run-all css-lint css-compile-main css-prefix-main css-minify-main css-copy

css-minify: css-minify-main css-minify-docs
@$(FUSV) $(FUSV_OPTS) scss/ site/assets/scss/

css-minify-main:
@$(CLEANCSS) $(CLEANCSS_OPTS) --output dist/css/bootstrap.min.css dist/css/bootstrap.css
css-minify:
@$(CLEANCSS) $(CLEANCSS_OPTS) --output dist/css/bootstrap.min.css dist/css/bootstrap.css
@$(CLEANCSS) $(CLEANCSS_OPTS) --output dist/css/bootstrap-grid.min.css dist/css/bootstrap-grid.css
@$(CLEANCSS) $(CLEANCSS_OPTS) --output dist/css/bootstrap-utilities.min.css dist/css/bootstrap-utilities.css
@$(CLEANCSS) $(CLEANCSS_OPTS) --output dist/css/bootstrap-reboot.min.css dist/css/bootstrap-reboot.css

css-minify-docs:
@$(CLEANCSS) $(CLEANCSS_OPTS) --output $^ $^ $(DOCS_ASSETSDIR)/css/docs.min.css $(DOCS_ASSETSDIR)/css/docs.min.css
css-prefix: css-prefix-examples css-prefix-main

css-prefix: css-prefix-main css-prefix-docs
css-prefix-examples:
@$(POSTCSS) $(POSTCSS_OPTS) postcss.config.js//postcss.config.js --replace "site/content/**/*.css"

css-prefix-main:
@$(POSTCSS) $(POSTCSS_OPTS) --replace "dist/css/*.css" "!dist/css/*.min.css"

css-prefix-docs:
@$(POSTCSS) $(POSTCSS_OPTS) --replace "site/docs/**/*.css"
@$(POSTCSS) $(POSTCSS_OPTS) postcss.config.js//postcss.config.js --replace "dist/css/*.css" "!dist/css/*.min.css"

dist: css js

docs: css-docs js-docs docs-build docs-lint
docs: docs-build docs-lint

docs-build:
@bundle exec jekyll build

docs-compile: docs-build
@npm run docs-build

docs-production:
@JEKYLL_ENV=production $(MAKE) docs-build
@$(HUGO) $(HUGO_OPTS) --cleanDestinationDir

docs-netlify:
@JEKYLL_ENV=netlify $(MAKE) docs-build
docs-compile:
@$(NPM) $(NPM_OPTS) run docs-build

docs-linkinator:
@$(LINKINATOR) _gh_pages --recurse --silent --skip \"^(?!http://localhost)\"

docs-vnu:
@node build/vnu-jar.js
@$(LINKINATOR) $(LINKINATOR_OPTS) _gh_pages --recurse --silent --skip "^(?!http://localhost)"

docs-lint: docs-vnu docs-linkinator

docs-serve:
@bundle exec jekyll serve
@$(HUGO) $(HUGO_OPTS) server --port 9001 --disableFastRender

docs-serve-only:
@bundle exec jekyll serv --skip-initial-build --no-watche

distclean: realclean
@rm -rf $$(ls -1a | egrep -v '^(\.|\.\.|\.git|Makefile|README.md)$$'); true

init: package.json
@npm install
@$(SIRV) $(SIRV_OPTS) _gh_pages --port 9001

js: js-compile js-minify js-copy

js-copy:
@mkdir -p site/docs/$(VERSION_SHORT)/dist/
@cp -r dist/js/ site/docs/$(VERSION_SHORT)/dist/

js-main: js-lint js-compile js-minify-main
docs-vnu:
@$(NODE) $(NODE_OPTS) build/vnu-jar.js

js-docs: js-lint-docs js-minify-docs
js: js-compile js-minify

js-compile: js-compile-bundle js-compile-plugins js-compile-plugins-coverage js-compile-standalone js-copy
js-compile: js-compile-bundle js-compile-plugins js-compile-standalone js-compile-standalone-esm

js-compile-bundle:
@$(ROLLUP) $(ROLLUP_OPTS) --environment BUNDLE:true --config build/rollup.config.js --sourcemap

js-compile-plugins:
@node build/build-plugins.js

js-compile-plugins-coverage:
@NODE_ENV=test node build/build-plugins.js
@$(NODE) $(NODE_OPTS) build/build-plugins.js

js-compile-standalone:
@$(ROLLUP) $(ROLLUP_OPTS) --environment BUNDLE:false --config build/rollup.config.js --sourcemap

js-lint: js-lint-main js-lint-docs

js-lint-main:
@$(ESLINT) $(ESLINT_OPTS) js/src js/tests build/

js-lint-docs:
@$(ESLINT) $(ESLINT_OPTS) site/
js-compile-standalone-esm:
@$(ROLLUP) $(ROLLUP_OPTS) --environment ESM:true,BUNDLE:false --config build/rollup.config.js --sourcemap

js-minify: js-minify-main js-minify-docs
js-debug:
@DEBUG=true $(NPM) $(NPM_OPTS) run js-test-karma

js-minify-main: js-minify-standalone js-minify-bundle
js-lint:
@$(ESLINT) $(ESLINT_OPTS) .

js-minify-standalone:
@$(TERSER) $(TERSER_OPTS) \
--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: js-minify-bundle js-minify-standalone js-minify-standalone-esm

js-minify-bundle:
@$(TERSER) $(TERSER_OPTS) \
--source-map "content=dist/js/bootstrap.bundle.js.map,includeSources,url=bootstrap.bundle.min.js.map" \
--output dist/js/bootstrap.bundle.min.js dist/js/bootstrap.bundle.js

js-minify-docs:
@$(TERSER) $(TERSER_OPTS) --output $(DOCS_ASSETSDIR)/js/docs.min.js \
$(DOCS_ASSETSDIR)/js/vendor/anchor.min.js \
$(DOCS_ASSETSDIR)/js/vendor/clipboard.min.js \
$(DOCS_ASSETSDIR)/js/vendor/bs-custom-file-input.min.js \
"$(DOCS_ASSETSDIR)/js/src/*.js"

js-test: js-test-karma js-test-karma-bundle js-test-karma-bundle-old js-test-integration js-test-cloud
$(TERSER) $(TERSER_OPTS) --source-map "content=dist/js/bootstrap.bundle.js.map,includeSources,url=bootstrap.bundle.min.js.map" --output dist/js/bootstrap.bundle.min.js dist/js/bootstrap.bundle.js

js-test-karma:
@$(KARMA) $(KARMA_OPTS) start js/tests/karma.conf.js
js-minify-standalone:
$(TERSER) $(TERSER_OPTS) --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-test-karma-old:
@USE_OLD_JQUERY=true $(MAKE) js-test-karma
js-minify-standalone-esm:
$(TERSER) $(TERSER_OPTS) --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

js-test-karma-bundle:
@BUNDLE=true npm run js-test-karma
js-test: js-test-$(KARMA) $(KARMA_OPTS) js-test-jquery js-test-integration

js-test-karma-bundle-old:
@BUNDLE=true USE_OLD_JQUERY=true $(MAKE) js-test-karma
js-test-cloud:
@BROWSER=true $(NPM) $(NPM_OPTS) run js-test-karma

js-test-integration:
@$(ROLLUP) $(ROLLUP_OPTS) --config js/tests/integration/rollup.bundle.js
@$(ROLLUP) $(ROLLUP_OPTS) --config js/tests/integration/rollup.bundle-modularity.js

js-test-cloud:
@BROWSER=true $(MAKE) js-test-karma
js-test-jquery:
@JQUERY=true $(NPM) $(NPM_OPTS) run js-test-karma

js-test-karma:
@$(KARMA) $(KARMA_OPTS) start js/tests/karma.conf.js

lint: js-lint css-lint lockfile-lint

lockfile-lint:
@$(LOCKLINT) $(LOCKLINT_OPTS) --path package-lock.json

netlify: dist release-sri docs-netlify

package.json:
[[ -f $(TARBALL) ]] || curl -SsLO $(SOURCEURL)
[[ -d $(SOURCEDIR) ]] || tar xf $(TARBALL)
[[ -d $(SOURCEDIR)/.git ]] && rm -rf $(SOURCEDIR)/.git; true
[[ -f package.json ]] || mv -n $(SOURCEDIR)/* $(SOURCEDIR)/.* .
[[ -d $(SOURCEDIR) ]] && rm -rf $(SOURCEDIR); true
[[ -f $(TARBALL) ]] && rm $(TARBALL); true
@$(LOCKLINT) $(LOCKLINT_OPTS) --path package-lock.json

realclean: clean
rm -rf node_modules
netlify:
@HUGO_BASEURL=$DEPLOY_PRIME_URL $(MAKE) dist release-sri docs-build

release: dist release-sri docs-production release-zip release-zip-examples
release: dist release-sri docs-build release-zip release-zip-examples

release-sri:
@node build/generate-sri.js
@$(NODE) $(NODE_OPTS) build/generate-sri.js

release-version:
@node build/change-version.js
@$(NODE) $(NODE_OPTS) build/change-version.js

release-zip:
@rm -rf bootstrap-$npm_package_version-dist
@cp -r dist/ bootstrap-$npm_package_version-dist
@zip -r9 bootstrap-$npm_package_version-dist.zip bootstrap-$npm_package_version-dist
@rm -rf bootstrap-$npm_package_version-dist\"
@rm -rf bootstrap-$(VERSION)-dist
@cp -r dist/ bootstrap-$(VERSION)-dist
@zip -r9 bootstrap-$(VERSION)-dist.zip bootstrap-$(VERSION)-dist
@rm -rf bootstrap-$(VERSION)-dist

release-zip-examples:
@node build/zip-examples.js
@$(NODE) $(NODE_OPTS) build/zip-examples.js

start: watch docs-serve

test: lint dist js-test docs-build docs-lint

update-deps:
@ncu -u -x "jquery,karma-browserstack-launcher,sinon"
@npm update && bundle update
@echo Manually update "site/docs/$(VERSION_SHORT)/assets/js/vendor/"
@$(NCU) $(NCU_OPTS) -u -x karma-browserstack-launcher,popper.js
@$(NPM) $(NPM_OPTS) update
@echo Manually update site/assets/js/vendor

watch: watch-css-docs watch-css-main watch-js-docs watch-js-main

watch-css-docs:
@$(NODEMON) --watch "site/docs/**/assets/scss/" --ext scss --exec "npm run css-docs"
@$(NODEMON) $(NODEMON_OPTS) --watch site/assets/scss/ --ext scss --exec "$(NPM) $(NPM_OPTS) run css-lint"

watch-css-main:
@$(NODEMON) --watch scss/ --ext scss --exec "npm run css-main"
@$(NODEMON) $(NODEMON_OPTS) --watch scss/ --ext scss --exec "$(MAKE) css-lint css-compile css-prefix"

watch-js-docs:
@$(NODEMON) --watch "site/docs/**/assets/js/src/" --ext js --exec "npm run js-docs"
@$(NODEMON) $(NODEMON_OPTS) --watch site/assets/js/ --ext js --exec "$(NPM) $(NPM_OPTS) run js-lint"

watch-js-main:
@$(NODEMON) --watch js/src/ --ext js --exec "npm run js-compile"

@$(NODEMON) $(NODEMON_OPTS) --watch js/src/ --ext js --exec "$(MAKE) js-lint js-compile"

# vim: nospell
Loading

0 comments on commit 933370d

Please sign in to comment.