-
Notifications
You must be signed in to change notification settings - Fork 3
v1.2.0 - findAll, ImportPath class and use of ascii_art_tree. #3
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
base: master
Are you sure you want to change the base?
Changes from all commits
8eacba6
eaba85a
4fb8a35
1b686fa
91f38c8
a7f54f6
d341af6
5e80367
01b94b0
43e8940
9fd4252
891a1b5
359f31f
cc2a7f1
bed45b8
92636b2
1793d72
faeb219
ae1ddb0
955c8c8
944b3e7
750acb1
6e27209
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Dart CI | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dart-lang/setup-dart@v1 | ||
- name: Dart version | ||
run: | | ||
dart --version | ||
uname -a | ||
- name: Install dependencies | ||
run: dart pub get | ||
- name: Upgrade dependencies | ||
run: dart pub upgrade | ||
- name: dart format | ||
run: dart format -o none --set-exit-if-changed . | ||
- name: dart analyze | ||
run: dart analyze --fatal-infos --fatal-warnings . | ||
- name: dependency_validator | ||
run: dart run dependency_validator | ||
- name: dart pub publish --dry-run | ||
jakemac53 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
run: dart pub publish --dry-run | ||
|
||
|
||
test_linux: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dart-lang/setup-dart@v1 | ||
- name: Dart version | ||
run: | | ||
dart --version | ||
uname -a | ||
- name: Install dependencies | ||
run: dart pub get | ||
- name: Upgrade dependencies | ||
run: dart pub upgrade | ||
- name: Run tests | ||
run: dart run test --platform vm --coverage=./coverage | ||
- name: Generate coverage report | ||
run: | | ||
dart pub global activate coverage | ||
dart pub global run coverage:format_coverage --packages=.dart_tool/package_config.json --report-on=lib --lcov -o ./coverage/lcov.info -i ./coverage | ||
# - name: Upload coverage to Codecov | ||
# uses: codecov/codecov-action@v3 | ||
# env: | ||
# CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
# with: | ||
# directory: ./coverage/ | ||
# flags: unittests | ||
# env_vars: OS,DART | ||
# fail_ci_if_error: true | ||
# verbose: true | ||
|
||
test_windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dart-lang/setup-dart@v1 | ||
- name: Dart version | ||
run: | | ||
dart --version | ||
uname -a | ||
- name: Install dependencies | ||
run: dart pub get | ||
- name: Upgrade dependencies | ||
run: dart pub upgrade | ||
- name: Run tests | ||
run: dart run test --platform vm | ||
|
||
|
||
test_macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: dart-lang/setup-dart@v1 | ||
- name: Dart version | ||
run: | | ||
dart --version | ||
uname -a | ||
- name: Install dependencies | ||
run: dart pub get | ||
- name: Upgrade dependencies | ||
run: dart pub upgrade | ||
- name: Run tests | ||
run: dart run test --platform vm | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
# Below is a list of people and organizations that have contributed | ||
# to the project. Names should be added to the list like so: | ||
# | ||
# Name/Organization <email address> | ||
# Name/Organization <contact> | ||
|
||
Jacob MacDonald <[email protected]> | ||
Graciliano M. Passos: gmpassos @ GitHub | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add me back :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I was editing other package and edited the wrong file. |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,25 +1,98 @@ | ||||||
A tool to find the shortest import path from one dart file to another. | ||||||
# import_path | ||||||
|
||||||
## Usage | ||||||
[](https://pub.dartlang.org/packages/import_path) | ||||||
[](https://dart.dev/null-safety) | ||||||
[](https://github.com/jakemac53/import_path/actions/workflows/dart.yml) | ||||||
[](https://github.com/jakemac53/import_path/releases) | ||||||
[](https://github.com/jakemac53/import_path/commits/master) | ||||||
[](https://github.com/jakemac53/import_path/pulls) | ||||||
[](https://github.com/jakemac53/import_path) | ||||||
[](https://github.com/jakemac53/import_path/blob/master/LICENSE) | ||||||
|
||||||
A tool to find the shortest import path or listing | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
all import paths between two Dart files. | ||||||
It also supports the use of `RegExp` to match imports. | ||||||
|
||||||
## CLI Usage | ||||||
|
||||||
First, globally activate the package: | ||||||
|
||||||
`dart pub global activate import_path` | ||||||
```shell | ||||||
dart pub global activate import_path | ||||||
``` | ||||||
|
||||||
Then run it, the first argument is the library or application that you want to | ||||||
start searching from, and the second argument is the import you want to search | ||||||
for. | ||||||
|
||||||
`import_path <entrypoint> <import>` | ||||||
```shell | ||||||
import_path <entrypoint> <import> | ||||||
``` | ||||||
|
||||||
Files should be specified as dart import uris, so relative or absolute file | ||||||
paths, as well as `package:` and `dart:` uris are supported. | ||||||
|
||||||
## Example | ||||||
## Examples | ||||||
|
||||||
From the root of this package, you can do: | ||||||
|
||||||
``` | ||||||
```shell | ||||||
pub global activate import_path | ||||||
|
||||||
import_path bin/import_path.dart package:analyzer/dart/ast/ast.dart | ||||||
``` | ||||||
|
||||||
To find all the `dart:io` imports from a `web/main.dart`: | ||||||
|
||||||
```shell | ||||||
import_path web/main.dart dart:io --all | ||||||
``` | ||||||
|
||||||
Search for all the imports for "dart:io" and "dart:html" using `RegExp`: | ||||||
|
||||||
```shell | ||||||
import_path web/main.dart "dart:(io|html)" --regexp --all | ||||||
``` | ||||||
For help or more usage examples: | ||||||
|
||||||
```shell | ||||||
import_path --help | ||||||
``` | ||||||
|
||||||
## Library Usage | ||||||
|
||||||
You can also use the class `ImportPath` from your code: | ||||||
|
||||||
```dart | ||||||
import 'package:import_path/import_path.dart'; | ||||||
|
||||||
void main(List<String> args) async { | ||||||
var strip = args.any((a) => a == '--strip' || a == '-s'); | ||||||
|
||||||
var importPath = ImportPath( | ||||||
Uri.base.resolve('bin/import_path.dart'), | ||||||
'package:analyzer/dart/ast/ast.dart', | ||||||
strip: strip, | ||||||
); | ||||||
|
||||||
await importPath.execute(); | ||||||
} | ||||||
``` | ||||||
|
||||||
## Features and bugs | ||||||
|
||||||
Please file feature requests and bugs at the [issue tracker][tracker]. | ||||||
|
||||||
[tracker]: https://github.com/jakemac53/import_path/issues | ||||||
|
||||||
## Authors | ||||||
|
||||||
- Jacob MacDonald: [jakemac53][github_jakemac53]. | ||||||
- Graciliano M. Passos: [gmpassos][github_gmpassos]. | ||||||
|
||||||
[github_jakemac53]: https://github.com/jakemac53 | ||||||
[github_gmpassos]: https://github.com/gmpassos | ||||||
|
||||||
## License | ||||||
|
||||||
Dart free & open-source [license](https://github.com/jakemac53/import_path/blob/master/LICENSE). |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,30 @@ | ||||||
# This file configures the static analysis results for your project (errors, | ||||||
# warnings, and lints). | ||||||
# | ||||||
# This enables the 'recommended' set of lints from `package:lints`. | ||||||
# This set helps identify many issues that may lead to problems when running | ||||||
# or consuming Dart code, and enforces writing Dart using a single, idiomatic | ||||||
# style and format. | ||||||
# | ||||||
# If you want a smaller set of lints you can change this to specify | ||||||
# 'package:lints/core.yaml'. These are just the most critical lints | ||||||
# (the recommended set includes the core lints). | ||||||
# The core lints are also what is used by pub.dev for scoring packages. | ||||||
|
||||||
include: package:lints/recommended.yaml | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lets use this one:
Suggested change
(will also need to add a dev dependency) |
||||||
|
||||||
# Uncomment the following section to specify additional rules. | ||||||
|
||||||
# linter: | ||||||
# rules: | ||||||
# - camel_case_types | ||||||
|
||||||
# analyzer: | ||||||
# exclude: | ||||||
# - path/to/excluded/files/** | ||||||
|
||||||
# For more information about the core and recommended set of lints, see | ||||||
# https://dart.dev/go/core-lints | ||||||
|
||||||
# For additional information about configuring this file, see | ||||||
# https://dart.dev/guides/language/analysis-options |
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.
This is not necessary - a
get
always fetches the latest versions unless there is a pubspec.lock present.Either way we should only do one of a
get
orupgrade
though.Uh oh!
There was an error while loading. Please reload this page.
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.
In theory I agree with you, until I had some real world issues.
I only have included the upgrade command because in some cases the GitHub workflow has come cached packages and is not getting the last version for some pre-installed packages.
dart pub get
only gets the last version if it's downloading the package for the first time.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.
dart pub get
If the system cache doesn’t already contain the dependencies, dart pub get updates the cache, downloading dependencies if necessary.
From:
https://dart.dev/tools/pub/cmd/pub-get
When running
dart pub get
, if a dependency is already in the cache and matches the constraint, it won't download a newer version.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.
That isn't my experience with how it works, but I am fine with using
dart pub upgrade
. We definitely don't need both though (just remove theget
then).