Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Integralist
Copy link
Collaborator

Fixes #646

Context

The --watch flag (for the compute serve command) indicates to the Fastly CLI that all files within the Compute@Edge project directory need to be watched for changes.

The Fastly CLI will respect a .ignore or .gitignore file within the project directory (it also respects the user's global git ignore configuration as well).

New Feature

I've added a new --watch-dir flag which informs the Fastly CLI which directory it should start watching files from (defaults to the current directory, which is expected to be the associated Compute@Edge project directory).

Example

I've created a Compute@Edge project nested within another directory:

.
├── compute
│   ├── .gitignore
│   ├── Cargo.toml
│   ├── README.md
│   ├── fastly.toml
│   ├── rust-toolchain.toml
│   ├── src
└── foo

NOTE: foo (in the above tree output) is just a text file

The Fastly CLI must be run inside the compute directory as that is the Compute@Edge project, but now a user can provide the --watch-dir flag to indicate that changes to files outside of the directory need to be watched:

fastly compute serve --watch --watch-dir ../ --verbose

The above example uses a relative path from the compute directory up to the parent directory, but an absolute path works as well:

fastly compute serve --watch --watch-dir /Users/integralist/Code/test-projects/testing-fastly-cli/ --verbose

CAVEAT: The Fastly CLI only considers one set of ignore files. For example, with the above command executed, although I have .gitignore defined inside the compute directory, those patterns will not be used. Once the -watch-dir flag is set, it will look inside its specified directory for any ignore configuration.

Copy link
Member

@kailan kailan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@Integralist Integralist merged commit baaf9e0 into main Jan 18, 2023
@Integralist Integralist deleted the integralist/watch-dir branch January 18, 2023 15:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] fastly compute watch does not watch dependant packages

3 participants