@slicemachine/init 2.8.2-dev-next-release.2 → 2.8.2-dev-next-release.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SliceMachineInitProcess.cjs +3 -3
- package/dist/SliceMachineInitProcess.cjs.map +1 -1
- package/dist/SliceMachineInitProcess.js +4 -4
- package/dist/SliceMachineInitProcess.js.map +1 -1
- package/dist/_node_modules/hosted-git-info/git-host-info.cjs.map +1 -0
- package/dist/_node_modules/hosted-git-info/git-host-info.js.map +1 -0
- package/dist/_node_modules/hosted-git-info/git-host.cjs.map +1 -0
- package/dist/_node_modules/hosted-git-info/git-host.js.map +1 -0
- package/dist/_node_modules/{meow/_node_modules/read-pkg/_node_modules/hosted-git-info → hosted-git-info}/index.cjs +2 -2
- package/dist/_node_modules/hosted-git-info/index.cjs.map +1 -0
- package/dist/_node_modules/{meow/_node_modules/read-pkg/_node_modules/hosted-git-info → hosted-git-info}/index.js +2 -2
- package/dist/_node_modules/hosted-git-info/index.js.map +1 -0
- package/dist/_node_modules/meow/_node_modules/lru-cache/index.cjs.map +1 -0
- package/dist/_node_modules/meow/_node_modules/lru-cache/index.js.map +1 -0
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/_node_modules/hosted-git-info/lib/git-host-info.cjs.map +1 -0
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/_node_modules/hosted-git-info/lib/git-host-info.js.map +1 -0
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/_node_modules/hosted-git-info/lib/git-host.cjs.map +1 -0
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/_node_modules/hosted-git-info/lib/git-host.js.map +1 -0
- package/dist/_node_modules/meow/_node_modules/{hosted-git-info → normalize-package-data/_node_modules/hosted-git-info}/lib/index.cjs +2 -2
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/_node_modules/hosted-git-info/lib/index.cjs.map +1 -0
- package/dist/_node_modules/meow/_node_modules/{hosted-git-info → normalize-package-data/_node_modules/hosted-git-info}/lib/index.js +2 -2
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/_node_modules/hosted-git-info/lib/index.js.map +1 -0
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/_node_modules/hosted-git-info/lib/parse-url.cjs.map +1 -0
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/_node_modules/hosted-git-info/lib/parse-url.js.map +1 -0
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/lib/fixer.cjs +1 -1
- package/dist/_node_modules/meow/_node_modules/normalize-package-data/lib/fixer.js +1 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/fixer.cjs +1 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/normalize-package-data/lib/fixer.js +1 -1
- package/dist/lib/prompt.cjs.map +1 -1
- package/dist/lib/prompt.js.map +1 -1
- package/dist/lib/repositoryDomain.cjs +9 -8
- package/dist/lib/repositoryDomain.cjs.map +1 -1
- package/dist/lib/repositoryDomain.d.ts +2 -2
- package/dist/lib/repositoryDomain.js +9 -8
- package/dist/lib/repositoryDomain.js.map +1 -1
- package/dist/packages/init/package.json.cjs +8 -8
- package/dist/packages/init/package.json.js +8 -8
- package/package.json +8 -8
- package/src/SliceMachineInitProcess.ts +16 -7
- package/src/lib/prompt.ts +2 -3
- package/src/lib/repositoryDomain.ts +16 -8
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/_node_modules/lru-cache/index.cjs.map +0 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/_node_modules/lru-cache/index.js.map +0 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/git-host-info.cjs.map +0 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/git-host-info.js.map +0 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/git-host.cjs.map +0 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/git-host.js.map +0 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/index.cjs.map +0 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/index.js.map +0 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/parse-url.cjs.map +0 -1
- package/dist/_node_modules/meow/_node_modules/hosted-git-info/lib/parse-url.js.map +0 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host-info.cjs.map +0 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host-info.js.map +0 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host.cjs.map +0 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/hosted-git-info/git-host.js.map +0 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/hosted-git-info/index.cjs.map +0 -1
- package/dist/_node_modules/meow/_node_modules/read-pkg/_node_modules/hosted-git-info/index.js.map +0 -1
- /package/dist/_node_modules/{meow/_node_modules/read-pkg/_node_modules/hosted-git-info → hosted-git-info}/git-host-info.cjs +0 -0
- /package/dist/_node_modules/{meow/_node_modules/read-pkg/_node_modules/hosted-git-info → hosted-git-info}/git-host-info.js +0 -0
- /package/dist/_node_modules/{meow/_node_modules/read-pkg/_node_modules/hosted-git-info → hosted-git-info}/git-host.cjs +0 -0
- /package/dist/_node_modules/{meow/_node_modules/read-pkg/_node_modules/hosted-git-info → hosted-git-info}/git-host.js +0 -0
- /package/dist/_node_modules/meow/_node_modules/{hosted-git-info/_node_modules/lru-cache → lru-cache}/index.cjs +0 -0
- /package/dist/_node_modules/meow/_node_modules/{hosted-git-info/_node_modules/lru-cache → lru-cache}/index.js +0 -0
- /package/dist/_node_modules/meow/_node_modules/{hosted-git-info → normalize-package-data/_node_modules/hosted-git-info}/lib/git-host-info.cjs +0 -0
- /package/dist/_node_modules/meow/_node_modules/{hosted-git-info → normalize-package-data/_node_modules/hosted-git-info}/lib/git-host-info.js +0 -0
- /package/dist/_node_modules/meow/_node_modules/{hosted-git-info → normalize-package-data/_node_modules/hosted-git-info}/lib/git-host.cjs +0 -0
- /package/dist/_node_modules/meow/_node_modules/{hosted-git-info → normalize-package-data/_node_modules/hosted-git-info}/lib/git-host.js +0 -0
- /package/dist/_node_modules/meow/_node_modules/{hosted-git-info → normalize-package-data/_node_modules/hosted-git-info}/lib/parse-url.cjs +0 -0
- /package/dist/_node_modules/meow/_node_modules/{hosted-git-info → normalize-package-data/_node_modules/hosted-git-info}/lib/parse-url.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SliceMachineInitProcess.js","sources":["../../src/SliceMachineInitProcess.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport chalk from \"chalk\";\n\nimport { execaCommand, type ExecaChildProcess } from \"execa\";\n\nimport open from \"open\";\nimport logSymbols from \"log-symbols\";\nimport { globby } from \"globby\";\nimport { downloadTemplate } from \"giget\";\n\nimport {\n\tcreateSliceMachineManager,\n\tPrismicUserProfile,\n\tPrismicRepository,\n\tSliceMachineManager,\n\tPackageManager,\n\tStarterId,\n} from \"@slicemachine/manager\";\n\nimport pkg from \"../package.json\";\nimport { detectFramework, Framework } from \"./lib/framework\";\nimport { getRunScriptCommand } from \"./lib/getRunScriptCommand\";\nimport { getExecuteCommand } from \"./lib/getExecuteCommand\";\nimport {\n\tgetRandomRepositoryDomain,\n\tformatRepositoryDomain,\n\tvalidateRepositoryDomain,\n\tvalidateRepositoryDomainAndAvailability,\n\tgetErrorMessageForRepositoryDomainValidation,\n} from \"./lib/repositoryDomain\";\nimport { listr, listrRun } from \"./lib/listr\";\nimport { prompt } from \"./lib/prompt\";\nimport { assertExists } from \"./lib/assertExists\";\nimport {\n\tGIGET_ORGANIZATION,\n\tGIGET_PROVIDER,\n\tSLICE_MACHINE_INIT_USER_AGENT,\n\tSTART_SCRIPT_KEY,\n\tSTART_SCRIPT_VALUE,\n} from \"./constants\";\nimport { detectStarterId } from \"./lib/starters\";\nimport { setupSentry } from \"./lib/setupSentry\";\nimport { trackSentryError } from \"./lib/sentryErrorHandlers\";\nimport { updateSentryContext } from \"./lib/updateSentryContext\";\n\nexport type SliceMachineInitProcessOptions = {\n\trepository?: string;\n\tstarter?: string;\n\tdirectoryName?: string;\n\tpush?: boolean;\n\tpushSlices?: boolean;\n\tpushCustomTypes?: boolean;\n\tpushDocuments?: boolean;\n\tstartSlicemachine?: boolean;\n\tcwd?: string;\n} & Record<string, unknown>;\n\nconst DEFAULT_OPTIONS: SliceMachineInitProcessOptions = {\n\tpush: true,\n\tpushSlices: true,\n\tpushCustomTypes: true,\n\tpushDocuments: true,\n\tstartSlicemachine: true,\n};\n\nexport const createSliceMachineInitProcess = (\n\toptions?: SliceMachineInitProcessOptions,\n): SliceMachineInitProcess => {\n\treturn new SliceMachineInitProcess(options);\n};\n\ntype SliceMachineInitProcessContext = {\n\tframework?: Framework;\n\tpackageManager?: PackageManager;\n\tinstallProcess?: ExecaChildProcess;\n\tuserProfile?: PrismicUserProfile;\n\tuserRepositories?: PrismicRepository[];\n\trepository?: {\n\t\tdomain: string;\n\t\texists: boolean;\n\t};\n\tprojectInitialization?: {\n\t\tpatchedScript?: boolean;\n\t};\n\tstarterId?: StarterId;\n};\n\nexport class SliceMachineInitProcess {\n\tprotected options: SliceMachineInitProcessOptions;\n\tprotected manager: SliceMachineManager;\n\n\tprotected context: SliceMachineInitProcessContext;\n\n\tconstructor(options?: SliceMachineInitProcessOptions) {\n\t\tthis.options = { ...DEFAULT_OPTIONS, ...options };\n\t\tthis.manager = createSliceMachineManager({ cwd: options?.cwd });\n\n\t\tthis.context = {};\n\t}\n\n\tasync run(): Promise<void> {\n\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(\n\t\t\t`\\n${chalk.bgGray(` ${chalk.bold.white(\"Slice Machine\")} `)} ${chalk.dim(\n\t\t\t\t\"→\",\n\t\t\t)} Initializing\\n`,\n\t\t);\n\n\t\ttry {\n\t\t\tif (this.options.starter) {\n\t\t\t\tawait this.copyStarter();\n\t\t\t} else if (this.options.directoryName) {\n\t\t\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(\n\t\t\t\t\t`${logSymbols.warning} --directory-name has no effect because --starter is not specified\\n`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (await this.manager.telemetry.checkIsTelemetryEnabled()) {\n\t\t\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(\n\t\t\t\t\t`${\n\t\t\t\t\t\tlogSymbols.info\n\t\t\t\t\t} We collect telemetry data to improve user experience.\\n Learn more: ${chalk.cyan(\n\t\t\t\t\t\t\"https://prismic.dev/slice-machine/telemetry\",\n\t\t\t\t\t)}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tawait this.manager.telemetry.initTelemetry({\n\t\t\t\tappName: pkg.name,\n\t\t\t\tappVersion: pkg.version,\n\t\t\t});\n\t\t\tawait setupSentry();\n\t\t\tawait this.manager.telemetry.track({\n\t\t\t\tevent: \"command:init:start\",\n\t\t\t\trepository: this.options.repository,\n\t\t\t});\n\n\t\t\tawait this.detectEnvironment();\n\n\t\t\tassertExists(\n\t\t\t\tthis.context.framework,\n\t\t\t\t\"Project framework must be available through context to proceed\",\n\t\t\t);\n\n\t\t\tawait this.beginCoreDependenciesInstallation();\n\n\t\t\tif (this.options.repository) {\n\t\t\t\tawait this.useRepositoryFlag();\n\t\t\t} else {\n\t\t\t\tawait this.loginAndFetchUserData();\n\t\t\t\tawait this.selectRepository();\n\t\t\t}\n\n\t\t\tassertExists(\n\t\t\t\tthis.context.repository,\n\t\t\t\t\"Repository selection must be available through context to proceed\",\n\t\t\t);\n\n\t\t\tawait this.finishCoreDependenciesInstallation();\n\t\t\tawait this.upsertSliceMachineConfigurationAndStartPluginRunner();\n\n\t\t\tconst isLoginRequired = await this.checkIsLoginRequired();\n\t\t\tif (isLoginRequired) {\n\t\t\t\tawait this.loginAndFetchUserData();\n\t\t\t\tif (this.context.repository.exists) {\n\t\t\t\t\tthis.validateWriteAccess();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!this.context.repository.exists) {\n\t\t\t\tawait this.createNewRepository();\n\t\t\t}\n\n\t\t\tawait this.syncDataWithPrismic();\n\t\t\tawait this.initializeProject();\n\t\t\tawait this.initializePlugins();\n\t\t} catch (error) {\n\t\t\tawait this.trackError(error);\n\n\t\t\tthrow error;\n\t\t}\n\n\t\tawait this.manager.telemetry.track({\n\t\t\tevent: \"command:init:end\",\n\t\t\tframework: this.context.framework.sliceMachineTelemetryID,\n\t\t\trepository: this.context.repository.domain,\n\t\t\tsuccess: true,\n\t\t});\n\n\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(\n\t\t\t`\\n${chalk.bgGreen(` ${chalk.bold.white(\"Slice Machine\")} `)} ${chalk.dim(\n\t\t\t\t\"→\",\n\t\t\t)} Initialization successful!`,\n\t\t);\n\n\t\ttry {\n\t\t\tconst runSmCommand = this.context.projectInitialization?.patchedScript\n\t\t\t\t? await getRunScriptCommand({\n\t\t\t\t\t\tagent: this.context.packageManager || \"npm\",\n\t\t\t\t\t\tscript: \"slicemachine\",\n\t\t\t\t })\n\t\t\t\t: await getExecuteCommand({\n\t\t\t\t\t\tagent: this.context.packageManager || \"npm\",\n\t\t\t\t\t\tscript: \"start-slicemachine\",\n\t\t\t\t });\n\n\t\t\tconst runProjectCommand = await getRunScriptCommand({\n\t\t\t\tagent: this.context.packageManager || \"npm\",\n\t\t\t\tscript: \"dev\",\n\t\t\t});\n\n\t\t\tconst apiEndpoints = this.manager.getAPIEndpoints();\n\t\t\tconst wroomHost = new URL(apiEndpoints.PrismicWroom).host;\n\n\t\t\tconst dashboardURL = new URL(\n\t\t\t\t`https://${this.context.repository.domain}.${wroomHost}`,\n\t\t\t)\n\t\t\t\t.toString()\n\t\t\t\t.replace(/\\/$/, \"\");\n\t\t\tconst apiURL = new URL(\n\t\t\t\t\"./api/v2\",\n\t\t\t\t`https://${this.context.repository.domain}.cdn.${wroomHost}`,\n\t\t\t).toString();\n\n\t\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`\n YOUR REPOSITORY\n Page Builder ${chalk.cyan(dashboardURL)}\n API ${chalk.cyan(apiURL)}\n\n RESOURCES\n Documentation ${chalk.cyan(\n\t\t\tthis.context.framework.prismicDocumentation,\n\t\t)}\n Getting help ${chalk.cyan(\"https://community.prismic.io\")}\n\n GETTING STARTED\n Run Slice Machine ${chalk.cyan(runSmCommand)}\n Run your project ${chalk.cyan(runProjectCommand)}\n\t`);\n\n\t\t\tif (this.options.starter && this.options.repository) {\n\t\t\t\tconst { openDashboard } = await prompt<boolean, \"openDashboard\">({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"openDashboard\",\n\t\t\t\t\tmessage: \"Would you like to open your repository?\",\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (openDashboard) {\n\t\t\t\t\topen(dashboardURL);\n\t\t\t\t}\n\t\t\t} else if (this.options.startSlicemachine) {\n\t\t\t\tconst pkgJSONPath = path.join(this.manager.cwd, \"package.json\");\n\t\t\t\tconst pkg = JSON.parse(await fs.readFile(pkgJSONPath, \"utf-8\"));\n\t\t\t\tconst scripts = pkg.scripts || {};\n\n\t\t\t\tconst finalSmCommand = (() => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tscripts[\"dev\"] &&\n\t\t\t\t\t\ttypeof scripts[\"dev\"] === \"string\" &&\n\t\t\t\t\t\tscripts[\"dev\"].includes(\":slicemachine\")\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcommand: runProjectCommand,\n\t\t\t\t\t\t\tmessage: `Would you like to run your project and Slice Machine concurrently (${runProjectCommand})?`,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcommand: runSmCommand,\n\t\t\t\t\t\tmessage: `Would you like to run Slice Machine (${runSmCommand})?`,\n\t\t\t\t\t};\n\t\t\t\t})();\n\t\t\t\tconst { startSlicemachine } = await prompt<\n\t\t\t\t\tboolean,\n\t\t\t\t\t\"startSlicemachine\"\n\t\t\t\t>({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"startSlicemachine\",\n\t\t\t\t\tmessage: finalSmCommand.message,\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (startSlicemachine) {\n\t\t\t\t\tconst commandReturnValue = await execaCommand(\n\t\t\t\t\t\tfinalSmCommand.command,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tenv: { FORCE_COLOR: \"true\" },\n\t\t\t\t\t\t},\n\t\t\t\t\t).pipeStdout?.(process.stdout);\n\t\t\t\t\tif (commandReturnValue !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\t\tconsole.log(commandReturnValue.stdout);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// Only track this error with Sentry, it's only the final convenience message\n\t\t\tawait this.trackSentryError(error);\n\t\t}\n\t}\n\n\tprotected async checkIsLoginRequired(): Promise<boolean> {\n\t\ttry {\n\t\t\tassertExists(this.context.repository, \"\");\n\t\t\tif (this.context.repository.exists === false) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tconst [slices, ctLibrary, documentsGlob] = await Promise.all([\n\t\t\t\tthis.readAllSlices(),\n\t\t\t\tthis.manager.customTypes.readCustomTypeLibrary(),\n\t\t\t\tthis.readDocuments(),\n\t\t\t]);\n\n\t\t\t// If repository exists, and there's anything to push\n\t\t\tif (\n\t\t\t\tslices.length > 0 ||\n\t\t\t\tctLibrary.ids.length > 0 ||\n\t\t\t\t(documentsGlob !== undefined && documentsGlob.documents.length > 0)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// If repository exists, and there might be things to pull\n\t\t\tif (ctLibrary.ids.length === 0) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprotected trackError = async (error: unknown): Promise<void> => {\n\t\tawait this.trackSentryError(error);\n\t\tawait this.trackTelemetryError(error);\n\t};\n\n\tprotected trackTelemetryError = async (error: unknown): Promise<void> => {\n\t\t// Transform error to string and prevent hitting Segment 500kb API limit or sending ridiculously long trace\n\t\tconst safeError = (\n\t\t\terror instanceof Error ? error.message : `${error}`\n\t\t).slice(0, 512);\n\t\tawait this.manager.telemetry.track({\n\t\t\tevent: \"command:init:end\",\n\t\t\tframework: this.context.framework?.sliceMachineTelemetryID ?? \"unknown\",\n\t\t\trepository: this.context.repository?.domain || \"\",\n\t\t\tsuccess: false,\n\t\t\terror: safeError,\n\t\t});\n\t};\n\n\tprotected trackSentryError = async (error: unknown): Promise<void> => {\n\t\tawait updateSentryContext({\n\t\t\tmanager: this.manager,\n\t\t\trepositoryName: this.context.repository?.domain || \"\",\n\t\t\tframework: this.context.framework?.sliceMachineTelemetryID ?? \"unknown\",\n\t\t});\n\t\ttrackSentryError(error);\n\t};\n\n\tprotected async copyStarter(): Promise<void> {\n\t\tconst dir = await this.getStarterDirectoryName();\n\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Copying starter...\\n\",\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tconst starter = this.options.starter;\n\n\t\t\t\t\tawait downloadTemplate(\n\t\t\t\t\t\t`${GIGET_PROVIDER}:${GIGET_ORGANIZATION}/${starter}#HEAD`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdir,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\n\t\t\t\t\tprocess.chdir(dir);\n\t\t\t\t\tthis.manager.cwd = process.cwd();\n\n\t\t\t\t\ttask.title = \"Starter copied\\n\";\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected async getStarterDirectoryName(): Promise<string> {\n\t\tlet directoryName: string;\n\t\tconst folderNames = await fs.readdir(process.cwd());\n\n\t\tif (\n\t\t\tthis.options.directoryName &&\n\t\t\t!folderNames.includes(this.options.directoryName)\n\t\t) {\n\t\t\t// Use provided directory\n\t\t\tdirectoryName = this.options.directoryName;\n\t\t} else if (\n\t\t\tthis.options.repository &&\n\t\t\t!folderNames.includes(this.options.repository)\n\t\t) {\n\t\t\t// Use repository name\n\t\t\tdirectoryName = this.options.repository;\n\t\t} else {\n\t\t\t// Use random name\n\t\t\tlet suggestedName: string;\n\t\t\tdo {\n\t\t\t\tsuggestedName = getRandomRepositoryDomain();\n\t\t\t} while (folderNames.includes(suggestedName));\n\n\t\t\tconst { selectedDirectory } = await prompt<string, \"selectedDirectory\">({\n\t\t\t\ttype: \"text\",\n\t\t\t\tname: \"selectedDirectory\",\n\t\t\t\tmessage: \"Your starter directory name\",\n\t\t\t\tinitial: suggestedName,\n\t\t\t\tvalidate: async (rawDirectory: string) => {\n\t\t\t\t\tif (folderNames.includes(rawDirectory)) {\n\t\t\t\t\t\treturn \"Directory name already exists\";\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tdirectoryName = selectedDirectory;\n\t\t}\n\n\t\treturn directoryName;\n\t}\n\n\tprotected detectEnvironment(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Detecting environment...\",\n\t\t\t\ttask: (_, parentTask) =>\n\t\t\t\t\tlistr([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Detecting framework...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tthis.context.framework = await detectFramework(\n\t\t\t\t\t\t\t\t\tthis.manager.cwd,\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttask.title = `Detected framework ${chalk.cyan(\n\t\t\t\t\t\t\t\t\tthis.context.framework.name,\n\t\t\t\t\t\t\t\t)}`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Detecting package manager...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tthis.context.packageManager =\n\t\t\t\t\t\t\t\t\tawait this.manager.project.detectPackageManager({\n\t\t\t\t\t\t\t\t\t\troot: this.manager.cwd,\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\ttask.title = `Detected package manager ${chalk.cyan(\n\t\t\t\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t\t\t\t)}`;\n\n\t\t\t\t\t\t\t\tassertExists(\n\t\t\t\t\t\t\t\t\tthis.context.framework,\n\t\t\t\t\t\t\t\t\t\"Project framework must be available through context to proceed\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tparentTask.title = `Detected framework ${chalk.cyan(\n\t\t\t\t\t\t\t\t\tthis.context.framework.name,\n\t\t\t\t\t\t\t\t)} and package manager ${chalk.cyan(\n\t\t\t\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t\t\t\t)}`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Detecting starter...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tthis.context.starterId = await detectStarterId(\n\t\t\t\t\t\t\t\t\tthis.manager.cwd,\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif (this.context.starterId) {\n\t\t\t\t\t\t\t\t\ttask.title = `Detected starter ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\tthis.context.starterId,\n\t\t\t\t\t\t\t\t\t)}`;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ttask.title = \"No starter detected\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected beginCoreDependenciesInstallation(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Beginning core dependencies installation...\",\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t\t\"Project package manager must be available through context to run `beginCoreDependenciesInstallation`\",\n\t\t\t\t\t);\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.framework,\n\t\t\t\t\t\t\"Project framework must be available through context to run `beginCoreDependenciesInstallation`\",\n\t\t\t\t\t);\n\n\t\t\t\t\tconst { execaProcess } =\n\t\t\t\t\t\tawait this.manager.project.installDependencies({\n\t\t\t\t\t\t\tpackageManager: this.context.packageManager,\n\t\t\t\t\t\t\tdependencies: this.context.framework.devDependencies,\n\t\t\t\t\t\t\tdev: true,\n\t\t\t\t\t\t\t// Picked up later\n\t\t\t\t\t\t\tlog: () => {\n\t\t\t\t\t\t\t\t/* ... */\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\n\t\t\t\t\t// Fail hard if process fails\n\t\t\t\t\texecaProcess.catch(async (error) => {\n\t\t\t\t\t\tconst [_, ...argv1n] = process.argv;\n\t\t\t\t\t\t// Command the user used\n\t\t\t\t\t\tlet tryAgainCommand = [process.argv0, ...argv1n].join(\" \");\n\n\t\t\t\t\t\t// If the `repository` option wasn't used AND the repository was selected/created\n\t\t\t\t\t\tif (!this.options.repository && this.context.repository) {\n\t\t\t\t\t\t\ttryAgainCommand = `${tryAgainCommand} --repository=${this.context.repository.domain}`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.trackError(error);\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`\\n\\n${error.shortMessage}\\n${error.stderr}\\n\\n${\n\t\t\t\t\t\t\t\tlogSymbols.error\n\t\t\t\t\t\t\t} Dependency installation failed, try again with:\\n\\n ${chalk.gray(\n\t\t\t\t\t\t\t\t\"$\",\n\t\t\t\t\t\t\t)} ${chalk.cyan(tryAgainCommand)}`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tprocess.exit(1);\n\t\t\t\t\t});\n\n\t\t\t\t\tthis.context.installProcess = execaProcess;\n\n\t\t\t\t\ttask.title = `Began core dependencies installation with ${chalk.cyan(\n\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t)} ... (running in background)`;\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected async fetchUserProfile(): Promise<void> {\n\t\tthis.context.userProfile = await this.manager.user.getProfile();\n\n\t\tawait this.manager.telemetry.identify({\n\t\t\tuserID: this.context.userProfile.shortId,\n\t\t\tintercomHash: this.context.userProfile.intercomHash,\n\t\t});\n\t\tawait this.manager.telemetry.track({\n\t\t\tevent: \"command:init:identify\",\n\t\t\trepository: this.options.repository,\n\t\t});\n\t}\n\n\tprotected async fetchUserRepositories(): Promise<void> {\n\t\tthis.context.userRepositories =\n\t\t\tawait this.manager.prismicRepository.readAll();\n\t}\n\n\tprotected validateWriteAccess(): void {\n\t\tassertExists(\n\t\t\tthis.context.repository,\n\t\t\t\"Repository selection must be available through context to proceed\",\n\t\t);\n\t\tassertExists(\n\t\t\tthis.context.userRepositories,\n\t\t\t\"User repositories must be available through context to validate write access\",\n\t\t);\n\t\tconst { domain } = this.context.repository;\n\t\tconst maybeRepository = this.context.userRepositories.find(\n\t\t\t(repository) => repository.domain === domain,\n\t\t);\n\n\t\tif (maybeRepository) {\n\t\t\tif (!this.manager.prismicRepository.hasWriteAccess(maybeRepository)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Cannot run init command with repository ${chalk.cyan(\n\t\t\t\t\t\tmaybeRepository.domain,\n\t\t\t\t\t)}: you are not a developer or admin of this repository`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot validate write access for repository ${chalk.cyan(\n\t\t\t\t\tdomain,\n\t\t\t\t)}: you are not part of this repository`,\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected loginAndFetchUserData(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Logging in to Prismic...\",\n\t\t\t\ttask: async (_, parentTask) => {\n\t\t\t\t\tparentTask.output = \"Validating session...\";\n\t\t\t\t\tconst isLoggedIn = await this.manager.user.checkIsLoggedIn();\n\n\t\t\t\t\tif (!isLoggedIn) {\n\t\t\t\t\t\tparentTask.output = \"Press any key to open the browser to login...\";\n\t\t\t\t\t\tawait new Promise((resolve) => {\n\t\t\t\t\t\t\tconst initialRawMode = !!process.stdin.isRaw;\n\t\t\t\t\t\t\tprocess.stdin.setRawMode?.(true);\n\t\t\t\t\t\t\tprocess.stdin.resume();\n\t\t\t\t\t\t\tprocess.stdin.once(\"data\", (data: Buffer) => {\n\t\t\t\t\t\t\t\tprocess.stdin.setRawMode?.(initialRawMode);\n\t\t\t\t\t\t\t\tprocess.stdin.pause();\n\t\t\t\t\t\t\t\tresolve(data.toString(\"utf-8\"));\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tparentTask.output = \"Browser opened, waiting for you to login...\";\n\t\t\t\t\t\tconst { port, url } = await this.manager.user.getLoginSessionInfo();\n\t\t\t\t\t\tawait this.manager.user.nodeLoginSession({\n\t\t\t\t\t\t\tport,\n\t\t\t\t\t\t\tonListenCallback() {\n\t\t\t\t\t\t\t\topen(url);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tparentTask.output = \"\";\n\t\t\t\t\tparentTask.title = `Logged in`;\n\n\t\t\t\t\treturn listr(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttitle: \"Fetching user profile...\",\n\t\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\t\tawait this.fetchUserProfile();\n\t\t\t\t\t\t\t\t\tparentTask.title = `Logged in as ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\tthis.context.userProfile?.email,\n\t\t\t\t\t\t\t\t\t)}`;\n\t\t\t\t\t\t\t\t\ttask.title = \"Fetched user profile\";\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttitle: \"Fetching user repositories...\",\n\t\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\t\tawait this.fetchUserRepositories();\n\t\t\t\t\t\t\t\t\ttask.title = \"Fetched user repositories\";\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\t{ concurrent: true },\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected useRepositoryFlag(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: `Flag ${chalk.cyan(\"repository\")} used, validating input...`,\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.options.repository,\n\t\t\t\t\t\t\"Flag `repository` must be set to run `useRepositoryFlag`\",\n\t\t\t\t\t);\n\t\t\t\t\tconst domain = formatRepositoryDomain(this.options.repository);\n\t\t\t\t\tconst validation = await validateRepositoryDomainAndAvailability({\n\t\t\t\t\t\tdomain,\n\t\t\t\t\t\texistsFn: (domain) =>\n\t\t\t\t\t\t\tthis.manager.prismicRepository.checkExists({ domain }),\n\t\t\t\t\t});\n\n\t\t\t\t\tif (validation.LessThan4 || validation.MoreThan30) {\n\t\t\t\t\t\tconst errorMessage = getErrorMessageForRepositoryDomainValidation({\n\t\t\t\t\t\t\tvalidation: {\n\t\t\t\t\t\t\t\t...validation,\n\t\t\t\t\t\t\t\t// We don't want to throw if repo already exists.\n\t\t\t\t\t\t\t\t// User most probably just created it via their dashboard.\n\t\t\t\t\t\t\t\tAlreadyExists: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdisplayDomain: chalk.cyan(domain),\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (errorMessage) {\n\t\t\t\t\t\t\tthrow new Error(errorMessage);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttask.title = `Selected repository ${chalk.cyan(\n\t\t\t\t\t\tdomain,\n\t\t\t\t\t)} (flag ${chalk.cyan(\"repository\")} used)`;\n\n\t\t\t\t\tthis.context.repository = {\n\t\t\t\t\t\tdomain,\n\t\t\t\t\t\texists: validation.AlreadyExists ?? false,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected async selectRepository(): Promise<void> {\n\t\tassertExists(\n\t\t\tthis.context.userRepositories,\n\t\t\t\"User repositories must be available through context to run `selectRepository`\",\n\t\t);\n\n\t\tif (this.context.userRepositories.length) {\n\t\t\tawait this.trySelectExistingRepository();\n\t\t}\n\n\t\tif (!this.context.repository) {\n\t\t\tawait this.selectNewRepository();\n\t\t}\n\n\t\tassertExists(\n\t\t\tthis.context.repository,\n\t\t\t\"Repository selection must be available through context to proceed\",\n\t\t);\n\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(\n\t\t\t`${logSymbols.success} Selected repository ${chalk.cyan(\n\t\t\t\tthis.context.repository.domain,\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tprotected async trySelectExistingRepository(): Promise<void> {\n\t\tassertExists(\n\t\t\tthis.context.userRepositories,\n\t\t\t\"User repositories must be available through context to run `trySelectExistingRepository`\",\n\t\t);\n\n\t\tconst { maybeDomain } = await prompt<string, \"maybeDomain\">({\n\t\t\ttype: \"select\",\n\t\t\tname: \"maybeDomain\",\n\t\t\tmessage: \"Pick a repository to connect to or choose to create a new one\",\n\t\t\twarn: \"You are not a developer or admin of this repository\",\n\t\t\tchoices: [\n\t\t\t\t{\n\t\t\t\t\ttitle: \"CREATE NEW\",\n\t\t\t\t\tdescription: \"Create a new Prismic repository\\n\",\n\t\t\t\t\tvalue: \"\",\n\t\t\t\t},\n\t\t\t\t...this.context.userRepositories\n\t\t\t\t\t.map((repository) => {\n\t\t\t\t\t\tconst hasWriteAccess =\n\t\t\t\t\t\t\tthis.manager.prismicRepository.hasWriteAccess(repository);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: `${repository.domain}${\n\t\t\t\t\t\t\t\thasWriteAccess ? \"\" : \" (Unauthorized)\"\n\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tdescription: `Connect to ${chalk.cyan(repository.domain)}`,\n\t\t\t\t\t\t\tvalue: repository.domain,\n\t\t\t\t\t\t\tdisabled: !hasWriteAccess,\n\t\t\t\t\t\t};\n\t\t\t\t\t})\n\t\t\t\t\t.sort((a, b) => (a.value > b.value ? 1 : -1)),\n\t\t\t],\n\t\t});\n\n\t\tif (maybeDomain) {\n\t\t\tthis.context.repository = {\n\t\t\t\tdomain: maybeDomain,\n\t\t\t\texists: true,\n\t\t\t};\n\t\t}\n\t}\n\n\tprotected async selectNewRepository(): Promise<void> {\n\t\tlet suggestedName = \"\";\n\n\t\t// TODO: Improve concurrency\n\t\tconst trySuggestName = async (name: string): Promise<string | void> => {\n\t\t\tif (name) {\n\t\t\t\tconst formattedName = formatRepositoryDomain(name);\n\n\t\t\t\tif (\n\t\t\t\t\t!validateRepositoryDomain({ domain: formattedName }).hasErrors &&\n\t\t\t\t\t!(await this.manager.prismicRepository.checkExists({\n\t\t\t\t\t\tdomain: formattedName,\n\t\t\t\t\t}))\n\t\t\t\t) {\n\t\t\t\t\treturn formattedName;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// 1. Try to suggest name after directory name\n\t\tconst maybeSuggestion = await trySuggestName(\n\t\t\tpath.basename(this.manager.cwd),\n\t\t);\n\t\tif (maybeSuggestion) {\n\t\t\tsuggestedName = maybeSuggestion;\n\t\t}\n\n\t\t// 2. Try to suggest name after package name\n\t\tif (!suggestedName) {\n\t\t\ttry {\n\t\t\t\tconst pkgJSONPath = path.join(this.manager.cwd, \"package.json\");\n\t\t\t\tconst pkg = JSON.parse(await fs.readFile(pkgJSONPath, \"utf-8\"));\n\n\t\t\t\tconst maybeSuggestion = await trySuggestName(pkg.name);\n\t\t\t\tif (maybeSuggestion) {\n\t\t\t\t\tsuggestedName = maybeSuggestion;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Noop\n\t\t\t}\n\t\t}\n\n\t\t// 3. Use random name\n\t\tif (!suggestedName) {\n\t\t\tdo {\n\t\t\t\tsuggestedName = getRandomRepositoryDomain();\n\t\t\t} while (\n\t\t\t\tawait this.manager.prismicRepository.checkExists({\n\t\t\t\t\tdomain: suggestedName,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tconst { domain } = await prompt<string, \"domain\">({\n\t\t\ttype: \"text\",\n\t\t\tname: \"domain\",\n\t\t\t// Overriden by the `onRender` function, just used as a fallback\n\t\t\tmessage: \"Choose a name for your Prismic repository\",\n\t\t\tinitial: suggestedName,\n\t\t\tonRender() {\n\t\t\t\tconst rawDomain = this.value || this.initial || \"\";\n\t\t\t\tconst domain = formatRepositoryDomain(rawDomain);\n\t\t\t\tconst validation = validateRepositoryDomain({ domain });\n\n\t\t\t\tconst minRule = validation.LessThan4\n\t\t\t\t\t? chalk.red(\n\t\t\t\t\t\t\t`1. Name must be ${chalk.bold(\"4 characters long or more\")}`,\n\t\t\t\t\t )\n\t\t\t\t\t: `1. Name must be ${chalk.cyan(\"4 characters long or more\")}`;\n\n\t\t\t\tconst maxRule = validation.MoreThan30\n\t\t\t\t\t? chalk.red(\n\t\t\t\t\t\t\t`1. Name must be ${chalk.bold(\"30 characters long or less\")}`,\n\t\t\t\t\t )\n\t\t\t\t\t: `1. Name must be ${chalk.cyan(\"30 characters long or less\")}`;\n\n\t\t\t\tthis.msg = chalk.reset(\n\t\t\t\t\t`\nChoose a name for your Prismic repository\n\n NAMING RULES\n ${minRule}\n ${maxRule}\n 3. Name will be ${chalk.cyan(\"kebab-cased\")} automatically\n\n CONSIDERATIONS\n 1. Once picked, your repository name ${chalk.cyan(\"cannot be changed\")}\n 2. A ${chalk.cyan(\n\t\t\t\"display name\",\n\t\t)} for the repository can be configured later on\n\n PREVIEW\n Dashboard ${chalk.cyan(`https://${domain}.prismic.io`)}\n API ${chalk.cyan(`https://${domain}.cdn.prismic.io/api/v2`)}\n\n${chalk.cyan(\"?\")} Your Prismic repository name`.replace(\"\\n\", \"\"),\n\t\t\t\t);\n\t\t\t},\n\t\t\tvalidate: async (rawDomain: string) => {\n\t\t\t\tconst domain = formatRepositoryDomain(rawDomain);\n\t\t\t\tconst validation = await validateRepositoryDomainAndAvailability({\n\t\t\t\t\tdomain,\n\t\t\t\t\texistsFn: (domain) =>\n\t\t\t\t\t\tthis.manager.prismicRepository.checkExists({ domain }),\n\t\t\t\t});\n\t\t\t\tconst errorMessage = getErrorMessageForRepositoryDomainValidation({\n\t\t\t\t\tvalidation,\n\t\t\t\t\tdisplayDomain: chalk.cyan(domain),\n\t\t\t\t});\n\n\t\t\t\treturn errorMessage || true;\n\t\t\t},\n\t\t\tformat: (value) => {\n\t\t\t\treturn formatRepositoryDomain(value);\n\t\t\t},\n\t\t});\n\n\t\t// Clear extra lines\n\t\tprocess.stdout.moveCursor?.(0, -16);\n\t\tprocess.stdout.clearScreenDown?.();\n\n\t\tthis.context.repository = {\n\t\t\tdomain,\n\t\t\texists: false,\n\t\t};\n\t}\n\n\tprotected createNewRepository(): Promise<void> {\n\t\tassertExists(\n\t\t\tthis.context.repository,\n\t\t\t\"Repository selection must be available through context to run `createNewRepository`\",\n\t\t);\n\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: `Creating new repository ${chalk.cyan(\n\t\t\t\t\tthis.context.repository.domain,\n\t\t\t\t)} ...`,\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.repository,\n\t\t\t\t\t\t\"Repository selection must be available through context to run `createNewRepository`\",\n\t\t\t\t\t);\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.framework,\n\t\t\t\t\t\t\"Project framework must be available through context to run `createNewRepository`\",\n\t\t\t\t\t);\n\n\t\t\t\t\tawait this.manager.prismicRepository.create({\n\t\t\t\t\t\tdomain: this.context.repository.domain,\n\t\t\t\t\t\tframework: this.context.framework.wroomTelemetryID,\n\t\t\t\t\t\tstarterId: this.context.starterId,\n\t\t\t\t\t});\n\n\t\t\t\t\tthis.context.repository.exists = true;\n\t\t\t\t\ttask.title = `Created new repository ${chalk.cyan(\n\t\t\t\t\t\tthis.context.repository.domain,\n\t\t\t\t\t)}`;\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected finishCoreDependenciesInstallation(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: `Finishing core dependencies installation with ${chalk.cyan(\n\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t)} ...`,\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.installProcess,\n\t\t\t\t\t\t\"Initial dependencies installation process must be available through context to run `finishCoreDependenciesInstallation`\",\n\t\t\t\t\t);\n\n\t\t\t\t\tconst updateOutput = (data: Buffer | null) => {\n\t\t\t\t\t\tif (data instanceof Buffer) {\n\t\t\t\t\t\t\ttask.output = data.toString();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\t// Don't clutter console with logs when process is non TTY (CI, etc.)\n\t\t\t\t\tif (process.stdout.isTTY || process.env.NODE_ENV === \"test\") {\n\t\t\t\t\t\tthis.context.installProcess.stdout?.on(\"data\", updateOutput);\n\t\t\t\t\t}\n\t\t\t\t\tthis.context.installProcess.stderr?.on(\"data\", updateOutput);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.context.installProcess;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Error catching happens when then process is started ealier so\n\t\t\t\t\t\t * that all install errors, earlier and presents, can be catched.\n\t\t\t\t\t\t *\n\t\t\t\t\t\t * Here, we force the task to wait so that it is neither marked as\n\t\t\t\t\t\t * done or has the opportunity to handle the error itself.\n\t\t\t\t\t\t */\n\t\t\t\t\t\t// If for whatever reason the process is not exited by now, we still throw the error\n\t\t\t\t\t\tawait new Promise((resolve) => setTimeout(resolve, 5000));\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\n\t\t\t\t\ttask.title = `Installed core dependencies with ${chalk.cyan(\n\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t)}`;\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected upsertSliceMachineConfigurationAndStartPluginRunner(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Resolving Slice Machine configuration...\",\n\t\t\t\ttask: async (_, parentTask) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.framework,\n\t\t\t\t\t\t\"Project framework must be available through context to run `upsertSliceMachineConfiguration`\",\n\t\t\t\t\t);\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.repository,\n\t\t\t\t\t\t\"Repository selection must be available through context to run `upsertSliceMachineConfiguration`\",\n\t\t\t\t\t);\n\n\t\t\t\t\tlet sliceMachineConfigExists = false;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.manager.project.getSliceMachineConfigPath();\n\t\t\t\t\t\tsliceMachineConfigExists = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// noop, config does not exists, we'll create it\n\t\t\t\t\t}\n\n\t\t\t\t\tif (sliceMachineConfigExists) {\n\t\t\t\t\t\tparentTask.title = \"Updating Slice Machine configuration...\";\n\n\t\t\t\t\t\tconst config = await this.manager.project.getSliceMachineConfig();\n\t\t\t\t\t\tawait this.manager.project.writeSliceMachineConfig({\n\t\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\t\t...config,\n\t\t\t\t\t\t\t\trepositoryName: this.context.repository.domain,\n\t\t\t\t\t\t\t\tadapter: this.context.framework.adapterName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tparentTask.title = \"Updated Slice Machine configuration\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparentTask.title = \"Creating Slice Machine configuration...\";\n\n\t\t\t\t\t\tconst sliceMachineConfigPath =\n\t\t\t\t\t\t\tawait this.manager.project.suggestSliceMachineConfigPath();\n\n\t\t\t\t\t\tawait this.manager.project.writeSliceMachineConfig({\n\t\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\t\trepositoryName: this.context.repository.domain,\n\t\t\t\t\t\t\t\tadapter: this.context.framework.adapterName,\n\t\t\t\t\t\t\t\tlibraries: [\"./slices\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpath: sliceMachineConfigPath,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tparentTask.title = \"Created Slice Machine configuration\";\n\t\t\t\t\t}\n\n\t\t\t\t\treturn listr([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t\t\t// title: \"Starting plugin runner...\",\n\t\t\t\t\t\t\ttitle: \"Loading adapter...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tawait this.manager.plugins.initPlugins();\n\t\t\t\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t\t\t\t// task.title = \"Started plugin runner\";\n\t\t\t\t\t\t\t\ttask.title = \"Loaded adapter\";\n\t\t\t\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t\t\t\t// parentTask.title = `${parentTask.title} and started plugin runner`;\n\t\t\t\t\t\t\t\tparentTask.title = `${parentTask.title} and loaded adapter`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t]);\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected async readAllSlices(): Promise<\n\t\t{ libraryID: string; sliceID: string }[]\n\t> {\n\t\tconst { libraries, errors } =\n\t\t\tawait this.manager.slices.readAllSliceLibraries();\n\n\t\tif (errors.length > 0) {\n\t\t\t// TODO: Provide better error message.\n\t\t\tthrow new Error(`Failed to read slice libraries: ${errors.join(\", \")}`);\n\t\t}\n\n\t\tconst slices: { libraryID: string; sliceID: string }[] = [];\n\t\tfor (const library of libraries) {\n\t\t\tif (library.sliceIDs) {\n\t\t\t\tfor (const sliceID of library.sliceIDs) {\n\t\t\t\t\tslices.push({\n\t\t\t\t\t\tlibraryID: library.libraryID,\n\t\t\t\t\t\tsliceID,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn slices;\n\t}\n\n\tprotected async readDocuments(): Promise<\n\t\t| {\n\t\t\t\tsignature: string;\n\t\t\t\tdocuments: string[];\n\t\t\t\tdirectoryPath: string;\n\t\t }\n\t\t| undefined\n\t> {\n\t\tconst root = await this.manager.project.getRoot();\n\t\tconst documentsDirectoryPath = path.resolve(root, \"documents\");\n\t\ttry {\n\t\t\tawait fs.access(documentsDirectoryPath);\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t\tconst signaturePath = path.resolve(documentsDirectoryPath, \"index.json\");\n\t\tconst rawSignature = await fs.readFile(signaturePath, \"utf-8\");\n\t\tconst signature: string = JSON.parse(rawSignature).signature;\n\n\t\tconst documents = await globby(\"*/*.json\", {\n\t\t\tcwd: documentsDirectoryPath,\n\t\t});\n\n\t\treturn { signature, documents, directoryPath: documentsDirectoryPath };\n\t}\n\n\tprotected syncDataWithPrismic(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Syncing data with Prismic...\",\n\t\t\t\ttask: (_, parentTask) =>\n\t\t\t\t\tlistr([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Pushing slices...\",\n\t\t\t\t\t\t\tskip: () => {\n\t\t\t\t\t\t\t\tif (!this.options.push) {\n\t\t\t\t\t\t\t\t\treturn `--no-push used`;\n\t\t\t\t\t\t\t\t} else if (!this.options.pushSlices) {\n\t\t\t\t\t\t\t\t\treturn `--no-push-slices used`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst slices = await this.readAllSlices();\n\n\t\t\t\t\t\t\t\tif (slices.length === 0) {\n\t\t\t\t\t\t\t\t\ttask.skip(\"No slice to push\");\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\ttask.title = \"Pushing slices... (initializing ACL)\";\n\t\t\t\t\t\t\t\tawait this.manager.screenshots.initS3ACL();\n\n\t\t\t\t\t\t\t\tlet pushed = 0;\n\t\t\t\t\t\t\t\ttask.title = `Pushing slices... (0/${slices.length})`;\n\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\t\t\t\t\tawait this.manager.slices.pushSlice({\n\t\t\t\t\t\t\t\t\t\t\t...slice,\n\t\t\t\t\t\t\t\t\t\t\tuserAgent: SLICE_MACHINE_INIT_USER_AGENT,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tpushed++;\n\t\t\t\t\t\t\t\t\t\ttask.title = `Pushing slices... (${pushed}/${slices.length})`;\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttask.title = \"Pushed all slices\";\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Pushing types...\",\n\t\t\t\t\t\t\tskip: () => {\n\t\t\t\t\t\t\t\tif (!this.options.push) {\n\t\t\t\t\t\t\t\t\treturn `--no-push used`;\n\t\t\t\t\t\t\t\t} else if (!this.options.pushCustomTypes) {\n\t\t\t\t\t\t\t\t\treturn `--no-push-custom-types used`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst { ids, errors } =\n\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.readCustomTypeLibrary();\n\n\t\t\t\t\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\t\t\t\t\t// TODO: Provide better error message.\n\t\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\t`Failed to read custom type libraries: ${errors.join(\n\t\t\t\t\t\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t\t\t\t\t)}`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!ids || ids.length === 0) {\n\t\t\t\t\t\t\t\t\ttask.skip(\"No custom type to push\");\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tlet pushed = 0;\n\t\t\t\t\t\t\t\ttask.title = `Pushing types... (0/${ids.length})`;\n\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\tids.map(async (id) => {\n\t\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.pushCustomType({\n\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\tuserAgent: SLICE_MACHINE_INIT_USER_AGENT,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tpushed++;\n\t\t\t\t\t\t\t\t\t\ttask.title = `Pushing types... (${pushed}/${ids.length})`;\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttask.title = \"Pushed all types\";\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Pushing documents...\",\n\t\t\t\t\t\t\tskip: () => {\n\t\t\t\t\t\t\t\tif (!this.options.push) {\n\t\t\t\t\t\t\t\t\treturn `--no-push used`;\n\t\t\t\t\t\t\t\t} else if (!this.options.pushDocuments) {\n\t\t\t\t\t\t\t\t\treturn `--no-push-documents used`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tassertExists(\n\t\t\t\t\t\t\t\t\tthis.context.repository,\n\t\t\t\t\t\t\t\t\t\"Repository selection must be available through context to run `syncDataWithPrismic`\",\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst documentsRead = await this.readDocuments();\n\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tdocumentsRead === undefined ||\n\t\t\t\t\t\t\t\t\t\tdocumentsRead.documents.length === 0\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\ttask.skip(\"No document to push\");\n\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tconst { signature, documents, directoryPath } = documentsRead;\n\n\t\t\t\t\t\t\t\t\t// TODO: Replace `unknown` with a Prismic document type.\n\t\t\t\t\t\t\t\t\t// The exact format is not know at this time, hence the `unknown`.\n\t\t\t\t\t\t\t\t\tconst recordDocument: Record<string, unknown> = {};\n\n\t\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\t\tdocuments.map(async (documentPath) => {\n\t\t\t\t\t\t\t\t\t\t\tconst filename = path.basename(documentPath, \".json\");\n\t\t\t\t\t\t\t\t\t\t\tconst fileContent = await fs.readFile(\n\t\t\t\t\t\t\t\t\t\t\t\tpath.resolve(directoryPath, documentPath),\n\t\t\t\t\t\t\t\t\t\t\t\t\"utf-8\",\n\t\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\t\t// TOOD: Validate the contents of the JSON file and skip on invalid documents.\n\t\t\t\t\t\t\t\t\t\t\t\tconst parsedContents = JSON.parse(fileContent);\n\n\t\t\t\t\t\t\t\t\t\t\t\trecordDocument[filename] = parsedContents;\n\t\t\t\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t\t\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\t\t\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\t\t\t\t\t\t\t`Skipped document due to its invalid format: ${documentPath}`,\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tawait this.manager.prismicRepository.pushDocuments({\n\t\t\t\t\t\t\t\t\t\tdomain: this.context.repository.domain,\n\t\t\t\t\t\t\t\t\t\tdocuments: recordDocument,\n\t\t\t\t\t\t\t\t\t\tsignature,\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\ttask.title = \"Pushed all documents\";\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\ttask.skip(\"No document to push\");\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Cleaning up data push artifacts\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst root = await this.manager.project.getRoot();\n\t\t\t\t\t\t\t\tconst documentsDirectoryPath = path.resolve(root, \"documents\");\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tawait fs.rm(documentsDirectoryPath, {\n\t\t\t\t\t\t\t\t\t\tforce: true,\n\t\t\t\t\t\t\t\t\t\trecursive: true,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t// Noop, it's not that big of a deal if we cannot delete this directory\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\ttask.title = \"Cleaned up data push artifacts\";\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Pulling existing types...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst { ids, errors } =\n\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.readCustomTypeLibrary();\n\n\t\t\t\t\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\t\t\t\t\t// TODO: Provide better error message.\n\t\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\t`Failed to read custom type libraries: ${errors.join(\n\t\t\t\t\t\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t\t\t\t\t)}`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (ids && ids.length > 0) {\n\t\t\t\t\t\t\t\t\ttask.skip(\"Types already exist\");\n\t\t\t\t\t\t\t\t\tparentTask.title = \"Synced data with Prismic\";\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst remoteTypes =\n\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.fetchRemoteCustomTypes();\n\n\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\tremoteTypes.map(async (model) => {\n\t\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.createCustomType({ model });\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttask.title = \"Pulled existing types\";\n\t\t\t\t\t\t\t\tparentTask.title = \"Synced data with Prismic\";\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected initializeProject(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Initializing project...\",\n\t\t\t\ttask: async (_, parentTask) =>\n\t\t\t\t\t// We return another Listr instance in the event we have additional task to perform to initialize the project\n\t\t\t\t\tlistr([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: `Patching ${chalk.cyan(\"package.json\")} scripts...`,\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst pkgPath = path.join(this.manager.cwd, \"package.json\");\n\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst pkgRaw = await fs.readFile(pkgPath, \"utf-8\");\n\t\t\t\t\t\t\t\t\tconst pkg = JSON.parse(pkgRaw);\n\n\t\t\t\t\t\t\t\t\tpkg.scripts ||= {};\n\n\t\t\t\t\t\t\t\t\tif (!pkg.scripts[START_SCRIPT_KEY]) {\n\t\t\t\t\t\t\t\t\t\tpkg.scripts[START_SCRIPT_KEY] = START_SCRIPT_VALUE;\n\n\t\t\t\t\t\t\t\t\t\t// Cheap indent detection based on https://github.com/sindresorhus/detect-indent (simplified because we're only dealing with JSON here)\n\t\t\t\t\t\t\t\t\t\tconst firstIndent = pkgRaw\n\t\t\t\t\t\t\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t\t\t\t\t\t\t.find((line) => line.match(/^(?:( )+|\\t+)/));\n\t\t\t\t\t\t\t\t\t\tconst indent = firstIndent?.match(/^(?:( )+|\\t+)/)?.[0];\n\n\t\t\t\t\t\t\t\t\t\tawait fs.writeFile(\n\t\t\t\t\t\t\t\t\t\t\tpkgPath,\n\t\t\t\t\t\t\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t\t\t\t\t\t\tpkg,\n\t\t\t\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t\t\t\tindent && indent !== \" \" ? indent : \" \",\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t!pkg.scripts[\"slicemachine\"].startsWith(START_SCRIPT_VALUE)\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tthrow new Error(\"Script already exists\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\ttask.title = `Could not patch ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\t\"package.json\",\n\t\t\t\t\t\t\t\t\t)} scripts (warning)`;\n\t\t\t\t\t\t\t\t\tparentTask.title = `Initialized project (could not patch ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\t\"package.json\",\n\t\t\t\t\t\t\t\t\t)} scripts)`;\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tthis.context.projectInitialization ||= {};\n\t\t\t\t\t\t\t\tthis.context.projectInitialization.patchedScript = true;\n\n\t\t\t\t\t\t\t\ttask.title = `Patched ${chalk.cyan(\"package.json\")} scripts`;\n\t\t\t\t\t\t\t\tparentTask.title = `Initialized project (patched ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\"package.json\",\n\t\t\t\t\t\t\t\t)} scripts)`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected initializePlugins(): Promise<void> {\n\t\treturn listrRun(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t// title: \"Initializing plugins...\",\n\t\t\t\t\ttitle: \"Initializing adapter...\",\n\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\tconst updateOutput = (data: Buffer | string | null) => {\n\t\t\t\t\t\t\tif (data instanceof Buffer) {\n\t\t\t\t\t\t\t\ttask.output = data.toString();\n\t\t\t\t\t\t\t} else if (typeof data === \"string\") {\n\t\t\t\t\t\t\t\ttask.output = data;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tawait this.manager.project.initProject({\n\t\t\t\t\t\t\tlog: updateOutput,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t\t// task.title = \"Initialized plugins\";\n\t\t\t\t\t\ttask.title = \"Initialized adapter\";\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ exitOnError: false },\n\t\t).catch(() => void 0);\n\t}\n}\n"],"names":["pkg","_","_b","_a","domain","maybeSuggestion"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,MAAM,kBAAkD;AAAA,EACvD,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,mBAAmB;;AAGP,MAAA,gCAAgC,CAC5C,YAC4B;AACrB,SAAA,IAAI,wBAAwB,OAAO;AAC3C;MAkBa,wBAAuB;AAAA,EAMnC,YAAY,SAAwC;AAL1C;AACA;AAEA;AA0PA,sCAAa,OAAO,UAAiC;AACxD,YAAA,KAAK,iBAAiB,KAAK;AAC3B,YAAA,KAAK,oBAAoB,KAAK;AAAA,IAAA;AAG3B,+CAAsB,OAAO,UAAiC;;AAEjE,YAAA,aACL,iBAAiB,QAAQ,MAAM,UAAU,GAAG,SA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AAW,QAAQ,wCAAwC,MAAM,KAChE,cAAc;AAGf;AAAA,gBACA;AAEI,2BAAA,SAAQ,0BAAR,GAAQ,wBAA0B;AAClC,qBAAA,QAAQ,sBAAsB,gBAAgB;AAEnD,qBAAK,QAAQ,WAAW,MAAM,KAAK,cAAc;AACjD,2BAAW,QAAQ,gCAAgC,MAAM,KACxD,cAAc;AAAA,cAEhB;AAAA,YACA;AAAA,UAAA,CACD;AAAA;AAAA,MACF;AAAA,IAAA,CACD;AAAA,EACF;AAAA,EAEU,oBAAiB;AAC1B,WAAO,SACN;AAAA,MACC;AAAA;AAAA;AAAA,QAGC,OAAO;AAAA,QACP,MAAM,OAAO,GAAG,SAAQ;AACjB,gBAAA,eAAe,CAAC,SAAgC;AACrD,gBAAI,gBAAgB,QAAQ;AACtB,mBAAA,SAAS,KAAK;uBACT,OAAO,SAAS,UAAU;AACpC,mBAAK,SAAS;AAAA,YACd;AAAA,UAAA;AAGI,gBAAA,KAAK,QAAQ,QAAQ,YAAY;AAAA,YACtC,KAAK;AAAA,UAAA,CACL;AAID,eAAK,QAAQ;AAAA,QACd;AAAA,MACA;AAAA,IAAA,GAEF,EAAE,aAAa,MAAO,CAAA,EACrB,MAAM,MAAM,MAAM;AAAA,EACrB;AACA;"}
|
|
1
|
+
{"version":3,"file":"SliceMachineInitProcess.js","sources":["../../src/SliceMachineInitProcess.ts"],"sourcesContent":["import * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\n\nimport chalk from \"chalk\";\n\nimport { execaCommand, type ExecaChildProcess } from \"execa\";\n\nimport open from \"open\";\nimport logSymbols from \"log-symbols\";\nimport { globby } from \"globby\";\nimport { downloadTemplate } from \"giget\";\n\nimport {\n\tcreateSliceMachineManager,\n\tPrismicUserProfile,\n\tPrismicRepository,\n\tSliceMachineManager,\n\tPackageManager,\n\tStarterId,\n\tREPOSITORY_NAME_VALIDATION,\n} from \"@slicemachine/manager\";\n\nimport pkg from \"../package.json\";\nimport { detectFramework, Framework } from \"./lib/framework\";\nimport { getRunScriptCommand } from \"./lib/getRunScriptCommand\";\nimport { getExecuteCommand } from \"./lib/getExecuteCommand\";\nimport {\n\tgetRandomRepositoryDomain,\n\tformatRepositoryDomain,\n\tvalidateRepositoryDomain,\n\tvalidateRepositoryDomainAndAvailability,\n\tgetErrorMessageForRepositoryDomainValidation,\n} from \"./lib/repositoryDomain\";\nimport { listr, listrRun } from \"./lib/listr\";\nimport { prompt } from \"./lib/prompt\";\nimport { assertExists } from \"./lib/assertExists\";\nimport {\n\tGIGET_ORGANIZATION,\n\tGIGET_PROVIDER,\n\tSLICE_MACHINE_INIT_USER_AGENT,\n\tSTART_SCRIPT_KEY,\n\tSTART_SCRIPT_VALUE,\n} from \"./constants\";\nimport { detectStarterId } from \"./lib/starters\";\nimport { setupSentry } from \"./lib/setupSentry\";\nimport { trackSentryError } from \"./lib/sentryErrorHandlers\";\nimport { updateSentryContext } from \"./lib/updateSentryContext\";\n\nexport type SliceMachineInitProcessOptions = {\n\trepository?: string;\n\tstarter?: string;\n\tdirectoryName?: string;\n\tpush?: boolean;\n\tpushSlices?: boolean;\n\tpushCustomTypes?: boolean;\n\tpushDocuments?: boolean;\n\tstartSlicemachine?: boolean;\n\tcwd?: string;\n} & Record<string, unknown>;\n\nconst DEFAULT_OPTIONS: SliceMachineInitProcessOptions = {\n\tpush: true,\n\tpushSlices: true,\n\tpushCustomTypes: true,\n\tpushDocuments: true,\n\tstartSlicemachine: true,\n};\n\nexport const createSliceMachineInitProcess = (\n\toptions?: SliceMachineInitProcessOptions,\n): SliceMachineInitProcess => {\n\treturn new SliceMachineInitProcess(options);\n};\n\ntype SliceMachineInitProcessContext = {\n\tframework?: Framework;\n\tpackageManager?: PackageManager;\n\tinstallProcess?: ExecaChildProcess;\n\tuserProfile?: PrismicUserProfile;\n\tuserRepositories?: PrismicRepository[];\n\trepository?: {\n\t\tdomain: string;\n\t\texists: boolean;\n\t};\n\tprojectInitialization?: {\n\t\tpatchedScript?: boolean;\n\t};\n\tstarterId?: StarterId;\n};\n\nexport class SliceMachineInitProcess {\n\tprotected options: SliceMachineInitProcessOptions;\n\tprotected manager: SliceMachineManager;\n\n\tprotected context: SliceMachineInitProcessContext;\n\n\tconstructor(options?: SliceMachineInitProcessOptions) {\n\t\tthis.options = { ...DEFAULT_OPTIONS, ...options };\n\t\tthis.manager = createSliceMachineManager({ cwd: options?.cwd });\n\n\t\tthis.context = {};\n\t}\n\n\tasync run(): Promise<void> {\n\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(\n\t\t\t`\\n${chalk.bgGray(` ${chalk.bold.white(\"Slice Machine\")} `)} ${chalk.dim(\n\t\t\t\t\"→\",\n\t\t\t)} Initializing\\n`,\n\t\t);\n\n\t\ttry {\n\t\t\tif (this.options.starter) {\n\t\t\t\tawait this.copyStarter();\n\t\t\t} else if (this.options.directoryName) {\n\t\t\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(\n\t\t\t\t\t`${logSymbols.warning} --directory-name has no effect because --starter is not specified\\n`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tif (await this.manager.telemetry.checkIsTelemetryEnabled()) {\n\t\t\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\tconsole.log(\n\t\t\t\t\t`${\n\t\t\t\t\t\tlogSymbols.info\n\t\t\t\t\t} We collect telemetry data to improve user experience.\\n Learn more: ${chalk.cyan(\n\t\t\t\t\t\t\"https://prismic.dev/slice-machine/telemetry\",\n\t\t\t\t\t)}\\n`,\n\t\t\t\t);\n\t\t\t}\n\t\t\tawait this.manager.telemetry.initTelemetry({\n\t\t\t\tappName: pkg.name,\n\t\t\t\tappVersion: pkg.version,\n\t\t\t});\n\t\t\tawait setupSentry();\n\t\t\tawait this.manager.telemetry.track({\n\t\t\t\tevent: \"command:init:start\",\n\t\t\t\trepository: this.options.repository,\n\t\t\t});\n\n\t\t\tawait this.detectEnvironment();\n\n\t\t\tassertExists(\n\t\t\t\tthis.context.framework,\n\t\t\t\t\"Project framework must be available through context to proceed\",\n\t\t\t);\n\n\t\t\tawait this.beginCoreDependenciesInstallation();\n\n\t\t\tif (this.options.repository) {\n\t\t\t\tawait this.useRepositoryFlag();\n\t\t\t} else {\n\t\t\t\tawait this.loginAndFetchUserData();\n\t\t\t\tawait this.selectRepository();\n\t\t\t}\n\n\t\t\tassertExists(\n\t\t\t\tthis.context.repository,\n\t\t\t\t\"Repository selection must be available through context to proceed\",\n\t\t\t);\n\n\t\t\tawait this.finishCoreDependenciesInstallation();\n\t\t\tawait this.upsertSliceMachineConfigurationAndStartPluginRunner();\n\n\t\t\tconst isLoginRequired = await this.checkIsLoginRequired();\n\t\t\tif (isLoginRequired) {\n\t\t\t\tawait this.loginAndFetchUserData();\n\t\t\t\tif (this.context.repository.exists) {\n\t\t\t\t\tthis.validateWriteAccess();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (!this.context.repository.exists) {\n\t\t\t\tawait this.createNewRepository();\n\t\t\t}\n\n\t\t\tawait this.syncDataWithPrismic();\n\t\t\tawait this.initializeProject();\n\t\t\tawait this.initializePlugins();\n\t\t} catch (error) {\n\t\t\tawait this.trackError(error);\n\n\t\t\tthrow error;\n\t\t}\n\n\t\tawait this.manager.telemetry.track({\n\t\t\tevent: \"command:init:end\",\n\t\t\tframework: this.context.framework.sliceMachineTelemetryID,\n\t\t\trepository: this.context.repository.domain,\n\t\t\tsuccess: true,\n\t\t});\n\n\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(\n\t\t\t`\\n${chalk.bgGreen(` ${chalk.bold.white(\"Slice Machine\")} `)} ${chalk.dim(\n\t\t\t\t\"→\",\n\t\t\t)} Initialization successful!`,\n\t\t);\n\n\t\ttry {\n\t\t\tconst runSmCommand = this.context.projectInitialization?.patchedScript\n\t\t\t\t? await getRunScriptCommand({\n\t\t\t\t\t\tagent: this.context.packageManager || \"npm\",\n\t\t\t\t\t\tscript: \"slicemachine\",\n\t\t\t\t })\n\t\t\t\t: await getExecuteCommand({\n\t\t\t\t\t\tagent: this.context.packageManager || \"npm\",\n\t\t\t\t\t\tscript: \"start-slicemachine\",\n\t\t\t\t });\n\n\t\t\tconst runProjectCommand = await getRunScriptCommand({\n\t\t\t\tagent: this.context.packageManager || \"npm\",\n\t\t\t\tscript: \"dev\",\n\t\t\t});\n\n\t\t\tconst apiEndpoints = this.manager.getAPIEndpoints();\n\t\t\tconst wroomHost = new URL(apiEndpoints.PrismicWroom).host;\n\n\t\t\tconst dashboardURL = new URL(\n\t\t\t\t`https://${this.context.repository.domain}.${wroomHost}`,\n\t\t\t)\n\t\t\t\t.toString()\n\t\t\t\t.replace(/\\/$/, \"\");\n\t\t\tconst apiURL = new URL(\n\t\t\t\t\"./api/v2\",\n\t\t\t\t`https://${this.context.repository.domain}.cdn.${wroomHost}`,\n\t\t\t).toString();\n\n\t\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t\t// eslint-disable-next-line no-console\n\t\t\tconsole.log(`\n YOUR REPOSITORY\n Page Builder ${chalk.cyan(dashboardURL)}\n API ${chalk.cyan(apiURL)}\n\n RESOURCES\n Documentation ${chalk.cyan(\n\t\t\tthis.context.framework.prismicDocumentation,\n\t\t)}\n Getting help ${chalk.cyan(\"https://community.prismic.io\")}\n\n GETTING STARTED\n Run Slice Machine ${chalk.cyan(runSmCommand)}\n Run your project ${chalk.cyan(runProjectCommand)}\n\t`);\n\n\t\t\tif (this.options.starter && this.options.repository) {\n\t\t\t\tconst { openDashboard } = await prompt<boolean, \"openDashboard\">({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"openDashboard\",\n\t\t\t\t\tmessage: \"Would you like to open your repository?\",\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (openDashboard) {\n\t\t\t\t\topen(dashboardURL);\n\t\t\t\t}\n\t\t\t} else if (this.options.startSlicemachine) {\n\t\t\t\tconst pkgJSONPath = path.join(this.manager.cwd, \"package.json\");\n\t\t\t\tconst pkg = JSON.parse(await fs.readFile(pkgJSONPath, \"utf-8\"));\n\t\t\t\tconst scripts = pkg.scripts || {};\n\n\t\t\t\tconst finalSmCommand = (() => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tscripts[\"dev\"] &&\n\t\t\t\t\t\ttypeof scripts[\"dev\"] === \"string\" &&\n\t\t\t\t\t\tscripts[\"dev\"].includes(\":slicemachine\")\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcommand: runProjectCommand,\n\t\t\t\t\t\t\tmessage: `Would you like to run your project and Slice Machine concurrently (${runProjectCommand})?`,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcommand: runSmCommand,\n\t\t\t\t\t\tmessage: `Would you like to run Slice Machine (${runSmCommand})?`,\n\t\t\t\t\t};\n\t\t\t\t})();\n\t\t\t\tconst { startSlicemachine } = await prompt<\n\t\t\t\t\tboolean,\n\t\t\t\t\t\"startSlicemachine\"\n\t\t\t\t>({\n\t\t\t\t\ttype: \"confirm\",\n\t\t\t\t\tname: \"startSlicemachine\",\n\t\t\t\t\tmessage: finalSmCommand.message,\n\t\t\t\t\tinitial: true,\n\t\t\t\t});\n\n\t\t\t\tif (startSlicemachine) {\n\t\t\t\t\tconst commandReturnValue = await execaCommand(\n\t\t\t\t\t\tfinalSmCommand.command,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tenv: { FORCE_COLOR: \"true\" },\n\t\t\t\t\t\t},\n\t\t\t\t\t).pipeStdout?.(process.stdout);\n\t\t\t\t\tif (commandReturnValue !== undefined) {\n\t\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\t\tconsole.log(commandReturnValue.stdout);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} catch (error) {\n\t\t\t// Only track this error with Sentry, it's only the final convenience message\n\t\t\tawait this.trackSentryError(error);\n\t\t}\n\t}\n\n\tprotected async checkIsLoginRequired(): Promise<boolean> {\n\t\ttry {\n\t\t\tassertExists(this.context.repository, \"\");\n\t\t\tif (this.context.repository.exists === false) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tconst [slices, ctLibrary, documentsGlob] = await Promise.all([\n\t\t\t\tthis.readAllSlices(),\n\t\t\t\tthis.manager.customTypes.readCustomTypeLibrary(),\n\t\t\t\tthis.readDocuments(),\n\t\t\t]);\n\n\t\t\t// If repository exists, and there's anything to push\n\t\t\tif (\n\t\t\t\tslices.length > 0 ||\n\t\t\t\tctLibrary.ids.length > 0 ||\n\t\t\t\t(documentsGlob !== undefined && documentsGlob.documents.length > 0)\n\t\t\t) {\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t// If repository exists, and there might be things to pull\n\t\t\tif (ctLibrary.ids.length === 0) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t} catch (e) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprotected trackError = async (error: unknown): Promise<void> => {\n\t\tawait this.trackSentryError(error);\n\t\tawait this.trackTelemetryError(error);\n\t};\n\n\tprotected trackTelemetryError = async (error: unknown): Promise<void> => {\n\t\t// Transform error to string and prevent hitting Segment 500kb API limit or sending ridiculously long trace\n\t\tconst safeError = (\n\t\t\terror instanceof Error ? error.message : `${error}`\n\t\t).slice(0, 512);\n\t\tawait this.manager.telemetry.track({\n\t\t\tevent: \"command:init:end\",\n\t\t\tframework: this.context.framework?.sliceMachineTelemetryID ?? \"unknown\",\n\t\t\trepository: this.context.repository?.domain || \"\",\n\t\t\tsuccess: false,\n\t\t\terror: safeError,\n\t\t});\n\t};\n\n\tprotected trackSentryError = async (error: unknown): Promise<void> => {\n\t\tawait updateSentryContext({\n\t\t\tmanager: this.manager,\n\t\t\trepositoryName: this.context.repository?.domain || \"\",\n\t\t\tframework: this.context.framework?.sliceMachineTelemetryID ?? \"unknown\",\n\t\t});\n\t\ttrackSentryError(error);\n\t};\n\n\tprotected async copyStarter(): Promise<void> {\n\t\tconst dir = await this.getStarterDirectoryName();\n\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Copying starter...\\n\",\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tconst starter = this.options.starter;\n\n\t\t\t\t\tawait downloadTemplate(\n\t\t\t\t\t\t`${GIGET_PROVIDER}:${GIGET_ORGANIZATION}/${starter}#HEAD`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdir,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\n\t\t\t\t\tprocess.chdir(dir);\n\t\t\t\t\tthis.manager.cwd = process.cwd();\n\n\t\t\t\t\ttask.title = \"Starter copied\\n\";\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected async getStarterDirectoryName(): Promise<string> {\n\t\tlet directoryName: string;\n\t\tconst folderNames = await fs.readdir(process.cwd());\n\n\t\tif (\n\t\t\tthis.options.directoryName &&\n\t\t\t!folderNames.includes(this.options.directoryName)\n\t\t) {\n\t\t\t// Use provided directory\n\t\t\tdirectoryName = this.options.directoryName;\n\t\t} else if (\n\t\t\tthis.options.repository &&\n\t\t\t!folderNames.includes(this.options.repository)\n\t\t) {\n\t\t\t// Use repository name\n\t\t\tdirectoryName = this.options.repository;\n\t\t} else {\n\t\t\t// Use random name\n\t\t\tlet suggestedName: string;\n\t\t\tdo {\n\t\t\t\tsuggestedName = getRandomRepositoryDomain();\n\t\t\t} while (folderNames.includes(suggestedName));\n\n\t\t\tconst { selectedDirectory } = await prompt<string, \"selectedDirectory\">({\n\t\t\t\ttype: \"text\",\n\t\t\t\tname: \"selectedDirectory\",\n\t\t\t\tmessage: \"Your starter directory name\",\n\t\t\t\tinitial: suggestedName,\n\t\t\t\tvalidate: async (rawDirectory: string) => {\n\t\t\t\t\tif (folderNames.includes(rawDirectory)) {\n\t\t\t\t\t\treturn \"Directory name already exists\";\n\t\t\t\t\t}\n\n\t\t\t\t\treturn true;\n\t\t\t\t},\n\t\t\t});\n\n\t\t\tdirectoryName = selectedDirectory;\n\t\t}\n\n\t\treturn directoryName;\n\t}\n\n\tprotected detectEnvironment(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Detecting environment...\",\n\t\t\t\ttask: (_, parentTask) =>\n\t\t\t\t\tlistr([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Detecting framework...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tthis.context.framework = await detectFramework(\n\t\t\t\t\t\t\t\t\tthis.manager.cwd,\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttask.title = `Detected framework ${chalk.cyan(\n\t\t\t\t\t\t\t\t\tthis.context.framework.name,\n\t\t\t\t\t\t\t\t)}`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Detecting package manager...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tthis.context.packageManager =\n\t\t\t\t\t\t\t\t\tawait this.manager.project.detectPackageManager({\n\t\t\t\t\t\t\t\t\t\troot: this.manager.cwd,\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\ttask.title = `Detected package manager ${chalk.cyan(\n\t\t\t\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t\t\t\t)}`;\n\n\t\t\t\t\t\t\t\tassertExists(\n\t\t\t\t\t\t\t\t\tthis.context.framework,\n\t\t\t\t\t\t\t\t\t\"Project framework must be available through context to proceed\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tparentTask.title = `Detected framework ${chalk.cyan(\n\t\t\t\t\t\t\t\t\tthis.context.framework.name,\n\t\t\t\t\t\t\t\t)} and package manager ${chalk.cyan(\n\t\t\t\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t\t\t\t)}`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Detecting starter...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tthis.context.starterId = await detectStarterId(\n\t\t\t\t\t\t\t\t\tthis.manager.cwd,\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\tif (this.context.starterId) {\n\t\t\t\t\t\t\t\t\ttask.title = `Detected starter ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\tthis.context.starterId,\n\t\t\t\t\t\t\t\t\t)}`;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\ttask.title = \"No starter detected\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected beginCoreDependenciesInstallation(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Beginning core dependencies installation...\",\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t\t\"Project package manager must be available through context to run `beginCoreDependenciesInstallation`\",\n\t\t\t\t\t);\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.framework,\n\t\t\t\t\t\t\"Project framework must be available through context to run `beginCoreDependenciesInstallation`\",\n\t\t\t\t\t);\n\n\t\t\t\t\tconst { execaProcess } =\n\t\t\t\t\t\tawait this.manager.project.installDependencies({\n\t\t\t\t\t\t\tpackageManager: this.context.packageManager,\n\t\t\t\t\t\t\tdependencies: this.context.framework.devDependencies,\n\t\t\t\t\t\t\tdev: true,\n\t\t\t\t\t\t\t// Picked up later\n\t\t\t\t\t\t\tlog: () => {\n\t\t\t\t\t\t\t\t/* ... */\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\n\t\t\t\t\t// Fail hard if process fails\n\t\t\t\t\texecaProcess.catch(async (error) => {\n\t\t\t\t\t\tconst [_, ...argv1n] = process.argv;\n\t\t\t\t\t\t// Command the user used\n\t\t\t\t\t\tlet tryAgainCommand = [process.argv0, ...argv1n].join(\" \");\n\n\t\t\t\t\t\t// If the `repository` option wasn't used AND the repository was selected/created\n\t\t\t\t\t\tif (!this.options.repository && this.context.repository) {\n\t\t\t\t\t\t\ttryAgainCommand = `${tryAgainCommand} --repository=${this.context.repository.domain}`;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tawait this.trackError(error);\n\t\t\t\t\t\tconsole.error(\n\t\t\t\t\t\t\t`\\n\\n${error.shortMessage}\\n${error.stderr}\\n\\n${\n\t\t\t\t\t\t\t\tlogSymbols.error\n\t\t\t\t\t\t\t} Dependency installation failed, try again with:\\n\\n ${chalk.gray(\n\t\t\t\t\t\t\t\t\"$\",\n\t\t\t\t\t\t\t)} ${chalk.cyan(tryAgainCommand)}`,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tprocess.exit(1);\n\t\t\t\t\t});\n\n\t\t\t\t\tthis.context.installProcess = execaProcess;\n\n\t\t\t\t\ttask.title = `Began core dependencies installation with ${chalk.cyan(\n\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t)} ... (running in background)`;\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected async fetchUserProfile(): Promise<void> {\n\t\tthis.context.userProfile = await this.manager.user.getProfile();\n\n\t\tawait this.manager.telemetry.identify({\n\t\t\tuserID: this.context.userProfile.shortId,\n\t\t\tintercomHash: this.context.userProfile.intercomHash,\n\t\t});\n\t\tawait this.manager.telemetry.track({\n\t\t\tevent: \"command:init:identify\",\n\t\t\trepository: this.options.repository,\n\t\t});\n\t}\n\n\tprotected async fetchUserRepositories(): Promise<void> {\n\t\tthis.context.userRepositories =\n\t\t\tawait this.manager.prismicRepository.readAll();\n\t}\n\n\tprotected validateWriteAccess(): void {\n\t\tassertExists(\n\t\t\tthis.context.repository,\n\t\t\t\"Repository selection must be available through context to proceed\",\n\t\t);\n\t\tassertExists(\n\t\t\tthis.context.userRepositories,\n\t\t\t\"User repositories must be available through context to validate write access\",\n\t\t);\n\t\tconst { domain } = this.context.repository;\n\t\tconst maybeRepository = this.context.userRepositories.find(\n\t\t\t(repository) => repository.domain === domain,\n\t\t);\n\n\t\tif (maybeRepository) {\n\t\t\tif (!this.manager.prismicRepository.hasWriteAccess(maybeRepository)) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t`Cannot run init command with repository ${chalk.cyan(\n\t\t\t\t\t\tmaybeRepository.domain,\n\t\t\t\t\t)}: you are not a developer or admin of this repository`,\n\t\t\t\t);\n\t\t\t}\n\t\t} else {\n\t\t\tthrow new Error(\n\t\t\t\t`Cannot validate write access for repository ${chalk.cyan(\n\t\t\t\t\tdomain,\n\t\t\t\t)}: you are not part of this repository`,\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected loginAndFetchUserData(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Logging in to Prismic...\",\n\t\t\t\ttask: async (_, parentTask) => {\n\t\t\t\t\tparentTask.output = \"Validating session...\";\n\t\t\t\t\tconst isLoggedIn = await this.manager.user.checkIsLoggedIn();\n\n\t\t\t\t\tif (!isLoggedIn) {\n\t\t\t\t\t\tparentTask.output = \"Press any key to open the browser to login...\";\n\t\t\t\t\t\tawait new Promise((resolve) => {\n\t\t\t\t\t\t\tconst initialRawMode = !!process.stdin.isRaw;\n\t\t\t\t\t\t\tprocess.stdin.setRawMode?.(true);\n\t\t\t\t\t\t\tprocess.stdin.resume();\n\t\t\t\t\t\t\tprocess.stdin.once(\"data\", (data: Buffer) => {\n\t\t\t\t\t\t\t\tprocess.stdin.setRawMode?.(initialRawMode);\n\t\t\t\t\t\t\t\tprocess.stdin.pause();\n\t\t\t\t\t\t\t\tresolve(data.toString(\"utf-8\"));\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tparentTask.output = \"Browser opened, waiting for you to login...\";\n\t\t\t\t\t\tconst { port, url } = await this.manager.user.getLoginSessionInfo();\n\t\t\t\t\t\tawait this.manager.user.nodeLoginSession({\n\t\t\t\t\t\t\tport,\n\t\t\t\t\t\t\tonListenCallback() {\n\t\t\t\t\t\t\t\topen(url);\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\n\t\t\t\t\tparentTask.output = \"\";\n\t\t\t\t\tparentTask.title = `Logged in`;\n\n\t\t\t\t\treturn listr(\n\t\t\t\t\t\t[\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttitle: \"Fetching user profile...\",\n\t\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\t\tawait this.fetchUserProfile();\n\t\t\t\t\t\t\t\t\tparentTask.title = `Logged in as ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\tthis.context.userProfile?.email,\n\t\t\t\t\t\t\t\t\t)}`;\n\t\t\t\t\t\t\t\t\ttask.title = \"Fetched user profile\";\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttitle: \"Fetching user repositories...\",\n\t\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\t\tawait this.fetchUserRepositories();\n\t\t\t\t\t\t\t\t\ttask.title = \"Fetched user repositories\";\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\t{ concurrent: true },\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected useRepositoryFlag(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: `Flag ${chalk.cyan(\"repository\")} used, validating input...`,\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.options.repository,\n\t\t\t\t\t\t\"Flag `repository` must be set to run `useRepositoryFlag`\",\n\t\t\t\t\t);\n\t\t\t\t\tconst domain = formatRepositoryDomain(this.options.repository);\n\t\t\t\t\tconst validation = await validateRepositoryDomainAndAvailability({\n\t\t\t\t\t\tdomain,\n\t\t\t\t\t\texistsFn: (domain) =>\n\t\t\t\t\t\t\tthis.manager.prismicRepository.checkExists({ domain }),\n\t\t\t\t\t});\n\n\t\t\t\t\tif (validation.LessThanMin || validation.MoreThanMax) {\n\t\t\t\t\t\tconst errorMessage = getErrorMessageForRepositoryDomainValidation({\n\t\t\t\t\t\t\tvalidation: {\n\t\t\t\t\t\t\t\t...validation,\n\t\t\t\t\t\t\t\t// We don't want to throw if repo already exists.\n\t\t\t\t\t\t\t\t// User most probably just created it via their dashboard.\n\t\t\t\t\t\t\t\tAlreadyExists: false,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tdisplayDomain: chalk.cyan(domain),\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (errorMessage) {\n\t\t\t\t\t\t\tthrow new Error(errorMessage);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\ttask.title = `Selected repository ${chalk.cyan(\n\t\t\t\t\t\tdomain,\n\t\t\t\t\t)} (flag ${chalk.cyan(\"repository\")} used)`;\n\n\t\t\t\t\tthis.context.repository = {\n\t\t\t\t\t\tdomain,\n\t\t\t\t\t\texists: validation.AlreadyExists ?? false,\n\t\t\t\t\t};\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected async selectRepository(): Promise<void> {\n\t\tassertExists(\n\t\t\tthis.context.userRepositories,\n\t\t\t\"User repositories must be available through context to run `selectRepository`\",\n\t\t);\n\n\t\tif (this.context.userRepositories.length) {\n\t\t\tawait this.trySelectExistingRepository();\n\t\t}\n\n\t\tif (!this.context.repository) {\n\t\t\tawait this.selectNewRepository();\n\t\t}\n\n\t\tassertExists(\n\t\t\tthis.context.repository,\n\t\t\t\"Repository selection must be available through context to proceed\",\n\t\t);\n\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.log(\n\t\t\t`${logSymbols.success} Selected repository ${chalk.cyan(\n\t\t\t\tthis.context.repository.domain,\n\t\t\t)}`,\n\t\t);\n\t}\n\n\tprotected async trySelectExistingRepository(): Promise<void> {\n\t\tassertExists(\n\t\t\tthis.context.userRepositories,\n\t\t\t\"User repositories must be available through context to run `trySelectExistingRepository`\",\n\t\t);\n\n\t\tconst { maybeDomain } = await prompt<string, \"maybeDomain\">({\n\t\t\ttype: \"select\",\n\t\t\tname: \"maybeDomain\",\n\t\t\tmessage: \"Pick a repository to connect to or choose to create a new one\",\n\t\t\twarn: \"You are not a developer or admin of this repository\",\n\t\t\tchoices: [\n\t\t\t\t{\n\t\t\t\t\ttitle: \"CREATE NEW\",\n\t\t\t\t\tdescription: \"Create a new Prismic repository\\n\",\n\t\t\t\t\tvalue: \"\",\n\t\t\t\t},\n\t\t\t\t...this.context.userRepositories\n\t\t\t\t\t.map((repository) => {\n\t\t\t\t\t\tconst hasWriteAccess =\n\t\t\t\t\t\t\tthis.manager.prismicRepository.hasWriteAccess(repository);\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\ttitle: `${repository.domain}${\n\t\t\t\t\t\t\t\thasWriteAccess ? \"\" : \" (Unauthorized)\"\n\t\t\t\t\t\t\t}`,\n\t\t\t\t\t\t\tdescription: `Connect to ${chalk.cyan(repository.domain)}`,\n\t\t\t\t\t\t\tvalue: repository.domain,\n\t\t\t\t\t\t\tdisabled: !hasWriteAccess,\n\t\t\t\t\t\t};\n\t\t\t\t\t})\n\t\t\t\t\t.sort((a, b) => (a.value > b.value ? 1 : -1)),\n\t\t\t],\n\t\t});\n\n\t\tif (maybeDomain) {\n\t\t\tthis.context.repository = {\n\t\t\t\tdomain: maybeDomain,\n\t\t\t\texists: true,\n\t\t\t};\n\t\t}\n\t}\n\n\tprotected async selectNewRepository(): Promise<void> {\n\t\tlet suggestedName = \"\";\n\n\t\t// TODO: Improve concurrency\n\t\tconst trySuggestName = async (name: string): Promise<string | void> => {\n\t\t\tif (name) {\n\t\t\t\tconst formattedName = formatRepositoryDomain(name);\n\n\t\t\t\tif (\n\t\t\t\t\t!validateRepositoryDomain({ domain: formattedName }).hasErrors &&\n\t\t\t\t\t!(await this.manager.prismicRepository.checkExists({\n\t\t\t\t\t\tdomain: formattedName,\n\t\t\t\t\t}))\n\t\t\t\t) {\n\t\t\t\t\treturn formattedName;\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t// 1. Try to suggest name after directory name\n\t\tconst maybeSuggestion = await trySuggestName(\n\t\t\tpath.basename(this.manager.cwd),\n\t\t);\n\t\tif (maybeSuggestion) {\n\t\t\tsuggestedName = maybeSuggestion;\n\t\t}\n\n\t\t// 2. Try to suggest name after package name\n\t\tif (!suggestedName) {\n\t\t\ttry {\n\t\t\t\tconst pkgJSONPath = path.join(this.manager.cwd, \"package.json\");\n\t\t\t\tconst pkg = JSON.parse(await fs.readFile(pkgJSONPath, \"utf-8\"));\n\n\t\t\t\tconst maybeSuggestion = await trySuggestName(pkg.name);\n\t\t\t\tif (maybeSuggestion) {\n\t\t\t\t\tsuggestedName = maybeSuggestion;\n\t\t\t\t}\n\t\t\t} catch {\n\t\t\t\t// Noop\n\t\t\t}\n\t\t}\n\n\t\t// 3. Use random name\n\t\tif (!suggestedName) {\n\t\t\tdo {\n\t\t\t\tsuggestedName = getRandomRepositoryDomain();\n\t\t\t} while (\n\t\t\t\tawait this.manager.prismicRepository.checkExists({\n\t\t\t\t\tdomain: suggestedName,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\n\t\tconst { domain } = await prompt<string, \"domain\">({\n\t\t\ttype: \"text\",\n\t\t\tname: \"domain\",\n\t\t\t// Overriden by the `onRender` function, just used as a fallback\n\t\t\tmessage: \"Choose a name for your Prismic repository\",\n\t\t\tinitial: suggestedName,\n\t\t\tonRender() {\n\t\t\t\tconst rawDomain = this.value || this.initial || \"\";\n\t\t\t\tconst domain = formatRepositoryDomain(rawDomain);\n\t\t\t\tconst validation = validateRepositoryDomain({ domain });\n\n\t\t\t\tconst minRule = validation.LessThanMin\n\t\t\t\t\t? chalk.red(\n\t\t\t\t\t\t\t`1. Name must be ${chalk.bold(\n\t\t\t\t\t\t\t\tREPOSITORY_NAME_VALIDATION.Min + \" characters long or more\",\n\t\t\t\t\t\t\t)}`,\n\t\t\t\t\t )\n\t\t\t\t\t: `1. Name must be ${chalk.cyan(\n\t\t\t\t\t\t\tREPOSITORY_NAME_VALIDATION.Min + \" characters long or more\",\n\t\t\t\t\t )}`;\n\n\t\t\t\tconst maxRule = validation.MoreThanMax\n\t\t\t\t\t? chalk.red(\n\t\t\t\t\t\t\t`1. Name must be ${chalk.bold(\n\t\t\t\t\t\t\t\tREPOSITORY_NAME_VALIDATION.Max + \" characters long or less\",\n\t\t\t\t\t\t\t)}`,\n\t\t\t\t\t )\n\t\t\t\t\t: `1. Name must be ${chalk.cyan(\n\t\t\t\t\t\t\tREPOSITORY_NAME_VALIDATION.Max + \" characters long or less\",\n\t\t\t\t\t )}`;\n\n\t\t\t\tthis.msg = chalk.reset(\n\t\t\t\t\t`\nChoose a name for your Prismic repository\n\n NAMING RULES\n ${minRule}\n ${maxRule}\n 3. Name will be ${chalk.cyan(\"kebab-cased\")} automatically\n\n CONSIDERATIONS\n 1. Once picked, your repository name ${chalk.cyan(\"cannot be changed\")}\n 2. A ${chalk.cyan(\n\t\t\t\"display name\",\n\t\t)} for the repository can be configured later on\n\n PREVIEW\n Dashboard ${chalk.cyan(`https://${domain}.prismic.io`)}\n API ${chalk.cyan(`https://${domain}.cdn.prismic.io/api/v2`)}\n\n${chalk.cyan(\"?\")} Your Prismic repository name`.replace(\"\\n\", \"\"),\n\t\t\t\t);\n\t\t\t},\n\t\t\tvalidate: async (rawDomain: string) => {\n\t\t\t\tconst domain = formatRepositoryDomain(rawDomain);\n\t\t\t\tconst validation = await validateRepositoryDomainAndAvailability({\n\t\t\t\t\tdomain,\n\t\t\t\t\texistsFn: (domain) =>\n\t\t\t\t\t\tthis.manager.prismicRepository.checkExists({ domain }),\n\t\t\t\t});\n\t\t\t\tconst errorMessage = getErrorMessageForRepositoryDomainValidation({\n\t\t\t\t\tvalidation,\n\t\t\t\t\tdisplayDomain: chalk.cyan(domain),\n\t\t\t\t});\n\n\t\t\t\treturn errorMessage || true;\n\t\t\t},\n\t\t\tformat: (value) => {\n\t\t\t\treturn formatRepositoryDomain(value);\n\t\t\t},\n\t\t});\n\n\t\t// Clear extra lines\n\t\tprocess.stdout.moveCursor?.(0, -16);\n\t\tprocess.stdout.clearScreenDown?.();\n\n\t\tthis.context.repository = {\n\t\t\tdomain,\n\t\t\texists: false,\n\t\t};\n\t}\n\n\tprotected createNewRepository(): Promise<void> {\n\t\tassertExists(\n\t\t\tthis.context.repository,\n\t\t\t\"Repository selection must be available through context to run `createNewRepository`\",\n\t\t);\n\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: `Creating new repository ${chalk.cyan(\n\t\t\t\t\tthis.context.repository.domain,\n\t\t\t\t)} ...`,\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.repository,\n\t\t\t\t\t\t\"Repository selection must be available through context to run `createNewRepository`\",\n\t\t\t\t\t);\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.framework,\n\t\t\t\t\t\t\"Project framework must be available through context to run `createNewRepository`\",\n\t\t\t\t\t);\n\n\t\t\t\t\tawait this.manager.prismicRepository.create({\n\t\t\t\t\t\tdomain: this.context.repository.domain,\n\t\t\t\t\t\tframework: this.context.framework.wroomTelemetryID,\n\t\t\t\t\t\tstarterId: this.context.starterId,\n\t\t\t\t\t});\n\n\t\t\t\t\tthis.context.repository.exists = true;\n\t\t\t\t\ttask.title = `Created new repository ${chalk.cyan(\n\t\t\t\t\t\tthis.context.repository.domain,\n\t\t\t\t\t)}`;\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected finishCoreDependenciesInstallation(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: `Finishing core dependencies installation with ${chalk.cyan(\n\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t)} ...`,\n\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.installProcess,\n\t\t\t\t\t\t\"Initial dependencies installation process must be available through context to run `finishCoreDependenciesInstallation`\",\n\t\t\t\t\t);\n\n\t\t\t\t\tconst updateOutput = (data: Buffer | null) => {\n\t\t\t\t\t\tif (data instanceof Buffer) {\n\t\t\t\t\t\t\ttask.output = data.toString();\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\n\t\t\t\t\t// Don't clutter console with logs when process is non TTY (CI, etc.)\n\t\t\t\t\tif (process.stdout.isTTY || process.env.NODE_ENV === \"test\") {\n\t\t\t\t\t\tthis.context.installProcess.stdout?.on(\"data\", updateOutput);\n\t\t\t\t\t}\n\t\t\t\t\tthis.context.installProcess.stderr?.on(\"data\", updateOutput);\n\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.context.installProcess;\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t/**\n\t\t\t\t\t\t * Error catching happens when then process is started ealier so\n\t\t\t\t\t\t * that all install errors, earlier and presents, can be catched.\n\t\t\t\t\t\t *\n\t\t\t\t\t\t * Here, we force the task to wait so that it is neither marked as\n\t\t\t\t\t\t * done or has the opportunity to handle the error itself.\n\t\t\t\t\t\t */\n\t\t\t\t\t\t// If for whatever reason the process is not exited by now, we still throw the error\n\t\t\t\t\t\tawait new Promise((resolve) => setTimeout(resolve, 5000));\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\n\t\t\t\t\ttask.title = `Installed core dependencies with ${chalk.cyan(\n\t\t\t\t\t\tthis.context.packageManager,\n\t\t\t\t\t)}`;\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected upsertSliceMachineConfigurationAndStartPluginRunner(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Resolving Slice Machine configuration...\",\n\t\t\t\ttask: async (_, parentTask) => {\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.framework,\n\t\t\t\t\t\t\"Project framework must be available through context to run `upsertSliceMachineConfiguration`\",\n\t\t\t\t\t);\n\t\t\t\t\tassertExists(\n\t\t\t\t\t\tthis.context.repository,\n\t\t\t\t\t\t\"Repository selection must be available through context to run `upsertSliceMachineConfiguration`\",\n\t\t\t\t\t);\n\n\t\t\t\t\tlet sliceMachineConfigExists = false;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tawait this.manager.project.getSliceMachineConfigPath();\n\t\t\t\t\t\tsliceMachineConfigExists = true;\n\t\t\t\t\t} catch {\n\t\t\t\t\t\t// noop, config does not exists, we'll create it\n\t\t\t\t\t}\n\n\t\t\t\t\tif (sliceMachineConfigExists) {\n\t\t\t\t\t\tparentTask.title = \"Updating Slice Machine configuration...\";\n\n\t\t\t\t\t\tconst config = await this.manager.project.getSliceMachineConfig();\n\t\t\t\t\t\tawait this.manager.project.writeSliceMachineConfig({\n\t\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\t\t...config,\n\t\t\t\t\t\t\t\trepositoryName: this.context.repository.domain,\n\t\t\t\t\t\t\t\tadapter: this.context.framework.adapterName,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t});\n\t\t\t\t\t\tparentTask.title = \"Updated Slice Machine configuration\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\tparentTask.title = \"Creating Slice Machine configuration...\";\n\n\t\t\t\t\t\tconst sliceMachineConfigPath =\n\t\t\t\t\t\t\tawait this.manager.project.suggestSliceMachineConfigPath();\n\n\t\t\t\t\t\tawait this.manager.project.writeSliceMachineConfig({\n\t\t\t\t\t\t\tconfig: {\n\t\t\t\t\t\t\t\trepositoryName: this.context.repository.domain,\n\t\t\t\t\t\t\t\tadapter: this.context.framework.adapterName,\n\t\t\t\t\t\t\t\tlibraries: [\"./slices\"],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tpath: sliceMachineConfigPath,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tparentTask.title = \"Created Slice Machine configuration\";\n\t\t\t\t\t}\n\n\t\t\t\t\treturn listr([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t\t\t// title: \"Starting plugin runner...\",\n\t\t\t\t\t\t\ttitle: \"Loading adapter...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tawait this.manager.plugins.initPlugins();\n\t\t\t\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t\t\t\t// task.title = \"Started plugin runner\";\n\t\t\t\t\t\t\t\ttask.title = \"Loaded adapter\";\n\t\t\t\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t\t\t\t// parentTask.title = `${parentTask.title} and started plugin runner`;\n\t\t\t\t\t\t\t\tparentTask.title = `${parentTask.title} and loaded adapter`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t]);\n\t\t\t\t},\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected async readAllSlices(): Promise<\n\t\t{ libraryID: string; sliceID: string }[]\n\t> {\n\t\tconst { libraries, errors } =\n\t\t\tawait this.manager.slices.readAllSliceLibraries();\n\n\t\tif (errors.length > 0) {\n\t\t\t// TODO: Provide better error message.\n\t\t\tthrow new Error(`Failed to read slice libraries: ${errors.join(\", \")}`);\n\t\t}\n\n\t\tconst slices: { libraryID: string; sliceID: string }[] = [];\n\t\tfor (const library of libraries) {\n\t\t\tif (library.sliceIDs) {\n\t\t\t\tfor (const sliceID of library.sliceIDs) {\n\t\t\t\t\tslices.push({\n\t\t\t\t\t\tlibraryID: library.libraryID,\n\t\t\t\t\t\tsliceID,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn slices;\n\t}\n\n\tprotected async readDocuments(): Promise<\n\t\t| {\n\t\t\t\tsignature: string;\n\t\t\t\tdocuments: string[];\n\t\t\t\tdirectoryPath: string;\n\t\t }\n\t\t| undefined\n\t> {\n\t\tconst root = await this.manager.project.getRoot();\n\t\tconst documentsDirectoryPath = path.resolve(root, \"documents\");\n\t\ttry {\n\t\t\tawait fs.access(documentsDirectoryPath);\n\t\t} catch {\n\t\t\treturn;\n\t\t}\n\t\tconst signaturePath = path.resolve(documentsDirectoryPath, \"index.json\");\n\t\tconst rawSignature = await fs.readFile(signaturePath, \"utf-8\");\n\t\tconst signature: string = JSON.parse(rawSignature).signature;\n\n\t\tconst documents = await globby(\"*/*.json\", {\n\t\t\tcwd: documentsDirectoryPath,\n\t\t});\n\n\t\treturn { signature, documents, directoryPath: documentsDirectoryPath };\n\t}\n\n\tprotected syncDataWithPrismic(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Syncing data with Prismic...\",\n\t\t\t\ttask: (_, parentTask) =>\n\t\t\t\t\tlistr([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Pushing slices...\",\n\t\t\t\t\t\t\tskip: () => {\n\t\t\t\t\t\t\t\tif (!this.options.push) {\n\t\t\t\t\t\t\t\t\treturn `--no-push used`;\n\t\t\t\t\t\t\t\t} else if (!this.options.pushSlices) {\n\t\t\t\t\t\t\t\t\treturn `--no-push-slices used`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst slices = await this.readAllSlices();\n\n\t\t\t\t\t\t\t\tif (slices.length === 0) {\n\t\t\t\t\t\t\t\t\ttask.skip(\"No slice to push\");\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\ttask.title = \"Pushing slices... (initializing ACL)\";\n\t\t\t\t\t\t\t\tawait this.manager.screenshots.initS3ACL();\n\n\t\t\t\t\t\t\t\tlet pushed = 0;\n\t\t\t\t\t\t\t\ttask.title = `Pushing slices... (0/${slices.length})`;\n\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\tslices.map(async (slice) => {\n\t\t\t\t\t\t\t\t\t\tawait this.manager.slices.pushSlice({\n\t\t\t\t\t\t\t\t\t\t\t...slice,\n\t\t\t\t\t\t\t\t\t\t\tuserAgent: SLICE_MACHINE_INIT_USER_AGENT,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tpushed++;\n\t\t\t\t\t\t\t\t\t\ttask.title = `Pushing slices... (${pushed}/${slices.length})`;\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttask.title = \"Pushed all slices\";\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Pushing types...\",\n\t\t\t\t\t\t\tskip: () => {\n\t\t\t\t\t\t\t\tif (!this.options.push) {\n\t\t\t\t\t\t\t\t\treturn `--no-push used`;\n\t\t\t\t\t\t\t\t} else if (!this.options.pushCustomTypes) {\n\t\t\t\t\t\t\t\t\treturn `--no-push-custom-types used`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst { ids, errors } =\n\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.readCustomTypeLibrary();\n\n\t\t\t\t\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\t\t\t\t\t// TODO: Provide better error message.\n\t\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\t`Failed to read custom type libraries: ${errors.join(\n\t\t\t\t\t\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t\t\t\t\t)}`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (!ids || ids.length === 0) {\n\t\t\t\t\t\t\t\t\ttask.skip(\"No custom type to push\");\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tlet pushed = 0;\n\t\t\t\t\t\t\t\ttask.title = `Pushing types... (0/${ids.length})`;\n\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\tids.map(async (id) => {\n\t\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.pushCustomType({\n\t\t\t\t\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\t\t\t\t\tuserAgent: SLICE_MACHINE_INIT_USER_AGENT,\n\t\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t\tpushed++;\n\t\t\t\t\t\t\t\t\t\ttask.title = `Pushing types... (${pushed}/${ids.length})`;\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttask.title = \"Pushed all types\";\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Pushing documents...\",\n\t\t\t\t\t\t\tskip: () => {\n\t\t\t\t\t\t\t\tif (!this.options.push) {\n\t\t\t\t\t\t\t\t\treturn `--no-push used`;\n\t\t\t\t\t\t\t\t} else if (!this.options.pushDocuments) {\n\t\t\t\t\t\t\t\t\treturn `--no-push-documents used`;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tassertExists(\n\t\t\t\t\t\t\t\t\tthis.context.repository,\n\t\t\t\t\t\t\t\t\t\"Repository selection must be available through context to run `syncDataWithPrismic`\",\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst documentsRead = await this.readDocuments();\n\n\t\t\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\t\t\tdocumentsRead === undefined ||\n\t\t\t\t\t\t\t\t\t\tdocumentsRead.documents.length === 0\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\ttask.skip(\"No document to push\");\n\n\t\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\tconst { signature, documents, directoryPath } = documentsRead;\n\n\t\t\t\t\t\t\t\t\t// TODO: Replace `unknown` with a Prismic document type.\n\t\t\t\t\t\t\t\t\t// The exact format is not know at this time, hence the `unknown`.\n\t\t\t\t\t\t\t\t\tconst recordDocument: Record<string, unknown> = {};\n\n\t\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\t\tdocuments.map(async (documentPath) => {\n\t\t\t\t\t\t\t\t\t\t\tconst filename = path.basename(documentPath, \".json\");\n\t\t\t\t\t\t\t\t\t\t\tconst fileContent = await fs.readFile(\n\t\t\t\t\t\t\t\t\t\t\t\tpath.resolve(directoryPath, documentPath),\n\t\t\t\t\t\t\t\t\t\t\t\t\"utf-8\",\n\t\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\t\t\t\t// TOOD: Validate the contents of the JSON file and skip on invalid documents.\n\t\t\t\t\t\t\t\t\t\t\t\tconst parsedContents = JSON.parse(fileContent);\n\n\t\t\t\t\t\t\t\t\t\t\t\trecordDocument[filename] = parsedContents;\n\t\t\t\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t\t\t\t// We prefer to manually allow console logs despite the app being a CLI to catch wild/unwanted console logs better\n\t\t\t\t\t\t\t\t\t\t\t\t// eslint-disable-next-line no-console\n\t\t\t\t\t\t\t\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t\t\t\t\t\t\t\t`Skipped document due to its invalid format: ${documentPath}`,\n\t\t\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\tawait this.manager.prismicRepository.pushDocuments({\n\t\t\t\t\t\t\t\t\t\tdomain: this.context.repository.domain,\n\t\t\t\t\t\t\t\t\t\tdocuments: recordDocument,\n\t\t\t\t\t\t\t\t\t\tsignature,\n\t\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\t\ttask.title = \"Pushed all documents\";\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\ttask.skip(\"No document to push\");\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Cleaning up data push artifacts\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst root = await this.manager.project.getRoot();\n\t\t\t\t\t\t\t\tconst documentsDirectoryPath = path.resolve(root, \"documents\");\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tawait fs.rm(documentsDirectoryPath, {\n\t\t\t\t\t\t\t\t\t\tforce: true,\n\t\t\t\t\t\t\t\t\t\trecursive: true,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\t// Noop, it's not that big of a deal if we cannot delete this directory\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\ttask.title = \"Cleaned up data push artifacts\";\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: \"Pulling existing types...\",\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst { ids, errors } =\n\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.readCustomTypeLibrary();\n\n\t\t\t\t\t\t\t\tif (errors.length > 0) {\n\t\t\t\t\t\t\t\t\t// TODO: Provide better error message.\n\t\t\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t\t\t`Failed to read custom type libraries: ${errors.join(\n\t\t\t\t\t\t\t\t\t\t\t\", \",\n\t\t\t\t\t\t\t\t\t\t)}`,\n\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif (ids && ids.length > 0) {\n\t\t\t\t\t\t\t\t\ttask.skip(\"Types already exist\");\n\t\t\t\t\t\t\t\t\tparentTask.title = \"Synced data with Prismic\";\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tconst remoteTypes =\n\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.fetchRemoteCustomTypes();\n\n\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\tremoteTypes.map(async (model) => {\n\t\t\t\t\t\t\t\t\t\tawait this.manager.customTypes.createCustomType({ model });\n\t\t\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\ttask.title = \"Pulled existing types\";\n\t\t\t\t\t\t\t\tparentTask.title = \"Synced data with Prismic\";\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected initializeProject(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Initializing project...\",\n\t\t\t\ttask: async (_, parentTask) =>\n\t\t\t\t\t// We return another Listr instance in the event we have additional task to perform to initialize the project\n\t\t\t\t\tlistr([\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\ttitle: `Patching ${chalk.cyan(\"package.json\")} scripts...`,\n\t\t\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\t\t\tconst pkgPath = path.join(this.manager.cwd, \"package.json\");\n\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tconst pkgRaw = await fs.readFile(pkgPath, \"utf-8\");\n\t\t\t\t\t\t\t\t\tconst pkg = JSON.parse(pkgRaw);\n\n\t\t\t\t\t\t\t\t\tpkg.scripts ||= {};\n\n\t\t\t\t\t\t\t\t\tif (!pkg.scripts[START_SCRIPT_KEY]) {\n\t\t\t\t\t\t\t\t\t\tpkg.scripts[START_SCRIPT_KEY] = START_SCRIPT_VALUE;\n\n\t\t\t\t\t\t\t\t\t\t// Cheap indent detection based on https://github.com/sindresorhus/detect-indent (simplified because we're only dealing with JSON here)\n\t\t\t\t\t\t\t\t\t\tconst firstIndent = pkgRaw\n\t\t\t\t\t\t\t\t\t\t\t.split(\"\\n\")\n\t\t\t\t\t\t\t\t\t\t\t.find((line) => line.match(/^(?:( )+|\\t+)/));\n\t\t\t\t\t\t\t\t\t\tconst indent = firstIndent?.match(/^(?:( )+|\\t+)/)?.[0];\n\n\t\t\t\t\t\t\t\t\t\tawait fs.writeFile(\n\t\t\t\t\t\t\t\t\t\t\tpkgPath,\n\t\t\t\t\t\t\t\t\t\t\tJSON.stringify(\n\t\t\t\t\t\t\t\t\t\t\t\tpkg,\n\t\t\t\t\t\t\t\t\t\t\t\tnull,\n\t\t\t\t\t\t\t\t\t\t\t\tindent && indent !== \" \" ? indent : \" \",\n\t\t\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\t\t} else if (\n\t\t\t\t\t\t\t\t\t\t!pkg.scripts[\"slicemachine\"].startsWith(START_SCRIPT_VALUE)\n\t\t\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\t\t\tthrow new Error(\"Script already exists\");\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\t\t\ttask.title = `Could not patch ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\t\"package.json\",\n\t\t\t\t\t\t\t\t\t)} scripts (warning)`;\n\t\t\t\t\t\t\t\t\tparentTask.title = `Initialized project (could not patch ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\t\"package.json\",\n\t\t\t\t\t\t\t\t\t)} scripts)`;\n\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tthis.context.projectInitialization ||= {};\n\t\t\t\t\t\t\t\tthis.context.projectInitialization.patchedScript = true;\n\n\t\t\t\t\t\t\t\ttask.title = `Patched ${chalk.cyan(\"package.json\")} scripts`;\n\t\t\t\t\t\t\t\tparentTask.title = `Initialized project (patched ${chalk.cyan(\n\t\t\t\t\t\t\t\t\t\"package.json\",\n\t\t\t\t\t\t\t\t)} scripts)`;\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t]),\n\t\t\t},\n\t\t]);\n\t}\n\n\tprotected initializePlugins(): Promise<void> {\n\t\treturn listrRun(\n\t\t\t[\n\t\t\t\t{\n\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t// title: \"Initializing plugins...\",\n\t\t\t\t\ttitle: \"Initializing adapter...\",\n\t\t\t\t\ttask: async (_, task) => {\n\t\t\t\t\t\tconst updateOutput = (data: Buffer | string | null) => {\n\t\t\t\t\t\t\tif (data instanceof Buffer) {\n\t\t\t\t\t\t\t\ttask.output = data.toString();\n\t\t\t\t\t\t\t} else if (typeof data === \"string\") {\n\t\t\t\t\t\t\t\ttask.output = data;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t};\n\n\t\t\t\t\t\tawait this.manager.project.initProject({\n\t\t\t\t\t\t\tlog: updateOutput,\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\t// TODO: Revert when plugin are introduced to users\n\t\t\t\t\t\t// task.title = \"Initialized plugins\";\n\t\t\t\t\t\ttask.title = \"Initialized adapter\";\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t],\n\t\t\t{ exitOnError: false },\n\t\t).catch(() => void 0);\n\t}\n}\n"],"names":["pkg","_","_b","_a","domain","maybeSuggestion"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4DA,MAAM,kBAAkD;AAAA,EACvD,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,mBAAmB;;AAGP,MAAA,gCAAgC,CAC5C,YAC4B;AACrB,SAAA,IAAI,wBAAwB,OAAO;AAC3C;MAkBa,wBAAuB;AAAA,EAMnC,YAAY,SAAwC;AAL1C;AACA;AAEA;AA0PA,sCAAa,OAAO,UAAiC;AACxD,YAAA,KAAK,iBAAiB,KAAK;AAC3B,YAAA,KAAK,oBAAoB,KAAK;AAAA,IAAA;AAG3B,+CAAsB,OAAO,UAAiC;;AAEjE,YAAA,aACL,iBAAiB,QAAQ,MAAM,UAAU,GAAG,SAC3C,MAAM,GAAG,GAAG;AACR,YAAA,KAAK,QAAQ,UAAU,MAAM;AAAA,QAClC,OAAO;AAAA,QACP,aAAW,UAAK,QAAQ,cAAb,mBAAwB,4BAA2B;AAAA,QAC9D,cAAY,UAAK,QAAQ,eAAb,mBAAyB,WAAU;AAAA,QAC/C,SAAS;AAAA,QACT,OAAO;AAAA,MAAA,CACP;AAAA,IAAA;AAGQ,4CAAmB,OAAO,UAAiC;;AACpE,YAAM,oBAAoB;AAAA,QACzB,SAAS,KAAK;AAAA,QACd,kBAAgB,UAAK,QAAQ,eAAb,mBAAyB,WAAU;AAAA,QACnD,aAAW,UAAK,QAAQ,cAAb,mBAAwB,4BAA2B;AAAA,MAAA,CAC9D;AACD,uBAAiB,KAAK;AAAA,IAAA;AAhRtB,SAAK,UAAU,EAAE,GAAG,iB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AgC;AACrD,gBAAI,gBAAgB,QAAQ;AACtB,mBAAA,SAAS,KAAK;uBACT,OAAO,SAAS,UAAU;AACpC,mBAAK,SAAS;AAAA,YACd;AAAA,UAAA;AAGI,gBAAA,KAAK,QAAQ,QAAQ,YAAY;AAAA,YACtC,KAAK;AAAA,UAAA,CACL;AAID,eAAK,QAAQ;AAAA,QACd;AAAA,MACA;AAAA,IAAA,GAEF,EAAE,aAAa,MAAO,CAAA,EACrB,MAAM,MAAM,MAAM;AAAA,EACrB;AACA;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-host-info.cjs","sources":["../../../../../node_modules/hosted-git-info/git-host-info.js"],"sourcesContent":["'use strict'\nconst maybeJoin = (...args) => args.every(arg => arg) ? args.join('') : ''\nconst maybeEncode = (arg) => arg ? encodeURIComponent(arg) : ''\n\nconst defaults = {\n sshtemplate: ({ domain, user, project, committish }) => `git@${domain}:${user}/${project}.git${maybeJoin('#', committish)}`,\n sshurltemplate: ({ domain, user, project, committish }) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n browsetemplate: ({ domain, user, project, committish, treepath }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}`,\n browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'master')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,\n docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,\n httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/raw/${maybeEncode(committish) || 'master'}/${path}`,\n shortcuttemplate: ({ type, user, project, committish }) => `${type}:${user}/${project}${maybeJoin('#', committish)}`,\n pathtemplate: ({ user, project, committish }) => `${user}/${project}${maybeJoin('#', committish)}`,\n bugstemplate: ({ domain, user, project }) => `https://${domain}/${user}/${project}/issues`,\n hashformat: formatHashFragment\n}\n\nconst gitHosts = {}\ngitHosts.github = Object.assign({}, defaults, {\n // First two are insecure and generally shouldn't be used any more, but\n // they are still supported.\n protocols: ['git:', 'http:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],\n domain: 'github.com',\n treepath: 'tree',\n filetemplate: ({ auth, user, project, committish, path }) => `https://${maybeJoin(auth, '@')}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish) || 'master'}/${path}`,\n gittemplate: ({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n tarballtemplate: ({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish) || 'master'}`,\n extract: (url) => {\n let [, user, project, type, committish] = url.pathname.split('/', 5)\n if (type && type !== 'tree') {\n return\n }\n\n if (!type) {\n committish = url.hash.slice(1)\n }\n\n if (project && project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n if (!user || !project) {\n return\n }\n\n return { user, project, committish }\n }\n})\n\ngitHosts.bitbucket = Object.assign({}, defaults, {\n protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],\n domain: 'bitbucket.org',\n treepath: 'src',\n tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish) || 'master'}.tar.gz`,\n extract: (url) => {\n let [, user, project, aux] = url.pathname.split('/', 4)\n if (['get'].includes(aux)) {\n return\n }\n\n if (project && project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n if (!user || !project) {\n return\n }\n\n return { user, project, committish: url.hash.slice(1) }\n }\n})\n\ngitHosts.gitlab = Object.assign({}, defaults, {\n protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],\n domain: 'gitlab.com',\n treepath: 'tree',\n httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish) || 'master'}`,\n extract: (url) => {\n const path = url.pathname.slice(1)\n if (path.includes('/-/') || path.includes('/archive.tar.gz')) {\n return\n }\n\n const segments = path.split('/')\n let project = segments.pop()\n if (project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n const user = segments.join('/')\n if (!user || !project) {\n return\n }\n\n return { user, project, committish: url.hash.slice(1) }\n }\n})\n\ngitHosts.gist = Object.assign({}, defaults, {\n protocols: ['git:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],\n domain: 'gist.github.com',\n sshtemplate: ({ domain, project, committish }) => `git@${domain}:${project}.git${maybeJoin('#', committish)}`,\n sshurltemplate: ({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin('#', committish)}`,\n browsetemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,\n browsefiletemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}${maybeJoin('#', hashformat(path))}`,\n docstemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,\n httpstemplate: ({ domain, project, committish }) => `git+https://${domain}/${project}.git${maybeJoin('#', committish)}`,\n filetemplate: ({ user, project, committish, path }) => `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin('/', maybeEncode(committish))}/${path}`,\n shortcuttemplate: ({ type, project, committish }) => `${type}:${project}${maybeJoin('#', committish)}`,\n pathtemplate: ({ project, committish }) => `${project}${maybeJoin('#', committish)}`,\n bugstemplate: ({ domain, project }) => `https://${domain}/${project}`,\n gittemplate: ({ domain, project, committish }) => `git://${domain}/${project}.git${maybeJoin('#', committish)}`,\n tarballtemplate: ({ project, committish }) => `https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish) || 'master'}`,\n extract: (url) => {\n let [, user, project, aux] = url.pathname.split('/', 4)\n if (aux === 'raw') {\n return\n }\n\n if (!project) {\n if (!user) {\n return\n }\n\n project = user\n user = null\n }\n\n if (project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n return { user, project, committish: url.hash.slice(1) }\n },\n hashformat: function (fragment) {\n return fragment && 'file-' + formatHashFragment(fragment)\n }\n})\n\ngitHosts.sourcehut = Object.assign({}, defaults, {\n protocols: ['git+ssh:', 'https:'],\n domain: 'git.sr.ht',\n treepath: 'tree',\n browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'main')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,\n filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'main'}/${path}`,\n httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'main'}.tar.gz`,\n bugstemplate: ({ domain, user, project }) => `https://todo.sr.ht/${user}/${project}`,\n docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,\n extract: (url) => {\n let [, user, project, aux] = url.pathname.split('/', 4)\n\n // tarball url\n if (['archive'].includes(aux)) {\n return\n }\n\n if (project && project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n if (!user || !project) {\n return\n }\n\n return { user, project, committish: url.hash.slice(1) }\n }\n})\n\nconst names = Object.keys(gitHosts)\ngitHosts.byShortcut = {}\ngitHosts.byDomain = {}\nfor (const name of names) {\n gitHosts.byShortcut[`${name}:`] = name\n gitHosts.byDomain[gitHosts[name].domain] = name\n}\n\nfunction formatHashFragment (f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;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-host-info.js","sources":["../../../../../node_modules/hosted-git-info/git-host-info.js"],"sourcesContent":["'use strict'\nconst maybeJoin = (...args) => args.every(arg => arg) ? args.join('') : ''\nconst maybeEncode = (arg) => arg ? encodeURIComponent(arg) : ''\n\nconst defaults = {\n sshtemplate: ({ domain, user, project, committish }) => `git@${domain}:${user}/${project}.git${maybeJoin('#', committish)}`,\n sshurltemplate: ({ domain, user, project, committish }) => `git+ssh://git@${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n browsetemplate: ({ domain, user, project, committish, treepath }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}`,\n browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'master')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,\n docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,\n httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/raw/${maybeEncode(committish) || 'master'}/${path}`,\n shortcuttemplate: ({ type, user, project, committish }) => `${type}:${user}/${project}${maybeJoin('#', committish)}`,\n pathtemplate: ({ user, project, committish }) => `${user}/${project}${maybeJoin('#', committish)}`,\n bugstemplate: ({ domain, user, project }) => `https://${domain}/${user}/${project}/issues`,\n hashformat: formatHashFragment\n}\n\nconst gitHosts = {}\ngitHosts.github = Object.assign({}, defaults, {\n // First two are insecure and generally shouldn't be used any more, but\n // they are still supported.\n protocols: ['git:', 'http:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],\n domain: 'github.com',\n treepath: 'tree',\n filetemplate: ({ auth, user, project, committish, path }) => `https://${maybeJoin(auth, '@')}raw.githubusercontent.com/${user}/${project}/${maybeEncode(committish) || 'master'}/${path}`,\n gittemplate: ({ auth, domain, user, project, committish }) => `git://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n tarballtemplate: ({ domain, user, project, committish }) => `https://codeload.${domain}/${user}/${project}/tar.gz/${maybeEncode(committish) || 'master'}`,\n extract: (url) => {\n let [, user, project, type, committish] = url.pathname.split('/', 5)\n if (type && type !== 'tree') {\n return\n }\n\n if (!type) {\n committish = url.hash.slice(1)\n }\n\n if (project && project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n if (!user || !project) {\n return\n }\n\n return { user, project, committish }\n }\n})\n\ngitHosts.bitbucket = Object.assign({}, defaults, {\n protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],\n domain: 'bitbucket.org',\n treepath: 'src',\n tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/get/${maybeEncode(committish) || 'master'}.tar.gz`,\n extract: (url) => {\n let [, user, project, aux] = url.pathname.split('/', 4)\n if (['get'].includes(aux)) {\n return\n }\n\n if (project && project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n if (!user || !project) {\n return\n }\n\n return { user, project, committish: url.hash.slice(1) }\n }\n})\n\ngitHosts.gitlab = Object.assign({}, defaults, {\n protocols: ['git+ssh:', 'git+https:', 'ssh:', 'https:'],\n domain: 'gitlab.com',\n treepath: 'tree',\n httpstemplate: ({ auth, domain, user, project, committish }) => `git+https://${maybeJoin(auth, '@')}${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/repository/archive.tar.gz?ref=${maybeEncode(committish) || 'master'}`,\n extract: (url) => {\n const path = url.pathname.slice(1)\n if (path.includes('/-/') || path.includes('/archive.tar.gz')) {\n return\n }\n\n const segments = path.split('/')\n let project = segments.pop()\n if (project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n const user = segments.join('/')\n if (!user || !project) {\n return\n }\n\n return { user, project, committish: url.hash.slice(1) }\n }\n})\n\ngitHosts.gist = Object.assign({}, defaults, {\n protocols: ['git:', 'git+ssh:', 'git+https:', 'ssh:', 'https:'],\n domain: 'gist.github.com',\n sshtemplate: ({ domain, project, committish }) => `git@${domain}:${project}.git${maybeJoin('#', committish)}`,\n sshurltemplate: ({ domain, project, committish }) => `git+ssh://git@${domain}/${project}.git${maybeJoin('#', committish)}`,\n browsetemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,\n browsefiletemplate: ({ domain, project, committish, path, hashformat }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}${maybeJoin('#', hashformat(path))}`,\n docstemplate: ({ domain, project, committish }) => `https://${domain}/${project}${maybeJoin('/', maybeEncode(committish))}`,\n httpstemplate: ({ domain, project, committish }) => `git+https://${domain}/${project}.git${maybeJoin('#', committish)}`,\n filetemplate: ({ user, project, committish, path }) => `https://gist.githubusercontent.com/${user}/${project}/raw${maybeJoin('/', maybeEncode(committish))}/${path}`,\n shortcuttemplate: ({ type, project, committish }) => `${type}:${project}${maybeJoin('#', committish)}`,\n pathtemplate: ({ project, committish }) => `${project}${maybeJoin('#', committish)}`,\n bugstemplate: ({ domain, project }) => `https://${domain}/${project}`,\n gittemplate: ({ domain, project, committish }) => `git://${domain}/${project}.git${maybeJoin('#', committish)}`,\n tarballtemplate: ({ project, committish }) => `https://codeload.github.com/gist/${project}/tar.gz/${maybeEncode(committish) || 'master'}`,\n extract: (url) => {\n let [, user, project, aux] = url.pathname.split('/', 4)\n if (aux === 'raw') {\n return\n }\n\n if (!project) {\n if (!user) {\n return\n }\n\n project = user\n user = null\n }\n\n if (project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n return { user, project, committish: url.hash.slice(1) }\n },\n hashformat: function (fragment) {\n return fragment && 'file-' + formatHashFragment(fragment)\n }\n})\n\ngitHosts.sourcehut = Object.assign({}, defaults, {\n protocols: ['git+ssh:', 'https:'],\n domain: 'git.sr.ht',\n treepath: 'tree',\n browsefiletemplate: ({ domain, user, project, committish, treepath, path, fragment, hashformat }) => `https://${domain}/${user}/${project}/${treepath}/${maybeEncode(committish || 'main')}/${path}${maybeJoin('#', hashformat(fragment || ''))}`,\n filetemplate: ({ domain, user, project, committish, path }) => `https://${domain}/${user}/${project}/blob/${maybeEncode(committish) || 'main'}/${path}`,\n httpstemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}.git${maybeJoin('#', committish)}`,\n tarballtemplate: ({ domain, user, project, committish }) => `https://${domain}/${user}/${project}/archive/${maybeEncode(committish) || 'main'}.tar.gz`,\n bugstemplate: ({ domain, user, project }) => `https://todo.sr.ht/${user}/${project}`,\n docstemplate: ({ domain, user, project, treepath, committish }) => `https://${domain}/${user}/${project}${maybeJoin('/', treepath, '/', maybeEncode(committish))}#readme`,\n extract: (url) => {\n let [, user, project, aux] = url.pathname.split('/', 4)\n\n // tarball url\n if (['archive'].includes(aux)) {\n return\n }\n\n if (project && project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n if (!user || !project) {\n return\n }\n\n return { user, project, committish: url.hash.slice(1) }\n }\n})\n\nconst names = Object.keys(gitHosts)\ngitHosts.byShortcut = {}\ngitHosts.byDomain = {}\nfor (const name of names) {\n gitHosts.byShortcut[`${name}:`] = name\n gitHosts.byDomain[gitHosts[name].domain] = name\n}\n\nfunction formatHashFragment (fragment) {\n return fragment.toLowerCase().replace(/^\\W+|\\/|\\W+$/g, '').replace(/\\W+/g, '-')\n}\n\nmodule.exports = gitHosts\n"],"names":[],"mappings":"AACA,MAAM,YAAY,IAAI,SAAS,KAAK,MAAM,SAAO,GAAG,IAAI,KAAK,KAAK,EAAE,IAAI;AACxE,MAAM,cAAc,CAAC,QAAQ,MAAM,mBAAmB,GAAG,IAAI;AAE7D,MAAM,WAAW;AAAA,EACf,aAAa,CAAC,EAAE,QAAQ,MAA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AAE,QAAQ,MAAM,QAAO,MAAO,sBAAsB,QAAQ;AAAA,EAC3E,cAAc,CAAC,EAAE,QAAQ,MAAM,SAAS,UAAU,iBAAiB,WAAW,UAAU,QAAQ,UAAU,UAAU,KAAK,UAAU,KAAK,YAAY,UAAU,CAAC;AAAA,EAC/J,SAAS,CAAC,QAAQ;AAChB,QAAI,CAAG,EAAA,MAAM,SAAS,GAAG,IAAI,IAAI,SAAS,MAAM,KAAK,CAAC;AAGtD,QAAI,CAAC,SAAS,EAAE,SAAS,GAAG,GAAG;AAC7B;AAAA,IACD;AAED,QAAI,WAAW,QAAQ,SAAS,MAAM,GAAG;AACvC,gBAAU,QAAQ,MAAM,GAAG,EAAE;AAAA,IAC9B;AAED,QAAI,CAAC,QAAQ,CAAC,SAAS;AACrB;AAAA,IACD;AAED,WAAO,EAAE,MAAM,SAAS,YAAY,IAAI,KAAK,MAAM,CAAC,EAAG;AAAA,EACxD;AACH,CAAC;AAED,MAAM,QAAQ,OAAO,KAAK,QAAQ;AAClC,SAAS,aAAa,CAAE;AACxB,SAAS,WAAW,CAAE;AACtB,WAAW,QAAQ,OAAO;AACxB,WAAS,WAAW,GAAG,OAAO,IAAI;AAClC,WAAS,SAAS,SAAS,IAAI,EAAE,MAAM,IAAI;AAC7C;AAEA,SAAS,mBAAoB,UAAU;AACrC,SAAO,SAAS,YAAa,EAAC,QAAQ,iBAAiB,EAAE,EAAE,QAAQ,QAAQ,GAAG;AAChF;AAEA,IAAA,cAAiB;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-host.cjs","sources":["../../../../../node_modules/hosted-git-info/git-host.js"],"sourcesContent":["'use strict'\nconst gitHosts = require('./git-host-info.js')\n\nclass GitHost {\n constructor (type, user, auth, project, committish, defaultRepresentation, opts = {}) {\n Object.assign(this, gitHosts[type])\n this.type = type\n this.user = user\n this.auth = auth\n this.project = project\n this.committish = committish\n this.default = defaultRepresentation\n this.opts = opts\n }\n\n hash () {\n return this.committish ? `#${this.committish}` : ''\n }\n\n ssh (opts) {\n return this._fill(this.sshtemplate, opts)\n }\n\n _fill (template, opts) {\n if (typeof template === 'function') {\n const options = { ...this, ...this.opts, ...opts }\n\n // the path should always be set so we don't end up with 'undefined' in urls\n if (!options.path) {\n options.path = ''\n }\n\n // template functions will insert the leading slash themselves\n if (options.path.startsWith('/')) {\n options.path = options.path.slice(1)\n }\n\n if (options.noCommittish) {\n options.committish = null\n }\n\n const result = template(options)\n return options.noGitPlus && result.startsWith('git+') ? result.slice(4) : result\n }\n\n return null\n }\n\n sshurl (opts) {\n return this._fill(this.sshurltemplate, opts)\n }\n\n browse (path, fragment, opts) {\n // not a string, treat path as opts\n if (typeof path !== 'string') {\n return this._fill(this.browsetemplate, path)\n }\n\n if (typeof fragment !== 'string') {\n opts = fragment\n fragment = null\n }\n return this._fill(this.browsefiletemplate, { ...opts, fragment, path })\n }\n\n docs (opts) {\n return this._fill(this.docstemplate, opts)\n }\n\n bugs (opts) {\n return this._fill(this.bugstemplate, opts)\n }\n\n https (opts) {\n return this._fill(this.httpstemplate, opts)\n }\n\n git (opts) {\n return this._fill(this.gittemplate, opts)\n }\n\n shortcut (opts) {\n return this._fill(this.shortcuttemplate, opts)\n }\n\n path (opts) {\n return this._fill(this.pathtemplate, opts)\n }\n\n tarball (opts) {\n return this._fill(this.tarballtemplate, { ...opts, noCommittish: false })\n }\n\n file (path, opts) {\n return this._fill(this.filetemplate, { ...opts, path })\n }\n\n getDefaultRepresentation () {\n return this.default\n }\n\n toString (opts) {\n if (this.default && typeof this[this.default] === 'function') {\n return this[this.default](opts)\n }\n\n return this.sshurl(opts)\n }\n}\nmodule.exports = GitHost\n"],"names":["require$$0"],"mappings":";;;AACA,MAAM,WAAWA,YAA6B;AAE9C,MAAM,QAAQ;AAAA,EACZ,YAAa,MAAM,MAAM,MAAM,SAAS,YAAY,uBAAuB,OAAO,IAAI;AACpF,WAAO,OAAO,MAAM,SAAS,IAAI,CAAC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KAAK,MAAM,KAAK,cAAc,IAAI;AAAA,EAC1C;AAAA,EAED,MAAO,MAAM;AACX,WAAO,KAAK,MAAM,KAAK,eAAe,IAAI;AAAA,EAC3C;AAAA,EAED,IAAK,MAAM;AACT,WAAO,KAAK,MAAM,KAAK,aAAa,IAAI;AAAA,EACzC;AAAA,EAED,SAAU,MAAM;AACd,WAAO,KAAK,MAAM,KAAK,kBAAkB,IAAI;AAAA,EAC9C;AAAA,EAED,KAAM,MAAM;AACV,WAAO,KAAK,MAAM,KAAK,cAAc,IAAI;AAAA,EAC1C;AAAA,EAED,QAAS,MAAM;AACb,WAAO,KAAK,MAAM,KAAK,iBAAiB,EAAE,GAAG,MAAM,cAAc,OAAO;AAAA,EACzE;AAAA,EAED,KAAM,MAAM,MAAM;AAChB,WAAO,KAAK,MAAM,KAAK,cAAc,EAAE,GAAG,MAAM,MAAM;AAAA,EACvD;AAAA,EAED,2BAA4B;AAC1B,WAAO,KAAK;AAAA,EACb;AAAA,EAED,SAAU,MAAM;AACd,QAAI,KAAK,WAAW,OAAO,KAAK,KAAK,OAAO,MAAM,YAAY;AAC5D,aAAO,KAAK,KAAK,OAAO,EAAE,IAAI;AAAA,IAC/B;AAED,WAAO,KAAK,OAAO,IAAI;AAAA,EACxB;AACH;AACA,IAAA,UAAiB;;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-host.js","sources":["../../../../../node_modules/hosted-git-info/git-host.js"],"sourcesContent":["'use strict'\nconst gitHosts = require('./git-host-info.js')\n\nclass GitHost {\n constructor (type, user, auth, project, committish, defaultRepresentation, opts = {}) {\n Object.assign(this, gitHosts[type])\n this.type = type\n this.user = user\n this.auth = auth\n this.project = project\n this.committish = committish\n this.default = defaultRepresentation\n this.opts = opts\n }\n\n hash () {\n return this.committish ? `#${this.committish}` : ''\n }\n\n ssh (opts) {\n return this._fill(this.sshtemplate, opts)\n }\n\n _fill (template, opts) {\n if (typeof template === 'function') {\n const options = { ...this, ...this.opts, ...opts }\n\n // the path should always be set so we don't end up with 'undefined' in urls\n if (!options.path) {\n options.path = ''\n }\n\n // template functions will insert the leading slash themselves\n if (options.path.startsWith('/')) {\n options.path = options.path.slice(1)\n }\n\n if (options.noCommittish) {\n options.committish = null\n }\n\n const result = template(options)\n return options.noGitPlus && result.startsWith('git+') ? result.slice(4) : result\n }\n\n return null\n }\n\n sshurl (opts) {\n return this._fill(this.sshurltemplate, opts)\n }\n\n browse (path, fragment, opts) {\n // not a string, treat path as opts\n if (typeof path !== 'string') {\n return this._fill(this.browsetemplate, path)\n }\n\n if (typeof fragment !== 'string') {\n opts = fragment\n fragment = null\n }\n return this._fill(this.browsefiletemplate, { ...opts, fragment, path })\n }\n\n docs (opts) {\n return this._fill(this.docstemplate, opts)\n }\n\n bugs (opts) {\n return this._fill(this.bugstemplate, opts)\n }\n\n https (opts) {\n return this._fill(this.httpstemplate, opts)\n }\n\n git (opts) {\n return this._fill(this.gittemplate, opts)\n }\n\n shortcut (opts) {\n return this._fill(this.shortcuttemplate, opts)\n }\n\n path (opts) {\n return this._fill(this.pathtemplate, opts)\n }\n\n tarball (opts) {\n return this._fill(this.tarballtemplate, { ...opts, noCommittish: false })\n }\n\n file (path, opts) {\n return this._fill(this.filetemplate, { ...opts, path })\n }\n\n getDefaultRepresentation () {\n return this.default\n }\n\n toString (opts) {\n if (this.default && typeof this[this.default] === 'function') {\n return this[this.default](opts)\n }\n\n return this.sshurl(opts)\n }\n}\nmodule.exports = GitHost\n"],"names":["require$$0"],"mappings":";AACA,MAAM,WAAWA;AAEjB,MAAM,QAAQ;AAAA,EACZ,YAAa,MAAM,MAAM,MAAM,SAAS,YAAY,uBAAuB,OAAO,IAAI;AACpF,WAAO,OAAO,MAAM,SAAS,IAAI,CAAC;AAClC,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,OAAO;AACZ,SAAK,UAAU;AACf,SAAK,aAAa;AAClB,SAAK,UAAU;AACf,SAAK,OAAO;A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EAED,IAAK,MAAM;AACT,WAAO,KAAK,MAAM,KAAK,aAAa,IAAI;AAAA,EACzC;AAAA,EAED,SAAU,MAAM;AACd,WAAO,KAAK,MAAM,KAAK,kBAAkB,IAAI;AAAA,EAC9C;AAAA,EAED,KAAM,MAAM;AACV,WAAO,KAAK,MAAM,KAAK,cAAc,IAAI;AAAA,EAC1C;AAAA,EAED,QAAS,MAAM;AACb,WAAO,KAAK,MAAM,KAAK,iBAAiB,EAAE,GAAG,MAAM,cAAc,OAAO;AAAA,EACzE;AAAA,EAED,KAAM,MAAM,MAAM;AAChB,WAAO,KAAK,MAAM,KAAK,cAAc,EAAE,GAAG,MAAM,MAAM;AAAA,EACvD;AAAA,EAED,2BAA4B;AAC1B,WAAO,KAAK;AAAA,EACb;AAAA,EAED,SAAU,MAAM;AACd,QAAI,KAAK,WAAW,OAAO,KAAK,KAAK,OAAO,MAAM,YAAY;AAC5D,aAAO,KAAK,KAAK,OAAO,EAAE,IAAI;AAAA,IAC/B;AAED,WAAO,KAAK,OAAO,IAAI;AAAA,EACxB;AACH;AACA,IAAA,UAAiB;","x_google_ignoreList":[0]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const index = require("
|
|
3
|
+
const index = require("../../_virtual/index19.cjs");
|
|
4
4
|
const require$$0 = require("url");
|
|
5
5
|
const gitHostInfo = require("./git-host-info.cjs");
|
|
6
6
|
const gitHost = require("./git-host.cjs");
|
|
7
|
-
const index$1 = require("
|
|
7
|
+
const index$1 = require("../lru-cache/index.cjs");
|
|
8
8
|
const url = require$$0;
|
|
9
9
|
const gitHosts = gitHostInfo.gitHostInfo;
|
|
10
10
|
const GitHost = index.__module.exports = gitHost.gitHost;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../../../node_modules/hosted-git-info/index.js"],"sourcesContent":["'use strict'\nconst url = require('url')\nconst gitHosts = require('./git-host-info.js')\nconst GitHost = module.exports = require('./git-host.js')\nconst LRU = require('lru-cache')\nconst cache = new LRU({ max: 1000 })\n\nconst protocolToRepresentationMap = {\n 'git+ssh:': 'sshurl',\n 'git+https:': 'https',\n 'ssh:': 'sshurl',\n 'git:': 'git'\n}\n\nfunction protocolToRepresentation (protocol) {\n return protocolToRepresentationMap[protocol] || protocol.slice(0, -1)\n}\n\nconst authProtocols = {\n 'git:': true,\n 'https:': true,\n 'git+https:': true,\n 'http:': true,\n 'git+http:': true\n}\n\nconst knownProtocols = Object.keys(gitHosts.byShortcut).concat(['http:', 'https:', 'git:', 'git+ssh:', 'git+https:', 'ssh:'])\n\nmodule.exports.fromUrl = function (giturl, opts) {\n if (typeof giturl !== 'string') {\n return\n }\n\n const key = giturl + JSON.stringify(opts || {})\n\n if (!cache.has(key)) {\n cache.set(key, fromUrl(giturl, opts))\n }\n\n return cache.get(key)\n}\n\nfunction fromUrl (giturl, opts) {\n if (!giturl) {\n return\n }\n\n const url = isGitHubShorthand(giturl) ? 'github:' + giturl : correctProtocol(giturl)\n const parsed = parseGitUrl(url)\n if (!parsed) {\n return parsed\n }\n\n const gitHostShortcut = gitHosts.byShortcut[parsed.protocol]\n const gitHostDomain = gitHosts.byDomain[parsed.hostname.startsWith('www.') ? parsed.hostname.slice(4) : parsed.hostname]\n const gitHostName = gitHostShortcut || gitHostDomain\n if (!gitHostName) {\n return\n }\n\n const gitHostInfo = gitHosts[gitHostShortcut || gitHostDomain]\n let auth = null\n if (authProtocols[parsed.protocol] && (parsed.username || parsed.password)) {\n auth = `${parsed.username}${parsed.password ? ':' + parsed.password : ''}`\n }\n\n let committish = null\n let user = null\n let project = null\n let defaultRepresentation = null\n\n try {\n if (gitHostShortcut) {\n let pathname = parsed.pathname.startsWith('/') ? parsed.pathname.slice(1) : parsed.pathname\n const firstAt = pathname.indexOf('@')\n // we ignore auth for shortcuts, so just trim it out\n if (firstAt > -1) {\n pathname = pathname.slice(firstAt + 1)\n }\n\n const lastSlash = pathname.lastIndexOf('/')\n if (lastSlash > -1) {\n user = decodeURIComponent(pathname.slice(0, lastSlash))\n // we want nulls only, never empty strings\n if (!user) {\n user = null\n }\n project = decodeURIComponent(pathname.slice(lastSlash + 1))\n } else {\n project = decodeURIComponent(pathname)\n }\n\n if (project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n if (parsed.hash) {\n committish = decodeURIComponent(parsed.hash.slice(1))\n }\n\n defaultRepresentation = 'shortcut'\n } else {\n if (!gitHostInfo.protocols.includes(parsed.protocol)) {\n return\n }\n\n const segments = gitHostInfo.extract(parsed)\n if (!segments) {\n return\n }\n\n user = segments.user && decodeURIComponent(segments.user)\n project = decodeURIComponent(segments.project)\n committish = decodeURIComponent(segments.committish)\n defaultRepresentation = protocolToRepresentation(parsed.protocol)\n }\n } catch (err) {\n /* istanbul ignore else */\n if (err instanceof URIError) {\n return\n } else {\n throw err\n }\n }\n\n return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts)\n}\n\n// accepts input like git:github.com:user/repo and inserts the // after the first :\nconst correctProtocol = (arg) => {\n const firstColon = arg.indexOf(':')\n const proto = arg.slice(0, firstColon + 1)\n if (knownProtocols.includes(proto)) {\n return arg\n }\n\n const firstAt = arg.indexOf('@')\n if (firstAt > -1) {\n if (firstAt > firstColon) {\n return `git+ssh://${arg}`\n } else {\n return arg\n }\n }\n\n const doubleSlash = arg.indexOf('//')\n if (doubleSlash === firstColon + 1) {\n return arg\n }\n\n return arg.slice(0, firstColon + 1) + '//' + arg.slice(firstColon + 1)\n}\n\n// look for github shorthand inputs, such as npm/cli\nconst isGitHubShorthand = (arg) => {\n // it cannot contain whitespace before the first #\n // it cannot start with a / because that's probably an absolute file path\n // but it must include a slash since repos are username/repository\n // it cannot start with a . because that's probably a relative file path\n // it cannot start with an @ because that's a scoped package if it passes the other tests\n // it cannot contain a : before a # because that tells us that there's a protocol\n // a second / may not exist before a #\n const firstHash = arg.indexOf('#')\n const firstSlash = arg.indexOf('/')\n const secondSlash = arg.indexOf('/', firstSlash + 1)\n const firstColon = arg.indexOf(':')\n const firstSpace = /\\s/.exec(arg)\n const firstAt = arg.indexOf('@')\n\n const spaceOnlyAfterHash = !firstSpace || (firstHash > -1 && firstSpace.index > firstHash)\n const atOnlyAfterHash = firstAt === -1 || (firstHash > -1 && firstAt > firstHash)\n const colonOnlyAfterHash = firstColon === -1 || (firstHash > -1 && firstColon > firstHash)\n const secondSlashOnlyAfterHash = secondSlash === -1 || (firstHash > -1 && secondSlash > firstHash)\n const hasSlash = firstSlash > 0\n // if a # is found, what we really want to know is that the character immediately before # is not a /\n const doesNotEndWithSlash = firstHash > -1 ? arg[firstHash - 1] !== '/' : !arg.endsWith('/')\n const doesNotStartWithDot = !arg.startsWith('.')\n\n return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && secondSlashOnlyAfterHash\n}\n\n// attempt to correct an scp style url so that it will parse with `new URL()`\nconst correctUrl = (giturl) => {\n const firstAt = giturl.indexOf('@')\n const lastHash = giturl.lastIndexOf('#')\n let firstColon = giturl.indexOf(':')\n let lastColon = giturl.lastIndexOf(':', lastHash > -1 ? lastHash : Infinity)\n\n let corrected\n if (lastColon > firstAt) {\n // the last : comes after the first @ (or there is no @)\n // like it would in:\n // proto://hostname.com:user/repo\n // username@hostname.com:user/repo\n // :password@hostname.com:user/repo\n // username:password@hostname.com:user/repo\n // proto://username@hostname.com:user/repo\n // proto://:password@hostname.com:user/repo\n // proto://username:password@hostname.com:user/repo\n // then we replace the last : with a / to create a valid path\n corrected = giturl.slice(0, lastColon) + '/' + giturl.slice(lastColon + 1)\n // // and we find our new : positions\n firstColon = corrected.indexOf(':')\n lastColon = corrected.lastIndexOf(':')\n }\n\n if (firstColon === -1 && giturl.indexOf('//') === -1) {\n // we have no : at all\n // as it would be in:\n // username@hostname.com/user/repo\n // then we prepend a protocol\n corrected = `git+ssh://${corrected}`\n }\n\n return corrected\n}\n\n// try to parse the url as its given to us, if that throws\n// then we try to clean the url and parse that result instead\n// THIS FUNCTION SHOULD NEVER THROW\nconst parseGitUrl = (giturl) => {\n let result\n try {\n result = new url.URL(giturl)\n } catch (err) {}\n\n if (result) {\n return result\n }\n\n const correctedUrl = correctUrl(giturl)\n try {\n result = new url.URL(correctedUrl)\n } catch (err) {}\n\n return result\n}\n"],"names":["require$$1","hostedGitInfoModule","require$$2","require$$3","url","gitHostInfo"],"mappings":";;;;;;;AACA,MAAM,MAAM;AACZ,MAAM,WAAWA,YAA6B;AAC9C,MAAM,UAAUC,MAAAA,SAAc,UAAGC,QAAwB;AACzD,MAAM,MAAMC,QAAoB;AAChC,MAAM,QAAQ,IAAI,IAAI,EAAE,KAAK,IAAI,CAAE;AAEnC,MAAM,8BAA8B;AAAA,EAClC,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,QAAQ;AACV;AAEA,SAAS,yBAA0B,UAAU;AAC3C,SAAO,4BAA4B,QAAQ,KAAK,SAAS,MAAM,GAAG,EAAE;AACtE;AAEA,MAAM,gBAAgB;AAAA,EACpB,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,cAAc;AAAA,EACd,SAAS;AAAA,EACT,aAAa;AACf;AAEA,MAAM,iBAAiB,OAAO,KAAK,SAAS,UAAU,EAAE,OAAO,CAAC,SAAS,UAAU,QAAQ,YAAY,cAAc,MAAM,CAAC;AAE5HF,MAAA,SAAA,QAAA,UAAyB,SAAU,QAAQ,MAAM;AAC/C,MAAI,OAAO,WAAW,UAAU;AAC9B;AAAA,EACD;AAED,QAAM,MAAM,SAAS,KAAK,UAAU,QAAQ,CAAA,CAAE;AAE9C,MAAI,CAAC,MAAM,IAAI,GAAG,GAAG;AACnB,UAAM,IAAI,KAAK,QAAQ,QAAQ,IAAI,CAAC;AAAA,EACrC;AAED,SAAO,MAAM,IAAI,GAAG;AACtB;AAEA,SAAS,QAAS,QAAQ,MAAM;AAC9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;AAEhB,MAAI,QAAQ;AACV,WAAO;AAAA,EACR;AAED,QAAM,eAAe,WAAW,MAAM;AACtC,MAAI;AACF,aAAS,IAAI,IAAI,IAAI,YAAY;AAAA,EACrC,SAAW,KAAP;AAAA,EAAc;AAEhB,SAAO;AACT;;;","x_google_ignoreList":[0]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { __module as hostedGitInfo } from "
|
|
1
|
+
import { __module as hostedGitInfo } from "../../_virtual/index19.js";
|
|
2
2
|
import require$$0 from "url";
|
|
3
3
|
import { g as gitHostInfo } from "./git-host-info.js";
|
|
4
4
|
import { g as gitHost } from "./git-host.js";
|
|
5
|
-
import { l as lruCache } from "
|
|
5
|
+
import { l as lruCache } from "../lru-cache/index.js";
|
|
6
6
|
const url = require$$0;
|
|
7
7
|
const gitHosts = gitHostInfo;
|
|
8
8
|
const GitHost = hostedGitInfo.exports = gitHost;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../node_modules/hosted-git-info/index.js"],"sourcesContent":["'use strict'\nconst url = require('url')\nconst gitHosts = require('./git-host-info.js')\nconst GitHost = module.exports = require('./git-host.js')\nconst LRU = require('lru-cache')\nconst cache = new LRU({ max: 1000 })\n\nconst protocolToRepresentationMap = {\n 'git+ssh:': 'sshurl',\n 'git+https:': 'https',\n 'ssh:': 'sshurl',\n 'git:': 'git'\n}\n\nfunction protocolToRepresentation (protocol) {\n return protocolToRepresentationMap[protocol] || protocol.slice(0, -1)\n}\n\nconst authProtocols = {\n 'git:': true,\n 'https:': true,\n 'git+https:': true,\n 'http:': true,\n 'git+http:': true\n}\n\nconst knownProtocols = Object.keys(gitHosts.byShortcut).concat(['http:', 'https:', 'git:', 'git+ssh:', 'git+https:', 'ssh:'])\n\nmodule.exports.fromUrl = function (giturl, opts) {\n if (typeof giturl !== 'string') {\n return\n }\n\n const key = giturl + JSON.stringify(opts || {})\n\n if (!cache.has(key)) {\n cache.set(key, fromUrl(giturl, opts))\n }\n\n return cache.get(key)\n}\n\nfunction fromUrl (giturl, opts) {\n if (!giturl) {\n return\n }\n\n const url = isGitHubShorthand(giturl) ? 'github:' + giturl : correctProtocol(giturl)\n const parsed = parseGitUrl(url)\n if (!parsed) {\n return parsed\n }\n\n const gitHostShortcut = gitHosts.byShortcut[parsed.protocol]\n const gitHostDomain = gitHosts.byDomain[parsed.hostname.startsWith('www.') ? parsed.hostname.slice(4) : parsed.hostname]\n const gitHostName = gitHostShortcut || gitHostDomain\n if (!gitHostName) {\n return\n }\n\n const gitHostInfo = gitHosts[gitHostShortcut || gitHostDomain]\n let auth = null\n if (authProtocols[parsed.protocol] && (parsed.username || parsed.password)) {\n auth = `${parsed.username}${parsed.password ? ':' + parsed.password : ''}`\n }\n\n let committish = null\n let user = null\n let project = null\n let defaultRepresentation = null\n\n try {\n if (gitHostShortcut) {\n let pathname = parsed.pathname.startsWith('/') ? parsed.pathname.slice(1) : parsed.pathname\n const firstAt = pathname.indexOf('@')\n // we ignore auth for shortcuts, so just trim it out\n if (firstAt > -1) {\n pathname = pathname.slice(firstAt + 1)\n }\n\n const lastSlash = pathname.lastIndexOf('/')\n if (lastSlash > -1) {\n user = decodeURIComponent(pathname.slice(0, lastSlash))\n // we want nulls only, never empty strings\n if (!user) {\n user = null\n }\n project = decodeURIComponent(pathname.slice(lastSlash + 1))\n } else {\n project = decodeURIComponent(pathname)\n }\n\n if (project.endsWith('.git')) {\n project = project.slice(0, -4)\n }\n\n if (parsed.hash) {\n committish = decodeURIComponent(parsed.hash.slice(1))\n }\n\n defaultRepresentation = 'shortcut'\n } else {\n if (!gitHostInfo.protocols.includes(parsed.protocol)) {\n return\n }\n\n const segments = gitHostInfo.extract(parsed)\n if (!segments) {\n return\n }\n\n user = segments.user && decodeURIComponent(segments.user)\n project = decodeURIComponent(segments.project)\n committish = decodeURIComponent(segments.committish)\n defaultRepresentation = protocolToRepresentation(parsed.protocol)\n }\n } catch (err) {\n /* istanbul ignore else */\n if (err instanceof URIError) {\n return\n } else {\n throw err\n }\n }\n\n return new GitHost(gitHostName, user, auth, project, committish, defaultRepresentation, opts)\n}\n\n// accepts input like git:github.com:user/repo and inserts the // after the first :\nconst correctProtocol = (arg) => {\n const firstColon = arg.indexOf(':')\n const proto = arg.slice(0, firstColon + 1)\n if (knownProtocols.includes(proto)) {\n return arg\n }\n\n const firstAt = arg.indexOf('@')\n if (firstAt > -1) {\n if (firstAt > firstColon) {\n return `git+ssh://${arg}`\n } else {\n return arg\n }\n }\n\n const doubleSlash = arg.indexOf('//')\n if (doubleSlash === firstColon + 1) {\n return arg\n }\n\n return arg.slice(0, firstColon + 1) + '//' + arg.slice(firstColon + 1)\n}\n\n// look for github shorthand inputs, such as npm/cli\nconst isGitHubShorthand = (arg) => {\n // it cannot contain whitespace before the first #\n // it cannot start with a / because that's probably an absolute file path\n // but it must include a slash since repos are username/repository\n // it cannot start with a . because that's probably a relative file path\n // it cannot start with an @ because that's a scoped package if it passes the other tests\n // it cannot contain a : before a # because that tells us that there's a protocol\n // a second / may not exist before a #\n const firstHash = arg.indexOf('#')\n const firstSlash = arg.indexOf('/')\n const secondSlash = arg.indexOf('/', firstSlash + 1)\n const firstColon = arg.indexOf(':')\n const firstSpace = /\\s/.exec(arg)\n const firstAt = arg.indexOf('@')\n\n const spaceOnlyAfterHash = !firstSpace || (firstHash > -1 && firstSpace.index > firstHash)\n const atOnlyAfterHash = firstAt === -1 || (firstHash > -1 && firstAt > firstHash)\n const colonOnlyAfterHash = firstColon === -1 || (firstHash > -1 && firstColon > firstHash)\n const secondSlashOnlyAfterHash = secondSlash === -1 || (firstHash > -1 && secondSlash > firstHash)\n const hasSlash = firstSlash > 0\n // if a # is found, what we really want to know is that the character immediately before # is not a /\n const doesNotEndWithSlash = firstHash > -1 ? arg[firstHash - 1] !== '/' : !arg.endsWith('/')\n const doesNotStartWithDot = !arg.startsWith('.')\n\n return spaceOnlyAfterHash && hasSlash && doesNotEndWithSlash && doesNotStartWithDot && atOnlyAfterHash && colonOnlyAfterHash && secondSlashOnlyAfterHash\n}\n\n// attempt to correct an scp style url so that it will parse with `new URL()`\nconst correctUrl = (giturl) => {\n const firstAt = giturl.indexOf('@')\n const lastHash = giturl.lastIndexOf('#')\n let firstColon = giturl.indexOf(':')\n let lastColon = giturl.lastIndexOf(':', lastHash > -1 ? lastHash : Infinity)\n\n let corrected\n if (lastColon > firstAt) {\n // the last : comes after the first @ (or there is no @)\n // like it would in:\n // proto://hostname.com:user/repo\n // username@hostname.com:user/repo\n // :password@hostname.com:user/repo\n // username:password@hostname.com:user/repo\n // proto://username@hostname.com:user/repo\n // proto://:password@hostname.com:user/repo\n // proto://username:password@hostname.com:user/repo\n // then we replace the last : with a / to create a valid path\n corrected = giturl.slice(0, lastColon) + '/' + giturl.slice(lastColon + 1)\n // // and we find our new : positions\n firstColon = corrected.indexOf(':')\n lastColon = corrected.lastIndexOf(':')\n }\n\n if (firstColon === -1 && giturl.indexOf('//') === -1) {\n // we have no : at all\n // as it would be in:\n // username@hostname.com/user/repo\n // then we prepend a protocol\n corrected = `git+ssh://${corrected}`\n }\n\n return corrected\n}\n\n// try to parse the url as its given to us, if that throws\n// then we try to clean the url and parse that result instead\n// THIS FUNCTION SHOULD NEVER THROW\nconst parseGitUrl = (giturl) => {\n let result\n try {\n result = new url.URL(giturl)\n } catch (err) {}\n\n if (result) {\n return result\n }\n\n const correctedUrl = correctUrl(giturl)\n try {\n result = new url.URL(correctedUrl)\n } catch (err) {}\n\n return result\n}\n"],"names":["require$$1","hostedGitInfoModule","require$$2","require$$3","url","gitHostInfo"],"mappings":";;;;;AACA,MAAM,MAAM;AACZ,MAAM,WAAWA;AACjB,MAAM,UAAUC,cAAc,UAAGC;AACjC,MAAM,MAAMC;AACZ,MAAM,QAAQ,IAAI,IAAI,EAAE,KAAK,IAAI,CAAE;AAEnC,MAAM,8BAA8B;AAAA,EAClC,YAAY;AAAA,EACZ,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,QAAQ;AACV;A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