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

.claspignore is not ignoring anything in it #968

Open
sarahdriver opened this issue Jul 7, 2023 · 4 comments
Open

.claspignore is not ignoring anything in it #968

sarahdriver opened this issue Jul 7, 2023 · 4 comments

Comments

@sarahdriver
Copy link

sarahdriver commented Jul 7, 2023

Expected Behavior

I expected my .claspignore to ignore the files in it.

Actual Behavior

Nothing in .claspignore is being ignored. It also looks like it's not ignoring whatever starts with a period.

Steps to Reproduce the Problem

  1. Create a .claspignore file
  2. Put in every version possible of what I'm trying to ignore:
    /node_modules
    node_modules/
    node_modules/**
    /node_modules/
    node_modules//.*
    node_modules/
    /./**
    \node_modules
    node_modules
    node_modules*

    *\node_modules*
    node_modules*.
    node_modules*.**
    node_modules
  3. clasp status shows me way too much.
    (I am a newbie and I could be missing something, but still.)

Specifications

  • Node version (node -v): 18.16.0
  • Version (clasp -v): 2.4.2
  • OS (Mac/Linux/Windows): Windows
@dandv
Copy link
Contributor

dandv commented Oct 26, 2023

It also looks like it's not ignoring whatever starts with a period.

Same here, plus #983.

@lucia-gomez
Copy link

Also having this issue and it's blocking all work

@dotysan
Copy link

dotysan commented Mar 17, 2024

Brand new here with a big .venv/ and .git/ in my project. The clasp status output is a mess. And super inefficient! #694

It continues to recursively scan ignored folders. And spam the output with a long list of ignored files. So one might miss the short list of of included ones.

Workaround: clasp status |sed '/^Ignored/q'

Not ignored files:
└─ /foo/appsscript.json

Ignored files:

@zawadsoon
Copy link

I struggled with this one too and figured it out.

Maybe this information will help someone else. The multimatch package is used under the hood to ignore files. See:

clasp/src/files.ts

Lines 86 to 87 in d633ca9

const isIgnored = (file: string) =>
multimatch(path.relative(rootDir, file), ignorePatterns, {dot: true}).length > 0;

If you look at the multimatch docs, this package uses globbing patterns to match files. Now look at the mentioned code. If some of the provided patterns match the relative path, then a file is marked as ignored.

If you want to ignore directories, you should do:

.cache/**
.git/**
node-modules/**

If you want to ignore files, the file name is enough:

.gitignore
Makefile
README.md
package-lock.json
package.json

Notice that if you add a comment like # directories, it will be passed to multimatch function too.

I also noticed very poor performance when ignoring the node_modules/ directory, as all files inside are iterated.

I hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants