Skip to content

Commit

Permalink
Mixed dev doc improvements (dart-lang#7387)
Browse files Browse the repository at this point in the history
  • Loading branch information
sigurdm authored Jan 12, 2024
1 parent 3923e96 commit d669ac5
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 17 deletions.
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ reviewer will reformat your code themselves if necessary.
[pr]: https://help.github.com/articles/creating-a-pull-request/

Functional changes will require tests to be added or changed. The tests live in
the `test/` directory, and are run with `pub run test`. If you need to create
the `test/` directory, and are run with `dart test`. If you need to create
new tests, use the existing tests as a guideline for what they should look like.

Before you send your pull request, make sure all the tests pass! Just run
`pub run test`.
`dart test`.

### File headers

Expand Down
2 changes: 1 addition & 1 deletion app/build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Read about `build.yaml` at https://pub.dartlang.org/packages/build_config
# To update generated code, run `pub run build_runner build`
# To update generated code, run `dart run build_runner build`
targets:
pub_dev:
sources:
Expand Down
4 changes: 2 additions & 2 deletions app/dart_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ tags:
presubmit:
skip: false # Don't skip when running in presubmit
fragile:
skip: 'Only run fragile tests manually with `pub run test -P fragile`'
skip: 'Only run fragile tests manually with `dart run test -P fragile`'
presets:
fragile:
skip: false # Don't skip when running in -P fragile
sanity:
skip: 'Run sanity-check tests manually with `pub test -P sanity`.'
skip: 'Run sanity-check tests manually with `dart test -P sanity`.'
presets:
sanity:
skip: false # Don't skip these tests.
22 changes: 16 additions & 6 deletions doc/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ The main directories that one would be looking at:
The in-memory server starts with no data. Prepopulated data can be created
with test-profiles, using the following steps:

### Create a test-profile description
### Create a test-profile description

A test-profile is a short description of packages, publishers, users,
their flags and relations.
Expand All @@ -39,14 +39,22 @@ defaultUser: '[email protected]'
packages:
- name: retry
- name: http
publishers:
- # Only `example.com`` and `verified.com`` will verify.
# See app/lib/fake/backend/fake_domain_verifier.dart
name: example.com
members:
- email: [email protected]
role: admin
```
### Process and create data file
Using the test-profile above, the following process will:
- fetch the latest versions and the archive file from pub.dev
- create the publishers and users.
- fetch the latest versions and the archive file from pub.dev.
- publish the archive locally under the name of the user or
the publisher in the test-profile description
the publisher in the test-profile description.
- analyze the packages and runs dartdoc on them
- stores the results and all the entities in a local file.
Expand Down Expand Up @@ -74,12 +82,14 @@ cd app/
dart bin/fake_server.dart run --data-file=dev-data-file.jsonl
```

The fake_server.dart script picks up changes and rebuilds your style sheets when initializing.

## Local accounts

The web app and the API endpoints use a simple mechanism to map access tokens
to authenticated accounts: `user-at-domain-dot-com` gets mapped to `[email protected]`.
to authenticated accounts: `user-at-domain-dot-com` gets mapped to `[email protected]`.

- On the web app one can use this token by clicking on the `Sign in` top nav item.
- On the web app, use `localhost:8080/[email protected]` to sign in.
- On the API endpoints one should send the `Authorization` header with `Bearer $token` as value.

## Updating generated code
Expand All @@ -90,7 +100,7 @@ annotations. Input files are usually listed in `build.yaml`, and generated
files usually suffixed `.g.dart`. To generate code use:

```bash
dart pub run build_runner build
dart run build_runner build
```

## Working with `mono_repo`
Expand Down
2 changes: 1 addition & 1 deletion pkg/_popularity/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ Not to be published.
To update the generated code – `lib/popularity.g.dart` – run

```console
$ pub run build_runner build
$ dart run build_runner build
```
2 changes: 1 addition & 1 deletion pkg/_pub_shared/build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Read about `build.yaml` at https://pub.dartlang.org/packages/build_config
# To update generated code, run `pub run build_runner build`
# To update generated code, run `dart run build_runner build`
targets:
$default:
sources:
Expand Down
4 changes: 2 additions & 2 deletions pkg/code_coverage/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ APP_TEST_PID=$!
sleep 15;

cd "${CODE_COVERAGE_DIR}"
dart pub run coverage:collect_coverage \
dart run coverage:collect_coverage \
--uri=http://localhost:20202 \
-o "${OUTPUT_DIR}/raw/app_unit.json" \
--wait-paused \
Expand All @@ -60,7 +60,7 @@ rm ${APP_ALL_TEST_PATH}

echo "Exporting to LCOV"
cd "${APP_DIR}"
dart pub run coverage:format_coverage \
dart run coverage:format_coverage \
--packages "${APP_DIR}/.dart_tool/package_config.json" \
-i "${OUTPUT_DIR}/raw/app_unit.json" \
--base-directory "${PROJECT_DIR}" \
Expand Down
2 changes: 1 addition & 1 deletion pkg/pub_integration/tool/test-fake-with-local-dart-sdks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ LOCAL_DART_SDKS_DIR="${PUB_INTEGRATION_DIR}/.local-dart-sdks"
ls -1 ${LOCAL_DART_SDKS_DIR} | while read i;
do
echo "Running tests using ${i}..."
PUB_INTEGRATION_CLIENT_SDK_DIR="${LOCAL_DART_SDKS_DIR}/${i}" pub run test test/pub_integration_test.dart
PUB_INTEGRATION_CLIENT_SDK_DIR="${LOCAL_DART_SDKS_DIR}/${i}" run test test/pub_integration_test.dart
done
2 changes: 1 addition & 1 deletion pkg/pub_worker/build.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Read about `build.yaml` at https://pub.dartlang.org/packages/build_config
# To update generated code, run `pub run build_runner build`
# To update generated code, run `dart run build_runner build`
targets:
$default:
sources:
Expand Down

0 comments on commit d669ac5

Please sign in to comment.