Skip to content

Commit

Permalink
Changes for dart2. (#51)
Browse files Browse the repository at this point in the history
* Updated for dart 2

changed pub build to webdev build

* Updated compile

Added $HOME/pub-cache/bin directory to path

* dart2

* dart2

* path variale updated

* changed pub-cache to .pub-cache

* testing

* added / in pub cache path

* changes

* confliting-outputs

* removed webdev flag

* test-app changes

* Update README.md

* Update README.md
  • Loading branch information
SushantChandla committed Mar 31, 2021
1 parent b696d57 commit 3b5b40b
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
10 changes: 9 additions & 1 deletion README.md
Expand Up @@ -10,7 +10,7 @@ This is now the default stack on Heroku.)


* Runs Dart VM as a server in Heroku's cloud * Runs Dart VM as a server in Heroku's cloud
* Installs packages with [pub][] * Installs packages with [pub][]
* Builds the client app with [pub build][build] * Builds the client app with [webdev build][build]


## Getting Started ## Getting Started


Expand Down Expand Up @@ -74,6 +74,14 @@ The sample app's `Procfile` looks like:
web: ./dart-sdk/bin/dart bin/basic_http_server.dart web: ./dart-sdk/bin/dart bin/basic_http_server.dart
``` ```


Add build_runner and build_web_compilers to you dev_dependencies in pubspec.yaml
```
dev_dependencies:
build_runner:
build_web_compilers:
...
```

### Specifying the pubspect.yaml ### Specifying the pubspect.yaml


By default every pubspec.yaml will be processed. By default every pubspec.yaml will be processed.
Expand Down
16 changes: 10 additions & 6 deletions bin/compile
Expand Up @@ -35,20 +35,24 @@ build_pubspec() {
message "*** Found pubspec.yaml in $BUILD_DIR/$pub_dir" message "*** Found pubspec.yaml in $BUILD_DIR/$pub_dir"
cd $BUILD_DIR/$pub_dir cd $BUILD_DIR/$pub_dir


DART_PATH=/app/dart-sdk/bin
PUB_CACHE_BIN=/app/pub-cache/bin
export PATH=$PATH:$DART_PATH:$PUB_CACHE_BIN
message "*** Running pub get" message "*** Running pub get"


/app/dart-sdk/bin/pub --version pub --version


#start pub from the /app folder to have correct symlink paths #start pub from the /app folder to have correct symlink paths
/app/dart-sdk/bin/pub get pub get


dart pub global activate webdev
if [ -d "web" ] if [ -d "web" ]
then then
message "*** Running pub build" message "*** Running webdev build"
if [[ -z "$DART_BUILD_CMD" ]] if [[ -z "$DART_BUILD_CMD" ]]
then then
message 'Building with "pub build"' message 'Building with "webdev build"'
/app/dart-sdk/bin/pub build webdev build
else else
message "Building with \"$DART_BUILD_CMD\"" message "Building with \"$DART_BUILD_CMD\""
eval $DART_BUILD_CMD eval $DART_BUILD_CMD
Expand Down
2 changes: 1 addition & 1 deletion test-app/bin/basic_http_server.dart
Expand Up @@ -7,7 +7,7 @@ import 'package:shelf_static/shelf_static.dart';
void main() { void main() {
// Assumes the server lives in bin/ and that `pub build` ran // Assumes the server lives in bin/ and that `pub build` ran
var pathToBuild = join(dirname(Platform.script.toFilePath()), var pathToBuild = join(dirname(Platform.script.toFilePath()),
'..', 'build/web'); '..', 'build/');


var handler = createStaticHandler(pathToBuild, var handler = createStaticHandler(pathToBuild,
defaultDocument: 'index.html'); defaultDocument: 'index.html');
Expand Down
2 changes: 2 additions & 0 deletions test-app/pubspec.yaml
Expand Up @@ -3,6 +3,8 @@ author: Seth Ladd <sethladd@gmail.com>
version: 0.0.1 version: 0.0.1
homepage: https://github.com/igrigorik/heroku-buildpack-dart homepage: https://github.com/igrigorik/heroku-buildpack-dart
description: A minimal static HTTP server to demonstrate Dart on Heroku. description: A minimal static HTTP server to demonstrate Dart on Heroku.
environment:
sdk: '>=2.10.0 <3.0.0'
dependencies: dependencies:
browser: any browser: any
shelf: any shelf: any
Expand Down

0 comments on commit 3b5b40b

Please sign in to comment.