mirror of
https://github.com/boostorg/website-v2-docs.git
synced 2026-01-19 04:42:17 +00:00
feat: code format gulp task
This commit is contained in:
committed by
Alan de Freitas
parent
7c27983a21
commit
f683b73ef4
19
antora-ui/gulp.d/tasks/format-css.js
Normal file
19
antora-ui/gulp.d/tasks/format-css.js
Normal file
@@ -0,0 +1,19 @@
|
||||
'use strict'
|
||||
|
||||
const stylelint = require('gulp-stylelint')
|
||||
const vfs = require('vinyl-fs')
|
||||
|
||||
module.exports = (files) => async () => {
|
||||
const prettier = (await import('gulp-prettier')).default
|
||||
|
||||
vfs
|
||||
.src(files)
|
||||
.pipe(prettier()) // First format the CSS files with Prettier
|
||||
.pipe(
|
||||
stylelint({
|
||||
fix: true, // Automatically fix Stylelint issues
|
||||
reporters: [{ formatter: 'string', console: true }],
|
||||
})
|
||||
)
|
||||
.pipe(vfs.dest((file) => file.base)) // Write the changes back to the files
|
||||
}
|
||||
@@ -45,10 +45,22 @@ const lintTask = createTask({
|
||||
call: parallel(lintCssTask, lintJsTask),
|
||||
})
|
||||
|
||||
const formatCssTask = createTask({
|
||||
name: 'format:css',
|
||||
desc: 'Format the CSS source files (standard config)',
|
||||
call: task.formatCss(glob.css),
|
||||
})
|
||||
|
||||
const formatJsTask = createTask({
|
||||
name: 'format:js',
|
||||
desc: 'Format the JavaScript source files (JavaScript Standard Style)',
|
||||
call: task.formatJs(glob.js),
|
||||
})
|
||||
|
||||
const formatTask = createTask({
|
||||
name: 'format',
|
||||
desc: 'Format the JavaScript source files using prettify (JavaScript Standard Style)',
|
||||
call: task.format(glob.js),
|
||||
call: parallel(formatCssTask, formatJsTask),
|
||||
})
|
||||
|
||||
const buildTask = createTask({
|
||||
|
||||
42
antora-ui/package-lock.json
generated
42
antora-ui/package-lock.json
generated
@@ -6,6 +6,9 @@
|
||||
"": {
|
||||
"name": "@antora/ui-default",
|
||||
"license": "MPL-2.0",
|
||||
"dependencies": {
|
||||
"gulp-prettier": "^6.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@asciidoctor/core": "~2.2",
|
||||
"@asciidoctor/tabs": "^1.0.0-beta.3",
|
||||
@@ -756,7 +759,6 @@
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-1.1.0.tgz",
|
||||
"integrity": "sha512-SFKX67auSNoVR38N3L+nvsPjOE0bybKTYbkf5tRvushrAPQ9V75huw0ZxBkKVeRU9kqH3d6HA4xTckbwZ4ixmA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"ansi-wrap": "^0.1.0"
|
||||
},
|
||||
@@ -828,7 +830,6 @@
|
||||
"version": "0.1.0",
|
||||
"resolved": "https://registry.npmjs.org/ansi-wrap/-/ansi-wrap-0.1.0.tgz",
|
||||
"integrity": "sha512-ZyznvL8k/FZeQHr2T6LzcJ/+vBApDnMNZvfVFy3At0knswWd6rJ3/0Hhmpu8oqa6C92npmozs890sX9Dl6q+Qw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
@@ -6250,6 +6251,43 @@
|
||||
"postcss": "^8.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/gulp-prettier": {
|
||||
"version": "6.0.0",
|
||||
"resolved": "https://registry.npmjs.org/gulp-prettier/-/gulp-prettier-6.0.0.tgz",
|
||||
"integrity": "sha512-UzIivdVojdxC25VItzCGxKf+Psen8ZnroXnDZQUxyE+5wxKYZAR0B7c7VpjKvOgtx8EkbZJbB5okHE8lqKBAwg==",
|
||||
"dependencies": {
|
||||
"plugin-error": "^2.0.0",
|
||||
"prettier": "^3.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/gulp-prettier/node_modules/plugin-error": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/plugin-error/-/plugin-error-2.0.1.tgz",
|
||||
"integrity": "sha512-zMakqvIDyY40xHOvzXka0kUvf40nYIuwRE8dWhti2WtjQZ31xAgBZBhxsK7vK3QbRXS1Xms/LO7B5cuAsfB2Gg==",
|
||||
"dependencies": {
|
||||
"ansi-colors": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.13.0"
|
||||
}
|
||||
},
|
||||
"node_modules/gulp-prettier/node_modules/prettier": {
|
||||
"version": "3.3.3",
|
||||
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz",
|
||||
"integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==",
|
||||
"bin": {
|
||||
"prettier": "bin/prettier.cjs"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/prettier/prettier?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/gulp-stylelint": {
|
||||
"version": "13.0.0",
|
||||
"resolved": "https://registry.npmjs.org/gulp-stylelint/-/gulp-stylelint-13.0.0.tgz",
|
||||
|
||||
@@ -54,5 +54,8 @@
|
||||
"stylelint-config-standard": "~20.0",
|
||||
"tailwindcss": "^3.2.7",
|
||||
"vinyl-fs": "~3.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"gulp-prettier": "^6.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user