Skip to content

Commit 8b6e80c

Browse files
committed
build: refactor the typescript compiler broccoli plugin
1 parent fb3337b commit 8b6e80c

File tree

4 files changed

+184
-211
lines changed

4 files changed

+184
-211
lines changed

addon/ng2/commands/version.ts

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import * as Command from 'ember-cli/lib/models/command';
22
import * as path from 'path';
3-
3+
import * as child_process from 'child_process';
44

55
const VersionCommand = Command.extend({
66
name: 'version',
@@ -21,7 +21,19 @@ const VersionCommand = Command.extend({
2121

2222
var alwaysPrint = ['node', 'os'];
2323

24-
this.printVersion('angular-cli', pkg.version);
24+
var ngCliVersion = pkg.version;
25+
if (!__dirname.match(/node_modules/)) {
26+
var gitBranch = '??';
27+
try {
28+
var gitRefName = '' + child_process.execSync('git symbolic-ref HEAD', {cwd: __dirname});
29+
gitBranch = path.basename(gitRefName.replace('\n', ''));
30+
} catch (e) {
31+
}
32+
33+
ngCliVersion = `local (v${pkg.version}, branch: ${gitBranch})`;
34+
}
35+
36+
this.printVersion('angular-cli', ngCliVersion);
2537

2638
for (var module in versions) {
2739
if (options.verbose || alwaysPrint.indexOf(module) > -1) {

lib/broccoli/angular2-app.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
var path = require('path');
22
var configReplace = require('./broccoli-config-replace');
3-
var compileWithTypescript = require('./broccoli-typescript').default;
3+
var compileWithTypescript = require('./broccoli-typescript');
44
var SwManifest = require('./service-worker-manifest').default;
55
var fs = require('fs');
66
var Funnel = require('broccoli-funnel');
@@ -71,11 +71,6 @@ Angular2App.prototype.toTree = function () {
7171
exclude: ['*.d.ts', 'tsconfig.json']
7272
});
7373

74-
var tsSrcTree = new Funnel(sourceDir, {
75-
include: ['**/*.ts'],
76-
allowEmpty: true
77-
});
78-
7974
var jsTree = new Funnel(sourceDir, {
8075
include: ['**/*.js'],
8176
allowEmpty: true
@@ -94,7 +89,6 @@ Angular2App.prototype.toTree = function () {
9489

9590
var merged = mergeTrees([
9691
assetTree,
97-
tsSrcTree,
9892
tsTree,
9993
jsTree,
10094
this.index(),

0 commit comments

Comments
 (0)