Skip to content
This repository was archived by the owner on Nov 30, 2023. It is now read-only.

Commit af68070

Browse files
authored
Merge pull request #44 from DanTup/dart-tweaks
Tweaks to Dart container
2 parents af9ed33 + a9fad74 commit af68070

File tree

9 files changed

+18
-45
lines changed

9 files changed

+18
-45
lines changed

containers/dart/.devcontainer/Dockerfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@ FROM google/dart:2
77

88
ENV PATH="$PATH":"/root/.pub-cache/bin"
99

10-
RUN pub global activate webdev
11-
1210
# Install git, process tools
1311
RUN apt-get update && apt-get -y install git procps
1412

containers/dart/.devcontainer/devcontainer.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
"name": "Dart",
33
"dockerFile": "Dockerfile",
44
"extensions": [
5-
"dart-code.dart-code",
6-
"msjsdiag.debugger-for-chrome"
5+
"dart-code.dart-code"
76
],
87

98
// Uncomment the next line if you want to publish any ports.
109
// "appPort": [],
1110

1211
// Uncomment the next line to run commands after the container is created.
13-
// "postCreateCommand": "pub get"
12+
// "postCreateCommand": ""
1413
}

containers/dart/.vscode/launch.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@
88
"name": "Launch Server",
99
"type": "dart",
1010
"request": "launch",
11-
"program": "server.dart",
12-
"cwd": "${workspaceFolder}/test-project",
13-
"preLaunchTask": "get"
11+
"program": "bin/server.dart",
12+
"cwd": "test-project",
13+
"serverReadyAction": {
14+
"pattern": "Listening on localhost:([0-9]+)",
15+
"uriFormat": "http://localhost:%s",
16+
"action": "openExternally"
17+
}
1418
}
1519
]
1620
}

containers/dart/.vscode/tasks.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

containers/dart/README.md

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ This definition includes some test code that will help you verify it is working
3838
2. Clone this repository.
3939
3. Start VS Code, press <kbd>F1</kbd>, and select **Remote-Containers: Open Folder in Container...**
4040
4. Select the `containers/dart` folder.
41-
5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project. This will automatically run `pub get` and build the code before starting it.
42-
6. Once the project is running, press <kbd>F1</kbd> and select **Remote-Containers: Forward Port from Container...**
43-
7. Select port 8080 and click the "Open Browser" button in the notification that appears.
44-
8. You should see "Hello remote world!" after the page loads.
45-
9. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
41+
5. After the folder has opened in the container, press <kbd>F5</kbd> to start the project and launch the browser.
42+
6. You should see "Hello remote world!" after the page loads.
43+
7. From here, you can add breakpoints or edit the contents of the `test-project` folder to do further testing.
4644

4745
## License
4846

containers/dart/test-project/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@ build/
99

1010
# Directory created by dartdoc
1111
doc/api/
12+
13+
# Don't exclude bin/ folders for Dart projects
14+
![Bb]in/

containers/dart/test-project/analysis_options.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

containers/dart/test-project/server.dart renamed to containers/dart/test-project/bin/server.dart

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,16 @@
66
import 'dart:io';
77

88
Future main() async {
9-
10-
11-
var server = await HttpServer.bind(
9+
final server = await HttpServer.bind(
1210
InternetAddress.loopbackIPv4,
1311
8080,
1412
);
15-
print('*************************************************************************');
16-
print('* Press F1, select "Remote-Containers: Forward Port from Container...", *');
17-
print('* and select the server port listed below to access server. *');
18-
print('*************************************************************************');
13+
1914
print('Listening on localhost:${server.port}');
2015

2116
await for (HttpRequest request in server) {
2217
request.response
2318
..write('Hello remote world!')
2419
..close();
2520
}
26-
}
21+
}

containers/dart/test-project/pubspec.yaml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,3 @@ description: A test project
88

99
environment:
1010
sdk: '>=2.1.0 <3.0.0'
11-
12-
dev_dependencies:
13-
build_runner: ^1.1.2
14-
build_web_compilers: ^1.0.0
15-
pedantic: ^1.0.0

0 commit comments

Comments
 (0)