How to use projectName method in storybook-root

Best JavaScript code snippet using storybook-root

main_worker.ts

Source:main_worker.ts Github

copy

Full Screen

1/* eslint-disable class-methods-use-this */2import { startCase, toLower } from 'lodash'3import { CliAnswerModel, JavaCliAnswerModel, ProjectTypeEnum, JavaSection } from '../model/prompt_answer'4import { CliResponse, CliError, TempCopy } from '../model/workers'5import { Utils } from './utils'6import { Replacetruct, buildReplaceFoldersAndVals, BuildReplaceInput } from '../config/file_mapper'7import { ssr, netcore, javaSpringAksTfs, javaSpringAksJenkins, javaSerenityTfs, csr, shared, netcoreSelenium,8 gkeSsr, infraAks, jsTestcafe, gkeSsrJenkins, infraGke } from '../config/worker_maps'9import conf from '../config/static.config.json'10import { Static } from '../model/config'11const staticConf: Static = conf as Static;12/* eslint class-methods-use-this: ["error", { "exceptMethods": ["ssrAksTfs", "infraAksAzdevops", "ssrGkeTfs", "netcoreSeleniumTfs", "csrAksTfs", "javaSpringAksTfs", "javaSpringAksJenkins", "netcoreAksTfs", "jsTestcafeTfs"] }] */13export class MainWorker {14 async ssrAksTfs(instructions: CliAnswerModel): Promise<CliResponse> {15 const selectedFlowResponse: CliResponse = {} as CliResponse16 try {17 const sharedBuildInput: Array<BuildReplaceInput> = shared.inFiles({18 projectName: instructions.projectName,19 businessObj: instructions.business,20 cloudObj: instructions.cloud,21 terraformObj: instructions.terraform,22 scmObj: instructions.sourceControl,23 networkObj: instructions.networking24 })25 const buildInput: Array<BuildReplaceInput> = ssr.inFiles({26 projectName: instructions.projectName,27 businessObj: instructions.business,28 cloudObj: instructions.cloud,29 terraformObj: instructions.terraform,30 scmObj: instructions.sourceControl,31 networkObj: instructions.networking32 }).concat(sharedBuildInput)33 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)34 await Utils.doGitClone(staticConf.ssr.gitRepo, newDirectory.tempPath, staticConf.ssr.localPath, staticConf.ssr.gitRef)35 await Utils.constructOutput(staticConf.ssr.folderMap, newDirectory.finalPath, newDirectory.tempPath)36 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput);37 await Utils.valueReplace(valMaps)38 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)39 selectedFlowResponse.code = 040 selectedFlowResponse.ok = true41 // Control the output message from each method42 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, ssr.responseMessage(instructions.projectName), instructions.enableAdvanced)43 return selectedFlowResponse44 } catch (ex) {45 const cliErr = ex as CliError46 return {47 ok: false,48 code: ex.code || -1,49 message: ex.message,50 error: cliErr51 } as CliResponse;52 }53 }54 async netcoreAksTfs(instructions: CliAnswerModel): Promise<CliResponse> {55 const selectedFlowResponse: CliResponse = {} as CliResponse56 try {57 const sharedBuildInput: Array<BuildReplaceInput> = shared.inFiles({58 projectName: instructions.projectName,59 businessObj: instructions.business,60 cloudObj: instructions.cloud,61 terraformObj: instructions.terraform,62 scmObj: instructions.sourceControl,63 networkObj: instructions.networking64 })65 const buildInput: Array<BuildReplaceInput> = netcore.inFiles({66 projectName: instructions.projectName,67 businessObj: instructions.business,68 cloudObj: instructions.cloud,69 terraformObj: instructions.terraform,70 scmObj: instructions.sourceControl,71 networkObj: instructions.networking72 }).concat(sharedBuildInput)73 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)74 // git clone node_repo custom app src75 // srcPathInTmp should be statically defined in each method76 await Utils.doGitClone(staticConf.netcore.gitRepo, newDirectory.tempPath, staticConf.netcore.localPath, staticConf.netcore.gitRef)77 await Utils.constructOutput([...staticConf.netcore.folderMap, ...staticConf.shared.folderMap], newDirectory.finalPath, newDirectory.tempPath)78 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput)79 await Utils.valueReplace(valMaps)80 const replaceString = `${startCase(toLower(instructions.business.company)).replace(/\s/gm, "")}.${startCase(toLower(instructions.business.project)).replace(/\s/gm, "")}`81 const fileNameReplacementPaths = staticConf.netcore.fileNameReplacementPaths?.map(path => `${newDirectory.finalPath}${path}`);82 await Utils.fileNameReplace(fileNameReplacementPaths || [], staticConf.netcore.searchValue as string, replaceString)83 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)84 selectedFlowResponse.code = 085 selectedFlowResponse.ok = true86 // Control the output message from each method87 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, netcore.responseMessage(instructions.projectName), instructions.enableAdvanced)88 return selectedFlowResponse89 } catch (ex) {90 const cliErr = ex as CliError91 return {92 ok: false,93 code: ex.code || -1,94 message: ex.message,95 error: cliErr96 } as CliResponse;97 }98 }99 async javaSpringAksTfs(instructions: JavaCliAnswerModel): Promise<CliResponse> {100 const selectedFlowResponse: CliResponse = {} as CliResponse101 try {102 const sharedBuildInput: Array<BuildReplaceInput> = shared.inFiles({103 projectName: instructions.projectName,104 businessObj: instructions.business,105 cloudObj: instructions.cloud,106 terraformObj: instructions.terraform,107 scmObj: instructions.sourceControl,108 networkObj: instructions.networking109 })110 const buildInput: Array<BuildReplaceInput> = javaSpringAksTfs.inFiles({111 projectName: instructions.projectName,112 projectType: instructions.projectType,113 businessObj: instructions.business,114 cloudObj: instructions.cloud,115 terraformObj: instructions.terraform,116 scmObj: instructions.sourceControl,117 networkObj: instructions.networking,118 javaspringObj: instructions[ProjectTypeEnum.JAVASPRING]119 }).concat(sharedBuildInput)120 let configName;121 switch (`${instructions.projectType}-${instructions.javaspring.testingFramework}`) {122 case "javaspring-serenity":123 configName = "javaSpring";124 break;125 case "javaspring-karate":126 configName = "javaSpringKarate";127 break;128 case "javaspringcqrs-serenity":129 configName = "javaSpringCqrs";130 break;131 case "javaspringcqrs-karate":132 configName = "javaSpringCqrsKarate";133 break;134 default:135 configName = "javaSpring";136 }137 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)138 // git clone node_repo custom app src139 // srcPathInTmp should be statically defined in each method140 await Utils.doGitClone(staticConf[configName].gitRepo, newDirectory.tempPath, staticConf[configName].localPath, staticConf[configName].gitRef)141 await Utils.constructOutput(142 staticConf[configName].folderMap,143 newDirectory.finalPath,144 newDirectory.tempPath,145 )146 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(147 newDirectory.finalPath,148 buildInput,149 )150 await Utils.valueReplace(valMaps)151 const replaceString = `${instructions[ProjectTypeEnum.JAVASPRING].namespace.replace(/\./gm, "/")}/${toLower(startCase(instructions.business.company)).replace(/\s/gm, "")}/${toLower(startCase(instructions.business.project)).replace(/\s/gm, "")}`152 const fileNameReplacementPaths = staticConf[configName].fileNameReplacementPaths?.map(path => `${newDirectory.finalPath}${path}`);153 await Utils.fileNameReplace(fileNameReplacementPaths || [],154 (staticConf[configName].searchValue as string).replace(/\./gm, "/"),155 replaceString, true)156 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)157 selectedFlowResponse.code = 0158 selectedFlowResponse.ok = true159 // Control the output message from each method160 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, javaSpringAksTfs.responseMessage(instructions.projectName), instructions.enableAdvanced)161 return selectedFlowResponse162 } catch (ex) {163 const cliErr = ex as CliError164 return {165 ok: false,166 code: ex.code || -1,167 message: ex.message,168 error: cliErr169 } as CliResponse;170 }171 }172 async javaSpringAksJenkins(instructions: JavaCliAnswerModel): Promise<CliResponse> {173 const selectedFlowResponse: CliResponse = {} as CliResponse174 try {175 const sharedBuildInput: Array<BuildReplaceInput> = shared.inFiles({176 projectName: instructions.projectName,177 businessObj: instructions.business,178 cloudObj: instructions.cloud,179 terraformObj: instructions.terraform,180 scmObj: instructions.sourceControl,181 networkObj: instructions.networking182 })183 const buildInput: Array<BuildReplaceInput> = javaSpringAksJenkins.inFiles({184 projectName: instructions.projectName,185 businessObj: instructions.business,186 cloudObj: instructions.cloud,187 terraformObj: instructions.terraform,188 scmObj: instructions.sourceControl,189 networkObj: instructions.networking,190 javaspringObj: instructions[ProjectTypeEnum.JAVASPRING]191 }).concat(sharedBuildInput)192 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)193 // git clone node_repo custom app src194 // srcPathInTmp should be statically defined in each method195 await Utils.doGitClone(staticConf.javaSpringJenkins.gitRepo, newDirectory.tempPath, staticConf.javaSpringJenkins.localPath, staticConf.javaSpringJenkins.gitRef)196 await Utils.constructOutput(staticConf.javaSpringJenkins.folderMap, newDirectory.finalPath, newDirectory.tempPath)197 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput)198 await Utils.valueReplace(valMaps)199 const replaceString = `${instructions[ProjectTypeEnum.JAVASPRING].namespace.replace(/\./gm, "/")}/${toLower(startCase(instructions.business.company)).replace(/\s/gm, "")}/${toLower(startCase(instructions.business.project)).replace(/\s/gm, "")}`200 const fileNameReplacementPaths = staticConf.javaSpringJenkins.fileNameReplacementPaths?.map(path => `${newDirectory.finalPath}${path}`);201 await Utils.fileNameReplace(fileNameReplacementPaths || [],202 (staticConf.javaSpringJenkins.searchValue as string).replace(/\./gm, "/"),203 replaceString, true)204 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)205 selectedFlowResponse.code = 0206 selectedFlowResponse.ok = true207 // Control the output message from each method208 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, javaSpringAksJenkins.responseMessage(instructions.projectName), instructions.enableAdvanced)209 return selectedFlowResponse210 } catch (ex) {211 const cliErr = ex as CliError212 return {213 ok: false,214 code: ex.code || -1,215 message: ex.message,216 error: cliErr217 } as CliResponse;218 }219 }220 async csrAksTfs(instructions: CliAnswerModel): Promise<CliResponse> {221 const selectedFlowResponse: CliResponse = {} as CliResponse222 try {223 const sharedBuildInput: Array<BuildReplaceInput> = shared.inFiles({224 projectName: instructions.projectName,225 businessObj: instructions.business,226 cloudObj: instructions.cloud,227 terraformObj: instructions.terraform,228 scmObj: instructions.sourceControl,229 networkObj: instructions.networking230 })231 const buildInput: Array<BuildReplaceInput> = csr.inFiles({232 projectName: instructions.projectName,233 businessObj: instructions.business,234 cloudObj: instructions.cloud,235 terraformObj: instructions.terraform,236 scmObj: instructions.sourceControl,237 networkObj: instructions.networking238 }).concat(sharedBuildInput)239 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)240 await Utils.doGitClone(staticConf.csr.gitRepo, newDirectory.tempPath, staticConf.csr.localPath, staticConf.csr.gitRef)241 await Utils.constructOutput(staticConf.csr.folderMap, newDirectory.finalPath, newDirectory.tempPath)242 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput)243 await Utils.valueReplace(valMaps)244 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)245 selectedFlowResponse.code = 0246 selectedFlowResponse.ok = true247 // Control the output message from each method248 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, csr.responseMessage(instructions.projectName), instructions.enableAdvanced)249 return selectedFlowResponse250 } catch (ex) {251 const cliErr = ex as CliError252 return {253 ok: false,254 code: ex.code || -1,255 message: ex.message,256 error: cliErr257 } as CliResponse;258 }259 }260 async netcoreSeleniumTfs(instructions: CliAnswerModel): Promise<CliResponse> {261 const selectedFlowResponse: CliResponse = {} as CliResponse262 try {263 const buildInput: Array<BuildReplaceInput> = netcoreSelenium.inFiles(instructions.projectName, instructions.business, instructions.cloud)264 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)265 await Utils.constructOutput(staticConf.netcoreSelenium.folderMap, newDirectory.finalPath, newDirectory.tempPath)266 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput);267 await Utils.valueReplace(valMaps)268 const replaceString = `${startCase(toLower(instructions.business.company)).replace(/\s/gm, "")}.${startCase(toLower(instructions.business.project)).replace(/\s/gm, "")}`269 const fileNameReplacementPaths = staticConf.netcoreSelenium.fileNameReplacementPaths?.map(path => `${newDirectory.finalPath}${path}`);270 await Utils.fileNameReplace(fileNameReplacementPaths || [], staticConf.netcoreSelenium.searchValue as string, replaceString)271 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)272 selectedFlowResponse.code = 0273 selectedFlowResponse.ok = true274 // Control the output message from each method275 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, netcoreSelenium.responseMessage(instructions.projectName))276 return selectedFlowResponse277 } catch (ex) {278 const cliErr = ex as CliError279 return {280 ok: false,281 code: ex.code || -1,282 message: ex.message,283 error: cliErr284 } as CliResponse;285 }286 }287 async javaSerenityTfs(instructions: JavaCliAnswerModel): Promise<CliResponse> {288 const javaSerenityTfsConfig = staticConf.javaSerenityTfs289 const selectedFlowResponse: CliResponse = {} as CliResponse290 try {291 const buildInput: Array<BuildReplaceInput> = javaSerenityTfs.inFiles({292 projectName: instructions.projectName,293 businessObj: instructions.business,294 javaspringObj: instructions[ProjectTypeEnum.JAVASPRING]295 })296 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)297 await Utils.constructOutput(298 javaSerenityTfsConfig.folderMap,299 newDirectory.finalPath,300 newDirectory.tempPath,301 )302 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(303 newDirectory.finalPath,304 buildInput,305 )306 await Utils.valueReplace(valMaps)307 const replaceString = `${instructions[ProjectTypeEnum.JAVASPRING].namespace.replace(/\./gm, "/")}/${toLower(startCase(instructions.business.company)).replace(/\s/gm, "")}/${toLower(startCase(instructions.business.project)).replace(/\s/gm, "")}`308 const fileNameReplacementPaths = javaSerenityTfsConfig.fileNameReplacementPaths?.map(path => `${newDirectory.finalPath}${path}`);309 await Utils.fileNameReplace(310 fileNameReplacementPaths || [],311 (javaSerenityTfsConfig.searchValue as string).replace(/\./gm, "/"),312 replaceString,313 true, // Java Style Replacement314 )315 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)316 selectedFlowResponse.code = 0317 selectedFlowResponse.ok = true318 // Control the output message from each method319 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, javaSerenityTfs.responseMessage(instructions.projectName))320 return selectedFlowResponse321 } catch (ex) {322 const cliErr = ex as CliError323 return {324 ok: false,325 code: ex.code || -1,326 message: ex.message,327 error: cliErr328 } as CliResponse329 }330 }331 async ssrGkeTfs(instructions: CliAnswerModel): Promise<CliResponse> {332 const selectedFlowResponse: CliResponse = {} as CliResponse333 try {334 const sharedBuildInput: Array<BuildReplaceInput> = shared.inFiles({335 projectName: instructions.projectName,336 businessObj: instructions.business,337 cloudObj: instructions.cloud,338 terraformObj: instructions.terraform,339 scmObj: instructions.sourceControl,340 networkObj: instructions.networking341 })342 const buildInput: Array<BuildReplaceInput> = gkeSsr.inFiles({343 projectName: instructions.projectName,344 businessObj: instructions.business,345 cloudObj: instructions.cloud,346 terraformObj: instructions.terraform,347 scmObj: instructions.sourceControl,348 networkObj: instructions.networking349 }).concat(sharedBuildInput)350 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)351 await Utils.doGitClone(staticConf.ssrGke.gitRepo, newDirectory.tempPath, staticConf.ssrGke.localPath, staticConf.ssrGke.gitRef)352 await Utils.constructOutput(staticConf.ssrGke.folderMap, newDirectory.finalPath, newDirectory.tempPath)353 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput);354 await Utils.valueReplace(valMaps)355 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)356 selectedFlowResponse.code = 0357 selectedFlowResponse.ok = true358 // Control the output message from each method359 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, gkeSsr.responseMessage(instructions.projectName), instructions.enableAdvanced)360 return selectedFlowResponse361 } catch (ex) {362 const cliErr = ex as CliError363 return {364 ok: false,365 code: ex.code || -1,366 message: ex.message,367 error: cliErr368 } as CliResponse;369 }370 }371 async ssrGkeJenkins(instructions: CliAnswerModel): Promise<CliResponse> {372 const selectedFlowResponse: CliResponse = {} as CliResponse373 try {374 const sharedBuildInput: Array<BuildReplaceInput> = shared.inFiles({375 projectName: instructions.projectName,376 businessObj: instructions.business,377 cloudObj: instructions.cloud,378 terraformObj: instructions.terraform,379 scmObj: instructions.sourceControl,380 networkObj: instructions.networking381 })382 const buildInput: Array<BuildReplaceInput> = gkeSsrJenkins.inFiles({383 projectName: instructions.projectName,384 businessObj: instructions.business,385 cloudObj: instructions.cloud,386 terraformObj: instructions.terraform,387 scmObj: instructions.sourceControl,388 networkObj: instructions.networking389 }).concat(sharedBuildInput)390 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)391 await Utils.constructOutput(staticConf.ssrGkeJenkins.folderMap, newDirectory.finalPath, newDirectory.tempPath)392 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput);393 await Utils.valueReplace(valMaps)394 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)395 selectedFlowResponse.code = 0396 selectedFlowResponse.ok = true397 // Control the output message from each method398 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, gkeSsr.responseMessage(instructions.projectName), instructions.enableAdvanced)399 return selectedFlowResponse400 } catch (ex) {401 const cliErr = ex as CliError402 return {403 ok: false,404 code: ex.code || -1,405 message: ex.message,406 error: cliErr407 } as CliResponse;408 }409 }410 async infraAksAzdevops(instructions: CliAnswerModel): Promise<CliResponse> {411 const selectedFlowResponse: CliResponse = {} as CliResponse412 try {413 const sharedBuildInput: Array<BuildReplaceInput> = shared.inFiles({414 projectName: instructions.projectName,415 businessObj: instructions.business,416 cloudObj: instructions.cloud,417 terraformObj: instructions.terraform,418 scmObj: instructions.sourceControl,419 networkObj: instructions.networking420 })421 const buildInput: Array<BuildReplaceInput> = infraAks.inFiles({422 projectName: instructions.projectName,423 businessObj: instructions.business,424 cloudObj: instructions.cloud,425 terraformObj: instructions.terraform,426 scmObj: instructions.sourceControl,427 networkObj: instructions.networking428 }).concat(sharedBuildInput)429 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)430 await Utils.doGitClone(staticConf.aksInfra.gitRepo, newDirectory.tempPath, staticConf.aksInfra.localPath, staticConf.aksInfra.gitRef)431 await Utils.constructOutput(staticConf.aksInfra.folderMap, newDirectory.finalPath, newDirectory.tempPath)432 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput);433 await Utils.valueReplace(valMaps)434 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions, "-infra")435 selectedFlowResponse.code = 0436 selectedFlowResponse.ok = true437 // Control the output message from each method438 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, infraAks.responseMessage(instructions.projectName), instructions.enableAdvanced)439 return selectedFlowResponse440 } catch (ex) {441 const cliErr = ex as CliError442 return {443 ok: false,444 code: ex.code || -1,445 message: ex.message,446 error: cliErr447 } as CliResponse;448 }449 }450 async infraGkeAzdevops(instructions: CliAnswerModel): Promise<CliResponse> {451 const selectedFlowResponse: CliResponse = {} as CliResponse452 try {453 const sharedBuildInput: Array<BuildReplaceInput> = shared.inFiles({454 projectName: instructions.projectName,455 businessObj: instructions.business,456 cloudObj: instructions.cloud,457 terraformObj: instructions.terraform,458 scmObj: instructions.sourceControl,459 networkObj: instructions.networking460 })461 const buildInput: Array<BuildReplaceInput> = infraGke.inFiles({462 projectName: instructions.projectName,463 businessObj: instructions.business,464 cloudObj: instructions.cloud,465 terraformObj: instructions.terraform,466 scmObj: instructions.sourceControl,467 networkObj: instructions.networking468 }).concat(sharedBuildInput)469 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)470 await Utils.constructOutput(staticConf.gkeInfra.folderMap, newDirectory.finalPath, newDirectory.tempPath)471 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput);472 await Utils.valueReplace(valMaps)473 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions, "-infra")474 selectedFlowResponse.code = 0475 selectedFlowResponse.ok = true476 // Control the output message from each method477 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, infraAks.responseMessage(instructions.projectName), instructions.enableAdvanced)478 return selectedFlowResponse479 } catch (ex) {480 const cliErr = ex as CliError481 return {482 ok: false,483 code: ex.code || -1,484 message: ex.message,485 error: cliErr486 } as CliResponse;487 }488 }489 async infraGkeJenkins(instructions: CliAnswerModel): Promise<CliResponse> {490 const selectedFlowResponse: CliResponse = {} as CliResponse491 try {492 const buildInput: Array<BuildReplaceInput> = shared.inFiles({493 projectName: instructions.projectName,494 businessObj: instructions.business,495 cloudObj: instructions.cloud,496 terraformObj: instructions.terraform,497 scmObj: instructions.sourceControl,498 networkObj: instructions.networking499 })500 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)501 await Utils.constructOutput(staticConf.gkeInfraJenkins.folderMap, newDirectory.finalPath, newDirectory.tempPath)502 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput);503 await Utils.valueReplace(valMaps)504 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions, "-infra")505 selectedFlowResponse.code = 0506 selectedFlowResponse.ok = true507 // Control the output message from each method508 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, infraAks.responseMessage(instructions.projectName), instructions.enableAdvanced)509 return selectedFlowResponse510 } catch (ex) {511 const cliErr = ex as CliError512 return {513 ok: false,514 code: ex.code || -1,515 message: ex.message,516 error: cliErr517 } as CliResponse;518 }519 }520 async jsTestcafeTfs(instructions: CliAnswerModel): Promise<CliResponse> {521 const selectedFlowResponse: CliResponse = {} as CliResponse522 try {523 const buildInput: Array<BuildReplaceInput> = jsTestcafe.inFiles(instructions.projectName)524 const newDirectory: TempCopy = await Utils.prepBase(instructions.projectName)525 await Utils.constructOutput(staticConf.jsTestcafe.folderMap, newDirectory.finalPath, newDirectory.tempPath)526 const valMaps: Array<Replacetruct> = buildReplaceFoldersAndVals(newDirectory.finalPath, buildInput);527 await Utils.valueReplace(valMaps)528 await Utils.writeOutConfigFile(`${instructions.projectName}.bootstrap-config.json`, instructions)529 selectedFlowResponse.code = 0530 selectedFlowResponse.ok = true531 // Control the output message from each method532 selectedFlowResponse.message = shared.finalResponseMessage(instructions.projectName, jsTestcafe.responseMessage(instructions.projectName))533 return selectedFlowResponse534 } catch (ex) {535 const cliErr = ex as CliError536 return {537 ok: false,538 code: ex.code || -1,539 message: ex.message,540 error: cliErr541 } as CliResponse;542 }543 }544}545export default {546 MainWorker...

