mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 00:02:23 +00:00
improve gitignore parser
This commit is contained in:
+3
-1
@@ -1,3 +1,5 @@
|
||||
import Gitignore from "npm:gitignore-fs";
|
||||
|
||||
// windmill
|
||||
export { setClient } from "https://deno.land/x/windmill@v1.226.1/mod.ts";
|
||||
export * from "https://deno.land/x/windmill@v1.226.1/windmill-api/index.ts";
|
||||
@@ -40,7 +42,7 @@ export * as cbor from "https://deno.land/x/cbor@v1.4.1/index.js";
|
||||
export { default as Murmurhash3 } from "https://deno.land/x/murmurhash@v1.0.0/mod.ts";
|
||||
export { default as microdiff } from "https://deno.land/x/microdiff@v1.3.1/index.ts";
|
||||
export { default as objectHash } from "https://deno.land/x/object_hash@2.0.3.1/mod.ts";
|
||||
export { default as gitignore_parser } from "npm:gitignore-parser";
|
||||
export * as ignore from "npm:ignore";
|
||||
export { default as JSZip } from "npm:jszip@3.7.1";
|
||||
export * as log from "https://deno.land/std@0.186.0/log/mod.ts";
|
||||
export {
|
||||
|
||||
+7
-7
@@ -4,7 +4,7 @@ import {
|
||||
Command,
|
||||
Confirm,
|
||||
ensureDir,
|
||||
gitignore_parser,
|
||||
ignore,
|
||||
JSZip,
|
||||
path,
|
||||
ScriptService,
|
||||
@@ -439,15 +439,15 @@ export const isWhitelisted = (p: string) => {
|
||||
};
|
||||
export async function ignoreF() {
|
||||
try {
|
||||
const ignore: {
|
||||
accepts(file: string): boolean;
|
||||
denies(file: string): boolean;
|
||||
} = gitignore_parser.compile(await Deno.readTextFile(".wmillignore"));
|
||||
|
||||
const ignoreContent = await Deno.readTextFile(".wmillignore");
|
||||
const ign = ignore.default().add(ignoreContent);
|
||||
// new Gitignore.default({ initialRules: ignoreContent.split("\n")}).ignoreContent).compile();
|
||||
return (p: string, isDirectory: boolean) => {
|
||||
p = path.relative(Deno.cwd(), p);
|
||||
|
||||
return (
|
||||
!isWhitelisted(p) &&
|
||||
(isNotWmillFile(p, isDirectory) || (!isDirectory && ignore.denies(p)))
|
||||
(isNotWmillFile(p, isDirectory) || (!isDirectory && ign.ignores(p)))
|
||||
);
|
||||
};
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user