function getUpdateFiles(localFiles: Tree) {
    return [
        { path: "src/app/app.module.ts", file: localFiles.get("code/module")! },
        { path: "src/app/app.component.ts", file: localFiles.get("code/component")! },
        { path: "src/app/app.component.html", file: localFiles.get("code/component_template")! },
        { path: "src/styles.css", file: localFiles.get("assets/styles.css")! },
        { path: "src/index.html", file: localFiles.get("assets/index.html")! },
    ];
}
Example #2
0
export function getFileContent(tree: Tree, path: string): string {
  const fileEntry = tree.get(path);

  if (!fileEntry) {
    throw new Error(`The file (${path}) does not exist.`);
  }

  return fileEntry.content.toString();
}
Example #3
0
function envConfig(host: Tree, options: PluginOptions) {
  const defEnvPath = `${options.sourceRoot}/environments/environment.ts`;
  const defContent = host.get(defEnvPath).content;
  if (!host.exists(defEnvPath)) return ;
  // 1. update default env file
  addValueToVariable(host, defEnvPath, 'environment', 'hmr: false');
  // 2. update prod env file
  addValueToVariable(host, `${options.sourceRoot}/environments/environment.prod.ts`, 'environment', 'hmr: false');
  // 3. copy default env file to hmr file
  const hmrEnvPath = `${options.sourceRoot}/environments/environment.hmr.ts`;
  host.create(hmrEnvPath, defContent);
  addValueToVariable(host, hmrEnvPath, 'environment', 'hmr: true');
}
function getCreateFiles(localFiles: Tree) {
    return [
        { path: "src/app/app-routing.module.ts", file: localFiles.get("code/routing")! },
        { path: "src/config.json", file: localFiles.get("code/config")! },
        { path: "src/assets/alt.calendar.png", file: localFiles.get("assets/alt.calendar.png")! },
        { path: "src/assets/alt.list.png", file: localFiles.get("assets/alt.list.png")! },
        { path: "src/assets/alt.summary.png", file: localFiles.get("assets/alt.summary.png")! },
        { path: "src/assets/alt.table.png", file: localFiles.get("assets/alt.table.png")! },
        { path: "src/assets/calendar.png", file: localFiles.get("assets/calendar.png")! },
        { path: "src/assets/list.png", file: localFiles.get("assets/list.png")! },
        { path: "src/assets/summary.png", file: localFiles.get("assets/summary.png")! },
        { path: "src/assets/table.png", file: localFiles.get("assets/table.png")! },
        { path: "src/fonts/iconFont.eot", file: localFiles.get("fonts/iconFont.eot")! },
        { path: "src/fonts/iconFont.svg", file: localFiles.get("fonts/iconFont.svg")! },
        { path: "src/fonts/iconFont.ttf", file: localFiles.get("fonts/iconFont.ttf")! },
        { path: "src/fonts/iconFont.woff", file: localFiles.get("fonts/iconFont.woff")! },
        { path: "src/fonts/license.txt", file: localFiles.get("fonts/license.txt")! },
        { path: "src/theme.css", file: localFiles.get("assets/theme.css")! },
        { path: "src/theme.alt.css", file: localFiles.get("assets/theme.alt.css")! },
    ];
}