Giter VIP home page Giter VIP logo

clasp's Issues

Error: Request contains an invalid argument

Expected Behavior

Push code to script project

Actual Behavior

Request fails on clasp push:
Push failed. Errors:
Request contains an invalid argument.

Steps to Reproduce the Problem

My current project directory looks like:
-a---- 14.02.2018 13:15 73 .clasp.json
-a---- 02.03.2018 16:14 48 .claspignore
-a---- 02.03.2018 16:19 1172 appsscript.json

Push should defenetly work, there is not an issue with "ignoring" some files.

Specifications

  • Node version (node -v): v6.11.3
  • Version (npm list | grep clasp): +-- @google/[email protected]
  • OS (Mac/Linux/Windows): windows 10

UPD: there was a typo in appscript.json :/

Add shell functionality (`clasp run`)

Since clasp is running authorised, it would be nice if it could leverage the execution api to add a shell functionality.

Looking at firebase's Cloudfunctions where the shell is a powerfull tool.

`clasp push` changes the execution order of script files in Apps Script projects

Expected Behavior

clasp push should retain the order of the script files in the Apps Script Editor not just visually but also in terms of order of execution.

Actual Behavior

clasp push re-orders the files so that they are executed in alphabetical order even though visually they retain the expected order in the sidebar of the editor. This bug is hazardous to projects that rely on script files to execute as listed in the Apps Script editor.

Steps to Reproduce the Problem

  1. Create a stand-alone script project

  2. In that project create 6 script files in sequence and name them Z, Y, X, C, B and A; each with a Logger.log() that logs their respective names.
    screenshot_1

  3. Create a 7th script file and add the following function:
    screenshot_2

  4. Run that function from the menu bar Run>Run function>runTest and then view the logs View>Logs and you will get the following:
    screenshot_3

  5. Open your terminal and use clasp clone [PROJECT-FILE-ID] and then clasp push from the command line (project file id omitted from screenshot):
    screenshot_4

  6. Then run the test function again and then view the logs and you'll see the following:
    screenshot_5

The execution order of the scripts (though visually correct in the editor's sidebar) is changed to run in alphabetical order!

This bug wreaked havoc on one of my projects before I found it. I would love for clasp to be a part of my development workflow but that won't happen until this issue is resolved.

Specifications

  • Node version - v6.11.0
  • Clasp Version - 3.10.10
  • OS - Windows

Tag your Releases

Expected Behavior

All releases on npm are tagged and in sync with git.

Actual Behavior

Tags are severely lagging and or not tagged on github.

This is important in tracking down bugs and stable versions.

clasp push β€”watch

Add an option to watch local file changes and clasp push on file change.

clasp push β€”-watch

Use: https://www.npmjs.com/package/node-watch
Something like:

const watch = require('node-watch');
getProjectSettings().then(({ scriptId, rootDir }: ProjectSettings) => {
  watch(rootDir, { recursive: true }, (e, name) => {
    console.log(`${name} changed. Pushing...`);
    // Push...
    console.log('Pushed');
  });
}

Support proxy network

To use proxy network, like http(s) or socks5, I use http_proxy and https_proxy environment variable that are supported by many tools. Currently, clasp can't work in proxy environment, for example clasp login and clasp clone.

Don't overwrite appsscript.json on create

Noticed that create does a fetch of the newly created project and overwrites any local files. In some cases that's undesirable (e.g. clone a project from git, create a new project before pushing code.) Would be helpful to skip the fetch if current directory looks like a valid project (e.g. appsscript.json present)

Multiple project push

Expected Behavior

Abiliy pushing a project to multiple destination over add anoder id in '.clasp.json'

Actual Behavior

Steps to Reproduce the Problem

Specifications

  • Node version (node -v)
  • Version (npm list | grep clasp):
  • OS (Mac/Linux/Windows)

Offline Error Messages

If a user executes the clasp push command while the network is silently down, the following errors are shown. Can the script check for network connection before proceeding?

Push failed. Errors:
(node:67970) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'map' of undefined
    at /Users/labnol/digitalinspiration/node_modules/@google/clasp/index.js:587:46
    at /Users/labnol/digitalinspiration/node_modules/google-auth-library/build/src/auth/oauth2client.js:396:24
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:160:7)
(node:67970) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:67970) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Feature Request - Additions to CLI UI

