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

refactor(cli): call setup hook in run command with more args #6353

Merged
merged 1 commit into from
Sep 4, 2019

Conversation

kevinmarrec
Copy link
Contributor

@kevinmarrec kevinmarrec commented Sep 3, 2019

Types of changes

  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

It's overall a fix (where the setup hook is called) that will make TypeScript Runtime shine by not relying anymore on process.argv to find the rootDir which was not optimal (glitchy and not secure regarding new potential CLI Options).

See : nuxt/typescript#97

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly. (PR: #)
  • I have added tests to cover my changes (if not applicable, please state why)
  • All new and existing tests are passing.

@kevinmarrec kevinmarrec requested a review from pi0 September 3, 2019 23:23
@codecov-io
Copy link

Codecov Report

Merging #6353 into dev will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #6353      +/-   ##
==========================================
- Coverage   95.71%   95.71%   -0.01%     
==========================================
  Files          79       79              
  Lines        2663     2661       -2     
  Branches      682      681       -1     
==========================================
- Hits         2549     2547       -2     
  Misses         98       98              
  Partials       16       16
Flag Coverage Δ
#e2e 100% <ø> (ø) ⬆️
#fixtures 50.73% <0%> (+0.03%) ⬆️
#unit 92.37% <100%> (-0.01%) ⬇️
Impacted Files Coverage Δ
packages/cli/src/run.js 100% <ø> (ø) ⬆️
packages/cli/src/command.js 99% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c010add...3591802. Read the comment docs.

1 similar comment
@codecov-io
Copy link

codecov-io commented Sep 3, 2019

Codecov Report

Merging #6353 into dev will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##              dev    #6353      +/-   ##
==========================================
- Coverage   95.71%   95.71%   -0.01%     
==========================================
  Files          79       79              
  Lines        2663     2661       -2     
  Branches      682      681       -1     
==========================================
- Hits         2549     2547       -2     
  Misses         98       98              
  Partials       16       16
Flag Coverage Δ
#e2e 100% <ø> (ø) ⬆️
#fixtures 50.73% <0%> (+0.03%) ⬆️
#unit 92.37% <100%> (-0.01%) ⬇️
Impacted Files Coverage Δ
packages/cli/src/run.js 100% <ø> (ø) ⬆️
packages/cli/src/command.js 99% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c010add...3591802. Read the comment docs.

await this.callHook('setup', {
argv: this._argv,
cmd: this.cmd,
rootDir: path.resolve(this.argv._[0] || '.')
Copy link
Member

Choose a reason for hiding this comment

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

That's a duplicated logic here but at least more consistent to be into the core :)

Copy link
Member

@pi0 pi0 left a comment

Choose a reason for hiding this comment

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

T.N.X 👍

@@ -35,6 +36,12 @@ export default class NuxtCommand extends Hookable {
}

async run () {
await this.callHook('setup', {
Copy link
Member

Choose a reason for hiding this comment

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

I hope no one complains about hook name 😆 It is inside run so could be called like run:before but with logical perspective, it is really a setup step and internal hook so looks good and also not breaking users.

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