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

feat: add concurrently & wait-on command #34

Merged
merged 5 commits into from
May 7, 2020

Conversation

Mohammer5
Copy link
Contributor

BREAKING CHANGE: The d2-utils-cypress open and d2-utils-cypress run now use concurrently and wait-on by default. If new behavior is undesired, it can be disabled with --appStart ''.

This PR does 3 things

  1. refactors the install command's code
  2. only writes the testFiles config to the cypress.json when using cucumber
  3. Uses concurrently and wait-on when using the open and run commands

@Mohammer5 Mohammer5 requested a review from amcgee May 1, 2020 15:16
Copy link
Member

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

Code looks great! Will take it for a quick test drive in a bit.

src/commands/open.js Outdated Show resolved Hide resolved
Copy link
Contributor

@varl varl left a comment

Choose a reason for hiding this comment

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

Very nice feature to add. It will clean up a lot of package.json files.

cypress(opts)
} else {
const cypressCommand = cypress({ ...opts, exec: false })
const waitOnCommand = `npx --no-install wait-on ${waitOn}`
Copy link
Contributor

Choose a reason for hiding this comment

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

This works great in apps, but when used through the global install of d2 (i.e. d2 utils cypress) this doesn't work for the same reasons it doesn't in d2 style.

I've been working on an alternative style that shouldn't get confused when e.g. d2 is installed globally using Yarn vs. NPM (they have different node_modules globally, and npx looks in the NPM one and not Yarn one).

There's also the case of not hoisting dependencies (not talking about de-duping) that are only used in e.g. d2-style which this "inside out" approach allows to work. Needs more testing and bug fixing but it's in @dhis2/cli-style@alpha right now: dhis2/cli-style@fd620c5

If it works out, maybe we should move the cli-style/src/utils/run.js file to e.g. cli-helpers-engine and use that as the primary process runner.

Copy link
Contributor

Choose a reason for hiding this comment

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

What I'm saying is: use npx for now, and be aware that there are some gotchas that we want to resolve, and there are experiments for that in dhis2/cli-style going on.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good to know. So if I get it right d2 utils cypress open won't work when using the globally installed cli utility. Never thought about that use-case before 😅

Copy link
Member

Choose a reason for hiding this comment

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

I think npx is probably OK here for the moment because wait-on doesn't need to find other dependencies (like eslint does when resolving plugins from the .eslintrc file). So should be fine for now but worth moving to a better process runner when we have it.

Copy link
Member

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

Just the one minor bug change requested, this looks great!

src/commands/install/createCypressConfig.js Outdated Show resolved Hide resolved
src/commands/install/createCypressConfig.js Outdated Show resolved Hide resolved
@Mohammer5
Copy link
Contributor Author

This should be ok now

Copy link
Member

@amcgee amcgee left a comment

Choose a reason for hiding this comment

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

🎉

@Mohammer5 Mohammer5 merged commit b1d067b into master May 7, 2020
@Mohammer5 Mohammer5 deleted the Add_concurrently_waiton_command branch May 7, 2020 10:00
dhis2-bot added a commit that referenced this pull request May 7, 2020
# [2.2.0](v2.1.0...v2.2.0) (2020-05-07)

### Features

* add concurrently & wait-on command ([#34](#34)) ([b1d067b](b1d067b))
@dhis2-bot
Copy link
Contributor

🎉 This PR is included in version 2.2.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants