angular-cli/lib/packages.js
Hans d29677815b feature(compiler): add support for AoT to the CLI. (#2333)
Also adding a new package, webpack, which is a plugin and loader for
webpack that adds support for AoT.

It is behind a `--aot` flag in the CLI that is supported by build and
serve.
2016-09-27 18:59:33 -07:00

25 lines
840 B
JavaScript

'use strict';
const fs = require('fs');
const path = require('path');
const packageRoot = path.join(__dirname, '../packages');
// All the supported packages. Go through the packages directory and create a map of
// name => fullPath.
const packages = fs.readdirSync(packageRoot)
.map(pkgName => ({ name: pkgName, root: path.join(packageRoot, pkgName) }))
.filter(pkg => fs.statSync(pkg.root).isDirectory())
.reduce((packages, pkg) => {
let pkgJson = JSON.parse(fs.readFileSync(path.join(pkg.root, 'package.json'), 'utf8'));
let name = pkgJson['name'];
packages[name] = {
dist: path.join(__dirname, '../dist', pkg.name),
packageJson: path.join(pkg.root, 'package.json'),
root: pkg.root,
main: path.resolve(pkg.root, 'src/index.ts')
};
return packages;
}, {});
module.exports = packages;