So the question is pretty basic but I can\'t find it.
I created a new app through ng new my-project
, followed by a ng g library my-library
.
use with simple node js
like this:
create js
file in ~App root (e.g: build.js
).
then placed the following codes in your file.
var child_process = require('child_process');
console.log("building all packages...\n");
var files = GetProjectList();
var count = files.length;
var counter = 1;
files.forEach(item =>
{
try
{
console.log(`${counter++} of ${count} building ${item.fileName}...`);
child_process.execSync(`ng b ${item.fileName}`);
console.log(`${item.fileName} built successfully.\n`);
}
catch (er)
{
console.error(` Couldn't build ${item.fileName} .\n`);
}
});
function GetProjectList()
{
// enter list of projects here.
var lst = [];
lst.push({ fileName : 'project1' });
lst.push({ fileName : 'project2' });
lst.push({ fileName : 'project3' });
//...
return lst;
}
Finally, run your file with node js
command. like this:
node build.js // `build.js` is name of your created file on above
pay attention to the unicode your file. //
build.js
it's working well.
I hope is useful.