google / clasp

🔗 Command Line Apps Script Projects
https://developers.google.com/apps-script/guides/clasp
Apache License 2.0
4.52k stars 422 forks source link

`.clasp` "rootDir" directive does not use a relative path and causes lots of issues/confusion #1009

Open cleary opened 2 months ago

cleary commented 2 months ago

.clasp file:

{"scriptId":"XXXXXXXXXXXX-VG0d-XXXXXXXXXX-XXXXXXXXXXXXXXXX","rootDir":"/home/cleary/appscript/project1"}

Use case 1:

I have a clasp project on which there are two users working, and pushing changes to a git repo before deployment.

The .clasp file includes a "rootDir" directive for the project that is an absolute path including my username, which causes clasp pull to fail with a "Cound not write file." error (they have a different username of course).

Expected Behavior

I expect a collaborator to be able to git clone the repo, and be able to clasp pull with files landing in the correct (current) directory

Actual Behavior

Files are not written ("Could not write file."), because they are trying to write to another home directory altogether

Use case 2:

I have a clasp project at /home/cleary/appscript/project1/ and decide to rearrange my local directories, with the project1 folder moving to /home/cleary/source/project1/

Expected Behavior

I expect to clasp pull with files landing in the current directory

Actual Behavior

The files get written to the old path, and my current working directory does not get updated

Steps to Reproduce the Problem

  1. clasp pull a new project
  2. rename your project directory
  3. make a change in the remote appscript code editor
  4. clasp pull again, the updates are not applied in the current, renamed directory

Specifications