这是indexloc提供的服务,不要输入任何密码
Skip to content

CLI papercuts #277

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

Merged
merged 1 commit into from
Dec 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions cli/internal/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ Options:
--help Show this message.
--scope Specify package(s) to act as entry points for task
execution. Supports globs.
--cache-dir Specify local filesystem cache directory.
(default "./node_modules/.cache/turbo")
--concurrency Limit the concurrency of task execution. Use 1 for
serial (i.e. one-at-a-time) execution. (default 10)
--continue Continue execution even if a task exits with an error
Expand All @@ -74,6 +76,9 @@ Options:
--force Ignore the existing cache (to force execution).
(default false)
--graph Generate a Dot graph of the task execution.
--global-deps Specify glob of global filesystem dependencies to
be hashed. Useful for .env and files in the root
directory. Can be specified multiple times.
--since Limit/Set scope to changed packages since a
mergebase. This uses the git diff ${target_branch}...
mechanism to identify which packages have changed.
Expand All @@ -85,10 +90,10 @@ Options:
You can load the file up in chrome://tracing to see
which parts of your build were slow.
--parallel Execute all tasks in parallel. (default false)
--includeDependencies Include the dependencies of tasks in execution.
--include-dependencies Include the dependencies of tasks in execution.
(default false)
--no-deps Exclude dependent task consumers from execution.
(default false)
--no-deps Exclude affected/dependent task consumers from
execution. (default false)
--no-cache Avoid saving task results to the cache. Useful for
development/watch tasks. (default false)
`)
Expand Down Expand Up @@ -720,7 +725,7 @@ func parseRunArgs(args []string, cwd string) (*RunOptions, error) {
return nil, errors.Errorf("At least one task must be specified.")
}

unresolvedCacheFolder := "./node_modules/.cache/turbo"
unresolvedCacheFolder := filepath.FromSlash("./node_modules/.cache/turbo")

for argIndex, arg := range args {
if arg == "--" {
Expand All @@ -742,7 +747,7 @@ func parseRunArgs(args []string, cwd string) (*RunOptions, error) {
}
case strings.HasPrefix(arg, "--global-deps="):
if len(arg[len("--global-deps="):]) > 1 {
runOptions.globalDeps = append(runOptions.ignore, arg[len("--global-deps="):])
runOptions.globalDeps = append(runOptions.globalDeps, arg[len("--global-deps="):])
}
case strings.HasPrefix(arg, "--cwd="):
if len(arg[len("--cwd="):]) > 1 {
Expand All @@ -764,7 +769,10 @@ func parseRunArgs(args []string, cwd string) (*RunOptions, error) {
case strings.HasPrefix(arg, "--no-cache"):
runOptions.cache = true
case strings.HasPrefix(arg, "--cacheFolder"):
log.Printf("[WARNING] The --cacheFolder flag has been deprecated and will be removed in future versions of turbo. Please use `--cache-dir` instead")
unresolvedCacheFolder = arg[len("--cacheFolder="):]
case strings.HasPrefix(arg, "--cache-dir"):
unresolvedCacheFolder = arg[len("--cache-dir="):]
case strings.HasPrefix(arg, "--continue"):
runOptions.bail = false
case strings.HasPrefix(arg, "--force"):
Expand Down Expand Up @@ -792,6 +800,7 @@ func parseRunArgs(args []string, cwd string) (*RunOptions, error) {
}
}
case strings.HasPrefix(arg, "--includeDependencies"):
case strings.HasPrefix(arg, "--include-dependencies"):
runOptions.ancestors = true
case strings.HasPrefix(arg, "--only"):
runOptions.only = true
Expand Down
25 changes: 23 additions & 2 deletions docs/pages/docs/reference/command-line-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,16 @@ Run NPM scripts across all packages in specified scope. Tasks must be specified

### Options

#### `--cache-dir`

`type: string`

Defaults to `./node_modules/.cache/turbo`. Specify local filesystem cache directory. Be sure to add this folder to your `.gitignore` if you change it from the default.

```sh
turbo run build --cache-dir="./my-cache"
```

#### `--concurrency`

`type: number`
Expand All @@ -52,7 +62,7 @@ turbo run build --continue
Set the working directory of the command.

```sh
turbo run build --cwd ./somewhere/else
turbo run build --cwd=./somewhere/else
```

#### `--deps`
Expand Down Expand Up @@ -102,6 +112,17 @@ Ignore existing cached artifacts and forcibly re-execute all tasks (overwriting
turbo run build --force
```

#### `--global-deps`

Specify glob of global filesystem dependencies to be hashed. Useful for .env and files in the root directory that impact multiple packages/apps.
Can be specified multiple times.

```sh
turbo run build --global-deps=".env.*" --global-deps=".eslintrc" --global-deps="jest.config.js"
```

You can also specify these in your `turbo` configuration as `globalDependencies` key.

#### `--ignore`

`type: string[]`
Expand Down Expand Up @@ -130,7 +151,7 @@ Just a quick overview.
- `{}` allows for a comma-separated list of "or" expressions
- `!` at the beginning of a pattern will negate the match

#### `--includeDependencies`
#### `--include-dependencies`

Default `false`. When `true`, `turbo` will add any packages that the packages in the current execution scope _depend_ on (i.e. those declared in `dependencies` or `devDependencies`).

Expand Down