How to use @angular/compiler-cli - 10 common examples

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 angular / components / src / dev-app / rollup-bundles.js View on Github external
async function main() {
  const config = ngc.readConfiguration(path.join(__dirname, 'tsconfig-build.json'));
  const host = ngc.createCompilerHost({options: config.options});
  const program = new NgtscProgram(config.rootNames, config.options, host);

  // Determine all lazy routes in the dev-app and setup their entry-point in
  // the  rollup inputs object.
  program.listLazyRoutes().forEach(route => {
    console.log('>>> Building route entry-point:', route.route);

    rollupInputs[route.route.split('#')[0]] = `${devAppOut}/${path
      .relative(__dirname, route.referencedModule.filePath.split('#')[0])
      .replace('.ts', '.js')}`;
  });

  const build = await rollup.rollup({
    input: rollupInputs,
    plugins: [
github angular / components / src / dev-app / rollup-bundles.js View on Github external
async function main() {
  const config = ngc.readConfiguration(path.join(__dirname, 'tsconfig-build.json'));
  const host = ngc.createCompilerHost({options: config.options});
  const program = new NgtscProgram(config.rootNames, config.options, host);

  // Determine all lazy routes in the dev-app and setup their entry-point in
  // the  rollup inputs object.
  program.listLazyRoutes().forEach(route => {
    console.log('>>> Building route entry-point:', route.route);

    rollupInputs[route.route.split('#')[0]] = `${devAppOut}/${path
      .relative(__dirname, route.referencedModule.filePath.split('#')[0])
      .replace('.ts', '.js')}`;
  });

  const build = await rollup.rollup({
    input: rollupInputs,
    plugins: [
      require('rollup-plugin-commonjs')({ignore: [ 'conditional-runtime-dependency' ]}),
github jlooper / angular-starter / tools / tasks / seed / compile.ahead.prod.ts View on Github external
.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 apache / incubator-dlab / services / self-service / src / main / resources / webapp / tools / tasks / seed / compile.ahead.prod.ts View on Github external
.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
.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 inspire-software / yes-cart / manager / jam-jsclient / src / main / typescript / tools / tasks / seed / compile.ahead.prod.ts View on Github external
.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 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);
    });
};