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.

.claspignore fails **/node_modules/**

See original GitHub issue

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/clasp@1.1.5”
  • OS (Mac/Linux/Windows): MAC

Maybe you guys should update or drop anymatch?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:23 (11 by maintainers)

github_iconTop GitHub Comments

20reactions
dustinmichelscommented, Feb 13, 2019

Also, you can put all the files you do want to push in a folder (eg, src/ or GAS/) and then add a line in your .clasp.json file, specifying which folder to push.

{
  "scriptId": "1upj...vkY5",
  "rootDir": "GAS"
}

That works pretty well for me, as an alternative to using .claspignore.

7reactions
erickoledadevrelcommented, Feb 1, 2019

For the node_modules case I found success by adding the following three lines to .claspignore:

node_modules/**
node_modules/**/.*/**
node_modules/**/.*

That said, the .claspignore syntax should be made compatible with .gitignore as much as possible.

Read more comments on GitHub >

github_iconTop Results From Across the Web

@google/clasp - npm
Start using @google/clasp in your project by running `npm i @google/clasp`. There are 4 other projects in the npm registry using @google/clasp.
Read more >
How to Write Google Apps Script Code Locally in VS Code ...
Important note: as Google Apps Script doesn't currently support node modules, if you include the import 'google-apps-script'; line in the files ...
Read more >
How to force tsc to ignore node_modules folder?
\tsconfig.json < node_modules/@types/node/index.d.ts(6208,55): error ...
Read more >
Google CLASP (Command Line Apps Script Project) NEW TOOL
Apps Script: Google CLASP (Command Line Apps Script Project) NEW TOOL ... CLASP Web App, Google Apps Script, Parcel JS, Nodemon, Node JS...
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 >

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