Skip to main content

What is the squarecloud.ignore file?

The squarecloud.ignore file lists the files and folders to leave out when you upload or commit an application. The Square Cloud CLI (upload, commit and zip) and the Square Cloud VS Code extension read the same file, with the same rules and the same defaults, so a project is packaged the same way by both. It uses .gitignore syntax: comments, wildcards, folder-only and root-only rules, and ! to bring a file back.

Creating the file

Create a file named squarecloud.ignore in the root of your project.
The file must be named exactly squarecloud.ignore. .gitignore is not read in its place: it often lists files the application needs to run, such as .env.

Always left out

These paths are ignored before your own rules, so you don’t need to list them:
  • node_modules
  • .git, .github and .vscode
  • package-lock.json, pnpm-lock.yaml and yarn.lock
Bring any of them back with a ! rule.

Lockfiles

Lockfiles stay out of the zip by default, so Square Cloud installs your dependencies from the version ranges in package.json. When you need the exact versions your lockfile pins, bring it back:

Syntax

Each line is a rule. A matching file or folder is left out of the upload. How the rules are applied:
  • The last matching line wins, so put ! rules after the rules they undo.
  • A file inside an ignored folder can’t be brought back. To keep one file of a folder, ignore the folder’s contents (logs/*) instead of the folder (logs/), then add !logs/keep.log.
  • Matching ignores case: Dist/ also matches dist.
  • Only trailing spaces are trimmed from a rule, never tabs. Escape a trailing space you want to keep with \ .
Use / for folder separators in patterns, including on Windows.

Common examples

Exclude development tools and generated files while keeping everything the application needs to run:
Don’t ignore a file your application reads at runtime. If your code loads secrets from a .env file and you list .env here, the application starts without them and a bot fails with an invalid token. Move those values to the application’s environment variables first; after that, leaving .env out of the upload is safe.

How it is applied

The CLI and the VS Code extension read squarecloud.ignore when preparing the files for upload or commit. Files that match a rule are left out of the zip sent to Square Cloud.
  • A symbolic link to a file is uploaded as the file it points to. Links to folders and broken links are skipped.
  • The CLI still reads the older names (.squareignore, .squarecloudignore and square.ignore) when squarecloud.ignore is missing, and asks you to rename the file.
Keep files required at runtime, such as the MAIN file from your configuration file, outside the ignored paths. The dashboard upload doesn’t read this file: when you build the zip yourself, leave those files out of it.