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

Use the closest package.json / yarn.lock #1

Closed
borekb opened this issue Apr 5, 2017 · 8 comments
Closed

Use the closest package.json / yarn.lock #1

borekb opened this issue Apr 5, 2017 · 8 comments
Assignees
Milestone

Comments

@borekb
Copy link

borekb commented Apr 5, 2017

I have a VSCode project with multiple packages and this extension doesn't seem to recognize it, I get this error:

Cannot read 'package.json'

I guess it's because there is no package.json in workspace root.

The ideal behavior for me is:

  • When I have package.json opened as an active editor, yarn should be invoked on it (or on the related yarn.lock to be precise).
  • When I have a focus on some folder in the sidebar, and that folder contains yarn.lock / package.json, that should be used as the context.
@gamunu
Copy link
Owner

gamunu commented Apr 7, 2017

yes, it seems like a good idea. I'll try to implement in the next release.

@gamunu gamunu self-assigned this Apr 7, 2017
@gamunu gamunu added this to the v1.1.0 milestone Apr 7, 2017
@gamunu
Copy link
Owner

gamunu commented Apr 8, 2017

I think the second behavior is cannot be implemented because of the vscode API simply doesn't support it microsoft/vscode#15991. feel free to submit a pull request if you have a workaround for it. 😃

What I planned is,

  1. If a package.json is opened as an active editor yarn will be invoked on it.
  2. If no package.json is opened as an active editor then it will use focused folder to invoke yarn (Add vscode.window.activeFolder microsoft/vscode#15991).
  3. If the above scenarios fail to satisfy fallback to package.json in project root folder.

@pjmagee
Copy link

pjmagee commented Apr 12, 2017

Yes please! My root directory has multiple projects that are part of a solution so being able to either configure yarn package.json location or currently active open package.json can be used for yarn install would be great.

gamunu added a commit that referenced this issue Apr 12, 2017
* Changed yarn execution behavior,
Fix for [Issue 1](#1)

01. If a package.json is opened as an active editor yarn will be invoked on it.
02. If the above scenario fails to satisfy fallback to package.json in project root folder.
@gamunu
Copy link
Owner

gamunu commented Apr 12, 2017

@borekb @pjmagee Done,

  1. If a package.json is opened as an active editor/focused tab yarn will be invoked on it.
  2. 👀
  3. If the above scenario fails to satisfy extension will fallback to package.json in project root folder.

@kunalgolani
Copy link

I have my package.json in a sub-folder of the project root - can it be a configuration option to specify the path to it so that I can run a script from anywhere without having to open my package.json file?

@gamunu
Copy link
Owner

gamunu commented Sep 12, 2017

@kunalgolani Possible. what do you think about the below flow of execution,

1.If a package.json is opened as an active editor/focused tab yarn will be invoked on it.
2.If the package.json is explicitly defined in the configuration yarn will invoke on it.
3.If above scenarios fail to satisfy. The extension will fall back to package.json in project root folder.

@kunalgolani
Copy link

@gamunu sounds good to me!

@gamunu gamunu modified the milestones: v1.1.0, v1.2.0, v1.3 Sep 14, 2017
gamunu added a commit that referenced this issue Sep 20, 2017
Addition for [Issue 1]( #1)
1.If a package.json is opened as an active editor/focused tab yarn will be invoked on it.
2.If the package.json is explicitly defined in the configuration yarn will invoke on it.
3.If above scenarios fail to satisfy. The extension will fall back to package.json in project root folder.
Fix typescript issues in init file
@gamunu
Copy link
Owner

gamunu commented Feb 26, 2018

Closing this. The new feature context menu introduced in v1.5.0 will provide much better integration.

@gamunu gamunu closed this as completed Feb 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants