question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`clasp push` fails with custom root directory

See original GitHub issue

Expected Behavior

clasp push works when I’ve specified a custom rootDir in .clasp.json.

Actual Behavior

clasp push doesn’t work when I’ve specified a custom rootDir in .clasp.json.

PS C:\src\gas\XP Logbook> Get-Content .\.clasp.json
{
    "scriptId": "<SCRIPT_ID>",
    "rootDir": "../../git/xp-logbook/src"
}
PS C:\src\gas\XP Logbook> Get-ChildItem ..\..\git\xp-logbook\src\


    Directory: C:\src\git\xp-logbook\src


Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       2018-06-03     22:29                node_modules
-a----       2018-06-07     21:00             75 .claspignore
-a----       2018-06-07     19:45            442 appsscript.json
-a----       2018-06-07     19:45            825 database.js
-a----       2018-06-07     19:45            252 macros.js
-a----       2018-06-03     22:29            382 package-lock.json
-a----       2018-06-07     19:45            516 players.js
-a----       2018-06-07     19:45           5543 sessions.js
-a----       2018-06-07     19:45           1152 sheets.js
-a----       2018-06-07     18:43             50 _imports.js


PS C:\src\gas\XP Logbook> clasp push
Push failed. Errors:
Project contents must include a manifest file named appsscript.
Files to push were:
PS C:\src\gas\XP Logbook>

Steps to Reproduce the Problem

  1. Create a .clasp.json file with a valid scriptId and a custom rootDir
  2. clasp pull
  3. clasp push

It looks like files.getProjectFiles() strips rootDir, but commands.push() doesn’t add it back before attempting script.projects.updateContent().

https://github.com/google/clasp/blob/98026240317c4a5107dadc6b99daffb2ccb089e9/src/files.ts#L101-L110

Specifications

  • Node version 10.3.0
  • Clasp version 1.3.1
  • Windows 10 x64 v 1803

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
grantcommented, Aug 14, 2018

Hi @ShowMeBillyJo, @agektmr, @misterludden, Can you try installing the latest version, 1.5.3? I think I’ve solved this issue.

Tests:

clasp status
Not ignored files:
└─ ../dist/src/appsscript.json
└─ ../dist/src/hi.js

Ignored files:
clasp push
└─ ../dist/src/appsscript.json
└─ ../dist/src/hi.js
Pushed 2 files.
cat .clasp.json
{
  "scriptId":"11AIejfE3_Qbmh0BO1Yb0g75c0giLjWlghFcALj9BI6OTLHI7JyDU-Pph",
  "rootDir": "../dist/src"
}

Sorry for the troubles and delayed fix.

2reactions
grantcommented, Jul 29, 2018

I must have broken custom directories with typescript support. I’ll fix this issue next week.

In the meanwhile, use 1.4 for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google sheets: clasp push command fails - Stack Overflow
I am trying to push Google App Scripts code to cloud using the following command clasp push. But it fails with the following...
Read more >
UNPKG - @google/clasp
The CDN for @google/clasp. ... 57, - Easily add custom Google OAuth scopes ... 148, - `--rootDir <dir>`: Local directory in which clasp...
Read more >
CLASP Web App, Google Apps Script, Parcel JS ... - YouTube
In this tutorial we'll use CLASP with many other tools like Parcel JS bundler, Nodemon, Node JS and setup a Web App Google...
Read more >
Editor not updated after files added/removed via clasp
edit: I found that in my case the issue was due to a syntax error in one of the pushed files. If I...
Read more >
Google Apps Script to Visual Studio Code with Clasp
I don't mind the Google Apps Script built-in online editor. It provides word completion, error handling, and pretty formatting, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found