1- # ! @revision 2020-08-19 (Wed) 21:26:44
2- # ! @brief Makefile port of Bootstrap 4 's _npm_ build
1+ # ! @revision Thu Aug 20 03:09:04 CEST 2020
2+ # ! @brief Makefile port of Bootstrap 5.0 's npm(1) build
33
44SHELL = /bin/ksh
55
66NAME = bootstrap
77DESCRIPTION = The most popular front-end framework for developing responsive, mobile first projects on the web.
88VERSION = 5.0.0-alpha1
99VERSION_SHORT = 5.0
10- TARBALL = v$(VERSION ) .tar.gz
11- SOURCEURL = https://github.com/twbs/bootstrap/archive/$(TARBALL )
10+ LICENSE = MIT
11+
12+ TARBALL = v\$(VERSION ) .tar.gz
13+ SOURCEURL = https://github.com/twbs/bootstrap/archive/\$(TARBALL )
1214SOURCEDIR = $(NAME ) -$(VERSION )
1315HOMEPAGE = https://getbootstrap.com/
1416AUTHOR = The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
@@ -17,265 +19,214 @@ SASS = scss/bootstrap.scss
1719MAIN = dist/js/bootstrap.js
1820GITURL = git+https://github.com/twbs/bootstrap.git
1921ISSUESURL = https://github.com/twbs/bootstrap/issues
20- LICENSE = MIT
21-
2222DISTFILES = dist/{css,js}/*.{css,js,map}
2323JSFILES = js/{src,dist}/**/*.{js,map}
2424SCSSFILES = scss/**/*.scss
25-
2625DOCS_PREFIX = site/docs/$(VERSION_SHORT )
2726DOCS_DISTDIR = $(DOCS_PREFIX ) /dist
2827DOCS_ASSETSDIR = $(DOCS_PREFIX ) /assets
29-
3028NODEBIN = node_modules/.bin
3129BUNDLEWATCH = $(NODEBIN ) /bundlewatch
3230CLEANCSS = $(NODEBIN ) /cleancss
3331CLEANCSS_OPTS = --level 1 --format breakWith=lf --source-map --source-map-inline-sources
3432ESLINT = $(NODEBIN ) /eslint
35- ESLINT_OPTS = eslint --report-unused-disable-directives --cache --cache-location .cache/.eslintcache
33+ ESLINT_OPTS = --report-unused-disable-directives --cache --cache-location .cache/.eslintcache
3634FUSV = $(NODEBIN ) /fusv
3735FUSV_OPTS =
36+ HUGO = $(NODEBIN ) /hugo
3837KARMA = $(NODEBIN ) /karma
3938KARMA_OPTS =
4039LINKINATOR = $(NODEBIN ) /linkinator
4140LOCKLINT = $(NODEBIN ) /lockfile-lint
4241LOCKLINT_OPTS = --allowed-hosts npm --allowed-schemes https: --empty-hostname false --type npm
42+ NODE = /usr/local/bin/node
4343NODEMON = $(NODEBIN ) /ṅodemon
4444NODEMON_OPTS =
45+ NPM = /usr/local/bin/npm
4546POSTCSS = $(NODEBIN ) /postcss
4647POSTCSS_OPTS = --config build/postcss.config.js
4748ROLLUP = $(NODEBIN ) /rollup
4849ROLLUP_OPTS =
4950SASSC = $(NODEBIN ) /node-sass
5051SASSC_OPTS = --output-style expanded --source-map true --source-map-contents true --precision 6
52+ SIRV = $(NODEBIN ) /sirv
5153STYLELINT = $(NODEBIN ) /stylelint
5254STYLELINT_OPTS = --cache --cache-location .cache/.stylelintcache
5355TERSER = $(NODEBIN ) /terser
54- TERSER_OPTS = --compress typeofs=false --mangle --comments "/^!/"
55-
56+ TERSER_OPTS = --compress typeofs=false --mangle --comments /^!/
5657
5758all : dist
5859
59- bundlewatch :
60- $( BUNDLEWATCH ) --config .bundlewatch.config. json
60+ remake :
61+ @source ./Makefuncs ; jsontomakefile package. json > Makefile.new
6162
62- clean :
63- @[[ -d dist ]] && rm -rf dist; true
63+ package.json :
64+ @[[ -f $( TARBALL) ]] || curl -SsLO $(SOURCEURL )
65+ @[[ -d $( SOURCEDIR) ]] || tar xf $(TARBALL )
66+ @[[ -d $( SOURCEDIR) /.git ]] && rm -rf $(SOURCEDIR ) /.git; true
67+ @[[ -f package.json ]] || mv -n $(SOURCEDIR ) /* $(SOURCEDIR ) /.* .
68+ @[[ -d $( SOURCEDIR) ]] && rm -rf $(SOURCEDIR ) ; true
69+ @[[ -f $( TARBALL) ]] && rm $(TARBALL ) ; true
6470
65- css : css-compile css-prefix css-minify css-copy
71+ init : package.json
72+ @npm install
6673
67- css-compile : css-compile-main css-compile-docs
74+ clean :
75+ @[[ -d dist ]] && rm -rf dist; true
6876
69- css-compile-main :
70- @$( SASSC ) $( SASSC_OPTS ) scss/ -o dist/css/ && make css-copy
77+ realclean : clean
78+ @rm -rf node_modules
7179
72- css-compile-docs : $( DOCS_ASSETSDIR ) /scss/docs.scss $( DOCS_ASSETSDIR ) /css/docs.min.css
73- @$( SASSC ) $( SASSC_OPTS ) $^
80+ distclean : realclean
81+ @rm -rf $$( ls -1a | egrep -v '^(\.|\.\.|\.git|Make.*|README.md ) $$ ' ); true
7482
75- css-copy :
76- @[[ -d $( DOCS_DISTDIR) ]] || mkdir -p $(DOCS_DISTDIR )
77- @cp -r dist/css/ $(DOCS_DISTDIR )
83+ bundlewatch :
84+ @$(BUNDLEWATCH ) $(BUNDLEWATCH_OPTS ) --config .bundlewatch.config.json
7885
79- css-docs : css-compile-docs css-prefix-docs css-minify-docs
86+ css : css-compile css-prefix css-minify
8087
81- css-lint : css-lint-main css-lint-docs
88+ css-compile :
89+ @$(SASSC ) $(SASSC_OPTS ) scss/ -o dist/css/
8290
83- css-lint-main :
84- @$(STYLELINT ) $(STYLELINT_OPTS ) " scss/**/*.scss"
91+ css-lint : css-lint-$(STYLELINT ) $(STYLELINT_OPTS ) css-lint-vars
8592
86- css-lint-docs :
87- @$(STYLELINT ) $(STYLELINT_OPTS ) " site/docs/ **/assets/scss/*. scss" " site/docs/**/*.css "
93+ css-lint-stylelint :
94+ @$(STYLELINT ) $(STYLELINT_OPTS ) " **/*.{css, scss} " -location .cache/.stylelintcache
8895
8996css-lint-vars :
90- @$(FUSV ) $(FUSV_OPTS ) scss/ site/docs /
97+ @$(FUSV ) $(FUSV_OPTS ) scss/ site/assets/scss /
9198
92- css-main :
93- @npm-run-all css-lint css-compile-main css-prefix-main css-minify-main css-copy
94-
95- css-minify : css-minify-main css-minify-docs
96-
97- css-minify-main :
98- @$(CLEANCSS ) $(CLEANCSS_OPTS ) --output dist/css/bootstrap.min.css dist/css/bootstrap.css
99+ css-minify :
100+ @$(CLEANCSS ) $(CLEANCSS_OPTS ) --output dist/css/bootstrap.min.css dist/css/bootstrap.css
99101 @$(CLEANCSS ) $(CLEANCSS_OPTS ) --output dist/css/bootstrap-grid.min.css dist/css/bootstrap-grid.css
102+ @$(CLEANCSS ) $(CLEANCSS_OPTS ) --output dist/css/bootstrap-utilities.min.css dist/css/bootstrap-utilities.css
100103 @$(CLEANCSS ) $(CLEANCSS_OPTS ) --output dist/css/bootstrap-reboot.min.css dist/css/bootstrap-reboot.css
101104
102- css-minify-docs :
103- @$(CLEANCSS ) $(CLEANCSS_OPTS ) --output $^ $^ $(DOCS_ASSETSDIR ) /css/docs.min.css $(DOCS_ASSETSDIR ) /css/docs.min.css
105+ css-prefix : css-prefix-examples css-prefix-main
104106
105- css-prefix : css-prefix-main css-prefix-docs
107+ css-prefix-examples :
108+ @$(POSTCSS ) $(POSTCSS_OPTS ) postcss.config.js//postcss.config.js --replace " site/content/**/*.css"
106109
107110css-prefix-main :
108- @$(POSTCSS ) $(POSTCSS_OPTS ) --replace " dist/css/*.css" " !dist/css/*.min.css"
109-
110- css-prefix-docs :
111- @$(POSTCSS ) $(POSTCSS_OPTS ) --replace " site/docs/**/*.css"
111+ @$(POSTCSS ) $(POSTCSS_OPTS ) postcss.config.js//postcss.config.js --replace " dist/css/*.css" " !dist/css/*.min.css"
112112
113113dist : css js
114114
115- docs : css-docs js-docs docs-build docs-lint
115+ docs : docs-build docs-lint
116116
117117docs-build :
118- @bundle exec jekyll build
119-
120- docs-compile : docs-build
121- @npm run docs-build
118+ @$(HUGO ) $(HUGO_OPTS ) --cleanDestinationDir
122119
123- docs-production :
124- @JEKYLL_ENV=production $(MAKE ) docs-build
125-
126- docs-netlify :
127- @JEKYLL_ENV=netlify $(MAKE ) docs-build
120+ docs-compile :
121+ @$(NPM ) $(NPM_OPTS ) run docs-build
128122
129123docs-linkinator :
130- @$(LINKINATOR ) _gh_pages --recurse --silent --skip \" ^(? ! http://localhost)\"
131-
132- docs-vnu :
133- @node build/vnu-jar.js
124+ @$(LINKINATOR ) $(LINKINATOR_OPTS ) _gh_pages --recurse --silent --skip " ^(?!http://localhost)"
134125
135126docs-lint : docs-vnu docs-linkinator
136127
137128docs-serve :
138- @bundle exec jekyll serve
129+ @$( HUGO ) $( HUGO_OPTS ) server --port 9001 --disableFastRender
139130
140131docs-serve-only :
141- @bundle exec jekyll serv --skip-initial-build --no-watche
142-
143- distclean : realclean
144- @rm -rf $$(ls -1a | egrep -v '^(\.|\.\.|\.git|Makefile|README.md|migration ) $$ ' ); true
145-
146- init : package.json
147- @npm install
132+ @$(SIRV ) $(SIRV_OPTS ) _gh_pages --port 9001
148133
149- js : js-compile js-minify js-copy
150-
151- js-copy :
152- @mkdir -p site/docs/$(VERSION_SHORT ) /dist/
153- @cp -r dist/js/ site/docs/$(VERSION_SHORT ) /dist/
154-
155- js-main : js-lint js-compile js-minify-main
134+ docs-vnu :
135+ @$(NODE ) $(NODE_OPTS ) build/vnu-jar.js
156136
157- js-docs : js-lint-docs js-minify-docs
137+ js : js-compile js-minify
158138
159- js-compile : js-compile-bundle js-compile-plugins js-compile-plugins-coverage js-compile-standalone js-copy
139+ js-compile : js-compile-bundle js-compile-plugins js-compile-standalone js-compile-standalone-esm
160140
161141js-compile-bundle :
162142 @$(ROLLUP ) $(ROLLUP_OPTS ) --environment BUNDLE:true --config build/rollup.config.js --sourcemap
163143
164144js-compile-plugins :
165- @node build/build-plugins.js
166-
167- js-compile-plugins-coverage :
168- @NODE_ENV=test node build/build-plugins.js
145+ @$(NODE ) $(NODE_OPTS ) build/build-plugins.js
169146
170147js-compile-standalone :
171148 @$(ROLLUP ) $(ROLLUP_OPTS ) --environment BUNDLE:false --config build/rollup.config.js --sourcemap
172149
173- js-lint : js-lint-main js-lint-docs
150+ js-compile-standalone-esm :
151+ @$(ROLLUP ) $(ROLLUP_OPTS ) --environment ESM:true,BUNDLE:false --config build/rollup.config.js --sourcemap
174152
175- js-lint-main :
176- @$( ESLINT ) $(ESLINT_OPTS ) js/src js/tests build/
153+ js-debug :
154+ @DEBUG=true $( NPM ) $(NPM_OPTS ) run js-test-karma
177155
178- js-lint-docs :
179- @$(ESLINT ) $(ESLINT_OPTS ) site/
156+ js-lint :
157+ @$(ESLINT ) $(ESLINT_OPTS ) .
180158
181- js-minify : js-minify-main js-minify-docs
182-
183- js-minify-main : js-minify-standalone js-minify-bundle
184-
185- js-minify-standalone :
186- @$(TERSER ) $(TERSER_OPTS ) \
187- --source-map " content=dist/js/bootstrap.js.map,includeSources,url=bootstrap.min.js.map" \
188- --output dist/js/bootstrap.min.js dist/js/bootstrap.js
159+ js-minify : js-minify-bundle js-minify-standalone js-minify-standalone-esm
189160
190161js-minify-bundle :
191- @$(TERSER ) $(TERSER_OPTS ) \
192- --source-map " content=dist/js/bootstrap.bundle.js.map,includeSources,url=bootstrap.bundle.min.js.map" \
193- --output dist/js/bootstrap.bundle.min.js dist/js/bootstrap.bundle.js
194-
195- js-minify-docs :
196- @$(TERSER ) $(TERSER_OPTS ) --output $(DOCS_ASSETSDIR ) /js/docs.min.js \
197- $(DOCS_ASSETSDIR ) /js/vendor/anchor.min.js \
198- $(DOCS_ASSETSDIR ) /js/vendor/clipboard.min.js \
199- $(DOCS_ASSETSDIR ) /js/vendor/bs-custom-file-input.min.js \
200- " $( DOCS_ASSETSDIR) /js/src/*.js"
162+ $(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
201163
202- js-test : js-test-karma js-test-karma-bundle js-test-karma-bundle-old js-test-integration js-test-cloud
203-
204- js-test-karma :
205- @$(KARMA ) $(KARMA_OPTS ) start js/tests/karma.conf.js
164+ js-minify-standalone :
165+ $(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
206166
207- js-test-karma-old :
208- @USE_OLD_JQUERY=true $(MAKE ) js-test-karma
167+ js-minify-standalone-esm :
168+ $( 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
209169
210- js-test-karma-bundle :
211- @BUNDLE=true npm run js-test-karma
170+ js-test : js-test-$(KARMA ) $(KARMA_OPTS ) js-test-jquery js-test-integration
212171
213- js-test-karma-bundle-old :
214- @BUNDLE =true USE_OLD_JQUERY=true $(MAKE ) js-test-karma
172+ js-test-cloud :
173+ @BROWSER =true $( NPM ) $(NPM_OPTS ) run js-test-karma
215174
216175js-test-integration :
217176 @$(ROLLUP ) $(ROLLUP_OPTS ) --config js/tests/integration/rollup.bundle.js
177+ @$(ROLLUP ) $(ROLLUP_OPTS ) --config js/tests/integration/rollup.bundle-modularity.js
218178
219- js-test-cloud :
220- @BROWSER=true $(MAKE ) js-test-karma
179+ js-test-jquery :
180+ @JQUERY=true $(NPM ) $(NPM_OPTS ) run js-test-karma
181+
182+ js-test-karma :
183+ @$(KARMA ) $(KARMA_OPTS ) start js/tests/karma.conf.js
221184
222185lint : js-lint css-lint lockfile-lint
223186
224187lockfile-lint :
225- @$(LOCKLINT ) $(LOCKLINT_OPTS ) --path package-lock.json
226-
227- netlify : dist release-sri docs-netlify
228-
229- package.json :
230- @[[ -f $( TARBALL) ]] || curl -SsLO $(SOURCEURL )
231- @[[ -d $( SOURCEDIR) ]] || tar xf $(TARBALL )
232- @[[ -d $( SOURCEDIR) /.git ]] && rm -rf $(SOURCEDIR ) /.git; true
233- @[[ -f package.json ]] || mv -n $(SOURCEDIR ) /* $(SOURCEDIR ) /.* .
234- @[[ -d $( SOURCEDIR) ]] && rm -rf $(SOURCEDIR ) ; true
235- @[[ -f $( TARBALL) ]] && rm $(TARBALL ) ; true
188+ @$(LOCKLINT ) $(LOCKLINT_OPTS ) --path package-lock.json
236189
237- realclean : clean
238- rm -rf node_modules
190+ netlify :
191+ @HUGO_BASEURL= $DEPLOY_PRIME_URL $( MAKE ) dist release-sri docs-build
239192
240- release : dist release-sri docs-production release-zip release-zip-examples
193+ release : dist release-sri docs-build release-zip release-zip-examples
241194
242195release-sri :
243- @node build/generate-sri.js
196+ @$( NODE ) $( NODE_OPTS ) build/generate-sri.js
244197
245198release-version :
246- @node build/change-version.js
199+ @$( NODE ) $( NODE_OPTS ) build/change-version.js
247200
248201release-zip :
249- @rm -rf bootstrap-$npm_package_version -dist
250- @cp -r dist/ bootstrap-$npm_package_version -dist
251- @zip -r9 bootstrap-$npm_package_version -dist.zip bootstrap-$npm_package_version -dist
252- @rm -rf bootstrap-$npm_package_version -dist\"
202+ @rm -rf bootstrap-$( VERSION ) -dist
203+ @cp -r dist/ bootstrap-$( VERSION ) -dist
204+ @zip -r9 bootstrap-$( VERSION ) -dist.zip bootstrap-$( VERSION ) -dist
205+ @rm -rf bootstrap-$( VERSION ) -dist
253206
254207release-zip-examples :
255- @node build/zip-examples.js
208+ @$( NODE ) $( NODE_OPTS ) build/zip-examples.js
256209
257210start : watch docs-serve
258211
259212test : lint dist js-test docs-build docs-lint
260213
261214update-deps :
262- @ncu -u -x " jquery, karma-browserstack-launcher,sinon "
263- @npm update && bundle update
264- @echo Manually update " site/docs/ $( VERSION_SHORT ) / assets/js/vendor/ "
215+ @$( NCU ) $( NCU_OPTS ) -u -x karma-browserstack-launcher,popper.js
216+ @$( NPM ) $( NPM_OPTS ) update
217+ @echo Manually update site/assets/js/vendor
265218
266219watch : watch-css-docs watch-css-main watch-js-docs watch-js-main
267220
268221watch-css-docs :
269- @$(NODEMON ) --watch " site/docs/**/ assets/scss/" --ext scss --exec " npm run css-docs "
222+ @$(NODEMON ) $( NODEMON_OPTS ) --watch site/assets/scss/ --ext scss --exec " $( NPM ) $( NPM_OPTS ) run css-lint "
270223
271224watch-css-main :
272- @$(NODEMON ) --watch scss/ --ext scss --exec " npm run css-main "
225+ @$(NODEMON ) $( NODEMON_OPTS ) --watch scss/ --ext scss --exec " $( MAKE ) css-lint css-compile css-prefix "
273226
274227watch-js-docs :
275- @$(NODEMON ) --watch " site/docs/**/ assets/js/src/ " --ext js --exec " npm run js-docs "
228+ @$(NODEMON ) $( NODEMON_OPTS ) --watch site/assets/js/ --ext js --exec " $( NPM ) $( NPM_OPTS ) run js-lint "
276229
277230watch-js-main :
278- @$(NODEMON ) --watch js/src/ --ext js --exec " npm run js-compile"
279-
231+ @$(NODEMON ) $(NODEMON_OPTS ) --watch js/src/ --ext js --exec " $( MAKE) js-lint js-compile"
280232
281- # vim: nospell
0 commit comments