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

Split out directDependencies and devDependencies in pub deps #4383

Merged
merged 8 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/src/command/deps.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,9 @@ class DepsCommand extends PubCommand {
'version': currentPackage.version.toString(),
'kind': kind,
'source': source,
'dependencies': next,
'dependencies': currentPackage.dependencies.keys.toList(),
if (isRoot)
'dev_dependencies': currentPackage.devDependencies.keys.toList(),
Copy link

Choose a reason for hiding this comment

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

Should this be devDependencies? I don't know about the rest of this file, but files like package_config.json seem to use camel case (for ex. rootUri)

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 question - in pubspec.yaml we use dev_dependencies - but json guidelines generally suggest camelCase.

@jonasfj do you have an opinion?

Copy link
Member

Choose a reason for hiding this comment

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

I don't know, I guess using devDependencies is the most consistent with other JSON outputs we have.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

});
toVisit.addAll(next);
}
Expand Down
14 changes: 7 additions & 7 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,23 @@ packages:
dependency: transitive
description:
name: _fe_analyzer_shared
sha256: f6dbf021f4b214d85c79822912c5fcd142a2c4869f01222ad371bc51f9f1c356
sha256: "45cfa8471b89fb6643fe9bf51bd7931a76b8f5ec2d65de4fb176dba8d4f22c77"
url: "https://pub.dev"
source: hosted
version: "74.0.0"
version: "73.0.0"
_macros:
dependency: transitive
description: dart
source: sdk
version: "0.3.3"
version: "0.3.2"
analyzer:
dependency: "direct main"
description:
name: analyzer
sha256: f7e8caf82f2d3190881d81012606effdf8a38e6c1ab9e30947149733065f817c
sha256: "4959fec185fe70cce007c57e9ab6983101dbe593d2bf8bbfb4453aaec0cf470a"
url: "https://pub.dev"
source: hosted
version: "6.9.0"
version: "6.8.0"
args:
dependency: "direct main"
description:
Expand Down Expand Up @@ -194,10 +194,10 @@ packages:
dependency: transitive
description:
name: macros
sha256: "1d9e801cd66f7ea3663c45fc708450db1fa57f988142c64289142c9b7ee80656"
sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536"
url: "https://pub.dev"
source: hosted
version: "0.1.3-main.0"
version: "0.1.2-main.4"
matcher:
dependency: transitive
description:
Expand Down
7 changes: 4 additions & 3 deletions test/deps_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,9 +158,10 @@ void main() {
"dependencies": [
"normal",
"overridden",
"from_path",
"unittest",
"override_only"
"from_path"
],
"dev_dependencies": [
"unittest"
]
},
{
Expand Down
81 changes: 81 additions & 0 deletions test/workspace_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,87 @@ transitive dependencies:
- transitive 1.0.0''',
);

await runPub(
args: ['deps', '--json'],
environment: {'_PUB_TEST_SDK_VERSION': '3.5.0'},
output: '''
{
"root": "myapp",
"packages": [
{
"name": "b",
"version": "1.1.1",
"kind": "root",
"source": "root",
"dependencies": [
"myapp",
"both"
],
"dev_dependencies": []
},
{
"name": "both",
"version": "1.0.0",
"kind": "direct",
"source": "hosted",
"dependencies": []
},
{
"name": "myapp",
"version": "1.2.3",
"kind": "root",
"source": "root",
"dependencies": [
"both",
"b"
],
"dev_dependencies": []
},
{
"name": "a",
"version": "1.1.1",
"kind": "root",
"source": "root",
"dependencies": [
"myapp",
"foo"
],
"dev_dependencies": [
"both"
]
},
{
"name": "foo",
"version": "1.0.0",
"kind": "transitive",
"source": "hosted",
"dependencies": [
"transitive"
]
},
{
"name": "transitive",
"version": "1.0.0",
"kind": "transitive",
"source": "hosted",
"dependencies": []
}
],
"sdks": [
{
"name": "Dart",
"version": "3.5.0"
}
],
"executables": [
":myappmain",
"both:bothmain",
"b:bmain"
]
}
''',
);

await runPub(
args: ['deps', '--style=list', '--no-dev'],
environment: {'_PUB_TEST_SDK_VERSION': '3.5.0'},
Expand Down
Loading