Skip to content
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

CI mode can be a bit awkward to use #762

Closed
abrenneke opened this issue Jun 16, 2021 · 5 comments · Fixed by #770
Closed

CI mode can be a bit awkward to use #762

abrenneke opened this issue Jun 16, 2021 · 5 comments · Fixed by #770

Comments

@abrenneke
Copy link
Contributor

So because CI mode I guess isn't always on if $CI is set, I had to end up with this in my package.json, since betterer is run with all of the rest of the linting:

{
  "scripts": {
    "lint": "npm-run-all -lpc lint:*",
    "lint:betterer": "function b() { if [[ -z $CI ]]; then yarn lint:betterer:dev $@; else yarn lint:betterer:ci $@; fi }; b",
    "lint:betterer:dev": "betterer -t tsconfig.base.json --cache",
    "lint:betterer:ci": "betterer ci -t tsconfig.base.json"
  }
}    

The function is necessary so that if you do yarn lint:betterer -f some-filter, that the filter gets passed to the actual betterer command that gets run.

Maybe $CI could always run in CI mode? And ignore --cache instead of erroring that the command doesn't exist?

@phenomnomnominal
Copy link
Owner

Excuse my ignorance, where does $CI come from?

@abrenneke
Copy link
Contributor Author

Oh, almost all CI runners out there will set a CI environment variable to something (true or 1 probably?) to indicate that you're running in the CI

@phenomnomnominal
Copy link
Owner

Oh that's super easy then, so it just comes through as process.env.CI?

@phenomnomnominal
Copy link
Owner

Is it literally just adding

if (process.env.CI) {
    return ciΔ(cwd, argv);
}

to packages/cli/src/start.ts ?

@abrenneke
Copy link
Contributor Author

abrenneke commented Jun 16, 2021

Yeah should be! (besides --cache erroring in CI mode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants