@regardio/dev 1.9.2 → 1.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/lint-md.js +7 -1
- package/package.json +9 -1
- package/src/bin/lint-md.ts +15 -3
package/dist/bin/lint-md.js
CHANGED
|
@@ -5,6 +5,12 @@ import { dirname, join } from 'node:path';
|
|
|
5
5
|
const require = createRequire(import.meta.url);
|
|
6
6
|
const packageDir = dirname(require.resolve('markdownlint-cli2'));
|
|
7
7
|
const bin = join(packageDir, 'markdownlint-cli2-bin.mjs');
|
|
8
|
-
const
|
|
8
|
+
const DEFAULT_GLOBS = ['**/*.md', '**/*.mdx'];
|
|
9
|
+
const DEFAULT_EXCLUSIONS = ['!**/.changeset/**', '!**/node_modules/**', '!**/dist/**'];
|
|
10
|
+
const rawArgs = process.argv.slice(2);
|
|
11
|
+
const fixFlag = rawArgs.includes('--fix');
|
|
12
|
+
const userGlobs = rawArgs.filter((arg) => arg !== '--fix');
|
|
13
|
+
const globs = userGlobs.length > 0 ? userGlobs : DEFAULT_GLOBS;
|
|
14
|
+
const args = [...(fixFlag ? ['--fix'] : []), ...globs, ...DEFAULT_EXCLUSIONS];
|
|
9
15
|
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
10
16
|
child.on('exit', (code) => process.exit(code ?? 0));
|
package/package.json
CHANGED
|
@@ -87,6 +87,14 @@
|
|
|
87
87
|
],
|
|
88
88
|
"license": "MIT",
|
|
89
89
|
"name": "@regardio/dev",
|
|
90
|
+
"peerDependencies": {
|
|
91
|
+
"postcss": "^8.4"
|
|
92
|
+
},
|
|
93
|
+
"peerDependenciesMeta": {
|
|
94
|
+
"postcss": {
|
|
95
|
+
"optional": true
|
|
96
|
+
}
|
|
97
|
+
},
|
|
90
98
|
"private": false,
|
|
91
99
|
"publishConfig": {
|
|
92
100
|
"access": "public"
|
|
@@ -113,5 +121,5 @@
|
|
|
113
121
|
},
|
|
114
122
|
"sideEffects": false,
|
|
115
123
|
"type": "module",
|
|
116
|
-
"version": "1.9.
|
|
124
|
+
"version": "1.9.3"
|
|
117
125
|
}
|
package/src/bin/lint-md.ts
CHANGED
|
@@ -1,16 +1,28 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
3
|
* lint-md: Run markdownlint-cli2 to lint and fix Markdown files.
|
|
4
|
-
* Usage: lint-md [
|
|
4
|
+
* Usage: lint-md [--fix] [globs...]
|
|
5
|
+
*
|
|
6
|
+
* Default globs (if none provided): "**\/*.md" "**\/*.mdx"
|
|
7
|
+
* Default exclusions (always added): "!**\/.changeset/**" "!**\/node_modules/**" "!**\/dist/**"
|
|
5
8
|
*/
|
|
6
9
|
import { spawn } from 'node:child_process';
|
|
7
10
|
import { createRequire } from 'node:module';
|
|
8
11
|
import { dirname, join } from 'node:path';
|
|
9
12
|
|
|
10
13
|
const require = createRequire(import.meta.url);
|
|
11
|
-
// Resolve to any exported file to find the package directory
|
|
12
14
|
const packageDir = dirname(require.resolve('markdownlint-cli2'));
|
|
13
15
|
const bin = join(packageDir, 'markdownlint-cli2-bin.mjs');
|
|
14
|
-
|
|
16
|
+
|
|
17
|
+
const DEFAULT_GLOBS = ['**/*.md', '**/*.mdx'];
|
|
18
|
+
const DEFAULT_EXCLUSIONS = ['!**/.changeset/**', '!**/node_modules/**', '!**/dist/**'];
|
|
19
|
+
|
|
20
|
+
const rawArgs = process.argv.slice(2);
|
|
21
|
+
const fixFlag = rawArgs.includes('--fix');
|
|
22
|
+
const userGlobs = rawArgs.filter((arg) => arg !== '--fix');
|
|
23
|
+
|
|
24
|
+
const globs = userGlobs.length > 0 ? userGlobs : DEFAULT_GLOBS;
|
|
25
|
+
const args = [...(fixFlag ? ['--fix'] : []), ...globs, ...DEFAULT_EXCLUSIONS];
|
|
26
|
+
|
|
15
27
|
const child = spawn(process.execPath, [bin, ...args], { stdio: 'inherit' });
|
|
16
28
|
child.on('exit', (code) => process.exit(code ?? 0));
|