How to use the @angular/compiler-cli.NgcCliOptions function in @angular/compiler-cli

To help you get started, we’ve selected a few @angular/compiler-cli examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jlooper / angular-starter / tools / tasks / seed / compile.ahead.prod.ts View on Github external
.filter(f => f.endsWith('d.ts'))
      .map(f => join(path, f)));
    parsed.files = parsed.files.filter((f: string, i: number) => parsed.files.indexOf(f) === i);
    parsed.files.push(join(Config.BOOTSTRAP_DIR, 'main.web.ts'));
    return JSON.stringify(parsed, null, 2);
  });
  const args = argv;

  // If a translation, tell the compiler
  if (args.lang) {
    args['i18nFile'] = `./src/client/assets/locale/messages.${args.lang}.xlf`;
    args['locale'] = args.lang;
    args['i18nFormat'] = 'xlf';
  }

  const cliOptions = new NgcCliOptions(args);
  main(Config.TMP_DIR, cliOptions, codegen)
    .then(done)
    .catch(e => {
      console.error(e.stack);
      console.error('Compilation failed');
      process.exit(1);
    });
};
github inspire-software / yes-cart / manager / jam-jsclient / src / main / typescript / tools / tasks / seed / compile.ahead.prod.ts View on Github external
.filter(f => f.endsWith('d.ts'))
      .map(f => join(path, f)));
    parsed.files = parsed.files.filter((f: string, i: number) => parsed.files.indexOf(f) === i);
    parsed.files.push(join(Config.BOOTSTRAP_DIR, 'main.ts'));
    return JSON.stringify(parsed, null, 2);
  });
  const args = argv;

  // If a translation, tell the compiler
  if (args.lang) {
    args['i18nFile'] = `./src/client/assets/locale/messages.${args.lang}.xlf`;
    args['locale'] = args.lang;
    args['i18nFormat'] = 'xlf';
  }

  const cliOptions = new NgcCliOptions(args);
  main(Config.TMP_DIR, cliOptions, codegen)
    .then(done)
    .catch(e => {
      console.error(e.stack);
      console.error('Compilation failed');
      process.exit(1);
    });
};
github apache / incubator-dlab / services / self-service / src / main / resources / webapp / tools / tasks / seed / compile.ahead.prod.ts View on Github external
readdirSync(path)
      .filter(f => f.endsWith('d.ts'))
      .map(f => join(path, f)));
    parsed.files.push(join(Config.BOOTSTRAP_DIR, 'main.ts'));
    return JSON.stringify(parsed, null, 2);
  });
  const args = argv;

  // If a translation, tell the compiler
  if (args.lang) {
    args['i18nFile'] = `./src/client/assets/locale/messages.${args.lang}.xlf`;
    args['locale'] = args.lang;
    args['i18nFormat'] = 'xlf';
  }

  const cliOptions = new NgcCliOptions(args);
  main(Config.TMP_DIR, cliOptions, codegen)
    .then(done)
    .catch(e => {
      console.error(e.stack);
      console.error('Compilation failed');
      process.exit(1);
    });
};
github vmware / xenon / xenon-ui / src / main / ui / tools / tasks / seed / compile.ahead.prod.ts View on Github external
.filter(f => f.endsWith('d.ts'))
      .map(f => join(path, f)));
    parsed.files = parsed.files.filter((f: string, i: number) => parsed.files.indexOf(f) === i);
    parsed.files.push(join(Config.BOOTSTRAP_DIR, Config.BOOTSTRAP_PROD_MODULE+'.ts'));
    return JSON.stringify(parsed, null, 2);
  });
  const args = argv;

  // If a translation, tell the compiler
  if (args.lang) {
    args['i18nFile'] = `./src/client/assets/locale/messages.${args.lang}.xlf`;
    args['locale'] = args.lang;
    args['i18nFormat'] = 'xlf';
  }

  const cliOptions = new NgcCliOptions(args);
  main(Config.TMP_DIR, cliOptions, codegen)
    .then(done)
    .catch(e => {
      console.error(e.stack);
      console.error('Compilation failed');
      process.exit(1);
    });
};
github shlomiassaf / ngc-webpack / src / plugin.ts View on Github external
      p.then( () => run(this.options.tsConfig, new NgcCliOptions(this.options.cliOptions || {}), this.webpackWrapper) )
        .then( () => undefined ) // ensure the last then get's undefined if no error.
github shlomiassaf / ngc-webpack / src / main.ts View on Github external
export function main(args: any, consoleError: (s: string) => void = console.error) {
  run = ( () => {
    return consoleError('NgcWebpackPlugin is configured for integrated compilation while the compiler executed from the command line, this is not valid. Integrated compilation cancelled.');
  } ) as any;

  const project = args.p || args.project || '.';
  const cliOptions = new NgcCliOptions(args);

  const webpack = WebpackWrapper.fromConfig(args.webpack);

  return runInternal(project, cliOptions, webpack)
    .then(() => 0)
    .catch(e => {
      if (e instanceof UserError || isSyntaxError(e)) {
        consoleError(e.message);
        return Promise.resolve(1);
      } else {
        consoleError(e.stack);
        consoleError('Compilation failed');
        return Promise.resolve(1);
      }
    });
}
github dscheerens / ngx-webstorage-service / build-tools / gulpfile.ts View on Github external
return (done: DoneCallback) => {
        const cliOptions = new NgcCliOptions({});

        const tsOptions: ts.CompilerOptions = {
            ...extraCompilerOptions,
            target: target === 'es6' ? ts.ScriptTarget.ES2016 : ts.ScriptTarget.ES5,
            importHelpers: true
        };

        ngc(sourceDirectory, cliOptions, codegen, tsOptions)
            .then(done)
            .catch((error) => {
                (console).error(error.stack);
                (console).error('Compilation failed');
                process.exit(1);
            });
    };
}