( projectName: string, template: ApplicationTemplate, valdiReleaseTag: string, valdiWidgetsReleaseTag: string, )
| 159 | |
| 160 | // Create files from templates |
| 161 | function initializeConfigFiles( |
| 162 | projectName: string, |
| 163 | template: ApplicationTemplate, |
| 164 | valdiReleaseTag: string, |
| 165 | valdiWidgetsReleaseTag: string, |
| 166 | ) { |
| 167 | |
| 168 | const TEMPLATE_FILES = [ |
| 169 | TemplateFile.init(TEMPLATE_BASE_PATHS.USER_CONFIG).withOutputPath(resolveFilePath(VALDI_CONFIG_PATHS[0] ?? '')), |
| 170 | TemplateFile.init(TEMPLATE_BASE_PATHS.BAZEL_VERSION), |
| 171 | TemplateFile.init(TEMPLATE_BASE_PATHS.MODULE_BAZEL).withReplacements({ |
| 172 | WORKSPACE_NAME: projectName, |
| 173 | VALDI_RELEASE_TAG: valdiReleaseTag, |
| 174 | VALDI_WIDGETS_RELEASE_TAG: valdiWidgetsReleaseTag, |
| 175 | }), |
| 176 | TemplateFile.init(TEMPLATE_BASE_PATHS.BAZEL_RC).withReplacements({ |
| 177 | VALDI_RELEASE_TAG: valdiReleaseTag, |
| 178 | }), |
| 179 | TemplateFile.init(TEMPLATE_BASE_PATHS.README), |
| 180 | TemplateFile.init(TEMPLATE_BASE_PATHS.GIT_IGNORE), |
| 181 | TemplateFile.init(TEMPLATE_BASE_PATHS.WATCHMAN_CONFIG), |
| 182 | TemplateFile.init(TEMPLATE_BASE_PATHS.EDITOR_CONFIG), |
| 183 | TemplateFile.init(TEMPLATE_BASE_PATHS.AGENTS).withReplacements({ MODULE_NAME: projectName }), |
| 184 | ]; |
| 185 | |
| 186 | TEMPLATE_FILES.forEach(templateFile => { |
| 187 | console.log( |
| 188 | wrapInColor(`Creating ${templateFile.baseName} in ${templateFile.outputPath}...`, ANSI_COLORS.YELLOW_COLOR), |
| 189 | ); |
| 190 | templateFile.expandTemplate(); |
| 191 | }); |
| 192 | |
| 193 | // Copy shared bootstrap directories |
| 194 | const replacements: Replacements = { |
| 195 | MODULE_NAME: projectName, |
| 196 | MODULE_NAME_PASCAL_CASED: toPascalCase(projectName), |
| 197 | }; |
| 198 | const githubSourcePath = path.join(BOOTSTRAP_DIR_PATH, '.github'); |
| 199 | if (fileExists(githubSourcePath)) { |
| 200 | console.log(wrapInColor('Creating GitHub templates...', ANSI_COLORS.YELLOW_COLOR)); |
| 201 | const githubDestPath = path.join(process.cwd(), '.github'); |
| 202 | copyBootstrapFiles(githubSourcePath, githubDestPath, replacements); |
| 203 | } |
| 204 | |
| 205 | // Setup hello world application |
| 206 | console.log(wrapInColor(`Initializing ${template.name} application...`, ANSI_COLORS.YELLOW_COLOR)); |
| 207 | const sourcePath = path.join(BOOTSTRAP_DIR_PATH, 'apps', template.path); |
| 208 | const destPath = process.cwd(); |
| 209 | |
| 210 | copyBootstrapFiles(sourcePath, destPath, replacements); |
| 211 | } |
| 212 | |
| 213 | const VALDI_SUB_MODULES: readonly { name: string; subPath: string }[] = [ |
| 214 | { name: 'android_macros', subPath: 'bzl/macros' }, |
no test coverage detected