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

Adding typescript support to generator-angular #1098

Closed
wants to merge 1 commit into from

Conversation

awk
Copy link
Contributor

@awk awk commented May 26, 2015

This is largely based upon an earlier pull request (#539).

It's updated for recent changes in generator-angular since that pull request was last updated. This flavor also uses tad and grunt-tsd to retrieve typescript definition files from the defintelyTyped repo instead of retrieving the definitions via bower_components.

Uses grunt-tsd to retrieve an initial set of typescript definitions.
Adds templates for typescript versions of angular items.

Based upon commit 'refs/pull/539/head' of github.com:yeoman/generator-angular
@awk awk force-pushed the awk/typescript branch from 6f14bc1 to 06041b0 Compare May 28, 2015 12:45
@nzamosenchuk
Copy link

Very important thing is missing in Gruntfile.js generated with --typescript. Actual typescript task is not referenced and thus, no JS generated.
Need to manually update Gruntfile.js, and add the following typescript references to concurrent task:

    concurrent: {
      server: [
        'typescript',
        'sass:server',
        'copy:styles'        
      ],
      test: [
        'typescript',
        'copy:styles'
      ],
      dist: [
        'typescript',
        'sass',
        'copy:styles',
        'imagemin',
        'svgmin'
      ]
    },

@awk
Copy link
Contributor Author

awk commented May 28, 2015

I'm not seeing this problem - if I run yo angular --typescript and accept the default options (or even if I choose not to use SASS) the resulting Gruntfile.js has entries for typescript in the concurrent:server task.

Can you make sure you've applied this pull request correctly?

@nzamosenchuk
Copy link

Sorry, looks to be a temporary glitch on my side. I've made the clean installation from scratch again (updating the npm, cleaning all the caches and all the stuff) and everything is fine now.

Thanks for great job done!

@eddiemonge
Copy link
Member

@LunarDevelopment
Copy link

👍 Is this happening soon ?

@awk
Copy link
Contributor Author

awk commented Jul 9, 2015

There hasn't been any real interest from the comitters for generator-angular - in the meantime I've created https://www.npmjs.com/package/generator-angular-typescript which is essentially this pull request 'made real'.

@eddiemonge
Copy link
Member

I've been feeling lately, more and more, that the correct thing is to strip out typescript/coffeescript/precompilers in general, make this fully composable and then either create (or let others do it) generators that add thos to this. Still not sure how that is going to work though

@awk
Copy link
Contributor Author

awk commented Jul 9, 2015

I'd be more than happy to take on the Typescript implementation part - once the composable part of the generator is worked out.

I agree with you though that working out that composable mechanism is going to be tough.

@eddiemonge eddiemonge closed this Jul 24, 2015
@ilubnon
Copy link

ilubnon commented Oct 10, 2015

Hello,

When using the option --typescript, my project does not add support typescript, works only for coffeescript.

$ yo angular --typescript // not working.

$ yo angular --coffee // work's fine.

Also, even creating a project "default" and create controller with option --typescript, does not working.

$ yo angular: controller user --typescript

I will appreciate your help

My npm packages and versions:

$ npm list -g --depth=0
  /usr/local/lib
  ├── babel@5.8.23
  ├── bower@1.5.3
  ├── coffee-script@1.10.0
  ├── express@4.13.3
  ├── express-generator@4.13.1
  ├── generator-angular@0.12.1
  ├── generator-angular-typescript@0.11.2
  ├── generator-karma@1.0.0
  ├── generator-karma-typescript@1.0.0
  ├── grunt@0.4.5
  ├── grunt-cli@0.1.13
  ├── grunt-karma@0.12.1
  ├── jasmine-core@2.3.4
  ├── jshint@2.8.0
  ├── karma@0.13.10
  ├── latest-version@1.0.1
  ├── npm@3.3.5
  ├── phantomjs@1.9.18
  ├── tsd@0.6.5
  ├── typescript@1.6.2
  └── yo@1.4.8

Version Node and NPM

$ node -v && npm -v
  v4.1.2
  3.3.5

@diwadu
Copy link

diwadu commented Oct 17, 2015

Have the same issue as ilubnon, can generate only coffee files but not ts.

Node & NPM versions

$ node -v && npm -v
v4.2.1
2.14.7

@awk
Copy link
Contributor Author

awk commented Oct 17, 2015

My commit was never merged - unless you're building from my branch those options don't work.

Alternatively you can install my fork of this repo https://www.npmjs.com/package/generator-angular-typescript and then you can do yo angular-typescript --typescript

@diwadu
Copy link

diwadu commented Oct 17, 2015

Thanks for the info. After lot of perturbations i installed finally your version, seems that working, creating app skeleton horribly long, but i suppose i have something wrong with versions of npm & git. Appreciate your work, i hope that TS support will appear soon in official version. Cheers!

@marcalj
Copy link

marcalj commented Oct 21, 2015

Thanks @awk I'm using generator-angular-typescript in the meantime. Let's see if it's easy to migrate a big app :)

@marcalj
Copy link

marcalj commented Oct 21, 2015

Hey @awk I can't add issues on your repo. It's always creating the app on my root user folder! Not the current one! How can I add an issue on your repo? Thanks!

@eddiemonge
Copy link
Member

@marcalj do you have a .yo-rc.json in your root user folder? Are you running the yo command as sudo?

@eddiemonge
Copy link
Member

@awk @marcalj @diwadu awk: your changes were merged. Haven't done a release for them yet though. To use the typescript option you have to install the git master version: npm i -g yeoman/generator-angular

@nzamosenchuk
Copy link

grunt test doesn't work with typescript-based app. They simply are not found by Karma.
Need to manually update karma.conf.js path to JS files. That are stored in '.tmp/...' after typescript preprocessing.

@marcalj
Copy link

marcalj commented Oct 29, 2015

@eddiemonge Removing yo-rc.json fixes the problem, thanks!

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

Successfully merging this pull request may close these issues.

7 participants