Full Screen

Full Screen

Gruntfile.js

Source:Gruntfile.js Github

copy

Full Screen

1var projectName = 'Butter';2var getHost = function () {3 return {4 get linux() {5 return process.platform === 'linux';6 },7 get windows() {8 return process.platform === 'win32';9 },10 get mac() {11 return process.platform === 'darwin';12 },13 };14};15var parseBuildPlatforms = function (argumentPlatform) {16 // this will make it build no platform when the platform option is specified17 // without a value which makes argumentPlatform into a boolean18 var inputPlatforms = argumentPlatform || process.platform + ";" + process.arch;19 // Do some scrubbing to make it easier to match in the regexes bellow20 inputPlatforms = inputPlatforms.replace("darwin", "mac");21 inputPlatforms = inputPlatforms.replace(/;ia|;x|;arm/, "");22 if (process.arch === "x64" && argumentPlatform === "") {23 inputPlatforms = inputPlatforms.replace("32", "64");24 }25 var buildAll = /^all$/.test(inputPlatforms);26 var buildPlatforms = {27 mac32: /mac/.test(inputPlatforms) || buildAll,28 mac64: /mac/.test(inputPlatforms) || buildAll,29 win32: /win32/.test(inputPlatforms) || buildAll,30 win64: /win64/.test(inputPlatforms) || buildAll,31 linux32: /linux32/.test(inputPlatforms) || buildAll,32 linux64: /linux64/.test(inputPlatforms) || buildAll33 };34 return buildPlatforms;35};36module.exports = function (grunt) {37 "use strict";38 var host = getHost();39 var buildPlatforms = parseBuildPlatforms(grunt.option('platforms'));40 var pkgJson = grunt.file.readJSON('package.json');41 var currentVersion = pkgJson.version;42 require('load-grunt-tasks')(grunt);43 grunt.registerTask('default', [44 'css',45 'jshint',46 'bower_clean',47 'injectgit'48 ]);49 // Called from the npm hook50 grunt.registerTask('setup', [51 'githooks'52 ]);53 grunt.registerTask('css', [54 'stylus:official'55 ]);56 grunt.registerTask('themes', [57 'shell:themes',58 'clean:css',59 'stylus:official',60 'stylus:third_party'61 ]);62 grunt.registerTask('js', [63 'jsbeautifier:default'64 ]);65 grunt.registerTask('build', [66 'injectgit',67 'bower_clean',68 /*'lang',*/69 'themes',70 'nwjs',71 'shell:setexecutable'72 ]);73 grunt.registerTask('lang', ['shell:language']);74 grunt.registerTask('dist', [75 'clean:releases',76 'clean:dist',77 'clean:update',78 'build',79 'clean:nwjs',80 'exec:codesign', // mac81 'exec:createDmg', // mac82 'exec:createWinInstall',83 'exec:pruneProduction',84 'exec:createLinuxInstall',85 'exec:createWinUpdate',86 'package' // all platforms87 ]);88 grunt.registerTask('start', function () {89 var start = parseBuildPlatforms();90 if (start.win32) {91 grunt.task.run('exec:win32');92 } else if (start.win64) {93 grunt.task.run('exec:win64');94 } else if (start.mac32) {95 grunt.task.run('exec:mac32');96 } else if (start.mac64) {97 grunt.task.run('exec:mac64');98 } else if (start.linux32) {99 grunt.task.run('exec:linux32');100 } else if (start.linux64) {101 grunt.task.run('exec:linux64');102 } else {103 grunt.log.writeln('OS not supported.');104 }105 });106 grunt.registerTask('package', [107 'shell:packageLinux64',108 'shell:packageDEBLinux64',109 'shell:packageLinux32',110 'shell:packageDEBLinux32',111 'shell:packageWin32',112 'shell:packageWin64',113 'shell:packageMac32',114 'shell:packageMac64',115 ]);116 grunt.registerTask('injectgit', function () {117 if (grunt.file.exists('.git/')) {118 var gitBranch, currCommit;119 var path = require('path');120 var gitRef = grunt.file.read('.git/HEAD');121 try {122 gitRef = gitRef.split(':')[1].trim();123 gitBranch = path.basename(gitRef);124 currCommit = grunt.file.read('.git/' + gitRef).trim();125 } catch (e) {126 var fs = require('fs');127 currCommit = gitRef.trim();128 var items = fs.readdirSync('.git/refs/heads');129 gitBranch = items[0];130 }131 var git = {132 branch: gitBranch,133 commit: currCommit134 };135 grunt.file.write('.git.json', JSON.stringify(git, null, ' '));136 }137 });138 grunt.initConfig({139 githooks: {140 all: {141 'pre-commit': 'jsbeautifier:default jsbeautifier:verify jshint',142 }143 },144 jsbeautifier: {145 options: {146 config: ".jsbeautifyrc"147 },148 default: {149 src: ["src/app/lib/*.js", "src/app/lib/**/*.js", "src/app/*.js", "src/app/vendor/videojshooks.js", "src/app/vendor/videojsplugins.js", "*.js", "*.json"],150 },151 verify: {152 src: ["src/app/lib/*.js", "src/app/lib/**/*.js", "src/app/*.js", "src/app/vendor/videojshooks.js", "src/app/vendor/videojsplugins.js", "*.js", "*.json"],153 options: {154 mode: 'VERIFY_ONLY'155 }156 }157 },158 stylus: {159 third_party: {160 options: {161 'resolve url': true,162 use: ['nib'],163 compress: false,164 paths: ['src/app/styl']165 },166 expand: true,167 cwd: 'src/app/styl',168 src: 'third_party/*.styl',169 dest: 'src/app/themes/',170 ext: '.css'171 },172 official: {173 options: {174 'resolve url': true,175 use: ['nib'],176 compress: false,177 paths: ['src/app/styl']178 },179 expand: true,180 cwd: 'src/app/styl',181 src: '*.styl',182 dest: 'src/app/themes/',183 ext: '.css'184 }185 },186 nwjs: {187 options: {188 version: '0.12.3',189 build_dir: './build', // Where the build version of my nwjs app is saved190 keep_nw: true,191 embed_nw: false,192 mac_icns: './src/app/images/butter.icns', // Path to the Mac icon file193 macZip: buildPlatforms.win, // Zip nw for mac in windows. Prevent path too long if build all is used.194 mac32: buildPlatforms.mac32,195 mac64: buildPlatforms.mac64,196 win32: buildPlatforms.win32,197 win64: buildPlatforms.win64,198 linux32: buildPlatforms.linux32,199 linux64: buildPlatforms.linux64,200 download_url: 'http://dl.nwjs.io/'201 },202 src: ['./src/**', '!./src/app/styl/**',203 './node_modules/**', '!./node_modules/bower/**',204 '!./node_modules/*grunt*/**', '!./node_modules/stylus/**',205 '!./node_modules/nw-gyp/**', '!./node_modules/**/*.bin',206 '!./node_modules/**/*.c', '!./node_modules/**/*.h',207 '!./node_modules/**/Makefile', '!./node_modules/**/*.h',208 '!./**/test*/**', '!./**/doc*/**', '!./**/example*/**',209 '!./**/demo*/**', '!./**/bin/**', '!./**/build/**', '!./**/.*/**',210 './package.json', './README.md', './CHANGELOG.md', './LICENSE.txt',211 './.git.json'212 ]213 },214 exec: {215 win32: {216 cmd: '"cache/<%= nwjs.options.version %>/win32/nw.exe" .'217 },218 win64: {219 cmd: '"cache/<%= nwjs.options.version %>/win64/nw.exe" .'220 },221 mac32: {222 cmd: 'cache/<%= nwjs.options.version %>/osx32/nwjs.app/Contents/MacOS/nwjs .'223 },224 mac64: {225 cmd: 'cache/<%= nwjs.options.version %>/osx64/nwjs.app/Contents/MacOS/nwjs .'226 },227 linux32: {228 cmd: '"build/' + projectName + '/linux32/' + projectName + '" .'229 },230 linux64: {231 cmd: '"build/' + projectName + '/linux64/' + projectName + '" .'232 },233 codesign: {234 cmd: 'sh dist/mac/codesign.sh || echo "Codesign failed, likely caused by not being run on mac, continuing"'235 },236 createDmg: {237 cmd: 'dist/mac/yoursway-create-dmg/create-dmg --volname "' + projectName + '-' + currentVersion + '" --background ./dist/mac/background.png --window-size 480 540 --icon-size 128 --app-drop-link 240 370 --icon "' + projectName + '" 240 110 ./build/releases/' + projectName + '/mac/' + projectName + '-' + currentVersion + '-Mac.dmg ./build/releases/' + projectName + '/mac/ || echo "Create dmg failed, likely caused by not being run on mac, continuing"'238 },239 createWinInstall: {240 cmd: 'makensis dist/windows/installer_makensis.nsi',241 maxBuffer: Infinity242 },243 createLinuxInstall: {244 cmd: 'sh dist/linux/exec_installer.sh'245 },246 createWinUpdate: {247 cmd: 'sh dist/windows/updater_package.sh'248 },249 pruneProduction: {250 cmd: 'npm prune --production'251 }252 },253 jshint: {254 gruntfile: {255 options: {256 jshintrc: '.jshintrc'257 },258 src: 'Gruntfile.js'259 },260 src: {261 options: {262 jshintrc: 'src/app/.jshintrc'263 },264 src: ['src/app/lib/*.js', 'src/app/lib/**/*.js', 'src/app/vendor/videojshooks.js', 'src/app/vendor/videojsplugins.js', 'src/app/*.js']265 }266 },267 shell: {268 themes: {269 command: [270 'git submodule init',271 'git submodule update'272 ].join('&&')273 },274 language: {275 command: [276 'git submodule init',277 'git submodule update'278 ].join('&&')279 },280 setexecutable: {281 command: function () {282 if (host.linux || host.mac) {283 var cmds = ['pct_rel="build/' + projectName + '"'];284 if (buildPlatforms.mac32 || buildPlatforms.mac64) {285 cmds.push('chmod -R +x ${pct_rel}/osx*/' + projectName + '.app || : ');286 }287 if (buildPlatforms.linux32 || buildPlatforms.linux64) {288 cmds.push('chmod +x ${pct_rel}/linux*/' + projectName + ' || : ');289 }290 return cmds.join(' && ');291 } else {292 return 'echo ""'; // Not needed in Windows293 }294 }295 },296 packageLinux64: {297 command: function () {298 if (host.linux || host.mac) {299 return [300 'cp build/cache/linux64/<%= nwjs.options.version %>/icudtl.dat build/releases/' + projectName + '/linux64/' + projectName,301 'cp -r build/cache/linux64/<%= nwjs.options.version %>/locales build/releases/' + projectName + '/linux64/' + projectName,302 'cp dist/linux/linux-installer build/releases/' + projectName + '/linux64/' + projectName + '/install',303 'cp dist/linux/butter.png build/releases/' + projectName + '/linux64/' + projectName,304 'cd build/releases/' + projectName + '/linux64/' + projectName,305 'chmod +x install',306 'tar --exclude-vcs -c . | $(command -v pxz || command -v xz) -T8 -7 > "../' + projectName + '-' + currentVersion + '-Linux-64.tar.xz"',307 'echo "Linux64 Sucessfully packaged" || echo "Linux64 failed to package"'308 ].join(' && ');309 } else {310 return [311 'cp build/cache/linux64/<%= nwjs.options.version %>/icudtl.dat build/releases/' + projectName + '/linux64/' + projectName,312 'cp -r build/cache/linux64/<%= nwjs.options.version %>/locales build/releases/' + projectName + '/linux64/' + projectName,313 'cp dist/linux/linux-installer build/releases/' + projectName + '/linux64/' + projectName + '/install',314 'cp dist/linux/butter.png build/releases/' + projectName + '/linux64/' + projectName,315 'grunt compress:linux64',316 '( echo "Compressed sucessfully" ) || ( echo "Failed to compress" )'317 ].join(' && ');318 }319 }320 },321 packageLinux32: {322 command: function () {323 if (host.linux || host.mac) {324 return [325 'cp build/cache/linux32/<%= nwjs.options.version %>/icudtl.dat build/releases/' + projectName + '/linux32/' + projectName,326 'cp -r build/cache/linux32/<%= nwjs.options.version %>/locales build/releases/' + projectName + '/linux32/' + projectName,327 'cp dist/linux/linux-installer build/releases/' + projectName + '/linux32/' + projectName + '/install',328 'cp dist/linux/butter.png build/releases/' + projectName + '/linux32/' + projectName,329 'cd build/releases/' + projectName + '/linux32/' + projectName,330 'chmod +x install',331 'tar --exclude-vcs -c . | $(command -v pxz || command -v xz) -T8 -7 > "../' + projectName + '-' + currentVersion + '-Linux-32.tar.xz"',332 'echo "Linux32 Sucessfully packaged" || echo "Linux32 failed to package"'333 ].join(' && ');334 } else {335 return [336 'cp build/cache/linux32/<%= nwjs.options.version %>/icudtl.dat build/releases/' + projectName + '/linux32/' + projectName,337 'cp -r build/cache/linux32/<%= nwjs.options.version %>/locales build/releases/' + projectName + '/linux32/' + projectName,338 'cp dist/linux/linux-installer build/releases/' + projectName + '/linux32/' + projectName + '/install',339 'cp dist/linux/butter.png build/releases/' + projectName + '/linux32/' + projectName,340 'grunt compress:linux32',341 '( echo "Compressed sucessfully" ) || ( echo "Failed to compress" )'342 ].join(' && ');343 }344 }345 },346 packageDEBLinux32: {347 command: function () {348 if (host.linux) {349 return [350 'sh dist/linux/deb-maker.sh <%= nwjs.options.version %> linux32',351 'echo "Linux32 Debian Package successfully built" || echo "Linux32 failed to create the Debian Package"'352 ].join(' && ');353 } else {354 return [355 'echo "Building debian package is not supported on Windows or Mac"'356 ].join(' && ');357 }358 }359 },360 packageDEBLinux64: {361 command: function () {362 if (host.linux) {363 return [364 'sh dist/linux/deb-maker.sh <%= nwjs.options.version %> linux64',365 'echo "Linux64 Debian Package successfully built" || echo "Linux64 failed to create the Debian Package"'366 ].join(' && ');367 } else {368 return [369 'echo "Building debian package is not supported on Windows or Mac"'370 ].join(' && ');371 }372 }373 },374 packageWin32: {375 command: function () {376 if (host.linux || host.mac) {377 return [378 'cp build/cache/win32/<%= nwjs.options.version %>/icudtl.dat build/releases/' + projectName + '/win32/' + projectName,379 'cp -r build/cache/win32/<%= nwjs.options.version %>/locales build/releases/' + projectName + '/win32/' + projectName,380 'cd build/releases/' + projectName + '/win32/' + projectName,381 'tar --exclude-vcs -c . | $(command -v pxz || command -v xz) -T8 -7 > "../' + projectName + '-' + currentVersion + '-Win.tar.xz"',382 'echo "Windows Sucessfully packaged" || echo "Windows failed to package"'383 ].join(' && ');384 } else {385 return [386 'cp build/cache/win32/<%= nwjs.options.version %>/icudtl.dat build/releases/' + projectName + '/win32/' + projectName,387 'cp -r build/cache/win32/<%= nwjs.options.version %>/locales build/releases/' + projectName + '/win32/' + projectName,388 'grunt compress:windows32',389 '( echo "Compressed sucessfully" ) || ( echo "Failed to compress" )'390 ].join(' && ');391 }392 }393 },394 packageWin64: {395 command: function () {396 if (host.linux || host.mac) {397 return [398 'cp build/cache/win64/<%= nwjs.options.version %>/icudtl.dat build/releases/' + projectName + '/win64/' + projectName,399 'cp -r build/cache/win64/<%= nwjs.options.version %>/locales build/releases/' + projectName + '/win64/' + projectName,400 'cd build/releases/' + projectName + '/win64/' + projectName,401 'tar --exclude-vcs -c . | $(command -v pxz || command -v xz) -T8 -7 > "../' + projectName + '-' + currentVersion + '-Win.tar.xz"',402 'echo "Windows Sucessfully packaged" || echo "Windows failed to package"'403 ].join(' && ');404 } else {405 return [406 'cp build/cache/win64/<%= nwjs.options.version %>/icudtl.dat build/releases/' + projectName + '/win64/' + projectName,407 'cp -r build/cache/win64/<%= nwjs.options.version %>/locales build/releases/' + projectName + '/win64/' + projectName,408 'grunt compress:windows64',409 '( echo "Compressed sucessfully" ) || ( echo "Failed to compress" )'410 ].join(' && ');411 }412 }413 },414 packageMac32: {415 command: function () {416 if (host.linux || host.mac) {417 return [418 'cd build/releases/' + projectName + '/mac/',419 'tar --exclude-vcs -c ' + projectName + '.app | $(command -v pxz || command -v xz) -T8 -7 > "' + projectName + '-' + currentVersion + '-Mac32.tar.xz"',420 'echo "Mac Sucessfully packaged" || echo "Mac failed to package"'421 ].join(' && ');422 } else {423 return [424 'grunt compress:mac32',425 '( echo "Compressed sucessfully" ) || ( echo "Failed to compress" )'426 ].join(' && ');427 }428 }429 },430 packageMac64: {431 command: function () {432 if (host.linux || host.mac) {433 return [434 'cd build/releases/' + projectName + '/mac/',435 'tar --exclude-vcs -c ' + projectName + '.app | $(command -v pxz || command -v xz) -T8 -7 > "' + projectName + '-' + currentVersion + '-Mac64.tar.xz"',436 'echo "Mac Sucessfully packaged" || echo "Mac failed to package"'437 ].join(' && ');438 } else {439 return [440 'grunt compress:mac64',441 '( echo "Compressed sucessfully" ) || ( echo "Failed to compress" )'442 ].join(' && ');443 }444 }445 }446 },447 compress: {448 linux32: {449 options: {450 mode: 'tgz',451 archive: 'build/releases/' + projectName + '/linux32/' + projectName + '-' + currentVersion + '-Linux-32.tar.gz'452 },453 expand: true,454 cwd: 'build/releases/' + projectName + '/linux32/' + projectName,455 src: '**',456 dest: projectName457 },458 linux64: {459 options: {460 mode: 'tgz',461 archive: 'build/releases/' + projectName + '/linux64/' + projectName + '-' + currentVersion + '-Linux-64.tar.gz'462 },463 expand: true,464 cwd: 'build/releases/' + projectName + '/linux64/' + projectName,465 src: '**',466 dest: projectName467 },468 mac32: {469 options: {470 mode: 'tgz',471 archive: 'build/releases/' + projectName + '/mac32/' + projectName + '-' + currentVersion + '-Mac.tar.gz'472 },473 expand: true,474 cwd: 'build/releases/' + projectName + '/mac32/',475 src: '**',476 dest: projectName477 },478 mac64: {479 options: {480 mode: 'tgz',481 archive: 'build/releases/' + projectName + '/mac64/' + projectName + '-' + currentVersion + '-Mac.tar.gz'482 },483 expand: true,484 cwd: 'build/releases/' + projectName + '/mac64/',485 src: '**',486 dest: projectName487 },488 windows32: {489 options: {490 mode: 'tgz',491 archive: 'build/releases/' + projectName + '/win32/' + projectName + '-' + currentVersion + '-Win.tar.gz'492 },493 expand: true,494 cwd: 'build/releases/' + projectName + '/win32/' + projectName,495 src: '**',496 dest: projectName497 },498 windows64: {499 options: {500 mode: 'tgz',501 archive: 'build/releases/' + projectName + '/win64/' + projectName + '-' + currentVersion + '-Win.tar.gz'502 },503 expand: true,504 cwd: 'build/releases/' + projectName + '/win64/' + projectName,505 src: '**',506 dest: projectName507 }508 },509 clean: {510 releases: ['build/' + projectName + '/**'],511 css: ['src/app/themes/**'],512 dist: ['dist/windows/*-Setup.exe', 'dist/mac/*.dmg'],513 update: ['build/updater/*.*'],514 nwjs: ['cache/**/<%= nwjs.options.version %>/*pdf*', 'cache/**/<%= nwjs.options.version %>/*credits*']515 },516 watch: {517 options: {518 dateFormat: function (time) {519 grunt.log.writeln('Completed in ' + time + 'ms at ' + (new Date()).toLocaleTimeString());520 grunt.log.writeln('Waiting for more changes...');521 }522 },523 scripts: {524 files: ['./src/app/styl/*.styl', './src/app/styl/**/*.styl'],525 tasks: ['css']526 }527 }528 });...

Full Screen

Full Screen

index.js

Source:index.js Github

copy

Full Screen

1const Generator = require("yeoman-generator"),2 fileaccess = require("../../helpers/fileaccess"),3 path = require("path"),4 glob = require("glob");5module.exports = class extends Generator {6 static hidden = true;7 prompting() {8 if (this.options.isSubgeneratorCall) {9 this.destinationRoot(this.options.cwd);10 this.options.oneTimeConfig = this.config.getAll();11 this.options.oneTimeConfig.modulename = this.options.modulename;12 return;13 }14 throw 'This subgenerator is only intended for internal use. Please don"t call it directly.';15 }16 async writing() {17 this.sourceRoot(path.join(__dirname, "templates"));18 const oConfig = this.options.oneTimeConfig;19 const platformIsAppRouter = this.options.oneTimeConfig.platform.includes("Application Router"); // aka no destination service etc needed20 // Copy approuter module21 if (oConfig.platform !== "SAP Launchpad service") {22 glob.sync("**", {23 cwd: this.sourceRoot() + "/approuter",24 nodir: true25 }).forEach((file) => {26 this.fs.copyTpl(27 this.templatePath("approuter/" + file),28 this.destinationPath("approuter/" + file.replace(/^_/, "").replace(/\/_/, "/")),29 oConfig30 );31 });32 const welcomeRoute = platformIsAppRouter33 ? "uimodule/index.html"34 : (oConfig.namespaceUI5 + oConfig.projectname + "/").replace(/\./g, "");35 await fileaccess.manipulateJSON.call(this, "/approuter/xs-app.json", {36 welcomeFile: welcomeRoute,37 authenticationMethod: "none",38 logout: {39 logoutEndpoint: "/do/logout"40 },41 routes: []42 });43 }44 if (oConfig.platform !== "Application Router @ SAP HANA XS Advanced") {45 // Copy deployer module46 glob.sync("**", {47 cwd: this.sourceRoot() + "/deployer",48 nodir: true49 }).forEach((file) => {50 this.fs.copyTpl(51 this.templatePath("deployer/" + file),52 this.destinationPath("deployer/" + file.replace(/^_/, "").replace(/\/_/, "/")),53 oConfig54 );55 });56 }57 }58 async addMTA() {59 const oConfig = this.config.getAll();60 let mta = {61 ID: oConfig.projectname,62 "_schema-version": "3.2.0",63 version: "0.0.1",64 parameters: {65 "enable-parallel-deployments": true66 },67 modules: [],68 resources: []69 };70 let approuter;71 if (oConfig.platform !== "SAP Launchpad service") {72 approuter = {73 name: oConfig.projectname,74 type: "nodejs",75 path: "approuter",76 parameters: {77 "disk-quota": "512M",78 memory: "512M"79 },80 requires: []81 };82 mta.modules.push(approuter);83 if (oConfig.platform.includes("Application Router")) {84 approuter["build-parameters"] = {85 builder: "custom",86 commands: ["npm install", "npm run build:ui --prefix .."]87 };88 }89 }90 if (oConfig.platform !== "Application Router @ SAP HANA XS Advanced") {91 mta.resources.push({92 name: oConfig.projectname + "_destination",93 type: "org.cloudfoundry.managed-service",94 parameters: {95 "service-plan": "lite",96 service: "destination",97 config: {98 HTML5Runtime_enabled: true,99 version: "1.0.0"100 }101 }102 });103 if (approuter) {104 approuter.requires.push({ name: oConfig.projectname + "_destination" });105 }106 if (107 oConfig.platform === "SAP HTML5 Application Repository service for SAP BTP" ||108 oConfig.platform === "SAP Launchpad service"109 ) {110 mta.modules.push({111 name: "webapp_deployer",112 type: "com.sap.application.content",113 path: "deployer",114 requires: [115 {116 name: oConfig.projectname + "_html5_repo_host",117 parameters: {118 "content-target": true119 }120 }121 ],122 "build-parameters": {123 ["build-result"]: "resources",124 ["requires"]: []125 }126 });127 mta.resources.push({128 name: oConfig.projectname + "_html5_repo_host",129 type: "org.cloudfoundry.managed-service",130 parameters: {131 "service-plan": "app-host",132 service: "html5-apps-repo",133 config: {134 sizeLimit: oConfig.ui5libs.indexOf("Local resources") >= 0 ? 100 : 2135 }136 }137 });138 if (approuter) {139 mta.resources.push({140 name: oConfig.projectname + "_html5_repo_runtime",141 type: "org.cloudfoundry.managed-service",142 parameters: {143 "service-plan": "app-runtime",144 service: "html5-apps-repo"145 }146 });147 approuter.requires.push({ name: oConfig.projectname + "_html5_repo_runtime" });148 }149 mta.resources.push({150 name: oConfig.projectname + "_uaa",151 type: "org.cloudfoundry.managed-service",152 parameters: {153 path: "./xs-security.json",154 "service-plan": "application",155 service: "xsuaa"156 }157 });158 this.fs.copyTpl(159 this.templatePath("xs-security.json"),160 this.destinationPath("xs-security.json"),161 oConfig162 );163 if (approuter) {164 approuter.requires.push({ name: oConfig.projectname + "_uaa" });165 }166 if (oConfig.platform === "SAP Launchpad service") {167 mta.modules.push({168 name: oConfig.projectname + "destination-content",169 type: "com.sap.application.content",170 "build-parameters": {171 "no-source": true172 },173 requires: [174 {175 name: oConfig.projectname + "_uaa",176 parameters: {177 "service-key": {178 name: oConfig.projectname + "_uaa-key"179 }180 }181 },182 {183 name: oConfig.projectname + "_html5_repo_host",184 parameters: {185 "service-key": {186 name: oConfig.projectname + "_html5_repo_host-key"187 }188 }189 },190 {191 name: oConfig.projectname + "_destination",192 parameters: {193 "content-target": true194 }195 }196 ],197 parameters: {198 content: {199 instance: {200 existing_destinations_policy: "update",201 destinations: [202 {203 Name: oConfig.projectname + "_html5_repo_host",204 ServiceInstanceName: oConfig.projectname + "_html5_repo_host",205 ServiceKeyName: oConfig.projectname + "_html5_repo_host-key",206 "sap.cloud.service": oConfig.projectname + ".service"207 },208 {209 Name: oConfig.projectname + "_uaa",210 Authentication: "OAuth2UserTokenExchange",211 ServiceInstanceName: oConfig.projectname + "_uaa",212 ServiceKeyName: oConfig.projectname + "_uaa-key",213 "sap.cloud.service": oConfig.projectname + ".service"214 }215 ]216 }217 }218 }219 });220 }221 }222 }223 await fileaccess.writeYAML.call(this, "/mta.yaml", mta);224 }...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { projectName } from 'storybook-root';2console.log(projectName);3{4 "scripts": {5 },6 "dependencies": {7 },8 "devDependencies": {9 }10}11export const projectName = 'storybook-root';12import { configure } from '@storybook/react';13import '../src/index.css';14const req = require.context('../src', true, /\.stories\.js$/);15function loadStories() {16 req.keys().forEach(filename => req(filename));17}18configure(loadStories, module);19import '@storybook/addon-actions/register';20import '@storybook/addon-links/register';21const path = require('path');22module.exports = async ({ config, mode }) => {23 config.module.rules.push({24 {25 options: {26 modifyVars: {27 }28 }29 }30 include: path.resolve(__dirname, '../')31 });32 return config;33};34{35 {36 "targets": {37 }38 }

Full Screen

Using AI Code Generation

copy

Full Screen

1import { projectName } from 'storybook-root';2projectName();3import { projectName } from 'storybook-root';4projectName();5import { projectName } from 'storybook-root';6projectName();7import { projectName } from 'storybook-root';8projectName();9import { projectName } from 'storybook-root';10projectName();11import { projectName } from 'storybook-root';12projectName();13import { projectName } from 'storybook-root';14projectName();15import { projectName } from 'storybook-root';16projectName();17import { projectName } from 'storybook-root';18projectName();19import { projectName } from 'storybook-root';20projectName();21import { projectName } from 'storybook-root';22projectName();23import { projectName } from 'storybook-root';24projectName();25import { projectName } from 'storybook-root';26projectName();27import { projectName } from 'storybook-root';28projectName();

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRoot = require('storybook-root');2console.log(storybookRoot.projectName());3module.exports.projectName = () => {4 return 'storybook-root';5};6{7 "scripts": {8 },9 "dependencies": {10 }11}

Full Screen

Using AI Code Generation

copy

Full Screen

1const projectName = require('storybook-root').projectName;2console.log(projectName());3"scripts": {4}5const projectName = require('./node_modules/storybook-root').projectName;6console.log(projectName());7"scripts": {8}9const projectName = require('storybook-root').projectName;10console.log(projectName());11"scripts": {12}13const projectName = require('storybook-root').projectName;14console.log(projectName());15"scripts": {16}

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful