-
Notifications
You must be signed in to change notification settings - Fork 429
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
Change in .clasp.json location & behavior with --rootDir #869
Comments
Additional issue: as the relative directory rootDir is also written to .clasp.json as given to the --rootDir option., clasp -P must also be called from a directory at a certain hierarchy. From the above, if we are in the % clasp -P src/ push
ENOENT: no such file or directory, open '../src/appsscript.json' If we can agree on desired behavior for |
also noticed this behavior breaking my app (built on https://github.com/enuchi/React-Google-Apps-Script) when npm decided to bump from clasp version 2.4.0 to 2.4.1! Might confuse others, especially if the breaking change comes from a minor version bump! |
I figured out that:
IF YOU ARE CREATING A NEW PROJECT( Google Sheets as Container in this example ) It's better you initialize the project with : cd ~/Desktop
mkdir my-gas-project
cd my-gas-project
clasp create --type sheets --title "MySheetsContainer" --rootDir . This let clasp create the Then, assumed your code bundler (ie. webpack ) put your code inside {
"scriptId": "1AFqeTOrlAA7TjcbAuW9Pqt_cxPVliUfeagV1YDS9WNHJK62RD8G2Lwt0",
"rootDir": "./dist", // <- HERE PUT YOUR BUNDLE DIRECTORY
"parentId": ["1lViSwkMtrnJcYSvi9NcvmO2OamJzgXz_dUoXNn0SxVQ"]
} IF YOU'VE ALREADY CREATED A PROJECTIn this case you should not have the So create {
"scriptId":"1AFqeTOrlAB7TrcbAuW9Pqt_cxPVliUfeagV1YDS9WNHJK62RD8G2Lwt0",
"rootDir":"./dist", // <- HERE PUT YOUR BUNDLE DIRECTORY
"parentId":["1lViSwuMtrnJcYHvi9NcvmO2OamJzgXz_dUoXNn0SxVQ"]
} |
I did the following:
Actual Result: The .clasp.json project file was created in the /myproject/src. Move the .clasp.json file Running clasp push from /myproject now works as expected. |
That worked for me too. Thanks a lot! |
I doubt this is the correct behavior, at least it's very counter-intuitive (#923). I think "specified directory" in #832 was misunderstood to mean "specified by
I'd interpret "project files" as "pushed files", as in telling clasp which subdirectory should be pushed, analogous to TypeScript's
This is no longer true, The suggested workaround with ProposalI propose the following changes to
I'd love to hear your thoughts on this! I'll look into creating a draft PR to see how this plays out. |
If I specify a rootDir it pushes the files but doesn't resolve them to be at the base, uploading them in a
Hence it's useless as the files don't appear in App Script. In the end I copied |
Steps to reproduce the problem
Expected Behavior
(as in 2.4.0:)
4. Success
Actual Behavior
(in 2.4.1:)
4. .clasp.json file (now in rootDir rather than same directory) not found; must run with clasp -P rootdir
Specifications
node -v
): 16.5.0clasp -v
): 2.4.1Presumably this is associated with #865 ; the new behavior may be the "correct" one, but failure to create .clasp.json in the working directory is a breaking change when that is expected (at least, for some of my scripts. :-) ) Is this worth specifying in documentation or release notes?
Thanks as always,
CDJ
The text was updated successfully, but these errors were encountered: