turbo-ignore 0.2.0 → 0.3.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.
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "turbo-ignore",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "",
5
5
  "homepage": "https://turborepo.org",
6
6
  "keywords": [],
@@ -18,9 +18,7 @@
18
18
  "bin": "index.js",
19
19
  "devDependencies": {
20
20
  "typescript": "^4.7.4",
21
- "turbo-utils": "0.0.0",
22
21
  "tsup": "^5.12.1",
23
- "tsconfig": "0.0.0",
24
22
  "ts-jest": "^27.1.1",
25
23
  "jest": "^27.4.3",
26
24
  "eslint": "^8.20.0",
@@ -1,13 +0,0 @@
1
- turbo-ignore:build: cache hit, replaying output 22f77e7f2d7f142a
2
- turbo-ignore:build: 
3
- turbo-ignore:build: > turbo-ignore@0.0.39 build /Users/knickman/Developer/vercel/development/turborepo/packages/turbo-ignore
4
- turbo-ignore:build: > tsup index.js --format=cjs && cp ./package.json ./dist/package.json "--cool"
5
- turbo-ignore:build: 
6
- turbo-ignore:build: CLI Building entry: index.js
7
- turbo-ignore:build: CLI tsup v5.12.6
8
- turbo-ignore:build: CLI Target: node12
9
- turbo-ignore:build: CJS Build start
10
- turbo-ignore:build: CJS ⚡️ Build success in 32ms
11
- turbo-ignore:build: CJS dist/index.js 136.58 KB
12
- turbo-ignore:build: cp: --cool is not a directory
13
- turbo-ignore:build:  ELIFECYCLE  Command failed with exit code 1.
@@ -1,5 +0,0 @@
1
- turbo-ignore:check-types: cache hit, replaying output cc6ee767690bb4b9
2
- turbo-ignore:check-types: 
3
- turbo-ignore:check-types: > turbo-ignore@0.1.0 check-types /Users/knickman/Developer/vercel/development/turborepo/packages/turbo-ignore
4
- turbo-ignore:check-types: > tsc --noEmit
5
- turbo-ignore:check-types: 
@@ -1,6 +0,0 @@
1
- turbo-ignore:lint: cache hit, replaying output f9501944cf35e2b0
2
- turbo-ignore:lint: 
3
- turbo-ignore:lint: > turbo-ignore@0.1.0 lint /Users/knickman/Developer/vercel/development/turborepo/packages/turbo-ignore
4
- turbo-ignore:lint: > eslint src/**/*.ts
5
- turbo-ignore:lint: 
6
- turbo-ignore:lint: Warning: React version was set to "detect" in eslint-plugin-react settings, but the "react" package is not installed. Assuming latest React version for linting.
@@ -1,17 +0,0 @@
1
- turbo-ignore:test: cache hit, replaying output 9a464a91e0c65822
2
- turbo-ignore:test: 
3
- turbo-ignore:test: > turbo-ignore@0.1.0 test /Users/knickman/Developer/vercel/development/turborepo/packages/turbo-ignore
4
- turbo-ignore:test: > jest
5
- turbo-ignore:test: 
6
- turbo-ignore:test: PASS __tests__/ignore.test.ts
7
- turbo-ignore:test:  turbo-ignore
8
- turbo-ignore:test:  getComparison()
9
- turbo-ignore:test:  ✓ uses headRelative comparison when not running Vercel CI (2 ms)
10
- turbo-ignore:test:  ✓ returns null when running in Vercel CI with no VERCEL_GIT_PREVIOUS_SHA (1 ms)
11
- turbo-ignore:test:  ✓ used previousDeploy when running in Vercel CI with VERCEL_GIT_PREVIOUS_SHA
12
- turbo-ignore:test: 
13
- turbo-ignore:test: Test Suites: 1 passed, 1 total
14
- turbo-ignore:test: Tests: 3 passed, 3 total
15
- turbo-ignore:test: Snapshots: 2 passed, 2 total
16
- turbo-ignore:test: Time: 1.022 s
17
- turbo-ignore:test: Ran all test suites.
package/README.md DELETED
@@ -1,11 +0,0 @@
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
- For more information about Turborepo, [visit turborepo.org](https://turborepo.org) and follow us on Twitter ([@turborepo](https://twitter.com/turborepo))!
@@ -1,29 +0,0 @@
1
- import { getComparison } from "../src/getComparison";
2
-
3
- describe("turbo-ignore", () => {
4
- describe("getComparison()", () => {
5
- it("uses headRelative comparison when not running Vercel CI", async () => {
6
- expect(getComparison()).toMatchInlineSnapshot(`
7
- Object {
8
- "ref": "HEAD^",
9
- "type": "headRelative",
10
- }
11
- `);
12
- });
13
- it("returns null when running in Vercel CI with no VERCEL_GIT_PREVIOUS_SHA", async () => {
14
- process.env.VERCEL = "1";
15
- expect(getComparison()).toBeNull();
16
- });
17
-
18
- it("used previousDeploy when running in Vercel CI with VERCEL_GIT_PREVIOUS_SHA", async () => {
19
- process.env.VERCEL = "1";
20
- process.env.VERCEL_GIT_PREVIOUS_SHA = "mygitsha";
21
- expect(getComparison()).toMatchInlineSnapshot(`
22
- Object {
23
- "ref": "mygitsha",
24
- "type": "previousDeploy",
25
- }
26
- `);
27
- });
28
- });
29
- });
package/dist/package.json DELETED
@@ -1,38 +0,0 @@
1
- {
2
- "name": "turbo-ignore",
3
- "version": "0.2.0",
4
- "description": "",
5
- "homepage": "https://turborepo.org",
6
- "keywords": [],
7
- "author": "Jared Palmer",
8
- "license": "MPL-2.0",
9
- "repository": {
10
- "type": "git",
11
- "url": "https://github.com/vercel/turborepo",
12
- "directory": "packages/turbo-ignore"
13
- },
14
- "bugs": {
15
- "url": "https://github.com/vercel/turborepo/issues"
16
- },
17
- "main": "index.js",
18
- "bin": "index.js",
19
- "scripts": {
20
- "build": "tsup && cp ./package.json ./dist/package.json",
21
- "release": "pnpm build && cd dist && pnpm publish",
22
- "test": "jest",
23
- "lint": "eslint src/**/*.ts",
24
- "check-types": "tsc --noEmit"
25
- },
26
- "devDependencies": {
27
- "typescript": "^4.7.4",
28
- "turbo-utils": "workspace:*",
29
- "tsup": "^5.12.1",
30
- "tsconfig": "workspace:*",
31
- "ts-jest": "^27.1.1",
32
- "jest": "^27.4.3",
33
- "eslint": "^8.20.0",
34
- "@types/node": "^16.11.12",
35
- "@types/jest": "^27.4.0",
36
- "@manypkg/find-root": "^1.1.0"
37
- }
38
- }
package/jest.config.js DELETED
@@ -1,7 +0,0 @@
1
- /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
- module.exports = {
3
- preset: "ts-jest/presets/js-with-ts",
4
- testEnvironment: "node",
5
- modulePathIgnorePatterns: ["<rootDir>/node_modules", "<rootDir>/dist"],
6
- transformIgnorePatterns: ["/node_modules/(?!(ansi-regex)/)"],
7
- };
@@ -1,17 +0,0 @@
1
- export function getComparison(): {
2
- ref: string;
3
- type: "previousDeploy" | "headRelative";
4
- } | null {
5
- if (process.env.VERCEL === "1") {
6
- if (process.env.VERCEL_GIT_PREVIOUS_SHA) {
7
- // use the commit SHA of the last successful deployment for this project / branch
8
- return {
9
- ref: process.env.VERCEL_GIT_PREVIOUS_SHA,
10
- type: "previousDeploy",
11
- };
12
- } else {
13
- return null;
14
- }
15
- }
16
- return { ref: "HEAD^", type: "headRelative" };
17
- }
package/src/index.ts DELETED
@@ -1,116 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import { exec } from "child_process";
4
- import { getTurboRoot, getScopeFromPath, getScopeFromArgs } from "turbo-utils";
5
- import { getComparison } from "./getComparison";
6
-
7
- console.log(
8
- "\u226B Using Turborepo to determine if this project is affected by the commit..."
9
- );
10
-
11
- // check for TURBO_FORCE and bail early if it's set
12
- if (process.env.TURBO_FORCE === "true") {
13
- console.log(
14
- "\u226B `TURBO_FORCE` detected, skipping check and proceeding with build."
15
- );
16
- process.exit(1);
17
- }
18
-
19
- // find the monorepo root
20
- const root = getTurboRoot();
21
- if (!root) {
22
- console.error(
23
- "Error: workspace root not found. turbo-ignore inferencing failed, proceeding with build."
24
- );
25
- console.error("");
26
- process.exit(1);
27
- }
28
-
29
- // Find the scope of the project
30
- const argsScope = getScopeFromArgs({ args: process.argv.slice(2) });
31
- const pathScope = getScopeFromPath({ cwd: process.cwd() });
32
- const { context, scope } = argsScope.scope ? argsScope : pathScope;
33
- if (!scope) {
34
- console.error(
35
- "Error: app scope not found. turbo-ignore inferencing failed, proceeding with build."
36
- );
37
- if (!pathScope.scope) {
38
- console.error(
39
- 'Error: the package.json is missing the "name" field.\nSet this field or pass the --scope flag to turbo-ignore.'
40
- );
41
- }
42
- console.error("");
43
- process.exit(1);
44
- }
45
- if (context.path) {
46
- console.log(`\u226B Inferred \`${scope}\` as scope from "${context.path}"`);
47
- } else {
48
- console.log(`\u226B Inferred \`${scope}\` as scope from arguments`);
49
- }
50
-
51
- // Get the start of the comparison (previous deployment when available, or previous commit by default)
52
- const comparison = getComparison();
53
- if (!comparison) {
54
- // This is either the first deploy of the project, or the first deploy for the branch, either way - build it.
55
- console.log(
56
- `\u226B No previous deployments found for this project${
57
- process.env.VERCEL === "1"
58
- ? ` on "${process.env.VERCEL_GIT_COMMIT_REF}.`
59
- : "."
60
- }"`
61
- );
62
- console.log(`\u226B Proceeding with build...`);
63
- process.exit(1);
64
- }
65
- if (comparison.type === "previousDeploy") {
66
- console.log("\u226B Found previous deployment for project");
67
- }
68
-
69
- // Build, and execute the command
70
- const command = `npx turbo run build --filter=${scope}...[${comparison.ref}] --dry=json`;
71
- console.log(`\u226B Analyzing results of \`${command}\`...`);
72
- exec(
73
- command,
74
- {
75
- cwd: root,
76
- },
77
- (error, stdout) => {
78
- if (error) {
79
- console.error(`exec error: ${error}`);
80
- console.error(`\u226B Proceeding with build to be safe...`);
81
- process.exit(1);
82
- }
83
-
84
- try {
85
- const parsed = JSON.parse(stdout);
86
- if (parsed == null) {
87
- console.error(
88
- `\u226B Failed to parse JSON output from \`${command}\`.`
89
- );
90
- console.error(`\u226B Proceeding with build to be safe...`);
91
- process.exit(1);
92
- }
93
- const { packages } = parsed;
94
- if (packages && packages.length > 0) {
95
- console.log(
96
- `\u226B The commit affects this project and/or its ${
97
- packages.length - 1
98
- } dependencies`
99
- );
100
- console.log(`\u226B Proceeding with build...`);
101
- process.exit(1);
102
- } else {
103
- console.log(
104
- "\u226B This project and its dependencies are not affected"
105
- );
106
- console.log("\u226B Ignoring the change");
107
- process.exit(0);
108
- }
109
- } catch (e) {
110
- console.error(`\u226B Failed to parse JSON output from \`${command}\`.`);
111
- console.error(e);
112
- console.error(`\u226B Proceeding with build to be safe...`);
113
- process.exit(1);
114
- }
115
- }
116
- );
package/tsconfig.json DELETED
@@ -1,6 +0,0 @@
1
- {
2
- "extends": "tsconfig/library.json",
3
- "compilerOptions": {
4
- "rootDir": "."
5
- }
6
- }
package/tsup.config.ts DELETED
@@ -1,8 +0,0 @@
1
- import { defineConfig, Options } from "tsup";
2
-
3
- export default defineConfig((options: Options) => ({
4
- entry: ["src/index.ts"],
5
- format: ["cjs"],
6
- clean: true,
7
- ...options,
8
- }));
package/yarn-error.log DELETED
@@ -1,71 +0,0 @@
1
- Arguments:
2
- /Users/knickman/.nvm/versions/node/v16.15.1/bin/node /Users/knickman/.nvm/versions/node/v16.15.1/bin/yarn jest
3
-
4
- PATH:
5
- /opt/homebrew/bin:/opt/homebrew/sbin:/Users/knickman/.nvm/versions/node/v16.15.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/go/bin:/Library/Apple/usr/bin
6
-
7
- Yarn version:
8
- 1.22.19
9
-
10
- Node version:
11
- 16.15.1
12
-
13
- Platform:
14
- darwin arm64
15
-
16
- Trace:
17
- Error: Failed to replace env in config: ${NPM_TOKEN}
18
- at /Users/knickman/.nvm/versions/node/v16.15.1/lib/node_modules/yarn/lib/cli.js:94933:13
19
- at String.replace (<anonymous>)
20
- at envReplace (/Users/knickman/.nvm/versions/node/v16.15.1/lib/node_modules/yarn/lib/cli.js:94928:16)
21
- at Function.normalizeConfig (/Users/knickman/.nvm/versions/node/v16.15.1/lib/node_modules/yarn/lib/cli.js:31938:69)
22
- at NpmRegistry.<anonymous> (/Users/knickman/.nvm/versions/node/v16.15.1/lib/node_modules/yarn/lib/cli.js:31968:34)
23
- at Generator.next (<anonymous>)
24
- at step (/Users/knickman/.nvm/versions/node/v16.15.1/lib/node_modules/yarn/lib/cli.js:310:30)
25
- at /Users/knickman/.nvm/versions/node/v16.15.1/lib/node_modules/yarn/lib/cli.js:321:13
26
-
27
- npm manifest:
28
- {
29
- "name": "turbo-ignore",
30
- "version": "0.1.0",
31
- "description": "",
32
- "homepage": "https://turborepo.org",
33
- "keywords": [],
34
- "author": "Jared Palmer",
35
- "license": "MPL-2.0",
36
- "repository": {
37
- "type": "git",
38
- "url": "https://github.com/vercel/turborepo",
39
- "directory": "packages/turbo-ignore"
40
- },
41
- "bugs": {
42
- "url": "https://github.com/vercel/turborepo/issues"
43
- },
44
- "main": "index.js",
45
- "bin": "index.js",
46
- "scripts": {
47
- "build": "tsup && cp ./package.json ./dist/package.json",
48
- "release": "pnpm build && cd dist && pnpm publish",
49
- "test": "pnpm lint && pnpm types && jest",
50
- "lint": "eslint src/**/*.ts",
51
- "types": "tsc --noEmit"
52
- },
53
- "devDependencies": {
54
- "@manypkg/find-root": "^1.1.0",
55
- "@types/jest": "^27.4.0",
56
- "@types/node": "^16.11.12",
57
- "esbuild": "^0.14.38",
58
- "eslint": "^8.20.0",
59
- "jest": "^27.4.3",
60
- "ts-jest": "^27.1.1",
61
- "tsup": "^5.12.1",
62
- "turbo-utils": "workspace:*",
63
- "typescript": "^4.7.4"
64
- }
65
- }
66
-
67
- yarn manifest:
68
- No manifest
69
-
70
- Lockfile:
71
- No lockfile