Skip to content
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

Update for Dart 1.0 release #731

Closed

Conversation

MathieuLorber
Copy link
Contributor

A refresh for the release of Dart 1.0 !

  • selector api breaking changes
  • files are moved to a vanilla directory, as it's not a MVC implementation (as vanillajs) (as discussed here Dart breaking changes #711 )
  • use of a dedicated dependency for UUID
  • HTML escape is done by std lib
  • compiled file update
  • .maps file (for sourcemap) is commited
  • directories layer simplified (/web directory is not mandatory)
  • readme update

As a result of libs use, the final compiled file is now 200k instead of 130. Pruning is not completely ok yet i guess =]. Using librairies still seems to be the good practice to me...

Sorry for previous PR, I did not merged my repo properly =/

@@ -43,7 +45,7 @@ class TodoApp {
if (e.keyCode == KeyCode.ENTER) {
var title = newTodoElement.value.trim();
if (title != '') {
addTodo(new Todo(UUID.createUuid(), title));
addTodo(new Todo(uuid.v4(), title));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since it's only used once:

addTodo(new Todo((new Uuid()).v4(), title));

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's used each time you add a task, and Uuid construction isn't free

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing for HTML escape, I'm even thinking it could be global.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, HtmlEscape construction is free, so let's forget about it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have no clue what best practises in Dart are, but aren't there const and final modifiers that could be applied to this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They could actually be both (uuid and htmlescape) static & final... I look at that

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW, a lot more fields could be final (all fields in TodoApp.dart actually)... I'm not a "final extremist" + not sure it worthwhile here... WDYT ?

@MathieuLorber
Copy link
Contributor Author

I did not though to the link in todomvc.com . Do I forget another one ?

@MathieuLorber
Copy link
Contributor Author

No more absolute path in sourcemap but still, relative paths to the dart sdk were relative to my environnement

@addyosmani
Copy link
Member

@sethladd if you have any time this week to help us review the Dart 1.0 changes to the app that would be hugely appreciated. Thanks!

@sethladd
Copy link

Happy to help. Looks like I can check this out tomorrow if that's ok?

@sindresorhus
Copy link
Member

sure

@@ -1,6 +1,9 @@
part of todomvc;

class TodoApp {

static final uuid = new Uuid();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a type annotation here. Put them on static fields for better code completion and documentation.

@sethladd
Copy link

It would be really nice if the app follow pub conventions. That way we can run pub build to create a nice output directory.

Is it OK if we had both a web/ and a build/ checked into TodoMVC? web/ would be the source and build/ would be the output.

@sindresorhus
Copy link
Member

Is it OK if we had both a web/ and a build/ checked into TodoMVC? web/ would be the source and build/ would be the output.

Yes

@addyosmani
Copy link
Member

+1. Thanks for the review, @sethladd!

Also, here in Paris atm with @MathieuLorber :)

@sethladd
Copy link

sethladd commented Dec 5, 2013

@MathieuLorber could you create a web directory, move the HTML, Dart, etc files into it, and then run pub build, which generated a build/ dir, and then check all that in? :)

@MathieuLorber
Copy link
Contributor Author

Yep I didn't forgot =]. Pretty busy last days, I work on your code review soon !

@sethladd
Copy link

sethladd commented Dec 5, 2013

No problem, thanks!

@MathieuLorber
Copy link
Contributor Author

Ok so if I understand the result of pub build, index.html is supposed to be in /web and get copied to /build ? There is no standard way to have an unique index.html which opens dart or js depending on the browser ?

@passy
Copy link
Member

passy commented Dec 9, 2013

That's also very relevant for the AngularDart submission.

@sethladd
Copy link

Why do we need base.js? That generates an AJAX request for getFile('learn.json', Learn); which is an error.

@sethladd
Copy link

See MathieuLorber#1 because I couldn't find a good way to comment on random bits of code (unless that code was part of this diff? How do I leave a comment on a non-diff code?)

@passy
Copy link
Member

passy commented Dec 13, 2013

@sethladd base.js is part of the JavaScript we have in all TodoMVC apps. It shows the learning bar, but since that's in the root folder, you have to start your http server there.

@sethladd
Copy link

lgtm, can we merge?

Thanks! 🎉

@passy
Copy link
Member

passy commented Dec 16, 2013

@sethladd Some of your comments aren't addressed in the current version, like missing type annotations for UUID.

@MathieuLorber
Copy link
Contributor Author

Sorry I couldn't look at it during last days. I'm just wondering one thing (can't verify right now), does the compiled version works without doing pub install first ? I'm thinking about dart.js for example

@passy
Copy link
Member

passy commented Dec 16, 2013

@MathieuLorber No worries!

I found two issues wrt spec compliance:

  • entries should always be trimmed when saved
  • pressing escape when editing an item should revert the edit

@sethladd
Copy link

Thanks @passy ! We can fix those.

@MathieuLorber it should work out of the box, as long as you open and run from build/

@sethladd
Copy link

Hitting ESC now clears out the input.

Entries are trimmed for me. That seemed to work before. I assume you mean entering " hello " gets trimmed to "hello" ?

@sethladd
Copy link

Apologies, this PR is not off the branch I was using. I think I need to send over a new PR.

@sethladd
Copy link

I think we should close this PR and move the conversation over to #748

@passy passy closed this Dec 16, 2013
@MathieuLorber
Copy link
Contributor Author

Sorry @sethladd , actually you commited on a branch I created for tests, I wanted to merge it to the branch of this PR when all was ok... But no problem =)

@MathieuLorber MathieuLorber deleted the dart-v1-release-PR branch March 15, 2015 13:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants