@regardio/dev 1.9.1 → 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.
@@ -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 args = process.argv.slice(2);
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
@@ -33,6 +33,7 @@
33
33
  "jsdom": "27.4.0",
34
34
  "markdownlint-cli2": "0.20.0",
35
35
  "npm-run-all": "4.1.5",
36
+ "postcss": "8.5.6",
36
37
  "rimraf": "6.1.2",
37
38
  "tsx": "4.21.0",
38
39
  "typescript": "5.9.3",
@@ -86,6 +87,14 @@
86
87
  ],
87
88
  "license": "MIT",
88
89
  "name": "@regardio/dev",
90
+ "peerDependencies": {
91
+ "postcss": "^8.4"
92
+ },
93
+ "peerDependenciesMeta": {
94
+ "postcss": {
95
+ "optional": true
96
+ }
97
+ },
89
98
  "private": false,
90
99
  "publishConfig": {
91
100
  "access": "public"
@@ -112,5 +121,5 @@
112
121
  },
113
122
  "sideEffects": false,
114
123
  "type": "module",
115
- "version": "1.9.1"
124
+ "version": "1.9.3"
116
125
  }
@@ -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 [markdownlint-cli2 args...]
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
- const args = process.argv.slice(2);
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));