@grant
Would you be open to adding some stying to the CLI like Firebase CLI?
If so, it would be great to be involved!

image

I have some suggestions using the same NPM packages that are used in the Firebase CLI.

Firstly is to add something to make the main clasp text stand out using figlet.js (possibly something like the images below but other suggestions are welcome):
clasp-cli

Second is to add some styling to errors and user input with chalk and Inquirer.js. An example of this might be to ask the user to set a name for otherwise undefined projects or to get them to select deployment versions. Similar to the Firebase CLI and Webpack CLI.

Thanks πŸ‘

Install fails on Ubuntu 16.04

After having an issue with the install on mac (#3), I gave my other machine a go.

I ran npm i @google/clasp -g per the installation instructions and got a npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules' (full output below). I then ran sudo npm i @google/clasp -g and got npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/.staging/resolve-384a17c1' -> '/usr/lib/node_modules/@google/clasp/node_modules/resolve' (full output also below).


Error output from npm i @google/clasp -g:

npm WARN checkPermissions Missing write access to /usr/lib/node_modules
/usr/lib
└─┬ @google/[email protected]
  β”œβ”€β”¬ [email protected]
  β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”‚ └─┬ [email protected]
  β”‚ β”‚ β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”‚ β”‚   β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”‚   β”‚ └── [email protected]
  β”‚ β”‚ β”‚ β”‚   β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”‚   β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”‚   β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”‚ β”‚   β”‚ └── [email protected]
  β”‚ β”‚ β”‚ β”‚   └── [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ └─┬ [email protected]
  β”‚ β”‚   └─┬ [email protected]
  β”‚ β”‚     └── [email protected]
  β”‚ └─┬ [email protected]
  β”‚   └── [email protected]
  β”œβ”€β”€ [email protected]
  β”œβ”€β”€ [email protected]
  β”œβ”€β”¬ [email protected]
  β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ └── [email protected]
  β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ └── [email protected]
  β”‚ β”œβ”€β”€ [email protected]
  β”‚ └── [email protected]
  β”œβ”€β”¬ [email protected]
  β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ └─┬ [email protected]
  β”‚ β”‚   └── [email protected]
  β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ └─┬ [email protected]
  β”‚ β”‚   └── [email protected]
  β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”œβ”€β”€ [email protected]
  β”‚ └── [email protected]
  β”œβ”€β”¬ [email protected]
  β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ └─┬ [email protected]
  β”‚ β”‚ β”‚   └─┬ [email protected]
  β”‚ β”‚ β”‚     └─┬ [email protected]
  β”‚ β”‚ β”‚       β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚       β”‚ └── [email protected]
  β”‚ β”‚ β”‚       └─┬ [email protected]
  β”‚ β”‚ β”‚         β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚         β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”‚         β”‚ └─┬ [email protected]
  β”‚ β”‚ β”‚         β”‚   └── [email protected]
  β”‚ β”‚ β”‚         └── [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ └─┬ [email protected]
  β”‚ β”‚ β”‚   └── [email protected]
  β”‚ β”‚ └─┬ [email protected]
  β”‚ β”‚   └── [email protected]
  β”‚ └─┬ [email protected]
  β”‚   β”œβ”€β”¬ [email protected]
  β”‚   β”‚ └── [email protected]
  β”‚   └── [email protected]
  β”œβ”€β”€ [email protected]
  β”œβ”€β”€ [email protected]
  β”œβ”€β”¬ [email protected]
  β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ └── [email protected]
  β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚ β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”‚ └── [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚ └─┬ [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ └── [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ └── [email protected]
  β”‚ β”‚   β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚ β”‚ └── [email protected]
  β”‚ β”‚   β”‚ └── [email protected]
  β”‚ β”‚   β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ β”‚ └── [email protected]
  β”‚ β”‚   β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚ └── [email protected]
  β”‚ β”‚   β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚ β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚ β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚ β”‚ └─┬ [email protected]
  β”‚ β”‚   β”‚ β”‚   └── [email protected]
  β”‚ β”‚   β”‚ └─┬ [email protected]
  β”‚ β”‚   β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”‚   └── [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ └── [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   β”œβ”€β”¬ [email protected]
  β”‚ β”‚   β”‚ └── [email protected]
  β”‚ β”‚   β”œβ”€β”€ [email protected]
  β”‚ β”‚   └── [email protected]
  β”‚ └── [email protected]
  β”œβ”€β”¬ [email protected]
  β”‚ └── [email protected]
  β”œβ”€β”€ [email protected]
  β”œβ”€β”¬ [email protected]
  β”‚ β”œβ”€β”€ [email protected]
  β”‚ └─┬ [email protected]
  β”‚   └── [email protected]
  β”œβ”€β”€ [email protected]
  β”œβ”€β”€ [email protected]
  β”œβ”€β”¬ [email protected]
  β”‚ β”œβ”€β”€ [email protected]
  β”‚ β”œβ”€β”€ [email protected]
  β”‚ └─┬ [email protected]
  β”‚   └── [email protected]
  β”œβ”€β”€ [email protected]
  β”œβ”€β”¬ [email protected]
  β”‚ └─┬ [email protected]
  β”‚   └─┬ [email protected]
  β”‚     β”œβ”€β”€ [email protected]
  β”‚     └── [email protected]
  β”œβ”€β”€ [email protected]
  └─┬ [email protected]
    β”œβ”€β”€ [email protected]
    └── [email protected]

npm ERR! Linux 4.4.0-43-Microsoft
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "@google/clasp" "-g"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! path /usr/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
npm ERR!     at Error (native)
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/whitecoop/npm-debug.log

Error output from sudo npm i @google/clasp -g:

/usr/lib
└── (empty)

npm ERR! Linux 4.4.0-43-Microsoft
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i" "@google/clasp" "-g"
npm ERR! node v6.11.4
npm ERR! npm  v3.10.10
npm ERR! path /usr/lib/node_modules/.staging/resolve-384a17c1
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall rename

npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/.staging/resolve-384a17c1' -> '/usr/lib/node_modules/@google/clasp/node_modules/resolve'
npm ERR!     at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:25:7)
npm ERR!     at /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:264:29npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/.staging/resolve-384a17c1' -> '/usr/lib/node_modules/@google/clasp/node_modules/resolve'
npm ERR!     at Error (native)
npm ERR!  { Error: EACCES: permission denied, rename '/usr/lib/node_modules/.staging/resolve-384a17c1' -> '/usr/lib/node_modules/@google/clasp/node_modules/resolve'
npm ERR!     at destStatted (/usr/lib/node_modules/npm/lib/install/action/finalize.js:25:7)
npm ERR!     at /usr/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:264:29npm ERR!     at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR!
npm ERR! Error: EACCES: permission denied, rename '/usr/lib/node_modules/.staging/resolve-384a17c1' -> '/usr/lib/node_modules/@google/clasp/node_modules/resolve'
npm ERR!     at Error (native) parent: '@google/clasp' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/whitecoop/npm-debug.log
npm ERR! code 1

Here's a gist with the full contents of npm-debug.log (which, based on the numbering in the file, I'm assuming is just from the sudo npm i @google/clasp -g command): https://gist.github.com/whitecoop/75531aa876f5437b6c0c61e188a61f04

clasp push hangs

Expected Behavior

Times out and or have a debugging capability from #65 to figure out why it is hanging.

Actual Behavior

❯ clasp push
\ Pushing files...   

Goes on forever

clasp deploy does not publish a new version of a Google Docs add-on

I might be misunderstanding the term "deployment" in the context of this CLI. I expect that when I deploy a new version of my add-on, it would publish a new version of the add-on.

Expected Behavior

That clasp deploy {version} would publish a new version of my Google docs add-on.

Actual Behavior

After running the above command and test out the published add-on, I don't see the changes in the version used above.

Steps to Reproduce the Problem

  1. Publish an add-on with initial functionality
  2. Make some noticeable changes to the add-on (so that you know if it gets published)
  3. Use clasp push to get your changes into your Google script
  4. Use clasp version and clasp deploy {version} to deploy your changes
  5. Test out add-on to see the published changes

Specifications

  • Node version (node -v): v8.9.4
  • Version (npm list | grep clasp): 1.1.1
  • OS (Mac/Linux/Windows): Windows

.claspignore fails **/node_modules/**

Expected Behavior

**/node_modules/**
**/**

Ignores all files in node_modules .

Actual Behavior

 follow-redirects options { protocol: 'https:',
  maxRedirects: 21,
  maxBodyLength: 10485760,
  path: '/v1/projects/SCRUBBED/content',
  method: 'put',
  headers:
   { Accept: 'application/json, text/plain, */*',
     'Content-Type': 'application/json;charset=utf-8',
     Authorization: 'Bearer SCRUBBED',
     'User-Agent': 'google-api-nodejs-client/1.3.1',
     'Content-Length': 3879 },
  agent: undefined,
  auth: undefined,
  hostname: 'script.googleapis.com',
  port: null,
  nativeProtocols:
   { 'http:':
      { _connectionListener: [Function: connectionListener],
        METHODS: [Array],
        STATUS_CODES: [Object],
        Agent: [Object],
        ClientRequest: [Object],
        globalAgent: [Object],
        IncomingMessage: [Object],
        OutgoingMessage: [Object],
        Server: [Object],
        ServerResponse: [Object],
        createServer: [Function: createServer],
        get: [Function: get],
        request: [Function: request] },
     'https:':
      { Server: [Object],
        createServer: [Function: createServer],
        globalAgent: [Object],
        Agent: [Object],
        request: [Function: request],
        get: [Function: get] } } } +0ms
Push failed. Errors:
Invalid value at 'files[2].type' (TYPE_ENUM), "D"

node_modules/fsevents/build/Release/.deps/Release/.node.d Is getting picked up with the following error.

Added logging to clasp produces:

{ name: 'node_modules/fsevents/build/Release/.deps/Release/.node.d' }
{ name: 'node_modules/fsevents/build/Release/.deps/Release/.node',
  type: 'D',
....}

from adding:

if (getAPIFileType(name) && !anymatch(ignorePatterns, name)) {
                                                nonIgnoredFilePaths.push(name);
                                                var file = {
                                                    name: formattedName,
                                                    type: getAPIFileType(name),
                                                    source: contents[i] //the file contents
                                                };
                                                console.log({name});
                                                console.log(file);
                                                return file;
                                            }

Only ignore which did work:

node_modules/**
node_modules/fsevents/build/Release/.deps/Release/.node.d
**/**

Specifications

  • Node version (node -v) : v8.9.4
  • Version (npm list | grep clasp): "@google/[email protected]"
  • OS (Mac/Linux/Windows): MAC

Maybe you guys should update or drop anymatch?

Error retrieving access token: Error: invalid_grant

I'm getting an odd error when trying to call clasp login. I'm successfully logged in and redirected but clasp is claiming an invalid token. I've also tried a few different accounts.

Steps to Reproduce the Problem

  1. clasp login
  2. allow the right account
  3. login successful return to terminal.
  4. Error retrieving access token: Error: invalid_grant

Specifications

  • Node version: 8.9.2
  • Version (npm list | grep clasp):

⟩ npm list -g | grep clasp
β”œβ”€β”¬ @google/[email protected]

  • OS mac

TypeError: console.err is not a function

clasp/index.js

Line 417 in 4cf4cc9

console.err(err);

This has logged an error in terminal(see below). Should be console.error() instead?

TypeError: console.err is not a function
at fs.writeFile (/usr/local/lib/node_modules/@google/clasp/index.js:417:23)
at /usr/local/lib/node_modules/@google/clasp/node_modules/graceful-fs/graceful-fs.js:43:10
at FSReqWrap.oncomplete (fs.js:135:15)

Empty files have "undefined" as contents

Expected Behavior

Empty gs files in apps script should be empty on local filesystem

Actual Behavior

Local file contains "undefined"

Steps to Reproduce the Problem

  1. create an empty gs file in apps script
  2. clasp clone the apps script project
  3. observe that the local file contains "undefined"

Specifications

  • Node version (node -v): 5.8.0
  • Version (npm list | grep clasp): Unknown but from bbf93d7
  • OS (Mac/Linux/Windows): Linux

clasp status: List files that are updated by push/pull

Expected Behavior

Running clasp status shows a list of files/directories that will be synced with script.google.com when using clasp push and clasp pull.

Proposed Example:

$ clasp status
Tracked by clasp:
.
β”œβ”€β”€ Code.js
β”œβ”€β”€ appsscript.json
└── html
    β”œβ”€β”€ Template.html
    └── javascript.html
1 directory, 4 files

Untracked:
.
└── node_modules/

The directory listing is similar to the tree command in linux or mac (via homebrew) that can be implemented using something like tree-cli

Untracked files can be picked up based on listing in .claspignore much like the way .gitignore works.

node.js - DeprecationWarning [DEP0013]

First of all: Thank you for this project, this is a godsend! I really like the idea of google AppScript but it's just a pain to develop without a proper IDE.

Upon trying it out, I've come upon a deprecation warning when cloning a project with node 8.9.3:

Cloned 4 files.
└─ Main.gs
(node:4835) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
└─ Api.gs
(node:4835) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
└─ Format.gs
(node:4835) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
└─ appsscript.json
(node:4835) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.

The warning relates to this Deprecation.

I've looked at the code but it seems that I'd have to dig into one of the dependencies. So for the time being, I'm just placing it here if anyone else stumbles upon it.

Remove fs write warning when fetching

There's a warning showing when fetching a project:

Warning: (node:46497) [DEP0013] DeprecationWarning: Calling an asynchronous function without callback is deprecated.
Node version: v9.0.0
Fix: In fetchProject, use a proper callback:

            fs.writeFile(`./${filePath}`, file.source, (err) => {
              if (err) console.error(err);
            });

Allow manifest, file list via CLI

Currently the file set to upload in the push command is automatically determined. It would be helpful to be able to specify files (both manifest and js) via the command line as well.

The particular use case is to be able to deploy different configurations -- e.g. in test mode I want to use an alternate manifest with execution API enabled, tests bundled, etc. while in prod mode I want to skip all that. This is particularly important for libraries where we don't want to have long-lived deployments, but may want to temporarily deploy as executable or web app for purposes of running tests and don't want to package code that is only used for resting.. Same can be used for add-ons and other things where we'd like to keep test code & configuration somewhat isolated.

My ideal is to have commands in package.json like:

"scripts": {
"push-test": "clasp push --env=test appsscript.test.json test/.js src/.js"
"push-prod": "clasp push --env=prod appscript.prod.json src/**.js",
...
}

Many CLIs allow specifying files via command line -- tsc, babel, jshint, etc.. all allow specifying which files to operate on as args. Typescript is also very close to what is being asked for. By default, it'll pick up all *.ts files as is the current behavior of clasp. But that can be overridden by explicitly providing a list of globs as args.

Do not rename .gs files to .js before pushing

Expected Behavior

When using : clasp push
a file named: Code.gs is still named Code.gs (locally, i'm not talking about remote)

Actual Behavior

When using : clasp push
a file named: Code.gs is renamed to Code.js

The project files should not be changed by the pushing operation.
Any preparation to the push operation should be done by the tool, without affecting project files.

Steps to Reproduce the Problem

  1. use clasp push with *.gs files

Specifications

  • Version (npm list | grep clasp): 1.1.5
  • OS (Mac/Linux/Windows): all ?

View Stackdriver logs

Expected Behavior

clasp logs
(DEBUG) {foo:42} – myFunction [2018-02-21T16:08:06.364Z]
clasp logs --json
[{
  "jsonPayload": {foo:42},
  ...
}, {...}]

Views StackDriver logs (console.log).

Actual Behavior

Command doesn't exist yet.

Notes

Example Stackdriver API result

{
  "insertId": "13oj0ajfyb6tdx",
  "jsonPayload": {foo:42},
  "labels": {…},
  "logName": "projects/project-id-4088669541713651222/logs/script.googleapis.com%2Fconsole_logs",
  "receiveTimestamp": "2018-02-21T16:08:07.370458993Z",
  "resource": {
    "labels": {
      "function_name": "myFunction",
      "invocation_type": "editor",
      "project_id": "project-id-4088669541713651222",
    },
    "type": "app_script_function"
  },
  "severity": "DEBUG",
  "timestamp": "2018-02-21T16:08:06.364Z",
}

Please πŸ‘ if you'd like this feature.

"Error: Request contains an invalid argument" on push and deploy

Expected Behavior

Push code to script project

Actual Behavior

Request fails on clasp push and on clasp redeploy. Redeploy has a more verbose error report:

    at new RequestError (/usr/lib/node_modules/@google/clasp/node_modules/google-auth-library/lib/transporters.js:34:42)
    at Request._callback (/usr/lib/node_modules/@google/clasp/node_modules/google-auth-library/lib/transporters.js:96:27)
    at Request.self.callback (/usr/lib/node_modules/@google/clasp/node_modules/request/request.js:186:22)
    at Request.emit (events.js:159:13)
    at Request.<anonymous> (/usr/lib/node_modules/@google/clasp/node_modules/request/request.js:1163:10)
    at Request.emit (events.js:159:13)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/@google/clasp/node_modules/request/request.js:1085:12)
    at Object.onceWrapper (events.js:254:19)
    at IncomingMessage.emit (events.js:164:20)
    at endReadableNT (_stream_readable.js:1062:12)
  code: 400,
  errors:
   [ { message: 'Request contains an invalid argument.',
       domain: 'global',
       reason: 'badRequest' } ] }

The auth library fails, so i tried logging back in and out and into another account to no avail

Steps to Reproduce the Problem

  1. My current project directory looks like:
β”œβ”€β”€ appsscript.json  
β”œβ”€β”€ build  
β”œβ”€β”€ node_modules  
β”œβ”€β”€ package.json  
β”œβ”€β”€ package-lock.json  
β”œβ”€β”€ README.md  
└── src  

With src and build as directories. The main apps script in my project is called build/Main.gs and should be pushed from the build directory.
2. My build system is currently just using babel to transpile syntax and perform a simple bundle of the src directory.
Besides that, I don't know what's out of the ordinary with my project. My Google account is personal, not organizational, so the auth issues don't come from that....

Specifications

  • Node version (node -v): v9.3.0
  • Version (npm list | grep clasp): @google/[email protected]
  • OS (Mac/Linux/Windows): Windows 10, WSL running Ubuntu 16.04

gcp-metadata module not found

Expected Behavior

no error?

Actual Behavior

Module not found error

Error: Cannot find module 'gcp-metadata'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/@google/clasp/node_modules/google-auth-library/build/src/auth/googleauth.js:55:19)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)

Steps to Reproduce the Problem

  1. Ran npm install -g @google/clasp
  2. Any clasp command issues same error

Specifications

  • Node version (node -v): 9.4
  • Version (npm list -g | grep clasp): 1.1.1
  • OS (Mac/Linux/Windows): mac 10.13

Add better default `clasp` message.

Currently, the command clasp with no arguments does not print anything.
We should print the output of clasp -h as the default command (clasp).

The last time I checked, the isDefault argument didn't work for npmjs.com/commander. See if we can make it work now.

Better Debug Logging

Optional debug logging would go a long way in figuring out what is going on in the clasp API when things do not work as expected. A very common practice in the node community is to utilize debug. If you want to gain lazy logging please have a look at debug-fabulous (shameless plug).

Expected Behavior

export DEBUG="@google/clasp*"

@google/clasp:getProjectSettings oh hi I am a debug statement

To turn on useful optional log messages.

Actual Behavior

Only errors are logged.

Examples

https://github.com/gulp-sourcemaps/gulp-sourcemaps/blob/master/src/debug.js#L1

https://github.com/gulp-sourcemaps/gulp-sourcemaps/blob/master/src/init/index.js#L49

Structure code: use the SAME structure char '/' for both window and other OS

Expected Behavior

The structure separator char should always be the same ('/') not depending on the OS you are running CLASP.

On script.google.com:

  • tests/slides.js
  • tests/sheets.js

locally:

  • tests/
    • slides.js
    • sheets.js

Actual Behavior

On Windows:

On script.google.com:

  • tests\slides.js
  • tests\sheets.js

locally on window:

  • tests/
    • slides.js
    • sheets.js

Steps to Reproduce the Problem

  1. On a computer with windows
  2. push your clasp project to a script file
  3. open the project on script.google.com

Specifications

  • OS (Windows)

Possible to specify directory for push / pull ?

Expected Behavior

I have my source files in an src directory, but do some transpiling which outputs the files to a build directory. Is it possible to specify a directory to push files from?

Actual Behavior

Files are pushed and pulled from the root of the repo

Specifications

  • Node version (node -v): any
  • Version (npm list | grep clasp): 1.0.7
  • OS (Mac/Linux/Windows): Mac

Install on mac fails

I'm running MacOS 10.11.6.

I ran the install with npm i @google/clasp -g. After the install clasp -h output -bash: clasp: command not found.

I then tried sudo npm i @google/clasp -g and got the same result.

I also restarted my terminal after both installs.

Looks like a path thing, but I haven't dug further. node -v gives v5.4.0 and npm -v gives v3.3.12

[email protected]

For the next version of clasp, I'd like to make it ridiculously simple and easy to use the tool.
Let's use features of modern CLIs.

Features

  • clasp/clasp push --watch (watches project file changes, pushes and logs updates)
  • clasp list #93 (requires Drive Scope)
  • clasp run foo #11 (define deployment name?)
  • clasp clone <scriptID> (autocomplete #69)
  • clasp logs #46
  • Optional Typescript Support #77 (Types / No Types)
    • Create a conversion guide (ex)
  • Autocomplete (vorpal) (example)
    • tab complete
    • select options

These updates will require a major version update (v2).

Docs

  • Update docs with all options for all commands
  • Add examples of ignoring files
    • clasp status?
  • Add a better way to version npm/git versions

Social

  • Blog (ex)
  • Video
  • Tweet

A new tab is opened when `clasp open` is executed

Expected Behavior

When I run clasp open, I want you to refresh the tab if there is a previously opened tab.

Actual Behavior

Another tab opens.
That behavior makes it hard to tell which is the latest code.

Steps to Reproduce the Problem

  1. invoke: clasp open
  2. invoke: clasp open

Specifications

  • Node version (node -v): v8.9.3
  • Version (npm list | grep clasp): 1.0.7
  • OS (Mac/Linux/Windows): Mac

Better error message when .claspignore is incorrect

Expected Behavior

Show this:

Push failed. Errors:
Invalid value at 'files[3].type' (TYPE_ENUM), "SUO"
Files to push were:
└─ Code.js
└─ appsscript.json
└─ index.html
└─ node_modules\dateformat\.vs\node-dateformat\v15\.suo
└─ script.js.html
└─ style.css.html

Actual Behavior

instead of this:

Push failed. Errors:
Invalid value at 'files[3].type' (TYPE_ENUM), "SUO"

PR forthcoming

Clasp deploy doesn't update the deployed version with Google Apps Script Web App

Expected Behavior

Perhaps I'm misunderstanding, but from the readme I'd thought that clasp deploy would allow me to publish a new version of a Web App (in this case bound to a google sheet).

I'd expected the workflow to be as follows:

  1. clasp version "My new version"

Created version xx.

  1. clasp deploy xx

yyyyyyyyyyyyyyyyy @XX

  1. clasp open
    browser opens to newly published version "xx"

Actual Behaviour

The version is created as expected, but the web app Project Version remains at the last deployed version not the version used with clasp deploy. To actually deploy it I have to go into the Script Editor then Publish > Deploy as Web App and then select the version "xx"

Related Issues

This seems related to #43, however that issue specifically relates to Chrome store apps and this is a Web App which the comments on that issue suggest should be supported.

Support options to specify dotfiles

Please support options to specify dotfiles. e.g: .clasp.json, .clasprc.json.

I would like to switch enviroment to deploy. eg: development, production...
So, If I can specify dotfiles by clasp's options, it is very useful.

Add possibility to store login by project

Feature request
I have a company project using clasp and a private one. When I'm switching projects, I need to change my clasp login inbetween.
If possible, it'd be nice to store a separate login projectwise instead of a global clasp login.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.