Skip to content

Commit 8219b54

Browse files
committed
Prefer installation as a dev-dependency
1 parent c63ad2d commit 8219b54

File tree

13 files changed

+79
-473
lines changed

13 files changed

+79
-473
lines changed

example/README.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11
# Running the example app
22

3-
1. In the root directory of `webdev`, run
4-
`pub global activate --source path webdev`
5-
1. Uncomment the dwds dependency override in `/webdev/webdev/pubspec.yaml`, then
6-
run `dart run build_runner build` from `/webdev/webdev` directory
7-
- *Note: You will have to comment and build, and then uncomment and build,
8-
each time you need to pick up new changes*
9-
1. From `/webdev/example`, run `webdev serve --debug --verbose` (Note: all
10-
options can be found by running `webdev help serve`)
3+
1. Run `dart run build_runner build` from `webdev/` directory to update build
4+
artifacts.
5+
1. From `example/`, run `dart run webdev serve --debug --verbose` (Note: all
6+
options can be found by running `dart run webdev help serve`)
117
1. Type opt/alt-d in the browser. This is required to start the VM.
128
1. \[OPTIONAL\] If you need to connect a locally running DevTools (instructions
139
for running

example/pubspec.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@ environment:
99
dev_dependencies:
1010
build_runner: ^2.4.0
1111
build_web_compilers: ^4.0.4
12+
webdev:
13+
path: ../webdev
14+
15+
dependency_overrides:
16+
dwds:
17+
path: ../dwds

webdev/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## 3.7.0-wip
22

3+
- Suggest using as a dev-dependency instead of as a globally activated package.
4+
The global flow will still work - but there will be no compatibility
5+
checking of dependencies.
6+
37
## 3.6.0
48

59
- Update `dwds` constraint to `24.1.0`.

webdev/README.md

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,18 @@ A command-line tool for developing and deploying web applications with Dart.
44

55
The latest release of `webdev` requires Dart SDK `2.18.0` or later.
66

7-
To use `webdev` with a package, make sure you have entries in `pubspec.yaml`
8-
similar to:
9-
10-
```yaml
11-
...
12-
dev_dependencies:
13-
build_runner: ^2.4.0
14-
build_web_compilers: ^4.0.4
15-
...
16-
```
17-
18-
## Installation
19-
20-
`webdev` is not meant to be used as a dependency. Instead, it should be
21-
["activated"][activating].
7+
To use `webdev` with a package, add it to the `dev_dependencies` in `pubspec.yaml`:
228

239
```console
24-
$ dart pub global activate webdev
10+
$ dart pub add dev:webdev
2511
```
2612

27-
Learn more about activating and using packages [here][pub global].
28-
2913
## Usage
3014

3115
`webdev` provides two commands: `serve` and `build`.
3216

17+
Run them with `dart run webdev serve` and `dart run webdev build`.
18+
3319
### `webdev serve`
3420

3521
```
@@ -148,8 +134,4 @@ Usage: webdev build [arguments]
148134
-v, --verbose Enables verbose logging.
149135
150136
Run "webdev help" to see global options.
151-
152137
```
153-
154-
[activating]: https://dart.dev/tools/pub/cmd/pub-global#activating-a-package
155-
[pub global]: https://dart.dev/tools/pub/cmd/pub-global

webdev/bin/webdev.dart

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,6 @@ Future main(List<String> args) async {
2626
if (e.path != null) {
2727
print(' ${e.path}');
2828
}
29-
exitCode = ExitCode.config.code;
30-
} on PackageException catch (e) {
31-
var withUnsupportedArg =
32-
e.unsupportedArgument != null ? ' with --${e.unsupportedArgument}' : '';
33-
print(red
34-
.wrap('$_boldApp could not run$withUnsupportedArg for this project.'));
35-
for (var detail in e.details) {
36-
print(yellow.wrap(detail.error));
37-
if (detail.description != null) {
38-
print(detail.description);
39-
}
40-
}
41-
4229
exitCode = ExitCode.config.code;
4330
} on IsolateSpawnException catch (e) {
4431
print(red.wrap('$_boldApp failed with an unexpected exception.'));

webdev/lib/src/command/build_command.dart

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import 'package:logging/logging.dart' as logging;
1616

1717
import '../daemon_client.dart';
1818
import '../logging.dart';
19-
import '../pubspec.dart';
2019
import 'configuration.dart';
2120
import 'shared.dart';
2221

@@ -50,15 +49,7 @@ class BuildCommand extends Command<int> {
5049
var configuration = Configuration.fromArgs(argResults);
5150
configureLogWriter(configuration.verbose);
5251

53-
List<String> arguments;
54-
try {
55-
await validatePubspecLock(configuration);
56-
arguments = buildRunnerArgs(configuration)..addAll(validExtraArgs);
57-
} on PackageException catch (e) {
58-
logWriter(logging.Level.SEVERE, 'Pubspec errors: ',
59-
error: '${e.details}');
60-
rethrow;
61-
}
52+
final arguments = buildRunnerArgs(configuration)..addAll(validExtraArgs);
6253

6354
try {
6455
logWriter(logging.Level.INFO, 'Connecting to the build daemon...');

webdev/lib/src/command/daemon_command.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import '../daemon/app_domain.dart';
1515
import '../daemon/daemon.dart';
1616
import '../daemon/daemon_domain.dart';
1717
import '../logging.dart';
18-
import '../pubspec.dart';
1918
import '../serve/dev_workflow.dart';
2019
import '../serve/utils.dart';
2120
import 'configuration.dart';
@@ -65,13 +64,6 @@ class DaemonCommand extends Command<int> {
6564
defaultConfiguration: Configuration(
6665
launchInChrome: true, debug: true, autoRun: false, release: false));
6766
configureLogWriter(configuration.verbose);
68-
// Validate the pubspec first to ensure we are in a Dart project.
69-
try {
70-
await validatePubspecLock(configuration);
71-
} on PackageException catch (e) {
72-
logWriter(Level.SEVERE, 'Pubspec errors: ', error: '${e.details}');
73-
rethrow;
74-
}
7567

7668
Daemon? daemon;
7769
DevWorkflow? workflow;

webdev/lib/src/command/serve_command.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@ import 'dart:async';
66

77
import 'package:args/args.dart';
88
import 'package:args/command_runner.dart';
9-
import 'package:logging/logging.dart';
109

1110
import '../logging.dart';
12-
import '../pubspec.dart';
1311
import '../serve/dev_workflow.dart';
1412
import 'configuration.dart';
1513
import 'shared.dart';
@@ -95,12 +93,6 @@ refresh: Performs a full page refresh.
9593
Configuration configuration;
9694
configuration = Configuration.fromArgs(argResults);
9795
configureLogWriter(configuration.verbose);
98-
try {
99-
await validatePubspecLock(configuration);
100-
} on PackageException catch (e) {
101-
logWriter(Level.SEVERE, 'Pubspec errors: ', error: '${e.details}');
102-
rethrow;
103-
}
10496
// Forward remaining arguments as Build Options to the Daemon.
10597
// This isn't documented. Should it be advertised?
10698
var buildOptions = buildRunnerArgs(configuration)

webdev/lib/src/command/shared.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22
// for details. All rights reserved. Use of this source code is governed by a
33
// BSD-style license that can be found in the LICENSE file.
44

5-
import 'dart:async';
65
import 'dart:io';
76

87
import 'package:args/args.dart';
98
import 'package:path/path.dart' as p;
109

11-
import '../pubspec.dart';
1210
import 'configuration.dart';
1311

1412
final lineLength = stdout.hasTerminal ? stdout.terminalColumns : 80;
@@ -102,12 +100,6 @@ List<String> buildRunnerArgs(Configuration configuration) {
102100
return arguments;
103101
}
104102

105-
Future<void> validatePubspecLock(Configuration configuration) async {
106-
var pubspecLock = await PubspecLock.read();
107-
await checkPubspecLock(pubspecLock,
108-
requireBuildWebCompilers: configuration.requireBuildWebCompilers);
109-
}
110-
111103
/// Checks that the normalized form of [path] is a top level directory under
112104
/// such as `web` or `test`.
113105
///

0 commit comments

Comments
 (0)