{"version":3,"file":"index.mjs","sources":["../../src/utils/buildTypePaths.ts","../../src/utils/compileAdditionalTemplateOverrides.ts","../../src/utils/executeHygen.ts","../../src/command.ts","../../src/handler.ts","../../src/utils/loadQuestions.ts","../../src/utils/getLeafAdditionalTemplatesPath.ts","../../src/utils/conditionallyChangeCwd.ts"],"sourcesContent":["export type BuildTypePaths = {\n  configTypePath: string[];\n  externalTypePath: string[];\n  internalTypePath: string[];\n};\n\nexport const buildTypePaths = (type: string, subtype?: string, customTypePath?: string): BuildTypePaths => {\n  const internalTypePath = subtype ? [type, subtype] : [type];\n  let configTypePath: BuildTypePaths['configTypePath'] = subtype ? ['new', type, subtype] : ['new', type];\n\n  if (customTypePath) {\n    configTypePath = [...configTypePath, ...customTypePath.split('.')];\n  }\n\n  return {\n    configTypePath,\n    externalTypePath: configTypePath,\n    internalTypePath,\n  };\n};\n","import { verboseLog } from '@repodog/cli-utils';\nimport { readdirSync } from 'node:fs';\n\nexport const compileAdditionalTemplateOverrides = (\n  leafAdditionalTemplatesPath: string,\n  internalTempatesPath: string,\n): Record<string, boolean> => {\n  const additionalfiles = readdirSync(leafAdditionalTemplatesPath);\n  const internalFiles = readdirSync(internalTempatesPath);\n\n  const overrides = additionalfiles.reduce<Record<string, boolean>>((acc, fileName) => {\n    if (internalFiles.includes(fileName)) {\n      const key = `overrideTemplate_${fileName.replaceAll('.', '_')}`;\n      acc[key] = true;\n    }\n\n    return acc;\n  }, {});\n\n  if (Object.keys(overrides).length > 0) {\n    verboseLog(`Additional template overrides:\\n${JSON.stringify(overrides, undefined, 2)}\\n`);\n  }\n\n  return overrides;\n};\n","import { asyncExec, resolveAbsolutePath, stringifyCliOptions, verboseLog } from '@repodog/cli-utils';\nimport { sep } from 'node:path';\nimport { type CliOptions } from '../types.ts';\n\nexport const executeHygen = (\n  templatesPath: string,\n  hygenPath: string,\n  typePath: string[],\n  cliOptions: CliOptions,\n): Promise<string> => {\n  const hygenTypePath = typePath.length > 2 ? typePath.slice(-2) : typePath;\n  const additionalTemplatePaths = typePath.length > 2 ? typePath.slice(0, -2) : [];\n  const hygenTemplatesPath = resolveAbsolutePath([templatesPath, ...additionalTemplatePaths].join(sep));\n\n  verboseLog(`Executing hygen with the following positional arguments: ${hygenTypePath.join(' ')}`);\n  verboseLog(`Executing hygen with the following options: ${stringifyCliOptions(cliOptions)}`);\n  verboseLog(`Executing hygen with the following templates path: ${hygenTemplatesPath}`);\n\n  return asyncExec(\n    `HYGEN_TMPLS=${hygenTemplatesPath} ${hygenPath} ${hygenTypePath.join(' ')} ${stringifyCliOptions(cliOptions)}`,\n  );\n};\n","import { type CommandBuilder } from 'yargs';\nimport { type NewHandlerArguments } from '#types.ts';\n\nexport const builder: CommandBuilder<NewHandlerArguments, NewHandlerArguments> = argv =>\n  argv\n    .positional('type', {\n      demandOption: true,\n      desc: 'The type of folder to scaffold: repo | pkg',\n      type: 'string',\n    })\n    .positional('subtype', {\n      demandOption: true,\n      desc: 'The subtype of folder to scaffold; repo: componentLibrary | library | monorepo; pkg: component | config | library',\n      type: 'string',\n    })\n    .positional('custom-type-path', {\n      demandOption: false,\n      desc: 'The additional types to apply to the scaffold. Multiple types should be separated by a \".\" character. These types are applied after the subtype',\n      type: 'string',\n    })\n    .option('exclude-builtin-templates', {\n      desc: 'To skip the node version check',\n      type: 'boolean',\n    })\n    .option('skip-node-version-check', {\n      alias: 'snvc',\n      desc: 'To skip the node version check',\n      type: 'boolean',\n    })\n    .option('verbose', {\n      desc: 'Whether to output verbose logs',\n      type: 'boolean',\n    });\n\nexport const command = 'new <type> <subtype> [custom-type-path]';\nexport const desc = 'Scaffold new folder structure';\nexport { handler } from './handler.ts';\n","import { handler as postinstallHandler } from '@repodog/cli-postinstall';\nimport { handleGlobalConfigSetup } from '@repodog/cli-setup';\nimport {\n  calculateDuration,\n  enrichQuestions,\n  flattenTemplateVariables,\n  getPackageManager,\n  getPackageManagerFilterCommand,\n  getPackageManagerTemporaryCommand,\n  hasGlobalRepodogConfig,\n  isRunWithinProject,\n  isValidNewSubtype,\n  isValidNewType,\n  language as lang,\n  loadRepodogConfig,\n  newType,\n  removeEmptyAnswers,\n  resolveAbsolutePath,\n  setVerbose,\n  typeToSubtypeMap,\n  verboseLog,\n} from '@repodog/cli-utils';\nimport colors from 'ansi-colors';\nimport enquirer from 'enquirer';\nimport { dirname, resolve as resolvePath, sep } from 'node:path';\nimport { performance } from 'node:perf_hooks';\nimport { fileURLToPath } from 'node:url';\nimport shelljs from 'shelljs';\nimport { type CliOptions, type NewHandlerArguments } from './types.ts';\nimport { buildTypePaths } from './utils/buildTypePaths.ts';\nimport { compileAdditionalTemplateOverrides } from './utils/compileAdditionalTemplateOverrides.ts';\nimport { conditionallyChangeCwd } from './utils/conditionallyChangeCwd.ts';\nimport { executeHygen } from './utils/executeHygen.ts';\nimport { getLeafAdditionalTemplatesPath } from './utils/getLeafAdditionalTemplatesPath.ts';\nimport { loadQuestions } from './utils/loadQuestions.ts';\n\nexport const handler = async (argv: NewHandlerArguments): Promise<void> => {\n  const startTime = performance.now();\n  const isVerbose = argv.verbose ?? false;\n  const customTypePath = argv['custom-type-path'] ?? undefined;\n  const toExcludeBuiltinTemplates = argv['exclude-builtin-templates'] ?? false;\n\n  if (!isRunWithinProject() && !hasGlobalRepodogConfig()) {\n    await handleGlobalConfigSetup();\n  }\n\n  setVerbose(isVerbose);\n  verboseLog('>>>> USER CONFIG START <<<<');\n  verboseLog(`customTypePath: ${customTypePath ?? 'undefined'}`);\n  verboseLog(`excludeBuiltinTemplates: ${String(toExcludeBuiltinTemplates)}`);\n  verboseLog(`subtype: ${argv.subtype}`);\n  verboseLog(`type: ${argv.type}`);\n  verboseLog('>>>> USER CONFIG END <<<<\\n');\n\n  try {\n    if (!isValidNewType(argv.type)) {\n      throw new Error(`Expected type to be a valid new type: ${Object.values(newType).join(', ')}`);\n    }\n\n    if (!isValidNewSubtype(argv.type, argv.subtype)) {\n      throw new Error(\n        `Expected subtype to be a valid new subtype: ${Object.values(typeToSubtypeMap[argv.type]).join(', ')}`,\n      );\n    }\n\n    const subtype = argv.subtype;\n    const type = argv.type;\n    const packageManager = getPackageManager();\n\n    if (!packageManager) {\n      throw new Error('Could not derive the package manager');\n    }\n\n    const directoryPath = dirname(fileURLToPath(import.meta.url));\n    const hygenPath = resolvePath(directoryPath, '../../node_modules/.bin/hygen');\n    const templatesPath = resolvePath(directoryPath, '../../_templates');\n\n    verboseLog('>>>> DERIVED VALUES START <<<<');\n    verboseLog(`Package manager: ${packageManager}`);\n    verboseLog(`Directory path: ${directoryPath}`);\n    verboseLog(`Hygen path: ${hygenPath}`);\n    verboseLog(`Default templates path: ${templatesPath}`);\n    verboseLog('>>>> DERIVED VALUES END <<<<\\n');\n\n    const {\n      additionalTemplatesPath,\n      language = lang.JAVASCRIPT,\n      questionOverrides,\n      templateVariables,\n    } = loadRepodogConfig();\n\n    verboseLog('>>>> CONFIG VALUES START <<<<');\n\n    verboseLog(\n      `Question overrides:${questionOverrides ? `\\n${JSON.stringify(questionOverrides, undefined, 2)}\\n` : ' None'}`,\n    );\n\n    verboseLog(`Template overrides path: ${additionalTemplatesPath ?? 'None'}`);\n\n    verboseLog(\n      `Template variables:${templateVariables ? `\\n${JSON.stringify(templateVariables, undefined, 2)}\\n` : ' None'}`,\n    );\n\n    verboseLog('>>>> CONFIG VALUES ENDS <<<<');\n\n    const { configTypePath, externalTypePath, internalTypePath } = buildTypePaths(type, subtype, customTypePath);\n    verboseLog(`internalTypePath: ${internalTypePath.join('.')}`);\n    verboseLog(`configTypePath: ${configTypePath.join('.')}`);\n    verboseLog(`externalTypePath: ${externalTypePath.join('.')}`);\n    let flattenedTemplateVariables: Record<string, string | number | boolean> = {};\n\n    if (templateVariables) {\n      flattenedTemplateVariables = flattenTemplateVariables(templateVariables, configTypePath);\n      verboseLog(`Flattened template variables:\\n${JSON.stringify(flattenedTemplateVariables, undefined, 2)}\\n`);\n    }\n\n    const questions = loadQuestions(internalTypePath, configTypePath, questionOverrides);\n    verboseLog(`Questions:\\n${JSON.stringify(questions, undefined, 2)}\\n`);\n    const leafAdditionalTemplatesPath = getLeafAdditionalTemplatesPath(additionalTemplatesPath, externalTypePath);\n\n    if (leafAdditionalTemplatesPath) {\n      verboseLog(`Leaf additional templates path: ${leafAdditionalTemplatesPath}`);\n    }\n\n    const cliOptions: CliOptions = {\n      excludeTypesFile: false,\n      ...flattenedTemplateVariables,\n      ...removeEmptyAnswers(await enquirer.prompt(enrichQuestions(questions, flattenedTemplateVariables))),\n      ...(leafAdditionalTemplatesPath && {\n        ...compileAdditionalTemplateOverrides(\n          leafAdditionalTemplatesPath,\n          resolveAbsolutePath([templatesPath, ...internalTypePath].join(sep)),\n        ),\n      }),\n      language,\n      newSubType: subtype,\n      newType: type,\n      packageManager,\n      packageManagerFilterCmd: getPackageManagerFilterCommand(packageManager),\n      packageManagerTemporaryCmd: getPackageManagerTemporaryCommand(packageManager),\n    };\n\n    if (type === newType.REPO) {\n      // cliOptions type is too generic, but the name\n      // property is a string.\n      // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n      conditionallyChangeCwd(cliOptions.name as string);\n    }\n\n    verboseLog(`Hygen cli options:\\n${JSON.stringify(cliOptions, undefined, 2)}\\n`);\n\n    if (toExcludeBuiltinTemplates) {\n      verboseLog('Built-in templates have been excluded from scaffolding.');\n    } else {\n      await executeHygen(templatesPath, hygenPath, internalTypePath, cliOptions);\n    }\n\n    if (additionalTemplatesPath && leafAdditionalTemplatesPath) {\n      verboseLog('Template overrides path exists, re-running hygen with new path');\n      await executeHygen(additionalTemplatesPath, hygenPath, externalTypePath, cliOptions);\n    }\n\n    if (argv.type === newType.REPO) {\n      await postinstallHandler({ subtype: argv.subtype, type: argv.type, verbose: isVerbose });\n    }\n\n    verboseLog(`Handler duration: ${String(calculateDuration(startTime))}sec`);\n    return shelljs.exit(0);\n  } catch (error: unknown) {\n    shelljs.echo(\n      // catch arg has to be of type unknown, but in this context it will\n      // always be of type Error.\n      // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n      `${colors.magenta('Repodog')} ${colors.dim('=>')} ${colors.red(`Error: ${(error as Error).message}`)}`,\n    );\n\n    verboseLog(`Handler duration: ${String(calculateDuration(startTime))}sec`);\n    return shelljs.exit(1);\n  }\n};\n","import { type PromptOption, type QuestionOverride, type QuestionOverrides, verboseLog } from '@repodog/cli-utils';\nimport { get } from 'lodash-es';\nimport { readFileSync } from 'node:fs';\nimport { dirname, resolve, sep } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport const loadQuestions = (\n  internalTypePath: string[],\n  configTypePath: string[],\n  questionOverrides?: Record<string, QuestionOverrides>,\n): PromptOption[] => {\n  const directoryPath = dirname(fileURLToPath(import.meta.url));\n  const joinedInternalTypePath = internalTypePath.join(sep);\n\n  // The import is a JSON file, which is not typed literally.\n  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n  const baseQuestions = JSON.parse(\n    readFileSync(resolve(directoryPath, `../questions/${joinedInternalTypePath}.json`), { encoding: 'utf8' }),\n  ) as PromptOption[];\n\n  verboseLog(`Loaded base questions:\\n${JSON.stringify(baseQuestions, undefined, 2)}\\n`);\n\n  if (!questionOverrides) {\n    verboseLog('No question overrides, returning base questions');\n    return baseQuestions;\n  }\n\n  let finalQuestions = [...baseQuestions];\n  // Difficult to type in with the get generic arguments.\n  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions\n  const override = get(questionOverrides, configTypePath.join('.')) as unknown as QuestionOverride | undefined;\n\n  if (!override) {\n    verboseLog(`No question override found for path \"${configTypePath.join('.')}\", returning base questions`);\n    return baseQuestions;\n  }\n\n  if (Array.isArray(override.remove)) {\n    verboseLog(`Remove question override: ${override.remove.join(', ')}`);\n    finalQuestions = finalQuestions.filter(question => !override.remove?.includes(question.name));\n  }\n\n  if (Array.isArray(override.add)) {\n    verboseLog(`Add question override:\\n${JSON.stringify(override.add, undefined, 2)}\\n`);\n    finalQuestions = [...finalQuestions, ...override.add];\n  }\n\n  if (Array.isArray(override.replace)) {\n    verboseLog(`Replace question override:\\n${JSON.stringify(override.replace, undefined, 2)}\\n`);\n\n    finalQuestions = finalQuestions.map(question => {\n      const questionToReplace = override.replace?.find(replaceQuestion => replaceQuestion.name === question.name);\n      return questionToReplace ?? question;\n    });\n  }\n\n  return finalQuestions;\n};\n","import { resolveAbsolutePath } from '@repodog/cli-utils';\nimport { existsSync, readdirSync } from 'node:fs';\nimport { sep } from 'node:path';\n\nexport const getLeafAdditionalTemplatesPath = (\n  additionalTemplatesPath: string | undefined,\n  externalTypePath: string[],\n): string | undefined => {\n  if (!additionalTemplatesPath) {\n    return;\n  }\n\n  const absolutePath = resolveAbsolutePath([additionalTemplatesPath, ...externalTypePath].join(sep));\n\n  if (!existsSync(absolutePath)) {\n    return;\n  }\n\n  const dirents = readdirSync(absolutePath, { withFileTypes: true });\n  const files = dirents.filter(dirent => dirent.isFile());\n\n  if (files.length === 0) {\n    return;\n  }\n\n  return absolutePath;\n};\n","import { existsSync, mkdirSync } from 'node:fs';\nimport { resolve } from 'node:path';\n\nexport const conditionallyChangeCwd = (name: string): void => {\n  const cwd = process.cwd();\n\n  if (!cwd.endsWith(name)) {\n    const targetDirectory = resolve(cwd, name);\n\n    if (!existsSync(targetDirectory)) {\n      mkdirSync(targetDirectory);\n    }\n\n    process.chdir(targetDirectory);\n  }\n};\n"],"names":["compileAdditionalTemplateOverrides","leafAdditionalTemplatesPath","internalTempatesPath","additionalfiles","readdirSync","internalFiles","overrides","reduce","acc","fileName","includes","replaceAll","Object","keys","length","verboseLog","JSON","stringify","undefined","executeHygen","templatesPath","hygenPath","typePath","cliOptions","hygenTypePath","slice","additionalTemplatePaths","hygenTemplatesPath","resolveAbsolutePath","join","sep","stringifyCliOptions","asyncExec","argv","positional","demandOption","desc","type","option","alias","async","startTime","performance","now","isVerbose","verbose","customTypePath","toExcludeBuiltinTemplates","isRunWithinProject","hasGlobalRepodogConfig","handleGlobalConfigSetup","setVerbose","String","subtype","isValidNewType","Error","values","newType","isValidNewSubtype","typeToSubtypeMap","packageManager","getPackageManager","directoryPath","dirname","fileURLToPath","url","resolvePath","additionalTemplatesPath","language","lang","JAVASCRIPT","questionOverrides","templateVariables","loadRepodogConfig","configTypePath","externalTypePath","internalTypePath","split","buildTypePaths","flattenedTemplateVariables","flattenTemplateVariables","questions","joinedInternalTypePath","baseQuestions","parse","readFileSync","resolve","encoding","finalQuestions","override","get","Array","isArray","remove","filter","question","name","add","replace","map","questionToReplace","find","replaceQuestion","loadQuestions","absolutePath","existsSync","withFileTypes","dirent","isFile","getLeafAdditionalTemplatesPath","excludeTypesFile","removeEmptyAnswers","enquirer","prompt","enrichQuestions","newSubType","packageManagerFilterCmd","getPackageManagerFilterCommand","packageManagerTemporaryCmd","getPackageManagerTemporaryCommand","REPO","cwd","process","endsWith","targetDirectory","mkdirSync","chdir","conditionallyChangeCwd","postinstallHandler","calculateDuration","shelljs","exit","error","echo","colors","magenta","dim","red","message"],"mappings":"86BAMO,MCHMA,EAAqC,CAChDC,EACAC,KAEA,MAAMC,EAAkBC,EAAYH,GAC9BI,EAAgBD,EAAYF,GAE5BI,EAAYH,EAAgBI,OAAgC,CAACC,EAAKC,KACtE,GAAIJ,EAAcK,SAASD,GAAW,CAEpCD,EADY,oBAAoBC,EAASE,WAAW,IAAK,SAC9C,CACb,CAEA,OAAOH,GACN,CAAA,GAMH,OAJII,OAAOC,KAAKP,GAAWQ,OAAS,GAClCC,EAAW,mCAAmCC,KAAKC,UAAUX,OAAWY,EAAW,QAG9EZ,GCnBIa,EAAe,CAC1BC,EACAC,EACAC,EACAC,KAEA,MAAMC,EAAgBF,EAASR,OAAS,EAAIQ,EAASG,OAAM,GAAMH,EAC3DI,EAA0BJ,EAASR,OAAS,EAAIQ,EAASG,MAAM,GAAG,GAAM,GACxEE,EAAqBC,EAAoB,CAACR,KAAkBM,GAAyBG,KAAKC,IAMhG,OAJAf,EAAW,4DAA4DS,EAAcK,KAAK,QAC1Fd,EAAW,+CAA+CgB,EAAoBR,MAC9ER,EAAW,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