@fatagnus/convex-sync-check 0.1.2 → 0.2.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.
- package/dist/{chunk-HARLMPMI.js → chunk-DIBNW6FK.js} +12 -3
- package/dist/cli.js +8 -1
- package/dist/index.d.ts +1 -4
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -186,10 +186,19 @@ function analyze(defs, refs) {
|
|
|
186
186
|
}
|
|
187
187
|
|
|
188
188
|
// src/index.ts
|
|
189
|
+
function globToRegex(pattern) {
|
|
190
|
+
const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
|
|
191
|
+
return new RegExp(`^${escaped}$`);
|
|
192
|
+
}
|
|
193
|
+
function matchesAnyPattern(apiPath, patterns) {
|
|
194
|
+
return patterns.some((p) => globToRegex(p).test(apiPath));
|
|
195
|
+
}
|
|
189
196
|
function checkConvexSync(options) {
|
|
190
197
|
const defs = scanBackend(options.convexDir, options.functionWrappers);
|
|
191
198
|
const refs = scanFrontend(options.frontendDirs);
|
|
192
|
-
const { errors, warnings
|
|
199
|
+
const { errors, warnings } = analyze(defs, refs);
|
|
200
|
+
const ignorePatterns = options.ignore ?? [];
|
|
201
|
+
const filteredErrors = ignorePatterns.length > 0 ? errors.filter((e) => !matchesAnyPattern(e.apiPath, ignorePatterns)) : errors;
|
|
193
202
|
const publicFunctions = defs.filter((d) => !d.isInternal).length;
|
|
194
203
|
const internalFunctions = defs.filter((d) => d.isInternal).length;
|
|
195
204
|
const uniqueRefs = new Set(refs.map((r) => r.apiPath));
|
|
@@ -211,9 +220,9 @@ function checkConvexSync(options) {
|
|
|
211
220
|
frontendRefs: uniqueRefs.size,
|
|
212
221
|
backendModules: uniqueModules.size
|
|
213
222
|
},
|
|
214
|
-
errors,
|
|
223
|
+
errors: filteredErrors,
|
|
215
224
|
warnings: filteredWarnings,
|
|
216
|
-
passed
|
|
225
|
+
passed: filteredErrors.length === 0
|
|
217
226
|
};
|
|
218
227
|
}
|
|
219
228
|
|
package/dist/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
checkConvexSync
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DIBNW6FK.js";
|
|
4
4
|
|
|
5
5
|
// src/cli.ts
|
|
6
6
|
import { parseArgs } from "util";
|
|
@@ -252,15 +252,22 @@ async function main() {
|
|
|
252
252
|
...config.functionWrappers
|
|
253
253
|
};
|
|
254
254
|
const suppressWarnings = args.noWarnings ? ["UNREFERENCED"] : config.suppressWarnings;
|
|
255
|
+
const cliIgnore = args.ignore ? args.ignore.split(",").map((s) => s.trim()) : [];
|
|
256
|
+
const configIgnore = config.ignore ?? [];
|
|
257
|
+
const ignore = [...cliIgnore, ...configIgnore];
|
|
255
258
|
if (args.verbose) {
|
|
256
259
|
console.log(`Scanning backend: ${convexDir}`);
|
|
257
260
|
console.log(`Scanning frontend: ${frontendDirs.join(", ")}`);
|
|
261
|
+
if (ignore.length > 0) {
|
|
262
|
+
console.log(`Ignoring ${ignore.length} pattern(s)`);
|
|
263
|
+
}
|
|
258
264
|
}
|
|
259
265
|
const result = checkConvexSync({
|
|
260
266
|
convexDir,
|
|
261
267
|
frontendDirs,
|
|
262
268
|
functionWrappers: Object.keys(functionWrappers).length > 0 ? functionWrappers : void 0,
|
|
263
269
|
suppressWarnings,
|
|
270
|
+
ignore: ignore.length > 0 ? ignore : void 0,
|
|
264
271
|
verbose: args.verbose
|
|
265
272
|
});
|
|
266
273
|
result.project = layout.project;
|
package/dist/index.d.ts
CHANGED
|
@@ -37,10 +37,7 @@ interface CheckOptions {
|
|
|
37
37
|
convexDir?: string;
|
|
38
38
|
frontendDirs?: string[];
|
|
39
39
|
functionWrappers?: Record<string, "public" | "internal">;
|
|
40
|
-
ignore?:
|
|
41
|
-
backend?: string[];
|
|
42
|
-
frontend?: string[];
|
|
43
|
-
};
|
|
40
|
+
ignore?: string[];
|
|
44
41
|
suppressWarnings?: WarningType[];
|
|
45
42
|
deployed?: boolean;
|
|
46
43
|
verbose?: boolean;
|
package/dist/index.js
CHANGED