Skip to content
This repository has been archived by the owner on Mar 26, 2018. It is now read-only.

Adding typescript support to generator-angular #539

Closed
wants to merge 16 commits into from

Conversation

eggers
Copy link
Contributor

@eggers eggers commented Jan 7, 2014

There have been a few other projects that have tried to support typescript with the angular generator (e.g. anchann and JakubMrozek), but are currently out of date. It would be great if we could get this merged in so that we can try keeping it current.

@eddiemonge
Copy link
Member

How is this different from #313?

@eggers
Copy link
Contributor Author

eggers commented Jan 7, 2014

@eddiemonge This is essentially a replacement for #313 which is now out of date as it was made 5 months ago. I also tried to keep the change smaller (22 changed files with 396 additions and 10 deletions vs 30 changed files with 604 additions and 83 deletions for #313), and typescriptify the ts files a bit more.

var config = {
file: path.join(
this.env.options.appPath,
'scripts/app.' + (coffee ? 'coffee' : 'js')
'scripts/app.' + (coffee ? 'coffee' : typescript ? 'ts': 'js')
Copy link

Choose a reason for hiding this comment

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

Are you sure the splicable section doesn't also need a condition for typescript? Maybe (coffee || typescript)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, because typescript is a superset of javascript, so it has the same syntax as javascript. CoffeeScript has different language syntax.

Copy link

Choose a reason for hiding this comment

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

Great. Just making sure.

@jednano
Copy link

jednano commented Jan 9, 2014

Aren't you also supposed to copy over the templates/javascript-min folder to templates/typescript-min?

@jednano
Copy link

jednano commented Jan 9, 2014

Is 'use strict'; required at the top of TypeScript files too?

@@ -0,0 +1,19 @@
/// <reference path="../bower_components/definitivelyTyped/angularjs/angular.d.ts" />
<% if (ngRoute) { %>/// <reference path="../bower_components/definitivelyTyped/angularjs/angular-route.d.ts" /><% } %>
/// <reference path="../bower_components/definitivelyTyped/angularjs/angular-resource.d.ts" />
Copy link

Choose a reason for hiding this comment

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

These module references should be conditional.

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 was a bunch of extra steps to get the other references to be conditional, though it would probably be a good idea.

@eggers
Copy link
Contributor Author

eggers commented Jan 9, 2014

@jedmao Thanks for all of your code review. I'm making your suggested changes as I type except where I commented. As for the other comments:

  • typescript doesn't automatically add use strict; to the compiled javascript unless you specific it explicitly.
  • I didn't copy javascript-min over because it's deprecated anyhow since ng-min does the work already.

"angular-scenario": "1.2.6"
"angular-scenario": "1.2.6"<% if (typescript) { %>,
"dt-jasmine": "~2.0.0",
"dt-angular": "https://github.com/jedmao/dt-angular/archive/v1.2.0.tar.gz"<% } %>
Copy link

Choose a reason for hiding this comment

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

Can we switch the placement of these two so they are listed alphabetically? I find it's sometimes hard to find what I'm looking for in these manifest files when they aren't alphabetical.

@jednano
Copy link

jednano commented Jan 12, 2014

I think this is ready for some code review. Let @eggers know if we need a squash.

@bsr203
Copy link

bsr203 commented Mar 4, 2014

can u please commnet how to install that branch. I tried something like,

npm install -g git://github.com/eggers/generator-angular/tree/ngdocs

which didn't work. thanks again.

I saw options like, build only changed filed, etc :-)

On Mon, Mar 3, 2014 at 7:28 PM, eggers [email protected] wrote:

Just redo yo angular - - typescript. It will overwrite the grunt.js, you
may also need to delete your .js files.

Also, I prefer my #ngdocs branch. It has some additional niceties.

Reply to this email directly or view it on GitHubhttps://github.com//pull/539#issuecomment-36578756
.

@bsr203
Copy link

bsr203 commented Mar 4, 2014

looks like this worked.. npm install -g git://github.com/eggers/generator-angular#ngdocs

@bsr203
Copy link

bsr203 commented Mar 4, 2014

@eggers can you please check the incremental compilation works. I just cloned the project, and modified two files (just whitespace). I see it compiles previous changes too.

I tried to debug this, as it works for me with jade compilation. Only difference I could see is

jade: {
                options: {
                    nospawn: true,
                    livereload: true
                },

vs

typescript: {
                options: {
                    spawn: false
                },

but, changing that too didn't work

Running "connect:livereload" (connect) task
Started connect web server on 127.0.0.1:9000.

Running "watch" task
Waiting...OK
>> File "app/scripts/app.ts" changed.


Running "typescript:base" (typescript) task
3 files created. js: 1 file, map: 1 file, declaration: 1 file

Running "ngdocs:api" (ngdocs) task
Generating Documentation...
DONE. Generated 2 pages in 67ms.

Running "watch" task
... Reload app/scripts/app.ts ...
... Reload app/scripts/app.ts ...
Completed in 13.196s at Mon Mar 03 2014 21:20:09 GMT-0500 (EST) - Waiting...
OK
>> File "app/scripts/controllers/main.ts" changed.


Running "typescript:base" (typescript) task
6 files created. js: 2 files, map: 2 files, declaration: 2 files

Running "ngdocs:api" (ngdocs) task
Generating Documentation...
DONE. Generated 2 pages in 56ms.

Running "watch" task
... Reload app/scripts/app.ts ...
... Reload app/scripts/controllers/main.ts ...
... Reload app/scripts/app.ts ...
... Reload app/scripts/controllers/main.ts ...
Completed in 13.558s at Mon Mar 03 2014 21:20:38 GMT-0500 (EST) - Waiting...

@eddiemonge
Copy link
Member

Haven't forget about this but need to do some more testing and other things first

@kclay
Copy link

kclay commented May 15, 2014

Whats the current status on this, looking to start a new project leveraging play+typescript+angular

@eddiemonge eddiemonge added this to the 0.10.0: The Future milestone Jun 5, 2014
@piotrwitek
Copy link

please give an update on TypeScript integration progress. Thx.

@stevemao
Copy link
Contributor

stevemao commented Jul 6, 2014

Still reviewing this PR?

@eddiemonge
Copy link
Member

its on hold at the moment while the generator is being updated

@vpassapera
Copy link

Is it going to be merged any time soon?

@eggers doesn't seem like you have rebased in a while, is this still alive?

thanks!

@eddiemonge
Copy link
Member

its on hold from me, not the author of this pr.

@eggers
Copy link
Contributor Author

eggers commented Sep 3, 2014

I will rework once the generator has been updated based upon my findings
and the new structure.

stevemao pushed a commit to stevemao/generator-angular that referenced this pull request Nov 6, 2014
refactor(app:templates:server): deprecate sendfile -- use sendFile instead
@gilamran
Copy link

Any news regarding this pull request?

@michikono
Copy link

+1

@eddiemonge
Copy link
Member

not yet

@moneytree-doug
Copy link

👍 Any updates?

@luisrudge
Copy link

I think its best to create a generator-angular-typescript and be done with it. No one from this project really care, unfortunately.

@mohlman3
Copy link

mohlman3 commented Feb 1, 2015

+1

@keichi
Copy link

keichi commented May 13, 2015

+1 for this.

@reroslyn
Copy link

+1 for this!

@awk
Copy link
Contributor

awk commented May 26, 2015

This pull request seems to have gone stale in the past 6-8 months. I just created #1098 which is based on this one but with updates for the latest version of generator-angular and also to use tsd/definitelyTyped to pull the .d.ts files

@danielsiwiec
Copy link

+1

@eddiemonge eddiemonge closed this Jul 10, 2015
@rogerpadilla
Copy link

+1

@eddiemonge
Copy link
Member

why are you +1 this? its already been added

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.