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

Skip dependency check on ember init #124

Merged
merged 3 commits into from
Feb 18, 2022
Merged

Conversation

gnclmorais
Copy link
Contributor

@gnclmorais gnclmorais commented Feb 9, 2022

This pull request addresses ember-cli/ember-cli#6277, trying to look into the process.argv passed to the Node process to evaluate if we’re looking into an ember init execution. Feedback welcome!

As a bonus, in order to get a green CI, I had to remove Node 6 from the versions we test again, since this seems to happen otherwise:

$> node -v
v6.17.1

$> yarn install --frozen-lockfile --non-interactive
yarn install v1.22.17
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=8". Got "6.17.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

Node.js 6.x (“Boron”), which has been maintained as a long-term stable (LTS) release line since fall of 2016, is reaching its scheduled end-of-life (EOL) on April 30, 2019. — source

const dependencyChecker = new DependencyChecker(this.project, reporter);
dependencyChecker.checkDependencies();
// When running `ember <command>`, find the `<command>`
const emberPosition = process.argv.findIndex(arg => arg.endsWith('/ember'));

Choose a reason for hiding this comment

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

Will this work on Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is a great question, I will investigate!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated AppVeyor’s configuration to run tests both on Linux and Windows, so we have empirical evidence that yes, it seems to work on Windows too! ✨

Copy link
Contributor Author

@gnclmorais gnclmorais Feb 17, 2022

Choose a reason for hiding this comment

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

Since we have Travis on this project as well, we could do a couple of extra things:

  • Either remove Travis and use Appveyor for Windows and Linux,
  • Or keep Travis for Linux builds while Appveyor would be used only for Windows builds;
  • Or even replace both with a single GitHub Actions that will run tests on both environments.

Copy link
Owner

Choose a reason for hiding this comment

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

Does cli pass invoked command directly to addons? If so, we can use that instead of parsing it.
Other than that, I am good with the changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@quaertym, I’ve explored what I could from the arguments we get, but I couldn’t find anything relevant — which is definitely a shame. 😞

Copy link
Owner

Choose a reason for hiding this comment

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

OK, maybe it can be done later on the cli side. I will approve.

Copy link
Owner

Choose a reason for hiding this comment

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

Let's add GitHub Actions in a separate PR.

@gnclmorais gnclmorais force-pushed the master branch 7 times, most recently from b1f0b20 to f3a6de8 Compare February 17, 2022 08:15
As described by a [GitHub issue][0], `ember init` would probably
make more sense skipping dependency check, so this commit looks
into the arguments received and, if the command issued was `init`,
skips dependency check and simply displays a warning.

[0]: ember-cli/ember-cli#6277
Node 6 is no longer supported as is on this project:
```
$> node -v
v6.17.1

$> yarn install --frozen-lockfile --non-interactive
yarn install v1.22.17
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
error [email protected]: The engine "node" is incompatible with this module. Expected version ">=8". Got "6.17.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
```

This commit removes version 6 from TravisCI
@quaertym quaertym merged commit db51b4b into quaertym:master Feb 18, 2022
const ranWithInit = process.argv[emberPosition + 1] === 'init';

if (ranWithInit) {
process.emitWarning('Skipped dependency checker…');

Choose a reason for hiding this comment

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

Hi! Was wondering if this is actually needed. Will this log a warning message in the user's terminal? If so, I think it could be confusing for people new to Ember?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That’s a good question, could be! However, could new people to Ember also find it confusing that dependency check happens on every command except init, without any warning nor explanation?

Choose a reason for hiding this comment

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

I could be wrong, but I think (most) people (new to Ember) don't know dependency checking happens when running an Ember command, unless it fails. Skipping silently here seems better to me than emitting a warning. There's also nothing the user can do to address it I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yup, there’s definitely some value to what you said. 👍 Maybe someone else on this PR can chime in…?

Copy link
Owner

Choose a reason for hiding this comment

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

I think dependency-checker should be silent if the things are working as expected. So we can remove the log.

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 this pull request may close these issues.

4 participants