@pob/root 27.15.0 → 27.17.0

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.
@@ -223,65 +223,60 @@ const createConfig = ({
223
223
  );
224
224
  const matchesTscTrigger = createMatcher([tscTriggerPattern]);
225
225
 
226
- // Build tasks generate their own command so that lint-staged does not append
227
- // the matched filenames: they build the whole project. They return no command
228
- // at all when nothing they depend on changed.
229
- const createBuildTask = (command) => (allStagedFiles) =>
230
- allStagedFiles.map(toRelativePosixPath).some(matchesTscTrigger)
231
- ? command
232
- : [];
233
-
226
+ // Both build the whole project, in parallel.
227
+ const buildCommands = (
228
+ hasRollup
229
+ ? ["rollup --config rollup.config.mjs", hasTsconfig && "tsc -b"]
230
+ : [hasTsconfig && "tsc"]
231
+ ).filter(Boolean);
232
+
233
+ // A single function at the top level: lint-staged runs its commands
234
+ // sequentially and does not append the matched filenames. A function inside a
235
+ // list of tasks would have its commands run in parallel.
234
236
  return defineConfig({
235
- "*": [
236
- (allStagedFiles) => {
237
- const filenames = allStagedFiles.map(toRelativePosixPath);
238
- const hasPmFiles = filenames.some(matchesPmFiles);
239
- const eslintFilenames = filenames.filter(matchesEslint);
240
-
241
- // Running on the whole project is simpler and avoids too long command
242
- // lines when many files are staged.
243
- const withFilenamesOrWholeProject = (command, commandFilenames) => {
244
- if (commandFilenames.length === 0) return undefined;
245
- if (commandFilenames.length > MAX_FILENAMES) return command;
246
- return withFilenames(command, commandFilenames);
247
- };
248
-
249
- const getOxlintCommand = () => {
250
- if (!hasOxlint) return undefined;
251
- return withFilenamesOrWholeProject(
252
- OXLINT_FIX,
253
- eslintFilenames.filter(isOxlintSupportedFile),
254
- );
255
- };
256
-
257
- const getEslintCommand = () => {
258
- // eslint runs on the whole project when a package.json, the lockfile
259
- // or the package manager config changed, like in the legacy config,
260
- // as lint rules depend on the dependencies themselves.
261
- if (hasPmFiles) return ESLINT_FIX;
262
- return withFilenamesOrWholeProject(ESLINT_FIX, eslintFilenames);
263
- };
264
-
265
- return [
266
- ...(hasPmFiles ? installAndDedupe : []),
267
- hasPmFiles && pkg.scripts?.checks
268
- ? `${pm.name} run checks`
269
- : undefined,
270
- withFilenamesOrWholeProject(OXFMT, filenames),
271
- getOxlintCommand(),
272
- getEslintCommand(),
273
- hasPmFiles ? getGitAddPmFilesCommand() : undefined,
274
- ].filter(Boolean);
275
- },
276
- // Runs after the tasks above, so that the build sees the formatted and
277
- // fixed files. Both commands build the whole project, in parallel.
278
- hasRollup
279
- ? [
280
- createBuildTask("rollup --config rollup.config.mjs"),
281
- hasTsconfig && createBuildTask("tsc -b"),
282
- ].filter(Boolean)
283
- : hasTsconfig && createBuildTask("tsc"),
284
- ].filter(Boolean),
237
+ "*": (allStagedFiles) => {
238
+ const filenames = allStagedFiles.map(toRelativePosixPath);
239
+ const hasPmFiles = filenames.some(matchesPmFiles);
240
+ const eslintFilenames = filenames.filter(matchesEslint);
241
+
242
+ // Running on the whole project is simpler and avoids too long command
243
+ // lines when many files are staged.
244
+ const withFilenamesOrWholeProject = (command, commandFilenames) => {
245
+ if (commandFilenames.length === 0) return undefined;
246
+ if (commandFilenames.length > MAX_FILENAMES) return command;
247
+ return withFilenames(command, commandFilenames);
248
+ };
249
+
250
+ const getOxlintCommand = () => {
251
+ if (!hasOxlint) return undefined;
252
+ return withFilenamesOrWholeProject(
253
+ OXLINT_FIX,
254
+ eslintFilenames.filter(isOxlintSupportedFile),
255
+ );
256
+ };
257
+
258
+ const getEslintCommand = () => {
259
+ // eslint runs on the whole project when a package.json, the lockfile
260
+ // or the package manager config changed, like in the legacy config,
261
+ // as lint rules depend on the dependencies themselves.
262
+ if (hasPmFiles) return ESLINT_FIX;
263
+ return withFilenamesOrWholeProject(ESLINT_FIX, eslintFilenames);
264
+ };
265
+
266
+ return [
267
+ ...(hasPmFiles ? installAndDedupe : []),
268
+ hasPmFiles && pkg.scripts?.checks ? `${pm.name} run checks` : undefined,
269
+ withFilenamesOrWholeProject(OXFMT, filenames),
270
+ getOxlintCommand(),
271
+ getEslintCommand(),
272
+ hasPmFiles ? getGitAddPmFilesCommand() : undefined,
273
+ // after the tasks above, so that the build sees the formatted and
274
+ // fixed files
275
+ buildCommands.length > 0 && filenames.some(matchesTscTrigger)
276
+ ? buildCommands
277
+ : undefined,
278
+ ].filter(Boolean);
279
+ },
285
280
  });
286
281
  };
287
282
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pob/root",
3
- "version": "27.15.0",
3
+ "version": "27.17.0",
4
4
  "description": "root package",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/christophehurpeau/pob",
@@ -63,20 +63,20 @@
63
63
  "access": "public"
64
64
  },
65
65
  "dependencies": {
66
- "@commitlint/format": "21.0.1",
67
- "@commitlint/lint": "21.0.2",
68
- "@commitlint/types": "21.0.1",
69
- "@pob/version": "6.5.1",
70
- "conventional-changelog-conventionalcommits": "^9.1.0",
71
- "conventional-changelog-writer": "^8.2.0",
72
- "conventional-commits-parser": "^6.2.1",
66
+ "@commitlint/format": "21.2.3",
67
+ "@commitlint/lint": "21.2.3",
68
+ "@commitlint/types": "21.2.3",
69
+ "@pob/version": "7.1.0",
70
+ "conventional-changelog-conventionalcommits": "^10.0.0",
71
+ "conventional-changelog-writer": "^9.0.0",
72
+ "conventional-commits-parser": "^7.0.0",
73
73
  "json5": "^2.2.3",
74
- "lint-staged": "17.4.1",
74
+ "lint-staged": "17.6.0",
75
75
  "oxfmt": "0.72.0",
76
76
  "oxlint": "1.85.0",
77
77
  "oxlint-tsgolint": "7.0.2003",
78
78
  "picomatch": "^4.0.7",
79
- "pob-dependencies": "27.12.0",
79
+ "pob-dependencies": "27.14.0",
80
80
  "semver": "^7.7.3"
81
81
  },
82
82
  "engines": {