@apollion-dsi/scripts 0.9.0 → 0.9.2

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.
@@ -0,0 +1,196 @@
1
+
2
+ <!doctype html>
3
+ <html lang="en">
4
+
5
+ <head>
6
+ <title>Code coverage report for utils/buildWrapperArgs.ts</title>
7
+ <meta charset="utf-8" />
8
+ <link rel="stylesheet" href="../prettify.css" />
9
+ <link rel="stylesheet" href="../base.css" />
10
+ <link rel="shortcut icon" type="image/x-icon" href="../favicon.png" />
11
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
12
+ <style type='text/css'>
13
+ .coverage-summary .sorter {
14
+ background-image: url(../sort-arrow-sprite.png);
15
+ }
16
+ </style>
17
+ </head>
18
+
19
+ <body>
20
+ <div class='wrapper'>
21
+ <div class='pad1'>
22
+ <h1><a href="../index.html">All files</a> / <a href="index.html">utils</a> buildWrapperArgs.ts</h1>
23
+ <div class='clearfix'>
24
+
25
+ <div class='fl pad1y space-right2'>
26
+ <span class="strong">100% </span>
27
+ <span class="quiet">Statements</span>
28
+ <span class='fraction'>6/6</span>
29
+ </div>
30
+
31
+
32
+ <div class='fl pad1y space-right2'>
33
+ <span class="strong">100% </span>
34
+ <span class="quiet">Branches</span>
35
+ <span class='fraction'>2/2</span>
36
+ </div>
37
+
38
+
39
+ <div class='fl pad1y space-right2'>
40
+ <span class="strong">100% </span>
41
+ <span class="quiet">Functions</span>
42
+ <span class='fraction'>2/2</span>
43
+ </div>
44
+
45
+
46
+ <div class='fl pad1y space-right2'>
47
+ <span class="strong">100% </span>
48
+ <span class="quiet">Lines</span>
49
+ <span class='fraction'>5/5</span>
50
+ </div>
51
+
52
+
53
+ </div>
54
+ <p class="quiet">
55
+ Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
56
+ </p>
57
+ <template id="filterTemplate">
58
+ <div class="quiet">
59
+ Filter:
60
+ <input type="search" id="fileSearch">
61
+ </div>
62
+ </template>
63
+ </div>
64
+ <div class='status-line high'></div>
65
+ <pre><table class="coverage">
66
+ <tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
67
+ <a name='L2'></a><a href='#L2'>2</a>
68
+ <a name='L3'></a><a href='#L3'>3</a>
69
+ <a name='L4'></a><a href='#L4'>4</a>
70
+ <a name='L5'></a><a href='#L5'>5</a>
71
+ <a name='L6'></a><a href='#L6'>6</a>
72
+ <a name='L7'></a><a href='#L7'>7</a>
73
+ <a name='L8'></a><a href='#L8'>8</a>
74
+ <a name='L9'></a><a href='#L9'>9</a>
75
+ <a name='L10'></a><a href='#L10'>10</a>
76
+ <a name='L11'></a><a href='#L11'>11</a>
77
+ <a name='L12'></a><a href='#L12'>12</a>
78
+ <a name='L13'></a><a href='#L13'>13</a>
79
+ <a name='L14'></a><a href='#L14'>14</a>
80
+ <a name='L15'></a><a href='#L15'>15</a>
81
+ <a name='L16'></a><a href='#L16'>16</a>
82
+ <a name='L17'></a><a href='#L17'>17</a>
83
+ <a name='L18'></a><a href='#L18'>18</a>
84
+ <a name='L19'></a><a href='#L19'>19</a>
85
+ <a name='L20'></a><a href='#L20'>20</a>
86
+ <a name='L21'></a><a href='#L21'>21</a>
87
+ <a name='L22'></a><a href='#L22'>22</a>
88
+ <a name='L23'></a><a href='#L23'>23</a>
89
+ <a name='L24'></a><a href='#L24'>24</a>
90
+ <a name='L25'></a><a href='#L25'>25</a>
91
+ <a name='L26'></a><a href='#L26'>26</a>
92
+ <a name='L27'></a><a href='#L27'>27</a>
93
+ <a name='L28'></a><a href='#L28'>28</a>
94
+ <a name='L29'></a><a href='#L29'>29</a>
95
+ <a name='L30'></a><a href='#L30'>30</a>
96
+ <a name='L31'></a><a href='#L31'>31</a>
97
+ <a name='L32'></a><a href='#L32'>32</a>
98
+ <a name='L33'></a><a href='#L33'>33</a>
99
+ <a name='L34'></a><a href='#L34'>34</a>
100
+ <a name='L35'></a><a href='#L35'>35</a>
101
+ <a name='L36'></a><a href='#L36'>36</a>
102
+ <a name='L37'></a><a href='#L37'>37</a>
103
+ <a name='L38'></a><a href='#L38'>38</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral">&nbsp;</span>
104
+ <span class="cline-any cline-neutral">&nbsp;</span>
105
+ <span class="cline-any cline-neutral">&nbsp;</span>
106
+ <span class="cline-any cline-neutral">&nbsp;</span>
107
+ <span class="cline-any cline-neutral">&nbsp;</span>
108
+ <span class="cline-any cline-neutral">&nbsp;</span>
109
+ <span class="cline-any cline-neutral">&nbsp;</span>
110
+ <span class="cline-any cline-neutral">&nbsp;</span>
111
+ <span class="cline-any cline-neutral">&nbsp;</span>
112
+ <span class="cline-any cline-neutral">&nbsp;</span>
113
+ <span class="cline-any cline-neutral">&nbsp;</span>
114
+ <span class="cline-any cline-neutral">&nbsp;</span>
115
+ <span class="cline-any cline-neutral">&nbsp;</span>
116
+ <span class="cline-any cline-neutral">&nbsp;</span>
117
+ <span class="cline-any cline-neutral">&nbsp;</span>
118
+ <span class="cline-any cline-neutral">&nbsp;</span>
119
+ <span class="cline-any cline-neutral">&nbsp;</span>
120
+ <span class="cline-any cline-neutral">&nbsp;</span>
121
+ <span class="cline-any cline-neutral">&nbsp;</span>
122
+ <span class="cline-any cline-neutral">&nbsp;</span>
123
+ <span class="cline-any cline-neutral">&nbsp;</span>
124
+ <span class="cline-any cline-neutral">&nbsp;</span>
125
+ <span class="cline-any cline-neutral">&nbsp;</span>
126
+ <span class="cline-any cline-neutral">&nbsp;</span>
127
+ <span class="cline-any cline-neutral">&nbsp;</span>
128
+ <span class="cline-any cline-neutral">&nbsp;</span>
129
+ <span class="cline-any cline-neutral">&nbsp;</span>
130
+ <span class="cline-any cline-neutral">&nbsp;</span>
131
+ <span class="cline-any cline-yes">1x</span>
132
+ <span class="cline-any cline-yes">11x</span>
133
+ <span class="cline-any cline-yes">3x</span>
134
+ <span class="cline-any cline-neutral">&nbsp;</span>
135
+ <span class="cline-any cline-neutral">&nbsp;</span>
136
+ <span class="cline-any cline-yes">15x</span>
137
+ <span class="cline-any cline-neutral">&nbsp;</span>
138
+ <span class="cline-any cline-yes">8x</span>
139
+ <span class="cline-any cline-neutral">&nbsp;</span>
140
+ <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">/**
141
+ * Build the argv passed to an underlying CLI (eslint, prettier) for a
142
+ * `scripts &lt;cmd&gt;` wrapper, from the user-provided argv.
143
+ *
144
+ * - Empty input → `defaults` verbatim (the canonical no-args
145
+ * invocation, e.g. `['src', '--quiet']` for lint).
146
+ * - Non-empty input → user args (with the POSIX `--` end-of-options
147
+ * marker removed) followed by `target`.
148
+ *
149
+ * The previous heuristic tried to detect "user-provided path" by
150
+ * scanning for any argv entry not starting with `-`, then handed full
151
+ * control to the user. That broke two real consumer invocations:
152
+ *
153
+ * 1. `scripts lint --max-warnings 0` — the `0` value of the flag was
154
+ * misread as a path, so `src` was dropped and ESLint ran with no
155
+ * files.
156
+ * 2. `scripts lint -- --fix` — every arg started with `-`, so `src`
157
+ * was appended, but the surviving `--` separator forced ESLint to
158
+ * treat `--fix` and `src` as positional files.
159
+ *
160
+ * The wrapper is intentionally narrow: pass flags, get the default
161
+ * target. Consumers that need a non-default target should invoke the
162
+ * underlying CLI directly (`node_modules/.bin/eslint &lt;path&gt;`).
163
+ *
164
+ * @param userArgs - argv after `scripts &lt;cmd&gt;` (i.e. `process.argv.slice(2)`).
165
+ * @param options.defaults - argv to use when `userArgs` is empty.
166
+ * @param options.target - path/glob appended after user flags otherwise.
167
+ */
168
+ export function buildWrapperArgs(userArgs: string[], options: { defaults: string[]; target: string }): string[] {
169
+ if (userArgs.length === 0) {
170
+ return [...options.defaults];
171
+ }
172
+ &nbsp;
173
+ const passthrough = userArgs.filter((a) =&gt; a !== '--');
174
+ &nbsp;
175
+ return [...passthrough, options.target];
176
+ }
177
+ &nbsp;</pre></td></tr></table></pre>
178
+
179
+ <div class='push'></div><!-- for sticky footer -->
180
+ </div><!-- /wrapper -->
181
+ <div class='footer quiet pad2 space-top1 center small'>
182
+ Code coverage generated by
183
+ <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
184
+ at 2026-06-10T09:06:41.820Z
185
+ </div>
186
+ <script src="../prettify.js"></script>
187
+ <script>
188
+ window.onload = function () {
189
+ prettyPrint();
190
+ };
191
+ </script>
192
+ <script src="../sorter.js"></script>
193
+ <script src="../block-navigation.js"></script>
194
+ </body>
195
+ </html>
196
+
@@ -163,7 +163,7 @@ export default function checkRequiredFiles(files: string[]): boolean {
163
163
  <div class='footer quiet pad2 space-top1 center small'>
164
164
  Code coverage generated by
165
165
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
166
- at 2026-05-29T12:15:51.314Z
166
+ at 2026-06-10T09:06:41.820Z
167
167
  </div>
168
168
  <script src="../prettify.js"></script>
169
169
  <script>
@@ -199,7 +199,7 @@ export default function formatWebpackMessages(json: any): FormattedMessages {
199
199
  <div class='footer quiet pad2 space-top1 center small'>
200
200
  Code coverage generated by
201
201
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
202
- at 2026-05-29T12:15:51.314Z
202
+ at 2026-06-10T09:06:41.820Z
203
203
  </div>
204
204
  <script src="../prettify.js"></script>
205
205
  <script>
@@ -244,7 +244,7 @@ export default function getPublicUrlOrPath(
244
244
  <div class='footer quiet pad2 space-top1 center small'>
245
245
  Code coverage generated by
246
246
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
247
- at 2026-05-29T12:15:51.314Z
247
+ at 2026-06-10T09:06:41.820Z
248
248
  </div>
249
249
  <script src="../prettify.js"></script>
250
250
  <script>
@@ -23,30 +23,30 @@
23
23
  <div class='clearfix'>
24
24
 
25
25
  <div class='fl pad1y space-right2'>
26
- <span class="strong">94.11% </span>
26
+ <span class="strong">94.59% </span>
27
27
  <span class="quiet">Statements</span>
28
- <span class='fraction'>64/68</span>
28
+ <span class='fraction'>70/74</span>
29
29
  </div>
30
30
 
31
31
 
32
32
  <div class='fl pad1y space-right2'>
33
- <span class="strong">86.36% </span>
33
+ <span class="strong">86.95% </span>
34
34
  <span class="quiet">Branches</span>
35
- <span class='fraction'>38/44</span>
35
+ <span class='fraction'>40/46</span>
36
36
  </div>
37
37
 
38
38
 
39
39
  <div class='fl pad1y space-right2'>
40
40
  <span class="strong">100% </span>
41
41
  <span class="quiet">Functions</span>
42
- <span class='fraction'>6/6</span>
42
+ <span class='fraction'>8/8</span>
43
43
  </div>
44
44
 
45
45
 
46
46
  <div class='fl pad1y space-right2'>
47
- <span class="strong">95.23% </span>
47
+ <span class="strong">95.58% </span>
48
48
  <span class="quiet">Lines</span>
49
- <span class='fraction'>60/63</span>
49
+ <span class='fraction'>65/68</span>
50
50
  </div>
51
51
 
52
52
 
@@ -79,6 +79,21 @@
79
79
  </tr>
80
80
  </thead>
81
81
  <tbody><tr>
82
+ <td class="file high" data-value="buildWrapperArgs.ts"><a href="buildWrapperArgs.ts.html">buildWrapperArgs.ts</a></td>
83
+ <td data-value="100" class="pic high">
84
+ <div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
85
+ </td>
86
+ <td data-value="100" class="pct high">100%</td>
87
+ <td data-value="6" class="abs high">6/6</td>
88
+ <td data-value="100" class="pct high">100%</td>
89
+ <td data-value="2" class="abs high">2/2</td>
90
+ <td data-value="100" class="pct high">100%</td>
91
+ <td data-value="2" class="abs high">2/2</td>
92
+ <td data-value="100" class="pct high">100%</td>
93
+ <td data-value="5" class="abs high">5/5</td>
94
+ </tr>
95
+
96
+ <tr>
82
97
  <td class="file high" data-value="checkRequiredFiles.ts"><a href="checkRequiredFiles.ts.html">checkRequiredFiles.ts</a></td>
83
98
  <td data-value="100" class="pic high">
84
99
  <div class="chart"><div class="cover-fill cover-full" style="width: 100%"></div><div class="cover-empty" style="width: 0%"></div></div>
@@ -146,7 +161,7 @@
146
161
  <div class='footer quiet pad2 space-top1 center small'>
147
162
  Code coverage generated by
148
163
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
149
- at 2026-05-29T12:15:51.314Z
164
+ at 2026-06-10T09:06:41.820Z
150
165
  </div>
151
166
  <script src="../prettify.js"></script>
152
167
  <script>
@@ -178,7 +178,7 @@ export function resolveBin(pkgName: string, binName: string = <span class="branc
178
178
  <div class='footer quiet pad2 space-top1 center small'>
179
179
  Code coverage generated by
180
180
  <a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
181
- at 2026-05-29T12:15:51.314Z
181
+ at 2026-06-10T09:06:41.820Z
182
182
  </div>
183
183
  <script src="../prettify.js"></script>
184
184
  <script>
@@ -15,7 +15,7 @@ FNDA:5,(anonymous_2)
15
15
  FNDA:1,(anonymous_3)
16
16
  FNDA:0,(anonymous_4)
17
17
  FNDA:2,getClientEnvironment
18
- FNDA:131,(anonymous_6)
18
+ FNDA:127,(anonymous_6)
19
19
  FNDA:1,(anonymous_7)
20
20
  FNDA:13,(anonymous_8)
21
21
  DA:1,1
@@ -35,7 +35,7 @@ DA:52,0
35
35
  DA:69,1
36
36
  DA:72,2
37
37
  DA:74,2
38
- DA:75,131
38
+ DA:75,127
39
39
  DA:76,1
40
40
  DA:100,2
41
41
  DA:101,13
@@ -112,6 +112,26 @@ BRF:0
112
112
  BRH:0
113
113
  end_of_record
114
114
  TN:
115
+ SF:src/utils/buildWrapperArgs.ts
116
+ FN:29,buildWrapperArgs
117
+ FN:34,(anonymous_1)
118
+ FNF:2
119
+ FNH:2
120
+ FNDA:11,buildWrapperArgs
121
+ FNDA:15,(anonymous_1)
122
+ DA:29,1
123
+ DA:30,11
124
+ DA:31,3
125
+ DA:34,15
126
+ DA:36,8
127
+ LF:5
128
+ LH:5
129
+ BRDA:30,0,0,3
130
+ BRDA:30,0,1,8
131
+ BRF:2
132
+ BRH:2
133
+ end_of_record
134
+ TN:
115
135
  SF:src/utils/checkRequiredFiles.ts
116
136
  FN:15,checkRequiredFiles
117
137
  FN:18,(anonymous_2)
package/lib/bin.js CHANGED
File without changes
@@ -4,28 +4,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const cross_spawn_1 = __importDefault(require("cross-spawn"));
7
+ const buildWrapperArgs_1 = require("../utils/buildWrapperArgs");
7
8
  const resolveBin_1 = require("../utils/resolveBin");
8
9
  /**
9
- * `scripts lint` — ESLint over `src` with `--quiet`. ESLint 9 flat
10
- * config uses `eslint.config.js#files` for filtering (no `--ext`).
10
+ * `scripts lint` — ESLint over `src`. ESLint 9 flat config uses
11
+ * `eslint.config.js#files` for filtering (no `--ext`).
11
12
  *
12
- * If the consumer passes any path-like arg, they own the invocation
13
- * entirely. Flag-only invocations (e.g. `scripts lint --fix`) keep the
14
- * default `src` target so the common case Just Works.
13
+ * Flag args pass through; the default `src` target is always appended
14
+ * so the common case (`scripts lint --fix`, `scripts lint
15
+ * --max-warnings 0`, `scripts lint -- --fix`) Just Works. Consumers
16
+ * that need a different target should call `eslint` directly from
17
+ * `node_modules/.bin`.
15
18
  */
16
19
  const eslintBin = (0, resolveBin_1.resolveBin)('eslint');
17
20
  const userArgs = process.argv.slice(2);
18
- const userProvidedPath = userArgs.some((a) => !a.startsWith('-'));
19
- let args;
20
- if (userArgs.length === 0) {
21
- args = ['src', '--quiet'];
22
- }
23
- else if (userProvidedPath) {
24
- args = userArgs;
25
- }
26
- else {
27
- args = [...userArgs, 'src'];
28
- }
21
+ const args = (0, buildWrapperArgs_1.buildWrapperArgs)(userArgs, {
22
+ defaults: ['src', '--quiet'],
23
+ target: 'src',
24
+ });
29
25
  const result = cross_spawn_1.default.sync(process.execPath, [eslintBin, ...args], { stdio: 'inherit' });
30
26
  process.exit(result.status ?? 1);
31
27
  //# sourceMappingURL=lint.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/command/lint.ts"],"names":[],"mappings":";;;;;AAAA,8DAAgC;AAEhC,oDAAiD;AAEjD;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,IAAA,uBAAU,EAAC,QAAQ,CAAC,CAAC;AAEvC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEvC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAElE,IAAI,IAAc,CAAC;AAEnB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC1B,IAAI,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAAC;AAC5B,CAAC;KAAM,IAAI,gBAAgB,EAAE,CAAC;IAC5B,IAAI,GAAG,QAAQ,CAAC;AAClB,CAAC;KAAM,CAAC;IACN,IAAI,GAAG,CAAC,GAAG,QAAQ,EAAE,KAAK,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,MAAM,GAAG,qBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAExF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"lint.js","sourceRoot":"","sources":["../../src/command/lint.ts"],"names":[],"mappings":";;;;;AAAA,8DAAgC;AAEhC,gEAA6D;AAC7D,oDAAiD;AAEjD;;;;;;;;;GASG;AACH,MAAM,SAAS,GAAG,IAAA,uBAAU,EAAC,QAAQ,CAAC,CAAC;AAEvC,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEvC,MAAM,IAAI,GAAG,IAAA,mCAAgB,EAAC,QAAQ,EAAE;IACtC,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC;IAC5B,MAAM,EAAE,KAAK;CACd,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,qBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,SAAS,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAExF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}
@@ -4,28 +4,23 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const cross_spawn_1 = __importDefault(require("cross-spawn"));
7
+ const buildWrapperArgs_1 = require("../utils/buildWrapperArgs");
7
8
  const resolveBin_1 = require("../utils/resolveBin");
8
9
  /**
9
10
  * `scripts prettier` — `--check` over `src/**\/*.{ts,tsx,json,css,md}`.
10
11
  *
11
- * Flag-only user args (e.g. `scripts prettier --write`) keep the default
12
- * glob so `--write` is enough. A path-like arg switches to fully
13
- * user-controlled invocation.
12
+ * Flag args pass through; the default glob is always appended so
13
+ * `scripts prettier --write` Just Works. Consumers that need a
14
+ * different target should call `prettier` directly from
15
+ * `node_modules/.bin`.
14
16
  */
15
17
  const prettierBin = (0, resolveBin_1.resolveBin)('prettier');
16
18
  const DEFAULT_GLOB = 'src/**/*.{ts,tsx,json,css,md}';
17
19
  const userArgs = process.argv.slice(2);
18
- const userProvidedPath = userArgs.some((a) => !a.startsWith('-'));
19
- let args;
20
- if (userArgs.length === 0) {
21
- args = ['--check', DEFAULT_GLOB];
22
- }
23
- else if (userProvidedPath) {
24
- args = userArgs;
25
- }
26
- else {
27
- args = [...userArgs, DEFAULT_GLOB];
28
- }
20
+ const args = (0, buildWrapperArgs_1.buildWrapperArgs)(userArgs, {
21
+ defaults: ['--check', DEFAULT_GLOB],
22
+ target: DEFAULT_GLOB,
23
+ });
29
24
  const result = cross_spawn_1.default.sync(process.execPath, [prettierBin, ...args], { stdio: 'inherit' });
30
25
  process.exit(result.status ?? 1);
31
26
  //# sourceMappingURL=prettier.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prettier.js","sourceRoot":"","sources":["../../src/command/prettier.ts"],"names":[],"mappings":";;;;;AAAA,8DAAgC;AAEhC,oDAAiD;AAEjD;;;;;;GAMG;AACH,MAAM,WAAW,GAAG,IAAA,uBAAU,EAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,YAAY,GAAG,+BAA+B,CAAC;AAErD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEvC,MAAM,gBAAgB,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAElE,IAAI,IAAc,CAAC;AAEnB,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC1B,IAAI,GAAG,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AACnC,CAAC;KAAM,IAAI,gBAAgB,EAAE,CAAC;IAC5B,IAAI,GAAG,QAAQ,CAAC;AAClB,CAAC;KAAM,CAAC;IACN,IAAI,GAAG,CAAC,GAAG,QAAQ,EAAE,YAAY,CAAC,CAAC;AACrC,CAAC;AAED,MAAM,MAAM,GAAG,qBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAE1F,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"prettier.js","sourceRoot":"","sources":["../../src/command/prettier.ts"],"names":[],"mappings":";;;;;AAAA,8DAAgC;AAEhC,gEAA6D;AAC7D,oDAAiD;AAEjD;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG,IAAA,uBAAU,EAAC,UAAU,CAAC,CAAC;AAE3C,MAAM,YAAY,GAAG,+BAA+B,CAAC;AAErD,MAAM,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEvC,MAAM,IAAI,GAAG,IAAA,mCAAgB,EAAC,QAAQ,EAAE;IACtC,QAAQ,EAAE,CAAC,SAAS,EAAE,YAAY,CAAC;IACnC,MAAM,EAAE,YAAY;CACrB,CAAC,CAAC;AAEH,MAAM,MAAM,GAAG,qBAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;AAE1F,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,CAAC,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Build the argv passed to an underlying CLI (eslint, prettier) for a
3
+ * `scripts <cmd>` wrapper, from the user-provided argv.
4
+ *
5
+ * - Empty input → `defaults` verbatim (the canonical no-args
6
+ * invocation, e.g. `['src', '--quiet']` for lint).
7
+ * - Non-empty input → user args (with the POSIX `--` end-of-options
8
+ * marker removed) followed by `target`.
9
+ *
10
+ * The previous heuristic tried to detect "user-provided path" by
11
+ * scanning for any argv entry not starting with `-`, then handed full
12
+ * control to the user. That broke two real consumer invocations:
13
+ *
14
+ * 1. `scripts lint --max-warnings 0` — the `0` value of the flag was
15
+ * misread as a path, so `src` was dropped and ESLint ran with no
16
+ * files.
17
+ * 2. `scripts lint -- --fix` — every arg started with `-`, so `src`
18
+ * was appended, but the surviving `--` separator forced ESLint to
19
+ * treat `--fix` and `src` as positional files.
20
+ *
21
+ * The wrapper is intentionally narrow: pass flags, get the default
22
+ * target. Consumers that need a non-default target should invoke the
23
+ * underlying CLI directly (`node_modules/.bin/eslint <path>`).
24
+ *
25
+ * @param userArgs - argv after `scripts <cmd>` (i.e. `process.argv.slice(2)`).
26
+ * @param options.defaults - argv to use when `userArgs` is empty.
27
+ * @param options.target - path/glob appended after user flags otherwise.
28
+ */
29
+ export declare function buildWrapperArgs(userArgs: string[], options: {
30
+ defaults: string[];
31
+ target: string;
32
+ }): string[];
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildWrapperArgs = buildWrapperArgs;
4
+ /**
5
+ * Build the argv passed to an underlying CLI (eslint, prettier) for a
6
+ * `scripts <cmd>` wrapper, from the user-provided argv.
7
+ *
8
+ * - Empty input → `defaults` verbatim (the canonical no-args
9
+ * invocation, e.g. `['src', '--quiet']` for lint).
10
+ * - Non-empty input → user args (with the POSIX `--` end-of-options
11
+ * marker removed) followed by `target`.
12
+ *
13
+ * The previous heuristic tried to detect "user-provided path" by
14
+ * scanning for any argv entry not starting with `-`, then handed full
15
+ * control to the user. That broke two real consumer invocations:
16
+ *
17
+ * 1. `scripts lint --max-warnings 0` — the `0` value of the flag was
18
+ * misread as a path, so `src` was dropped and ESLint ran with no
19
+ * files.
20
+ * 2. `scripts lint -- --fix` — every arg started with `-`, so `src`
21
+ * was appended, but the surviving `--` separator forced ESLint to
22
+ * treat `--fix` and `src` as positional files.
23
+ *
24
+ * The wrapper is intentionally narrow: pass flags, get the default
25
+ * target. Consumers that need a non-default target should invoke the
26
+ * underlying CLI directly (`node_modules/.bin/eslint <path>`).
27
+ *
28
+ * @param userArgs - argv after `scripts <cmd>` (i.e. `process.argv.slice(2)`).
29
+ * @param options.defaults - argv to use when `userArgs` is empty.
30
+ * @param options.target - path/glob appended after user flags otherwise.
31
+ */
32
+ function buildWrapperArgs(userArgs, options) {
33
+ if (userArgs.length === 0) {
34
+ return [...options.defaults];
35
+ }
36
+ const passthrough = userArgs.filter((a) => a !== '--');
37
+ return [...passthrough, options.target];
38
+ }
39
+ //# sourceMappingURL=buildWrapperArgs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildWrapperArgs.js","sourceRoot":"","sources":["../../src/utils/buildWrapperArgs.ts"],"names":[],"mappings":";;AA4BA,4CAQC;AApCD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,gBAAgB,CAAC,QAAkB,EAAE,OAA+C;IAClG,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IAC/B,CAAC;IAED,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAEvD,OAAO,CAAC,GAAG,WAAW,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;AAC1C,CAAC"}
package/llms.txt CHANGED
@@ -21,8 +21,12 @@ behind four commands: `create`, `dev`, `build`, `test`.
21
21
  | `audit` | `yarn npm audit --severity moderate --no-deprecations` (falls back to `npm audit --audit-level=moderate`) |
22
22
  | `validate` | Pre-merge gate: `check-types` + `prettier` + `lint` in parallel, then `test --watchAll=false`. `--skip=lint,prettier` to drop steps. |
23
23
 
24
- Every command accepts pass-through args — `scripts lint -- --fix`,
25
- `scripts prettier -- --write src/`, `scripts check-types -- -p tsconfig.build.json`, etc.
24
+ Every command accepts pass-through args — `scripts lint --fix`,
25
+ `scripts prettier --write`, `scripts check-types -p tsconfig.build.json`, etc.
26
+ Do **not** use the POSIX `--` end-of-options separator: `lint` and
27
+ `prettier` always append the default target (`src` / the default glob),
28
+ so `eslint -- --fix src` would treat `--fix` and `src` as positional
29
+ files. Pass flags directly.
26
30
 
27
31
  Use via `package.json#scripts` — the whole consumer file becomes thin:
28
32
 
@@ -33,8 +37,9 @@ Use via `package.json#scripts` — the whole consumer file becomes thin:
33
37
  "build": "scripts build",
34
38
  "test": "scripts test",
35
39
  "lint": "scripts lint",
36
- "lint:fix": "scripts lint -- --fix",
40
+ "lint:fix": "scripts lint --fix",
37
41
  "prettier": "scripts prettier",
42
+ "format": "scripts prettier --write",
38
43
  "check-types": "scripts check-types",
39
44
  "audit-dependencies": "scripts audit",
40
45
  "validate": "scripts validate"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@apollion-dsi/scripts",
3
- "version": "0.9.0",
3
+ "version": "0.9.2",
4
4
  "description": "Apollion Framework CLI",
5
5
  "main": "lib/index.js",
6
6
  "bin": "lib/bin.js",
@@ -30,7 +30,7 @@
30
30
  "author": "Apollion DS Team",
31
31
  "license": "ISC",
32
32
  "dependencies": {
33
- "@apollion-dsi/eslint-config": "0.7.0",
33
+ "@apollion-dsi/eslint-config": "0.8.0",
34
34
  "@babel/core": "7.29.0",
35
35
  "@babel/preset-env": "7.29.5",
36
36
  "@babel/preset-react": "7.28.5",
@@ -0,0 +1,73 @@
1
+ import { buildWrapperArgs } from '../utils/buildWrapperArgs';
2
+
3
+ describe('buildWrapperArgs', () => {
4
+ const lintOptions = { defaults: ['src', '--quiet'], target: 'src' };
5
+ const prettierOptions = {
6
+ defaults: ['--check', 'src/**/*.{ts,tsx,json,css,md}'],
7
+ target: 'src/**/*.{ts,tsx,json,css,md}',
8
+ };
9
+
10
+ describe('lint wrapper semantics', () => {
11
+ it('falls back to defaults when no user args', () => {
12
+ expect(buildWrapperArgs([], lintOptions)).toEqual(['src', '--quiet']);
13
+ });
14
+
15
+ it('returns a fresh defaults copy (does not alias the input array)', () => {
16
+ const defaults = ['src', '--quiet'];
17
+ const result = buildWrapperArgs([], { defaults, target: 'src' });
18
+
19
+ expect(result).not.toBe(defaults);
20
+ });
21
+
22
+ it('appends target after a single flag (lint --fix)', () => {
23
+ expect(buildWrapperArgs(['--fix'], lintOptions)).toEqual(['--fix', 'src']);
24
+ });
25
+
26
+ it('appends target after --flag=value form', () => {
27
+ expect(buildWrapperArgs(['--max-warnings=0'], lintOptions)).toEqual(['--max-warnings=0', 'src']);
28
+ });
29
+
30
+ it('appends target after --flag value (space-separated) form', () => {
31
+ // Regression: previously the literal `0` was misread as a path,
32
+ // dropping `src` from the eslint invocation so it ran with no files.
33
+ expect(buildWrapperArgs(['--max-warnings', '0'], lintOptions)).toEqual(['--max-warnings', '0', 'src']);
34
+ });
35
+
36
+ it('strips a POSIX `--` end-of-options marker before appending target', () => {
37
+ // Regression: the `--` previously survived into argv, so eslint
38
+ // treated `--fix` and `src` as positional file arguments and failed
39
+ // with "No files matching pattern '--fix'".
40
+ expect(buildWrapperArgs(['--', '--fix'], lintOptions)).toEqual(['--fix', 'src']);
41
+ });
42
+
43
+ it('strips multiple `--` markers (defensive)', () => {
44
+ expect(buildWrapperArgs(['--', '--fix', '--'], lintOptions)).toEqual(['--fix', 'src']);
45
+ });
46
+
47
+ it('preserves the order of user flags', () => {
48
+ expect(buildWrapperArgs(['--cache', '--max-warnings=0', '--fix'], lintOptions)).toEqual([
49
+ '--cache',
50
+ '--max-warnings=0',
51
+ '--fix',
52
+ 'src',
53
+ ]);
54
+ });
55
+ });
56
+
57
+ describe('prettier wrapper semantics', () => {
58
+ it('falls back to --check + DEFAULT_GLOB when no user args', () => {
59
+ expect(buildWrapperArgs([], prettierOptions)).toEqual(['--check', 'src/**/*.{ts,tsx,json,css,md}']);
60
+ });
61
+
62
+ it('appends DEFAULT_GLOB after --write', () => {
63
+ expect(buildWrapperArgs(['--write'], prettierOptions)).toEqual(['--write', 'src/**/*.{ts,tsx,json,css,md}']);
64
+ });
65
+
66
+ it('strips the `--` separator before appending DEFAULT_GLOB', () => {
67
+ expect(buildWrapperArgs(['--', '--write'], prettierOptions)).toEqual([
68
+ '--write',
69
+ 'src/**/*.{ts,tsx,json,css,md}',
70
+ ]);
71
+ });
72
+ });
73
+ });