google / clasp Goto Github PK
View Code? Open in Web Editor NEWπ Command Line Apps Script Projects
Home Page: https://developers.google.com/apps-script/guides/clasp
License: Apache License 2.0
π Command Line Apps Script Projects
Home Page: https://developers.google.com/apps-script/guides/clasp
License: Apache License 2.0
Push code to script project
Request fails on clasp push:
Push failed. Errors:
Request contains an invalid argument.
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.
node -v
): v6.11.3npm list | grep clasp
): +-- @google/[email protected]UPD: there was a typo in appscript.json :/
Add instructions on how you can use 3P tools to lint Apps Script.
Try out these linters:
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
should retain the order of the script files in the Apps Script Editor not just visually but also in terms of order of execution.
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.
Create a stand-alone script project
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.
Run that function from the menu bar Run>Run function>runTest and then view the logs View>Logs and you will get the following:
Open your terminal and use clasp clone [PROJECT-FILE-ID]
and then clasp push
from the command line (project file id omitted from screenshot):
Then run the test function again and then view the logs and you'll see the following:
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.
All releases on npm are tagged and in sync with git.
Tags are severely lagging and or not tagged on github.
This is important in tracking down bugs and stable versions.
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');
});
}
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
.
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)
Abiliy pushing a project to multiple destination over add anoder id in '.clasp.json'
node -v
)npm list | grep clasp
):README instructions how to sync git push
with clasp push
via a git hook. Same with pull
.
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.
in readme: file.js
file.gs
@grant
Would you be open to adding some stying to the CLI like Firebase CLI?
If so, it would be great to be involved!
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):
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 π
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
Interested in running this in Google Cloud Shell but currently login
redirects to localhost. A --no-localhost
option would be useful.
Times out and or have a debugging capability from #65 to figure out why it is hanging.
β― clasp push
\ Pushing files...
Goes on forever
clasp list
Does a Drive search for Apps Script projects using files.list
.
https://developers.google.com/drive/v3/reference/files/list
q
:mimeType="application/vnd.google-apps.script"
Currently, only top-level dotfiles are ignored. Ignore dotfiles recursively.
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.
That clasp deploy {version}
would publish a new version of my Google docs add-on.
After running the above command and test out the published add-on, I don't see the changes in the version used above.
clasp push
to get your changes into your Google scriptclasp version
and clasp deploy {version}
to deploy your changesnode -v
): v8.9.4npm list | grep clasp
): 1.1.1**/node_modules/**
**/**
Ignores all files in node_modules .
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
**/**
node -v
) : v8.9.4npm list | grep clasp
): "@google/[email protected]"Maybe you guys should update or drop anymatch?
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.
npm list | grep clasp
):β© npm list -g | grep clasp
βββ¬ @google/[email protected]
Add an ISSUE_TEMPLATE.md like other google repos.
Line 417 in 4cf4cc9
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)
Are any of you working with gs files inside IntelliJ by any chance? Would be really nice to have a plugin to provide support. I found references to an older plugin that has been removed ( https://github.com/MichaelSnowden/intellij-gas-plugin ) with a clone here: ( https://github.com/kehh/intellij-gas-plugin ), but haven't tried it out yet to see if it works with clasp.
Empty gs files in apps script should be empty on local filesystem
Local file contains "undefined"
node -v
): 5.8.0npm list | grep clasp
): Unknown but from bbf93d7Running clasp status
shows a list of files/directories that will be synced with script.google.com
when using clasp push
and clasp pull
.
$ 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.
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.
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);
});
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.
When using : clasp push
a file named: Code.gs is still named Code.gs (locally, i'm not talking about remote)
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.
npm list | grep clasp
): 1.1.5clasp logs
(DEBUG) {foo:42} β myFunction [2018-02-21T16:08:06.364Z]
clasp logs --json
[{
"jsonPayload": {foo:42},
...
}, {...}]
Views StackDriver logs (console.log
).
Command doesn't exist yet.
{
"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.
Push code to script project
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
βββ 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....
node -v
): v9.3.0npm list | grep clasp
): @google/[email protected]no error?
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)
npm install -g @google/clasp
node -v
): 9.4npm list -g | grep clasp
): 1.1.1Currently, 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.
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).
export DEBUG="@google/clasp*"
@google/clasp:getProjectSettings oh hi I am a debug statement
To turn on useful optional log messages.
Only errors are logged.
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
On the script GUI, we can have multiple versions of a deployment, and specify which version applies to which deployment id: See https://developers.google.com/gmail/add-ons/how-tos/publish#publish_an_add-on.
clasp
doesn't seem to support this yet. Would love to have it!
The structure separator char should always be the same ('/') not depending on the OS you are running CLASP.
On script.google.com:
locally:
On Windows:
On script.google.com:
locally on window:
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?
Files are pushed and pulled from the root of the repo
node -v
): anynpm list | grep clasp
): 1.0.7I'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
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.
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
#46These updates will require a major version update (v2).
clasp status
?Give autocompletion for `clasp commands.
clasp <tab>
Vorpal seems to be based on commander
and provides these features.
When I run clasp open
, I want you to refresh the tab if there is a previously opened tab.
Another tab opens.
That behavior makes it hard to tell which is the latest code.
clasp open
clasp open
node -v
): v8.9.3npm list | grep clasp
): 1.0.7If .claspignore contains
**/**
!**/gs/**
gs/genericFile.js
clasp should ignore everything that isn't in /gs and ignore genericFile.js
Clasp still pushes genericFile.js; pushes contents of /gs
Seems kind of silly that you guys are making a functional clone of my tool...
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
instead of this:
Push failed. Errors:
Invalid value at 'files[3].type' (TYPE_ENUM), "SUO"
PR forthcoming
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:
Created version xx.
yyyyyyyyyyyyyyyyy @XX
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"
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.
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.
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.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.