ngcc.js 852 Bytes
Newer Older
CED SA's avatar
CED SA committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

const cp = require('child_process');
const ph = require('path');
const os = require('os');

const libraries = []

const CMD = os.platform() === 'win32' ? `pnpx.cmd` : `pnpx`;

// --loglevel debug --async false --create-ivy-entry-points --first-only

libraries.forEach(function (lib) {

    // `--properties`, `es2015`, `browser`, `module`, `main`
    const ARGS = [`ngcc`, `--source`, lib, `--loglevel`, `debug`, `--async`, `false`]

    const RES = cp.spawnSync(CMD, ARGS)

    console.log(`status -->`, RES.status)

    if (RES.status !== 0) {

        if (RES.error) {
            console.error(RES.error.toString());
        }

        if (RES.stderr) {
            console.error(RES.stderr.toString())
        }

        process.exit(1)

    } else {
        if (RES.stdout) {
            console.info(RES.stdout.toString())
        }
    }

})