@codefast/cli 0.4.0 → 0.5.0-canary.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.
@@ -0,0 +1,20 @@
1
+ import picomatch from "picomatch";
2
+ //#region src/core/glob.ts
3
+ /**
4
+ * Compile a list of glob patterns into a predicate that returns `true` when its
5
+ * argument matches **any** of them (picomatch semantics). Returns a never-match
6
+ * predicate when no patterns are supplied.
7
+ *
8
+ * Shared by every "match a name/path against a configured pattern list" use
9
+ * (workspace excludes, `tag.skipPackages`, …) so the compile-then-`some` logic
10
+ * lives in one place.
11
+ *
12
+ * @since 0.5.0-canary.0
13
+ */
14
+ function createAnyGlobMatcher(patterns, options) {
15
+ if (!patterns || patterns.length === 0) return () => false;
16
+ const matchers = patterns.map((pattern) => picomatch(pattern, options));
17
+ return (value) => matchers.some((isMatch) => isMatch(value));
18
+ }
19
+ //#endregion
20
+ export { createAnyGlobMatcher };
@@ -1,9 +1,9 @@
1
1
  import { messageFrom } from "../errors.mjs";
2
2
  import { logger } from "../logger.mjs";
3
+ import { createAnyGlobMatcher } from "../glob.mjs";
3
4
  import { globSync } from "node:fs";
4
5
  import path from "node:path";
5
6
  import { fileURLToPath } from "node:url";
6
- import picomatch from "picomatch";
7
7
  import { parse } from "yaml";
8
8
  //#region src/core/workspace/resolver.ts
9
9
  /**
@@ -164,8 +164,8 @@ async function listWorkspacePackageDirectories(rootDirectoryPathAbsolute, fs, su
164
164
  foundRelativePosixPackageRoots.add(rel);
165
165
  }
166
166
  }
167
- const excludeMatchers = exclude.map((pat) => picomatch(pat, { dot: true }));
168
- const filteredRelative = [...foundRelativePosixPackageRoots].filter((rel) => !excludeMatchers.some((isMatch) => isMatch(rel)));
167
+ const isExcluded = createAnyGlobMatcher(exclude, { dot: true });
168
+ const filteredRelative = [...foundRelativePosixPackageRoots].filter((rel) => !isExcluded(rel));
169
169
  filteredRelative.sort((a, b) => a.localeCompare(b));
170
170
  return {
171
171
  packageDirectoryPathsAbsolute: filteredRelative.map((rel) => path.resolve(rootDirectoryPathAbsolute, rel.split("/").join(path.sep))),
package/dist/tag/sync.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { AppError, messageFrom } from "../core/errors.mjs";
2
2
  import { err, ok } from "../core/result.mjs";
3
+ import { createAnyGlobMatcher } from "../core/glob.mjs";
3
4
  import { resolveTagTargetCandidates } from "./target-candidates.mjs";
4
5
  import { runTagOnTarget } from "./target-runner.mjs";
5
6
  import path from "node:path";
@@ -83,17 +84,24 @@ function resolveTargetSelection(fs, candidate, rootDir) {
83
84
  packageName: candidate.packageName
84
85
  };
85
86
  }
87
+ /**
88
+ * Partition tag target candidates into those to tag and those to skip, matching
89
+ * each candidate's package name against `skipPackages` as glob patterns.
90
+ * Candidates without a package name (e.g. an explicit-target path) are never skipped.
91
+ *
92
+ * @since 0.5.0-canary.0
93
+ */
86
94
  function filterSkippedCandidates(targetCandidates, skipPackages) {
87
95
  if (!skipPackages || skipPackages.length === 0) return {
88
96
  includedCandidates: targetCandidates,
89
97
  skippedPackages: []
90
98
  };
91
- const skipPackageSet = new Set(skipPackages);
99
+ const isSkipped = createAnyGlobMatcher(skipPackages);
92
100
  const includedCandidates = [];
93
101
  const skippedPackages = [];
94
102
  for (const candidate of targetCandidates) {
95
103
  const packageName = candidate.packageName;
96
- if (packageName && skipPackageSet.has(packageName)) {
104
+ if (packageName && isSkipped(packageName)) {
97
105
  skippedPackages.push(packageName);
98
106
  continue;
99
107
  }
@@ -138,4 +146,4 @@ async function runOnResolvedTarget(fs, resolvedTarget, write, listener) {
138
146
  }
139
147
  }
140
148
  //#endregion
141
- export { runTagSync };
149
+ export { filterSkippedCandidates, runTagSync };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codefast/cli",
3
- "version": "0.4.0",
3
+ "version": "0.5.0-canary.0",
4
4
  "description": "Developer CLI for the Codefast monorepo (arrange, mirror, tag)",
5
5
  "keywords": [
6
6
  "cli",
@@ -59,14 +59,14 @@
59
59
  "zod": "^4.4.3"
60
60
  },
61
61
  "devDependencies": {
62
- "@types/node": "^26.0.0",
62
+ "@types/node": "^26.0.1",
63
63
  "@types/picomatch": "^4.0.3",
64
- "@typescript/native-preview": "7.0.0-dev.20260621.1",
64
+ "@typescript/native-preview": "7.0.0-dev.20260624.1",
65
65
  "@vitest/coverage-v8": "^4.1.9",
66
66
  "tsdown": "^0.22.3",
67
- "vite": "^8.0.16",
67
+ "vite": "~8.0.16",
68
68
  "vitest": "^4.1.9",
69
- "@codefast/typescript-config": "0.4.0"
69
+ "@codefast/typescript-config": "0.5.0-canary.0"
70
70
  },
71
71
  "engines": {
72
72
  "node": ">=24.0.0"