Generate module file based on metadata from generated components
function generateModuleFile(componentsMetadata, demoAppDocsModuleDir) {
  const imports = componentsMetadata
    .map(componentMetadata => `import { ${componentMetadata.name} } from './${componentMetadata.file}';`)
    .join('\n');

  const components = componentsMetadata
    .map(componentMetadata => `    ${componentMetadata.name},`)
    .join('\n');

  const routes = componentsMetadata
    .map(componentMetadata => `    { path: 'docs/${componentMetadata.route}', component: ${componentMetadata.name} },`)
    .join('\n');

  const moduleTsFileContents = `import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

${imports}

const routes: Routes = [
    { path: 'docs', component: IndexComponent }, // always start with index
${routes}
];

@NgModule({
  imports: [
    RouterModule.forChild(routes),
  ],
  declarations: [
${components}
  ],
  exports: [
${components}
  ]
})
export class DocsModule { }
`;

  const moduleTsFile = path.join(demoAppDocsModuleDir, 'docs.module.ts');
  fs.writeFileSync(moduleTsFile, moduleTsFileContents, { encoding: 'utf8' });
}