Skip to content

Commit

Permalink
fix:all and actually call the wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin committed Jun 8, 2024
1 parent db5f433 commit fe43104
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
15 changes: 9 additions & 6 deletions gulp-src/lint-md.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ const markdownlint = require('markdownlint');
const { taskArgs, trimBlankLinesFromArray } = require('./_util');
const fs = require('fs');

const defaultGlobs = [
'**/*.md',
];
const defaultGlobs = ['**/*.md'];
const markdownFiles = [
'!.github/**',
'!content-modules/**',
Expand Down Expand Up @@ -127,7 +125,9 @@ function applyFixesToFileContent(content, issue) {

function logFiles(debug) {
return through2.obj(function (file, enc, cb) {
if (debug) { console.log('Processing file:', file.path); }
if (debug) {
console.log('Processing file:', file.path);
}
cb(null, file);
});
}
Expand All @@ -137,7 +137,8 @@ function lintMarkdown() {
glob: {
alias: 'g',
type: 'array',
description: 'Globs of files to run through markdownlint. List flag more than once for multiple values.',
description:
'Globs of files to run through markdownlint. List flag more than once for multiple values.',
default: defaultGlobs,
},
debug: {
Expand All @@ -159,7 +160,9 @@ function lintMarkdown() {
fix = argv.fix;

const globs = [...argv.glob, ...markdownFiles];
if (argv.debug) { console.log('Globs being used:', globs); }
if (argv.debug) {
console.log('Globs being used:', globs);
}

return gulp
.src(globs, { followSymlinks: false })
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"_check:links--warn": "npm run _check:links || (echo; echo 'WARNING: see link-checker output for issues.'; echo)",
"_check:links:internal": "npm run __check:links",
"_check:links": "HTMLTEST_ARGS='--log-level 1' npm run __check:links",
"_check:markdown": "npx gulp lint-md",
"_check:text": "npx textlint content data `ls *.md`",
"_diff:check": "git diff --name-only --exit-code",
"_diff:fail": "git diff --name-only --exit-code || exit 1",
Expand All @@ -30,7 +31,7 @@
"_rename-to-kebab-case": "find assets content static -name '*_*' ! -name '_*' -exec sh -c 'mv \"$1\" \"${1//_/-}\"' _ {} \\;",
"_serve:hugo": "hugo server --buildDrafts --minify",
"_serve:netlify": "netlify dev -c \"npm run _serve:hugo -- --renderToMemory\"",
"_sync": "./scripts/sync-submodules.pl",
"_sync": "scripts/sync-submodules.pl",
"all": "bash -c 'x=0; for c in \"$@\"; do npm run $c || x=$((x+1)); done; ((!x)) || (echo \"ERROR: some scripts failed!\" && exit 1)' -",
"build:preview": "set -x && npm run _build -- --minify",
"build:production": "npm run _hugo -- --minify",
Expand All @@ -40,19 +41,19 @@
"check:format": "npm run _check:format || (echo '[help] Run: npm run fix:format'; exit 1)",
"check:links:internal": "npm run _check:links:internal",
"check:links": "npm run _check:links",
"check:markdown": "npx gulp lint-md",
"check:markdown": "scripts/check-markdown-wrapper.sh",
"check:spelling": "npx cspell --no-progress -c .cspell.yml content data 'layouts/**/*.md'",
"check:text": "npm run _check:text -- ",
"check": "npm run seq -- $(npm run -s _list:check:*)",
"clean": "make clean",
"code-excerpts": "rm -Rf tmp/excerpts/* && npm run seq -- code-excerpts:get code-excerpts:update-docs",
"code-excerpts:get": "cd tools && dart run build_runner build --delete-conflicting-outputs --output ../tmp/excerpts",
"code-excerpts:update-docs": "cd tools && dart run code_excerpt_updater --fragment-dir-path ../tmp/excerpts --src-dir-path examples --yaml --write-in-place content",
"cp:spec": "./scripts/content-modules/cp-pages.sh",
"cp:spec": "scripts/content-modules/cp-pages.sh",
"diff:check": "npm run _diff:check || (echo; echo 'WARNING: the files above have not been committed'; echo)",
"diff:fail": "npm run _diff:check || (echo; echo 'ERROR: the files above have changed. Locally rerun `npm run test-and-fix` and commit changes'; echo; exit 1)",
"fix:all": "npm run seq -- $(npm -s run _list:fix:*)",
"fix:dict": "find content layouts -name \"*.md\" -print0 | xargs -0 ./scripts/normalize-cspell-front-matter.pl",
"fix:dict": "find content layouts -name \"*.md\" -print0 | xargs -0 scripts/normalize-cspell-front-matter.pl",
"fix:filenames": "npm run _rename-to-kebab-case",
"fix:format": "npm run format",
"fix:i18n": "scripts/i18n-check.sh -u",
Expand Down Expand Up @@ -83,7 +84,7 @@
"serve:hugo": "npm run _serve:hugo -- --renderToMemory",
"serve:netlify": "npm run _serve:netlify",
"serve": "npm run serve:hugo --",
"sync": "./scripts/sync-submodules.pl",
"sync": "scripts/sync-submodules.pl",
"test-and-fix": "npm run seq -- check fix:dict fix:filenames",
"test": "npm run check",
"update:docsy-dep": "npm install --save-dev autoprefixer@latest postcss-cli@latest",
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-markdown-wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ if [[ ! -e $symlink_target ]]; then
fi

set -x
exec npx gulp lint-md "$@"
exec npm run _check:markdown "$@"

0 comments on commit fe43104

Please sign in to comment.