forked from umbraco/Umbraco-CMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
umbraco#5215 - Set up the initial build for typescript
I have rewritten the notificationsService and the AngularHelper (used by the NotificationsService) in Typescript. This gives a very good example of how the notificationsService can reference a concrete type even though the angularHelper is being injected in the constructor. Open the Umbraco.Web.UI.Client in an editor that supports Typescript, such as VS Code or Atom. In Umbraco.Web.UI.Client, run npm install. Then run "npm run dev" and it will do the following: 1. Compile the typescript into Umbraco.Web.UI.Client/src/common/services/build/temp/, into their respective files such as notifications.service.js 2. The existing JS build picks up the compiled JS files and merges them into umbraco.services.js, then is saved in Umbraco.Web.UI/Umbraco/js (all stuff it currently does) I converted the controller into a class, within the umbraco.services namespace. The benefit of this is having the ability to generate a definitions file that will retain all namespaces and therefore make it extremely easy to find what you are looking for when creating Umbraco extensions such as custom property types, dashboards etc. Note: I have set up a definitions folder for global variables that are declared outside of Typescript. We can add typings in for Angular etc at a later date if needed.
- Loading branch information
Showing
15 changed files
with
629 additions
and
494 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,6 +157,7 @@ build.tmp/ | |
build/hooks/ | ||
build/temp/ | ||
|
||
/src/Umbraco.Web.UI.Client/src/common/**/build/temp/ | ||
|
||
|
||
# eof | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
'use strict'; | ||
|
||
var config = require('../config'); | ||
var gulp = require('gulp'); | ||
|
||
var _ = require('lodash'); | ||
var MergeStream = require('merge-stream'); | ||
|
||
var processTs = require('../util/processTypescript'); | ||
|
||
/************************** | ||
* Copies all angular JS files into their seperate umbraco.*.js file | ||
**************************/ | ||
gulp.task('typescript', function () { | ||
|
||
//we run multiple streams, so merge them all together | ||
var stream = new MergeStream(); | ||
|
||
stream.add( | ||
gulp.src(config.sources.globs.js) | ||
.pipe(gulp.dest(config.root + config.targets.js)) | ||
); | ||
|
||
// compile TS | ||
_.forEach(config.sources.ts, function (group) { | ||
if(group.files.length > 0) | ||
stream.add (processTs(group.files, group.out)); | ||
}); | ||
|
||
return stream; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
var config = require('../config'); | ||
var gulp = require('gulp'); | ||
|
||
var ts = require('gulp-typescript'); | ||
|
||
module.exports = function(files, out) { | ||
|
||
var task = gulp.src(files); | ||
|
||
var tsProject = ts.createProject('tsconfig.json'); | ||
|
||
|
||
// sort files in stream by path or any custom sort comparator | ||
task = task.pipe(tsProject()) | ||
.pipe(gulp.dest(out)); | ||
|
||
|
||
return task; | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
declare var angular: any; | ||
declare var _: any; | ||
declare var $q: any; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
interface StringConstructor { | ||
CreateGuid(): string; | ||
} |
Oops, something went wrong.