Skip to content

Dart package analysis fails on pub.dev, work locally #7644

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

Closed
yoer opened this issue Apr 16, 2024 · 8 comments
Closed

Dart package analysis fails on pub.dev, work locally #7644

yoer opened this issue Apr 16, 2024 · 8 comments

Comments

@yoer
Copy link

yoer commented Apr 16, 2024

I found that this problem has occurred before.

7521
7149

It is successful in my local area:
image

On pub.dev it is failed like this:

log

image

@isoos
Copy link
Collaborator

isoos commented Apr 16, 2024

Not entirely sure what is happening here, but it looks like you may be triggering the nodoc error message from dartdoc. We are using dartdoc 8.0.7 at the moment, could you try to run that against your package locally?

@yoer
Copy link
Author

yoer commented Apr 16, 2024

nodoc , that's warning right?

that's result after run dartdoc, also success locally

dart pub global activate dartdoc 8.0.7
flutter --no-version-check pub global run dartdoc --output /tmp/dartdoc-zego_uikitQVAWHL --sanitize-html --max-file-count 10000000 --max-total-size 2147483648 --no-validate-links 
Documenting zego_uikit...
Discovering libraries...
Linking elements...
Precaching local docs for 913217 elements...
Initialized dartdoc with 2219 libraries
Generating docs for category APIs from package:zego_uikit...
Generating docs for category Features from package:zego_uikit...
Generating docs for library zego_uikit.dart from package:zego_uikit/zego_uikit.dart...
Documented 1 public library in 34.0 seconds
Success! Docs generated into /tmp/dartdoc-zego_uikitQVAWHL

@isoos
Copy link
Collaborator

isoos commented Apr 16, 2024

When I download the latest archive of zego_uikit and run dartdoc locally, I get the following errors:

First, a bad reference from dartdoc_options.yaml:

Unhandled exception:
PathNotFoundException(path=/[...]/doc/header.html; message=Cannot open file)

Which is not a problem on pub.dev, because we happen to remove the particular entry that references it. After a local update, the next error is the following:

 In categories definition for APIs, "markdown" resolves to the missing file /[...]/doc/apis.md
#0      CategoryConfiguration.fromYamlMap (package:dartdoc/src/dartdoc_options.dart:113:13)

The root cause of these issues is that the package archive is not complete, references items outside of it. Your local setup may be different from what you are publishing, and the dartdoc has no issue with it. To get it running on pub.dev, make sure that every references file is correct in the archive.

I'm unsure why we don't have the error in the log.txt file, we should have the full output there.

@nemoyuan
Copy link

@isoos Thanks, But our package should not have missing files.

please help to check this case, facing same issue:

pub.dev doc log: https://pub.dev/packages/zego_uikit_prebuilt_call/versions/4.8.2/score/log.txt
repo: https://github.com/ZEGOCLOUD/zego_uikit_prebuilt_call_flutter.git
image

my local test command:

git clone https://github.com/ZEGOCLOUD/zego_uikit_prebuilt_call_flutter.git --depth 1
cd zego_uikit_prebuilt_call_flutter
dart pub global activate dartdoc 8.0.7
flutter --no-version-check pub global run dartdoc --output /tmp/dartdoc-zego_uikitQVAWHL --sanitize-html --max-file-count 10000000 --max-total-size 2147483648 --no-validate-links

test result:

Found 38 warnings and 0 errors.
Documented 26 public libraries in 7.7 seconds
Success! Docs generated into /tmp/dartdoc-zego_uikitQVAWHL

My dart version:

$dart --version
Dart SDK version: 3.3.3 (stable) (Tue Mar 26 14:21:33 2024 +0000) on "macos_arm64"

I also checked our repository and there is no .pubignore file, any ideas?
Many Thanks.

@isoos
Copy link
Collaborator

isoos commented Apr 16, 2024

I'm not sure about the other package, but the previous one has no doc/ folder in the uploaded archive file:
https://pub.dev/api/archives/zego_uikit-2.22.1.tar.gz

@yoer
Copy link
Author

yoer commented Apr 17, 2024

Found the problem, now is fine.
image

it is caused by the .gitignore file,
image
which causes lose the doc/*. * files when uploading to the pub.dev by pub publish

However, as far as I know, during the pub publishing process, .gitignore should not take effect, right? what should take effect is .pubignore.

@isoos
Copy link
Collaborator

isoos commented Apr 17, 2024

Only if you have both files:

To use different ignore rules for git and dart pub publish, create a .pubignore file to overrule the .gitignore file in a given directory. If a directory contains both a .pubignore file and a .gitignore file, then dart pub publish ignores that directory's .gitignore file. The .pubignore files follow the same format as the .gitignore file.

https://dart.dev/tools/pub/publishing#what-files-are-published

@yoer
Copy link
Author

yoer commented Apr 17, 2024

👌🏻

@yoer yoer closed this as completed Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants