-
Notifications
You must be signed in to change notification settings - Fork 5.6k
fix(install): better json editing #26450
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
fix(install): better json editing #26450
Conversation
fn contents(&self) -> String { | ||
self.cst.to_string() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it need to be accessed more than one time? If not, consider making it consume self
to better communicate that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
self.path
is still used after this.
let deps_prop = self.root_object.get("dependencies"); | ||
let dev_deps_prop = self.root_object.get("devDependencies"); | ||
|
||
let dependencies = if dev { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this still remove the entry from the other "dependencies" when inserting it?
Ie. will deno install npm:foo
and then deno install --dev npm:foo
leave only a single entry and not entry in both dependencies
and devDependencies
?
path: PathBuf, | ||
modified: bool, | ||
} | ||
if let Some(other) = other_dependencies { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see now that it will 👍
1. Respects the formatting of the file (ex. keeps four space indents or tabs). 2. Handles editing of comments. 3. Handles trailing commas. 4. Code is easier to maintain.
Uh oh!
There was an error while loading. Please reload this page.