Skip to content

feat(builder): broccoli bump to 1.0 #332

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

Merged
merged 2 commits into from
Mar 23, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion addon/ng2/blueprints/ng2/files/ember-cli-build.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ module.exports = function(defaults) {
vendorNpmFiles: []
});
return app.toTree();
}
};
1 change: 0 additions & 1 deletion addon/ng2/blueprints/ng2/files/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<script src="vendor/angular2/bundles/http.dev.js"></script>
<script src="vendor/angular2/bundles/router.dev.js"></script>

<script src="thirdparty/libs.js"></script>
<script>
System.config({
packages: {
Expand Down
2 changes: 1 addition & 1 deletion addon/ng2/blueprints/ng2/files/src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},

"files": [
"app/main.ts",
"app.ts",
"typings.d.ts"
]
}
54 changes: 20 additions & 34 deletions lib/broccoli/angular2-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ var Project = require('ember-cli/lib/models/project');

module.exports = Angular2App;

function Angular2App(defaults, options, additionalPaths) {
function Angular2App(defaults, options) {
this._initProject();
this._notifyAddonIncluded();
this.options = options;
this.additionalPaths = additionalPaths || [];
}

Angular2App.prototype.toTree = function() {
var sourceDir = 'src';

var sourceTree = new Funnel('src', {
include: ['*.ts', '**/*.ts', '**/*.d.ts'],
destDir: 'src'
});

Expand All @@ -41,33 +41,31 @@ Angular2App.prototype.toTree = function() {
'angular2/bundles/upgrade.dev.js'
];



if (this.options && this.options.vendorNpmFiles) {
vendorNpmFiles = vendorNpmFiles.concat(this.options.vendorNpmFiles);
}

var tsconfig = JSON.parse(fs.readFileSync('src/tsconfig.json', 'utf-8'));
var tsConfigCompilerOptions = tsconfig.compilerOptions;


// TODO(i): why do we need these additional paths? remove?
tsConfigCompilerOptions.rootFilePaths = this.additionalPaths.map(function(name) {
return path.join(process.cwd(), sourceDir, name)
});

// TODO(i): kill rootFilePaths in broccoli-typescript and use tsconfig.json#files instead
tsConfigCompilerOptions.rootFilePaths = tsConfigCompilerOptions.rootFilePaths.
concat(tsconfig.files.map(function(p) {
// TODO(i): this is a hack - for some reason we need to prefix all paths with srcDir because
// tsc's "rootDir" doesn't take effect when resolving "files" paths
return path.join(sourceDir, p);
}));
// Add all spec files to files. We need this because spec files are their own entry
// point.
fs.readdirSync(sourceDir).forEach(function addPathRecursive(name) {
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

const filePath = path.join(sourceDir, name);
if (filePath.match(/\.spec\.[jt]s$/)) {
tsconfig.files.push(name);
} else if (fs.statSync(filePath).isDirectory()) {
// Recursively call this function with the full sub-path.
fs.readdirSync(filePath).forEach(function(n) {
addPathRecursive(path.join(name, n));
});
}
});

// Because the tsconfig does not include the source directory, add this as the first path
// element.
tsconfig.files = tsconfig.files.map(name => path.join(sourceDir, name));

var srcAndTypingsTree = mergeTrees([sourceTree, typingsTree]);

var tsTree = compileWithTypescript(srcAndTypingsTree, tsConfigCompilerOptions);
var tsTree = new compileWithTypescript(srcAndTypingsTree, tsconfig);

tsTree = new Funnel(tsTree, {
srcDir: 'src',
Expand Down Expand Up @@ -95,28 +93,16 @@ Angular2App.prototype.toTree = function() {
destDir: 'vendor'
});

var thirdPartyJsTree = new Funnel('node_modules', {
include: ['ng2*/bundles/*.js'],
exclude: ['ng2*/bundles/*.min.js', 'ng2*/bundles/*.standalone.js'],
});

var thirdPartyJs = new Concat(thirdPartyJsTree, {
inputFiles: ['**/*.js'],
outputFile: '/thirdparty/libs.js',
allowNone: true
});

var merged = mergeTrees([
assetTree,
tsSrcTree,
tsTree,
jsTree,
this.index(),
vendorNpmTree,
thirdPartyJs
], { overwrite: true });

return mergeTrees([merged, new SwManifest(merged)]);
return mergeTrees([merged, new SwManifest([merged])]);
};

/**
Expand Down
37 changes: 0 additions & 37 deletions lib/broccoli/broccoli-dest-copy.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/broccoli/broccoli-dest-copy.js.map

This file was deleted.

51 changes: 0 additions & 51 deletions lib/broccoli/broccoli-flatten.js

This file was deleted.

1 change: 0 additions & 1 deletion lib/broccoli/broccoli-flatten.js.map

This file was deleted.

131 changes: 0 additions & 131 deletions lib/broccoli/broccoli-merge-trees.js

This file was deleted.

Loading