Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out files and folders to exclude #5

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

iObject
Copy link
Collaborator

@iObject iObject commented Aug 21, 2024

No description provided.

@iObject iObject added the create-package create a temporary npm package on every commit label Aug 21, 2024
@iObject iObject linked an issue Aug 21, 2024 that may be closed by this pull request
@rokucommunity-bot
Copy link

Hey there! I just built a new temporary npm package based on 6a5ad9d. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/bsc-plugin-auto-findnode/releases/download/v0.0.0-packages/bsc-plugin-auto-findnode-0.1.0-3-ability-to-exclude-certain-folders-or-libraries.20240821180237.tgz

src/findNodes.ts Outdated Show resolved Hide resolved
@rokucommunity-bot
Copy link

Hey there! I just built a new temporary npm package based on 105b625. You can download it here or install it by running the following command:

npm install https://github.com/rokucommunity/bsc-plugin-auto-findnode/releases/download/v0.0.0-packages/bsc-plugin-auto-findnode-0.1.0-3-ability-to-exclude-certain-folders-or-libraries.20240821180512.tgz

@iObject iObject requested a review from chrisdp August 21, 2024 21:59
Copy link
Member

@TwitchBronBron TwitchBronBron left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to tweak the path filtering a bit more. It should walk through the filters one-by-one.

Something like:

let fileIsExcluded = false;
for(const filter of filters){
    let isFIlterNegated = filter.startsWith('!');
    if(filter.isMatch(filePath)){
        fileIsExcluded = !isFilterNegated;
    }
}
//we've made it through every path, `fileIsExcluded` now accurately represents what should happen to this file.

@@ -70,5 +70,8 @@
"ts-node": "^10.9.2",
"typescript": "^4.7.2",
"undent": "^0.1.0"
},
"dependencies": {
"minimatch": "^10.0.1"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's use the same version that's in brighterscript, just for consistency's sake. I'm sure they work in a similar fashion.

https://github.com/rokucommunity/brighterscript/blob/2d0f46b26e003701f0b69fcc7e1f3db07fc615c0/package.json#L149

@@ -16,112 +18,145 @@ function findChildrenWithIDs(children: Array<SGNode>): Map<string, Range> {
return foundIDs;
}

function getFilteredScopes(program: Program) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This exclusion logic is not correct. Each pattern operates based on the results of the previous pattern. For example:

[
    //exclude all vendor scripts
    "source/vendor/**/*",
    //except don't exclude rodash
    "!source/vendor/rodash/**/*",
    //except DO exclude this specific rodash file
    "source/vendor/rodash/_all.bs"
]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
create-package create a temporary npm package on every commit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to exclude certain folders or libraries
2 participants