Skip to content
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

Clarify what exactly the fileExtension setting in clasp.json does #1001

Open
dandv opened this issue Jan 30, 2024 · 2 comments
Open

Clarify what exactly the fileExtension setting in clasp.json does #1001

dandv opened this issue Jan 30, 2024 · 2 comments

Comments

@dandv
Copy link
Contributor

dandv commented Jan 30, 2024

Expected Behavior

My clasp.json looks like this:

{
  "scriptId": "1lIuKIOPX-...",
  "fileExtension": "gs",
  "filePushOrder": ["basics.gs"]
}

Actual Behavior

clasp push pushes all .ts and .js files, even from ./node_modules. I expected it to only push .gs files. Combined with #983, this seriously hinders usability.

The README section for fileExtension says,

Specifies the file extension for local script files in your Apps Script project.

What exactly does that mean?

Furthermore, the documentation for Push states it ignores files "That don't have an accepted file extension". Where is that accepted file extension configured?

Specifications

  • Node version (node -v): v18.19.0
  • Version (clasp -v): 2.4.2 (latest, released Sep 2022)
  • OS (Mac/Linux/Windows): Linux
@sqrrrl
Copy link
Member

sqrrrl commented Jan 30, 2024

fileExtension is used more for pulling from the apps script to local, but doesn't affect filtering when pushing.

Two recommendations for avoiding pushing node_modules:

  • Use .claspignore file to block node_modules and any other unnecessary sources
  • Set the rootdir property of the project to a subdir and keep apps script source there. Keep anything you don't want pushed above or parallel to that dir.

Personally I used the latter approach and point to a ./dist or ./build dir that contains the output of any build steps. That way you can use rollup or other tools to leverage modules, import npm packages, etc. and have it output code that is flattened and compatible with apps script as a runtime. See https://github.com/sqrrrl/apps-script-typescript-rollup-starter as an example (though realized I didn't check in the template clasp configs)

@dandv
Copy link
Contributor Author

dandv commented Jan 30, 2024

Thanks! Would be great to add that explanation of fileExtension in the README.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants