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

clasp push hangs if .claspignore file is present #983

Open
dandv opened this issue Oct 26, 2023 · 5 comments
Open

clasp push hangs if .claspignore file is present #983

dandv opened this issue Oct 26, 2023 · 5 comments

Comments

@dandv
Copy link
Contributor

dandv commented Oct 26, 2023

This is odd given the basic level of functionality/breakage, but clasp push, which normally takes 5-10 seconds, hangs for over a minute if .claspignore is present. Whether it's empty, or it contains one line denoting a particular file (e.g. local-stuff.js, a file that does exist), the behavior is the same.

Expected Behavior

clasp push works fine:

$ ./node_modules/.bin/clasp push
⠋ Pushing files…
└─ /home/dandv/...
[...]
Pushed 10 files.

Actual Behavior

clasp push freezes/hangs:

$ ./node_modules/.bin/clasp push
⠹ Pushing files…





^C^C^C^C^C^C^C^C
^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C^C
⠸ Pushing files…

The ASCII spinner freezes for a while, then resumes spinning. I've run out of patience after 90+ seconds.

Steps to Reproduce the Problem

  1. Create file .claspignore, even empty.
  2. Run ./node_modules/.bin/clasp push

Specifications

  • Node version (node -v): v18.18.0
  • Version (clasp -v): 2.4.2
  • OS (Mac/Linux/Windows): Fedora 38
@iRupam
Copy link

iRupam commented Nov 18, 2023

@dandv Hi, I've tried just now. It's working for me as expected. Anyways, is your issue fixed?

@zawadsoon
Copy link

I observed this issue as well while investigating this one: #968

I believe the process does not hang or freeze; it simply requires more time because every single file in your node_modules/ directory is iterated to mark files as ignored. If you have a large number of dependencies, this can take a considerable amount of time. In my case, I installed some development dependencies to format my files.

Try deleting the node_modules/ and .git/ directories, and then run clasp status. You should see a significant performance improvement.

I believe everyone who tries to do something serious using clasp struggles with this performance issue.

If I find the time, I will attempt to open a PR to optimize this, as I have been using clasp extensively recently. I have an idea that ignored directories could be skipped completely unless a specific flag is provided by the user.

@buschtoens
Copy link

An alternative solution is moving all source files to be clasp push-ed into a sub-directory, such as ./src/, and then use that directory as the rootDir in .clasp.json:

{
  "scriptId": "<redacted>",
  "rootDir": "./src/"
}

@dandv
Copy link
Contributor Author

dandv commented Nov 13, 2024

@iRupam In the meantime I had switched to a /src/ subdir. However, since there have been no clasp releases in over a year, I don't believe the issue fixed itself; more likely my environment no longer triggers it.

@zawadsoon
Copy link

@dandv I wouldn't say it's an issue. It more like a pitfall. All works as expected here, but very slow under some circumstances.

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

4 participants