turbo-ignore 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +96 -0
  2. package/index.js +19 -3786
  3. package/package.json +12 -12
package/README.md ADDED
@@ -0,0 +1,96 @@
1
+ # `turbo-ignore`
2
+
3
+ To get started, use the following command as your [Ignored Build Step](https://vercel.com/docs/concepts/projects/overview#ignored-build-step):
4
+
5
+ ```sh
6
+ $ npx turbo-ignore
7
+ ```
8
+
9
+ This uses `turbo` to automatically determine if the current app has new changes that need to be deployed.
10
+
11
+ ## Usage
12
+
13
+ Use `npx turbo-ignore --help` to see list of options:
14
+
15
+ ```sh
16
+ turbo-ignore
17
+
18
+ Automatically ignore builds that have no changes
19
+
20
+ Usage:
21
+ $ npx turbo-ignore [<workspace>] [flags...]
22
+
23
+ If <workspace> is not provided, it will be inferred from the "name"
24
+ field of the "package.json" located at the current working directory.
25
+
26
+ Flags:
27
+ --fallback=<ref> On Vercel, if no previously deployed SHA is available to compare against,
28
+ fallback to comparing against the provided ref, or use "false" to
29
+ disable [default: HEAD^]
30
+ --help, -h Show this help message
31
+ --version, -v Show the version of this script
32
+ ```
33
+
34
+ ### Examples
35
+
36
+ ```sh
37
+ npx turbo-ignore
38
+ ```
39
+
40
+ > Only build if there are changes to the workspace in the current working directory, or any of it's dependencies. On Vercel, compare against the last successful deployment for the current branch. If this does not exist (first deploy of the branch), compare against the previous commit. When not on Vercel, always compare against the previous commit.
41
+
42
+ ---
43
+
44
+ ```sh
45
+ npx turbo-ignore docs
46
+ ```
47
+
48
+ > Only build if there are changes to the `docs` workspace, or any of it's dependencies. On Vercel, compare against the last successful deployment for the current branch. If this does not exist (first deploy of the branch), compare against the previous commit. When not on Vercel, always compare against the previous commit.
49
+
50
+ ---
51
+
52
+ ```sh
53
+ npx turbo-ignore --fallback=false
54
+ ```
55
+
56
+ > Only build if there are changes to the workspace in the current working directory, or any of it's dependencies. On Vercel, compare against the last successful deployment for the current branch. If this does not exist, (first deploy of the branch), the build will proceed. When not on Vercel, always compare against the previous commit.
57
+
58
+ ---
59
+
60
+ ```sh
61
+ npx turbo-ignore --fallback=HEAD~10
62
+ ```
63
+
64
+ > Only build if there are changes to the workspace in the current working directory, or any of it's dependencies. On Vercel, compare against the last successful deployment for the current branch. If this does not exist (first deploy of the branch), compare against the previous 10 commits. When not on Vercel, always compare against the previous commit.
65
+
66
+ ---
67
+
68
+ ```sh
69
+ npx turbo-ignore app --fallback=develop
70
+ ```
71
+
72
+ > Only build if there are changes to the `app` workspace, or any of it's dependencies. On Vercel, compare against the last successful deployment for the current branch. If this does not exist (first deploy of the branch), compare against the `develop` branch. When not on Vercel, always compare against the previous commit.
73
+
74
+ ## How it Works
75
+
76
+ `turbo-ignore` determines if a build should continue by analyzing the package dependency graph of the given workspace.
77
+
78
+ The _given workspace_ is determined by reading the "name" field in the "package.json" file located at the current working directory, or by passing in a workspace name as the first argument to `turbo-ignore`.
79
+
80
+ Next, it uses `turbo run build --dry` to determine if the given workspace, _or any dependencies of the workspace_, have changed since the previous commit.
81
+
82
+ **NOTE:** `turbo` determines dependencies from reading the dependency graph of the given workspace. This means a workspace **must** be listed as a `dependency` (or `devDependency`) in the given workspaces `package.json` for `turbo` to recognize it.
83
+
84
+ When deploying on [Vercel](https://vercel.com), `turbo-ignore` can make a more accurate decision by comparing between the current commit, and the last successfully deployed commit for the current branch.
85
+
86
+ **NOTE:** By default on Vercel, if the branch has not been deployed, `turbo-ignore` will fall back to comparing against the previous commit. To always deploy the first commit of a new branch, this fallback behavior can be disabled with `--fallback=false`, or customized by providing the `ref` to compare against (defaults to `HEAD^1`).
87
+
88
+ ## Releasing
89
+
90
+ ```sh
91
+ pnpm release
92
+ ```
93
+
94
+ ---
95
+
96
+ For more information about Turborepo, visit [turbo.build](https://turbo.build) and follow us on Twitter ([@turborepo](https://twitter.com/turborepo))!