@slicemachine/init 2.2.7-dev-next-release.1 → 2.2.7-dev-next-release.3
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 +130 -73
- package/dist/SliceMachineInitProcess.cjs.map +1 -1
- package/dist/SliceMachineInitProcess.d.ts +13 -0
- package/dist/SliceMachineInitProcess.js +130 -73
- package/dist/SliceMachineInitProcess.js.map +1 -1
- package/dist/packages/init/package.json.cjs +5 -5
- package/dist/packages/init/package.json.js +5 -5
- package/package.json +5 -5
- package/src/SliceMachineInitProcess.ts +199 -120
|
@@ -72,18 +72,25 @@ ${chalk.bgGray(` ${chalk.bold.white("Slice Machine")} `)} ${chalk.dim("→")} In
|
|
|
72
72
|
await this.detectEnvironment();
|
|
73
73
|
assertExists(this.context.framework, "Project framework must be available through context to proceed");
|
|
74
74
|
await this.beginCoreDependenciesInstallation();
|
|
75
|
-
await this.loginAndFetchUserData();
|
|
76
75
|
if (this.options.repository) {
|
|
77
76
|
await this.useRepositoryFlag();
|
|
78
77
|
} else {
|
|
78
|
+
await this.loginAndFetchUserData();
|
|
79
79
|
await this.selectRepository();
|
|
80
80
|
}
|
|
81
81
|
assertExists(this.context.repository, "Repository selection must be available through context to proceed");
|
|
82
|
+
await this.finishCoreDependenciesInstallation();
|
|
83
|
+
await this.upsertSliceMachineConfigurationAndStartPluginRunner();
|
|
84
|
+
const isLoginRequired = await this.checkIsLoginRequired();
|
|
85
|
+
if (isLoginRequired) {
|
|
86
|
+
await this.loginAndFetchUserData();
|
|
87
|
+
if (this.context.repository.exists) {
|
|
88
|
+
this.validateWriteAccess();
|
|
89
|
+
}
|
|
90
|
+
}
|
|
82
91
|
if (!this.context.repository.exists) {
|
|
83
92
|
await this.createNewRepository();
|
|
84
93
|
}
|
|
85
|
-
await this.finishCoreDependenciesInstallation();
|
|
86
|
-
await this.upsertSliceMachineConfigurationAndStartPluginRunner();
|
|
87
94
|
await this.pushDataToPrismic();
|
|
88
95
|
await this.initializeProject();
|
|
89
96
|
await this.initializePlugins();
|
|
@@ -128,6 +135,25 @@ ${chalk.bgGreen(` ${chalk.bold.white("Slice Machine")} `)} ${chalk.dim("→")} I
|
|
|
128
135
|
} catch {
|
|
129
136
|
}
|
|
130
137
|
}
|
|
138
|
+
async checkIsLoginRequired() {
|
|
139
|
+
try {
|
|
140
|
+
assertExists(this.context.repository, "");
|
|
141
|
+
if (this.context.repository.exists === false) {
|
|
142
|
+
return true;
|
|
143
|
+
}
|
|
144
|
+
const [slices, ctLibrary, documentsGlob] = await Promise.all([
|
|
145
|
+
this.readAllSlices(),
|
|
146
|
+
this.manager.customTypes.readCustomTypeLibrary(),
|
|
147
|
+
this.readDocuments()
|
|
148
|
+
]);
|
|
149
|
+
if (slices.length > 0 || ctLibrary.ids.length > 0 || documentsGlob !== void 0 && documentsGlob.documents.length > 0) {
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
} catch (e) {
|
|
153
|
+
return true;
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
131
157
|
detectEnvironment() {
|
|
132
158
|
return listrRun([
|
|
133
159
|
{
|
|
@@ -204,6 +230,33 @@ ${logSymbols.error} Dependency installation failed, try again with:
|
|
|
204
230
|
}
|
|
205
231
|
]);
|
|
206
232
|
}
|
|
233
|
+
async fetchUserProfile() {
|
|
234
|
+
this.context.userProfile = await this.manager.user.getProfile();
|
|
235
|
+
await this.manager.telemetry.identify({
|
|
236
|
+
userID: this.context.userProfile.shortId,
|
|
237
|
+
intercomHash: this.context.userProfile.intercomHash
|
|
238
|
+
});
|
|
239
|
+
await this.manager.telemetry.track({
|
|
240
|
+
event: "command:init:identify",
|
|
241
|
+
repository: this.options.repository
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
async fetchUserRepositories() {
|
|
245
|
+
this.context.userRepositories = await this.manager.prismicRepository.readAll();
|
|
246
|
+
}
|
|
247
|
+
validateWriteAccess() {
|
|
248
|
+
assertExists(this.context.repository, "Repository selection must be available through context to proceed");
|
|
249
|
+
assertExists(this.context.userRepositories, "User repositories must be available through context to validate write access");
|
|
250
|
+
const { domain } = this.context.repository;
|
|
251
|
+
const maybeRepository = this.context.userRepositories.find((repository) => repository.domain === domain);
|
|
252
|
+
if (maybeRepository) {
|
|
253
|
+
if (!this.manager.prismicRepository.hasWriteAccess(maybeRepository)) {
|
|
254
|
+
throw new Error(`Cannot run init command with repository ${chalk.cyan(maybeRepository.domain)}: you are not a developer or admin of this repository`);
|
|
255
|
+
}
|
|
256
|
+
} else {
|
|
257
|
+
throw new Error(`Cannot validate write access for repository ${chalk.cyan(domain)}: you are not part of this repository`);
|
|
258
|
+
}
|
|
259
|
+
}
|
|
207
260
|
loginAndFetchUserData() {
|
|
208
261
|
return listrRun([
|
|
209
262
|
{
|
|
@@ -240,15 +293,7 @@ ${logSymbols.error} Dependency installation failed, try again with:
|
|
|
240
293
|
title: "Fetching user profile...",
|
|
241
294
|
task: async (_2, task) => {
|
|
242
295
|
var _a;
|
|
243
|
-
|
|
244
|
-
await this.manager.telemetry.identify({
|
|
245
|
-
userID: this.context.userProfile.shortId,
|
|
246
|
-
intercomHash: this.context.userProfile.intercomHash
|
|
247
|
-
});
|
|
248
|
-
await this.manager.telemetry.track({
|
|
249
|
-
event: "command:init:identify",
|
|
250
|
-
repository: this.options.repository
|
|
251
|
-
});
|
|
296
|
+
await this.fetchUserProfile();
|
|
252
297
|
parentTask.title = `Logged in as ${chalk.cyan((_a = this.context.userProfile) == null ? void 0 : _a.email)}`;
|
|
253
298
|
task.title = "Fetched user profile";
|
|
254
299
|
}
|
|
@@ -256,7 +301,7 @@ ${logSymbols.error} Dependency installation failed, try again with:
|
|
|
256
301
|
{
|
|
257
302
|
title: "Fetching user repositories...",
|
|
258
303
|
task: async (_2, task) => {
|
|
259
|
-
|
|
304
|
+
await this.fetchUserRepositories();
|
|
260
305
|
task.title = "Fetched user repositories";
|
|
261
306
|
}
|
|
262
307
|
}
|
|
@@ -270,21 +315,20 @@ ${logSymbols.error} Dependency installation failed, try again with:
|
|
|
270
315
|
{
|
|
271
316
|
title: `Flag ${chalk.cyan("repository")} used, validating input...`,
|
|
272
317
|
task: async (_, task) => {
|
|
273
|
-
assertExists(this.context.userRepositories, "User repositories must be available through context to run `useRepositoryFlag`");
|
|
274
318
|
assertExists(this.options.repository, "Flag `repository` must be set to run `useRepositoryFlag`");
|
|
275
319
|
const domain = formatRepositoryDomain(this.options.repository);
|
|
276
|
-
const
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
} else {
|
|
282
|
-
const validation = await validateRepositoryDomainAndAvailability({
|
|
283
|
-
domain,
|
|
284
|
-
existsFn: (domain2) => this.manager.prismicRepository.checkExists({ domain: domain2 })
|
|
285
|
-
});
|
|
320
|
+
const validation = await validateRepositoryDomainAndAvailability({
|
|
321
|
+
domain,
|
|
322
|
+
existsFn: (domain2) => this.manager.prismicRepository.checkExists({ domain: domain2 })
|
|
323
|
+
});
|
|
324
|
+
if (validation.LessThan4 || validation.MoreThan30) {
|
|
286
325
|
const errorMessage = getErrorMessageForRepositoryDomainValidation({
|
|
287
|
-
validation
|
|
326
|
+
validation: {
|
|
327
|
+
...validation,
|
|
328
|
+
// We don't want to throw if repo already exists.
|
|
329
|
+
// User most probably just created it via their dashboard.
|
|
330
|
+
AlreadyExists: false
|
|
331
|
+
},
|
|
288
332
|
displayDomain: chalk.cyan(domain)
|
|
289
333
|
});
|
|
290
334
|
if (errorMessage) {
|
|
@@ -294,7 +338,7 @@ ${logSymbols.error} Dependency installation failed, try again with:
|
|
|
294
338
|
task.title = `Selected repository ${chalk.cyan(domain)} (flag ${chalk.cyan("repository")} used)`;
|
|
295
339
|
this.context.repository = {
|
|
296
340
|
domain,
|
|
297
|
-
exists:
|
|
341
|
+
exists: validation.AlreadyExists ?? false
|
|
298
342
|
};
|
|
299
343
|
}
|
|
300
344
|
}
|
|
@@ -529,6 +573,40 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""));
|
|
|
529
573
|
}
|
|
530
574
|
]);
|
|
531
575
|
}
|
|
576
|
+
async readAllSlices() {
|
|
577
|
+
const { libraries, errors } = await this.manager.slices.readAllSliceLibraries();
|
|
578
|
+
if (errors.length > 0) {
|
|
579
|
+
throw new Error(`Failed to read slice libraries: ${errors.join(", ")}`);
|
|
580
|
+
}
|
|
581
|
+
const slices = [];
|
|
582
|
+
for (const library of libraries) {
|
|
583
|
+
if (library.sliceIDs) {
|
|
584
|
+
for (const sliceID of library.sliceIDs) {
|
|
585
|
+
slices.push({
|
|
586
|
+
libraryID: library.libraryID,
|
|
587
|
+
sliceID
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
return slices;
|
|
593
|
+
}
|
|
594
|
+
async readDocuments() {
|
|
595
|
+
const root = await this.manager.project.getRoot();
|
|
596
|
+
const documentsDirectoryPath = path.resolve(root, "documents");
|
|
597
|
+
try {
|
|
598
|
+
await fs.access(documentsDirectoryPath);
|
|
599
|
+
} catch {
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
const signaturePath = path.resolve(documentsDirectoryPath, "index.json");
|
|
603
|
+
const rawSignature = await fs.readFile(signaturePath, "utf-8");
|
|
604
|
+
const signature = JSON.parse(rawSignature).signature;
|
|
605
|
+
const documents = await globby("*/*.json", {
|
|
606
|
+
cwd: documentsDirectoryPath
|
|
607
|
+
});
|
|
608
|
+
return { signature, documents, directoryPath: documentsDirectoryPath };
|
|
609
|
+
}
|
|
532
610
|
pushDataToPrismic() {
|
|
533
611
|
return listrRun([
|
|
534
612
|
{
|
|
@@ -544,21 +622,7 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""));
|
|
|
544
622
|
}
|
|
545
623
|
},
|
|
546
624
|
task: async (_2, task) => {
|
|
547
|
-
const
|
|
548
|
-
if (errors.length > 0) {
|
|
549
|
-
throw new Error(`Failed to read slice libraries: ${errors.join(", ")}`);
|
|
550
|
-
}
|
|
551
|
-
const slices = [];
|
|
552
|
-
for (const library of libraries) {
|
|
553
|
-
if (library.sliceIDs) {
|
|
554
|
-
for (const sliceID of library.sliceIDs) {
|
|
555
|
-
slices.push({
|
|
556
|
-
libraryID: library.libraryID,
|
|
557
|
-
sliceID
|
|
558
|
-
});
|
|
559
|
-
}
|
|
560
|
-
}
|
|
561
|
-
}
|
|
625
|
+
const slices = await this.readAllSlices();
|
|
562
626
|
if (slices.length === 0) {
|
|
563
627
|
task.skip("No slice to push");
|
|
564
628
|
return;
|
|
@@ -614,44 +678,37 @@ ${chalk.cyan("?")} Your Prismic repository name`.replace("\n", ""));
|
|
|
614
678
|
},
|
|
615
679
|
task: async (_2, task) => {
|
|
616
680
|
assertExists(this.context.repository, "Repository selection must be available through context to run `pushDataToPrismic`");
|
|
617
|
-
const root = await this.manager.project.getRoot();
|
|
618
|
-
const documentsDirectoryPath = path.resolve(root, "documents");
|
|
619
681
|
try {
|
|
620
|
-
await
|
|
621
|
-
|
|
682
|
+
const documentsRead = await this.readDocuments();
|
|
683
|
+
if (documentsRead === void 0 || documentsRead.documents.length === 0) {
|
|
684
|
+
parentTask.title = "Pushed data to Prismic";
|
|
685
|
+
task.skip("No document to push");
|
|
686
|
+
return;
|
|
687
|
+
}
|
|
688
|
+
const { signature, documents, directoryPath } = documentsRead;
|
|
689
|
+
const recordDocument = {};
|
|
690
|
+
await Promise.all(documents.map(async (documentPath) => {
|
|
691
|
+
const filename = path.basename(documentPath, ".json");
|
|
692
|
+
const fileContent = await fs.readFile(path.resolve(directoryPath, documentPath), "utf-8");
|
|
693
|
+
try {
|
|
694
|
+
const parsedContents = JSON.parse(fileContent);
|
|
695
|
+
recordDocument[filename] = parsedContents;
|
|
696
|
+
} catch {
|
|
697
|
+
console.log(`Skipped document due to its invalid format: ${documentPath}`);
|
|
698
|
+
}
|
|
699
|
+
}));
|
|
700
|
+
await this.manager.prismicRepository.pushDocuments({
|
|
701
|
+
domain: this.context.repository.domain,
|
|
702
|
+
documents: recordDocument,
|
|
703
|
+
signature
|
|
704
|
+
});
|
|
705
|
+
task.title = "Pushed all documents";
|
|
622
706
|
parentTask.title = "Pushed data to Prismic";
|
|
623
|
-
|
|
624
|
-
return;
|
|
625
|
-
}
|
|
626
|
-
const signaturePath = path.resolve(documentsDirectoryPath, "index.json");
|
|
627
|
-
const rawSignature = await fs.readFile(signaturePath, "utf-8");
|
|
628
|
-
const signature = JSON.parse(rawSignature).signature;
|
|
629
|
-
const documentsGlob = await globby("*/*.json", {
|
|
630
|
-
cwd: documentsDirectoryPath
|
|
631
|
-
});
|
|
632
|
-
if (documentsGlob.length === 0) {
|
|
707
|
+
} catch {
|
|
633
708
|
parentTask.title = "Pushed data to Prismic";
|
|
634
709
|
task.skip("No document to push");
|
|
635
710
|
return;
|
|
636
711
|
}
|
|
637
|
-
const documents = {};
|
|
638
|
-
await Promise.all(documentsGlob.map(async (documentPath) => {
|
|
639
|
-
const filename = path.basename(documentPath, ".json");
|
|
640
|
-
const fileContent = await fs.readFile(path.resolve(documentsDirectoryPath, documentPath), "utf-8");
|
|
641
|
-
try {
|
|
642
|
-
const parsedContents = JSON.parse(fileContent);
|
|
643
|
-
documents[filename] = parsedContents;
|
|
644
|
-
} catch {
|
|
645
|
-
console.log(`Skipped document due to its invalid format: ${documentPath}`);
|
|
646
|
-
}
|
|
647
|
-
}));
|
|
648
|
-
await this.manager.prismicRepository.pushDocuments({
|
|
649
|
-
domain: this.context.repository.domain,
|
|
650
|
-
documents,
|
|
651
|
-
signature
|
|
652
|
-
});
|
|
653
|
-
task.title = "Pushed all documents";
|
|
654
|
-
parentTask.title = "Pushed data to Prismic";
|
|
655
712
|
}
|
|
656
713
|
},
|
|
657
714
|
{
|
|
@@ -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\";\nimport type { ExecaChildProcess } from \"execa\";\nimport open from \"open\";\nimport logSymbols from \"log-symbols\";\nimport { globby } from \"globby\";\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 { START_SCRIPT_KEY, START_SCRIPT_VALUE } from \"./constants\";\nimport { detectStarterId } from \"./lib/starters\";\n\nexport type SliceMachineInitProcessOptions = {\n\trepository?: string;\n\tpush?: boolean;\n\tpushSlices?: boolean;\n\tpushCustomTypes?: boolean;\n\tpushDocuments?: 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};\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)} Init command started\\n`,\n\t\t);\n\n\t\tif (await this.manager.telemetry.checkIsTelemetryEnabled()) {\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\t\t\t\t`${\n\t\t\t\t\tlogSymbols.info\n\t\t\t\t} We collect telemetry data to improve user experience.\\n Learn more: ${chalk.cyan(\n\t\t\t\t\t\"https://prismic.dev/slice-machine/telemetry\",\n\t\t\t\t)}\\n`,\n\t\t\t);\n\t\t}\n\t\tawait this.manager.telemetry.initTelemetry({\n\t\t\tappName: pkg.name,\n\t\t\tappVersion: pkg.version,\n\t\t});\n\t\tawait this.manager.telemetry.track({\n\t\t\tevent: \"command:init:start\",\n\t\t\trepository: this.options.repository,\n\t\t});\n\n\t\ttry {\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\t\t\tawait this.loginAndFetchUserData();\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.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\tif (!this.context.repository.exists) {\n\t\t\t\tawait this.createNewRepository();\n\t\t\t}\n\n\t\t\tawait this.finishCoreDependenciesInstallation();\n\t\t\tawait this.upsertSliceMachineConfigurationAndStartPluginRunner();\n\t\t\tawait this.pushDataToPrismic();\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)} Init command successful!`,\n\t\t);\n\n\t\ttry {\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 Dashboard ${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(\n\t\t\tthis.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\t\t)}\n Run your project ${chalk.cyan(\n\t\t\tawait getRunScriptCommand({\n\t\t\t\tagent: this.context.packageManager || \"npm\",\n\t\t\t\tscript: \"dev\",\n\t\t\t}),\n\t\t)}`);\n\t\t} catch {\n\t\t\t// Noop, it's only the final convenience messsage\n\t\t}\n\t}\n\n\tprotected trackError = (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\n\t\treturn 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 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.shortMessage);\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 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.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\tthis.context.userProfile =\n\t\t\t\t\t\t\t\t\t\tawait this.manager.user.getProfile();\n\n\t\t\t\t\t\t\t\t\tawait this.manager.telemetry.identify({\n\t\t\t\t\t\t\t\t\t\tuserID: this.context.userProfile.shortId,\n\t\t\t\t\t\t\t\t\t\tintercomHash: this.context.userProfile.intercomHash,\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\tawait this.manager.telemetry.track({\n\t\t\t\t\t\t\t\t\t\tevent: \"command:init:identify\",\n\t\t\t\t\t\t\t\t\t\trepository: this.options.repository,\n\t\t\t\t\t\t\t\t\t});\n\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\tthis.context.userRepositories =\n\t\t\t\t\t\t\t\t\t\tawait this.manager.prismicRepository.readAll();\n\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.context.userRepositories,\n\t\t\t\t\t\t\"User repositories must be available through context to run `useRepositoryFlag`\",\n\t\t\t\t\t);\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\n\t\t\t\t\tconst domain = formatRepositoryDomain(this.options.repository);\n\n\t\t\t\t\tconst maybeRepository = this.context.userRepositories.find(\n\t\t\t\t\t\t(repository) => repository.domain === domain,\n\t\t\t\t\t);\n\n\t\t\t\t\tif (maybeRepository) {\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!this.manager.prismicRepository.hasWriteAccess(maybeRepository)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Cannot run init command with repository ${chalk.cyan(\n\t\t\t\t\t\t\t\t\tmaybeRepository.domain,\n\t\t\t\t\t\t\t\t)}: you are not a developer or admin of this repository`,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst validation = await validateRepositoryDomainAndAvailability({\n\t\t\t\t\t\t\tdomain,\n\t\t\t\t\t\t\texistsFn: (domain) =>\n\t\t\t\t\t\t\t\tthis.manager.prismicRepository.checkExists({ domain }),\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst errorMessage = getErrorMessageForRepositoryDomainValidation({\n\t\t\t\t\t\t\tvalidation,\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: !!maybeRepository,\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 package name\n\t\ttry {\n\t\t\tconst pkgJSONPath = path.join(this.manager.cwd, \"package.json\");\n\t\t\tconst pkg = JSON.parse(await fs.readFile(pkgJSONPath, \"utf-8\"));\n\n\t\t\tconst maybeSuggestion = await trySuggestName(pkg.name);\n\t\t\tif (maybeSuggestion) {\n\t\t\t\tsuggestedName = maybeSuggestion;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Noop\n\t\t}\n\n\t\t// 2. Try to suggest name after directory name\n\t\tif (!suggestedName) {\n\t\t\tconst maybeSuggestion = await trySuggestName(\n\t\t\t\tpath.basename(this.manager.cwd),\n\t\t\t);\n\t\t\tif (maybeSuggestion) {\n\t\t\t\tsuggestedName = maybeSuggestion;\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 pushDataToPrismic(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Pushing data to 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 { libraries, errors } =\n\t\t\t\t\t\t\t\t\tawait this.manager.slices.readAllSliceLibraries();\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 slice libraries: ${errors.join(\", \")}`,\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\tconst slices: { libraryID: string; sliceID: string }[] = [];\n\t\t\t\t\t\t\t\tfor (const library of libraries) {\n\t\t\t\t\t\t\t\t\tif (library.sliceIDs) {\n\t\t\t\t\t\t\t\t\t\tfor (const sliceID of library.sliceIDs) {\n\t\t\t\t\t\t\t\t\t\t\tslices.push({\n\t\t\t\t\t\t\t\t\t\t\t\tlibraryID: library.libraryID,\n\t\t\t\t\t\t\t\t\t\t\t\tsliceID,\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 (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(slice);\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({ id });\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 `pushDataToPrismic`\",\n\t\t\t\t\t\t\t\t);\n\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\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tawait fs.access(documentsDirectoryPath);\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\tparentTask.title = \"Pushed data to Prismic\";\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\n\t\t\t\t\t\t\t\tconst signaturePath = path.resolve(\n\t\t\t\t\t\t\t\t\tdocumentsDirectoryPath,\n\t\t\t\t\t\t\t\t\t\"index.json\",\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t\tconst rawSignature = await fs.readFile(signaturePath, \"utf-8\");\n\t\t\t\t\t\t\t\tconst signature: string = JSON.parse(rawSignature).signature;\n\n\t\t\t\t\t\t\t\tconst documentsGlob = await globby(\"*/*.json\", {\n\t\t\t\t\t\t\t\t\tcwd: documentsDirectoryPath,\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\tif (documentsGlob.length === 0) {\n\t\t\t\t\t\t\t\t\tparentTask.title = \"Pushed data to Prismic\";\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\n\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// The exact format is not know at this time, hence the `unknown`.\n\t\t\t\t\t\t\t\tconst documents: Record<string, unknown> = {};\n\n\t\t\t\t\t\t\t\tawait Promise.all(\n\t\t\t\t\t\t\t\t\tdocumentsGlob.map(async (documentPath) => {\n\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\tconst fileContent = await fs.readFile(\n\t\t\t\t\t\t\t\t\t\t\tpath.resolve(documentsDirectoryPath, documentPath),\n\t\t\t\t\t\t\t\t\t\t\t\"utf-8\",\n\t\t\t\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t\t\t\ttry {\n\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\tconst parsedContents = JSON.parse(fileContent);\n\n\t\t\t\t\t\t\t\t\t\t\tdocuments[filename] = parsedContents;\n\t\t\t\t\t\t\t\t\t\t} catch {\n\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// eslint-disable-next-line no-console\n\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`Skipped document due to its invalid format: ${documentPath}`,\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\tawait this.manager.prismicRepository.pushDocuments({\n\t\t\t\t\t\t\t\t\tdomain: this.context.repository.domain,\n\t\t\t\t\t\t\t\t\tdocuments,\n\t\t\t\t\t\t\t\t\tsignature,\n\t\t\t\t\t\t\t\t});\n\n\t\t\t\t\t\t\t\ttask.title = \"Pushed all documents\";\n\t\t\t\t\t\t\t\tparentTask.title = \"Pushed data to Prismic\";\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\tparentTask.title = \"Pushed data to 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":["_","_b","_a","domain","pkg"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAM,kBAAkD;AAAA,EACvD,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,eAAe;;AAGH,MAAA,gCAAgC,CAC5C,YAC4B;AACrB,SAAA,IAAI,wBAAwB,OAAO;AAC3C;MAkBa,wBAAuB;AAAA,EAMnC,YAAY,SAAwC;AAL1C;AACA;AAEA;AA4IA,sCAAa,CAAC,UAAiC;;AAElD,YAAA,aACL,iBAAiB,QAAQ,MAAM,UAAU,GAAG,SAC3C,MAAM,GAAG,GAAG;AAEP,aAAA,KAAK,QAAQ,UAAU,MAAM;AAAA,QACnC,OAAO;AAAA,QACP,aAAW,UAAK,QAAQ,cAAb,mBAAwB,4BAA2B;AAAA,QAC9D,aAAY,UAAK,QAAQ,eAAb,mBAAyB;AAAA,QACrC,SAAS;AAAA,QACT,OAAO;AAAA,MAAA,CACP;AAAA,IAAA;AArJD,SAAK,UAAU,EAAE,GAAG,iBAAiB,GAAG,QAAO;AAC/C,SAAK,UAAU,0BAA0B,EAAE,KAAK,mCAAS,KAAK;AAE9D,SAAK,UAAU;EAChB;AAAA,EAEA,MAAM,MAAG;;AAGR,YAAQ,IACP;AAAA,EAAK,MAAM,OAAO,IAAI,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AAQ,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\";\nimport type { ExecaChildProcess } from \"execa\";\nimport open from \"open\";\nimport logSymbols from \"log-symbols\";\nimport { globby } from \"globby\";\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 { START_SCRIPT_KEY, START_SCRIPT_VALUE } from \"./constants\";\nimport { detectStarterId } from \"./lib/starters\";\n\nexport type SliceMachineInitProcessOptions = {\n\trepository?: string;\n\tpush?: boolean;\n\tpushSlices?: boolean;\n\tpushCustomTypes?: boolean;\n\tpushDocuments?: 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};\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)} Init command started\\n`,\n\t\t);\n\n\t\tif (await this.manager.telemetry.checkIsTelemetryEnabled()) {\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\t\t\t\t`${\n\t\t\t\t\tlogSymbols.info\n\t\t\t\t} We collect telemetry data to improve user experience.\\n Learn more: ${chalk.cyan(\n\t\t\t\t\t\"https://prismic.dev/slice-machine/telemetry\",\n\t\t\t\t)}\\n`,\n\t\t\t);\n\t\t}\n\t\tawait this.manager.telemetry.initTelemetry({\n\t\t\tappName: pkg.name,\n\t\t\tappVersion: pkg.version,\n\t\t});\n\t\tawait this.manager.telemetry.track({\n\t\t\tevent: \"command:init:start\",\n\t\t\trepository: this.options.repository,\n\t\t});\n\n\t\ttry {\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.pushDataToPrismic();\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)} Init command successful!`,\n\t\t);\n\n\t\ttry {\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 Dashboard ${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(\n\t\t\tthis.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\t\t)}\n Run your project ${chalk.cyan(\n\t\t\tawait getRunScriptCommand({\n\t\t\t\tagent: this.context.packageManager || \"npm\",\n\t\t\t\tscript: \"dev\",\n\t\t\t}),\n\t\t)}`);\n\t\t} catch {\n\t\t\t// Noop, it's only the final convenience messsage\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\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\t\t} catch (e) {\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprotected trackError = (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\n\t\treturn 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 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.shortMessage);\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.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 package name\n\t\ttry {\n\t\t\tconst pkgJSONPath = path.join(this.manager.cwd, \"package.json\");\n\t\t\tconst pkg = JSON.parse(await fs.readFile(pkgJSONPath, \"utf-8\"));\n\n\t\t\tconst maybeSuggestion = await trySuggestName(pkg.name);\n\t\t\tif (maybeSuggestion) {\n\t\t\t\tsuggestedName = maybeSuggestion;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Noop\n\t\t}\n\n\t\t// 2. Try to suggest name after directory name\n\t\tif (!suggestedName) {\n\t\t\tconst maybeSuggestion = await trySuggestName(\n\t\t\t\tpath.basename(this.manager.cwd),\n\t\t\t);\n\t\t\tif (maybeSuggestion) {\n\t\t\t\tsuggestedName = maybeSuggestion;\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 pushDataToPrismic(): Promise<void> {\n\t\treturn listrRun([\n\t\t\t{\n\t\t\t\ttitle: \"Pushing data to 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(slice);\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({ id });\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 `pushDataToPrismic`\",\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\tparentTask.title = \"Pushed data to Prismic\";\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\tparentTask.title = \"Pushed data to Prismic\";\n\t\t\t\t\t\t\t\t} catch {\n\t\t\t\t\t\t\t\t\tparentTask.title = \"Pushed data to Prismic\";\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\tparentTask.title = \"Pushed data to 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":["_","_b","_a","domain","pkg"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA4CA,MAAM,kBAAkD;AAAA,EACvD,MAAM;AAAA,EACN,YAAY;AAAA,EACZ,iBAAiB;AAAA,EACjB,eAAe;;AAGH,MAAA,gCAAgC,CAC5C,YAC4B;AACrB,SAAA,IAAI,wBAAwB,OAAO;AAC3C;MAkBa,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,eAAK,QAAQ;AAAA,QACd;AAAA,MACA;AAAA,IAAA,GAEF,EAAE,aAAa,MAAO,CAAA,EACrB,MAAM,MAAM,MAAM;AAAA,EACrB;AACA;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
3
3
|
const name = "@slicemachine/init";
|
|
4
|
-
const version = "2.2.7-dev-next-release.
|
|
4
|
+
const version = "2.2.7-dev-next-release.3";
|
|
5
5
|
const description = "Init Prismic Slice Machine in your project";
|
|
6
6
|
const keywords = [
|
|
7
7
|
"typescript",
|
|
@@ -41,7 +41,7 @@ const scripts = {
|
|
|
41
41
|
build: "vite build",
|
|
42
42
|
dev: "vite build --watch",
|
|
43
43
|
format: "prettier --write .",
|
|
44
|
-
lint: "eslint --ext .js,.ts .",
|
|
44
|
+
lint: "eslint --max-warnings 0 --ext .js,.ts .",
|
|
45
45
|
prepack: "$npm_execpath run build",
|
|
46
46
|
size: "size-limit",
|
|
47
47
|
test: "yarn lint && yarn types && yarn unit && yarn build && yarn size",
|
|
@@ -54,7 +54,7 @@ const scripts = {
|
|
|
54
54
|
const dependencies = {
|
|
55
55
|
"@antfu/ni": "^0.20.0",
|
|
56
56
|
"@lihbr/listr-update-renderer": "^0.5.3",
|
|
57
|
-
"@slicemachine/manager": "^0.7.2-dev-next-release.
|
|
57
|
+
"@slicemachine/manager": "^0.7.2-dev-next-release.3",
|
|
58
58
|
chalk: "^4.1.2",
|
|
59
59
|
globby: "^13.1.3",
|
|
60
60
|
listr: "^0.14.3",
|
|
@@ -66,7 +66,7 @@ const dependencies = {
|
|
|
66
66
|
};
|
|
67
67
|
const devDependencies = {
|
|
68
68
|
"@size-limit/preset-small-lib": "8.2.4",
|
|
69
|
-
"@slicemachine/plugin-kit": "0.4.7-dev-next-release.
|
|
69
|
+
"@slicemachine/plugin-kit": "0.4.7-dev-next-release.3",
|
|
70
70
|
"@types/listr": "0.14.4",
|
|
71
71
|
"@types/prompts": "2.4.3",
|
|
72
72
|
"@types/semver": "7.3.13",
|
|
@@ -92,7 +92,7 @@ const devDependencies = {
|
|
|
92
92
|
"vite-plugin-sdk": "0.1.1",
|
|
93
93
|
vitest: "0.32.0"
|
|
94
94
|
};
|
|
95
|
-
const gitHead = "
|
|
95
|
+
const gitHead = "8722d7c2b1d82a9f40197790da7b1d6289cf8b36";
|
|
96
96
|
const pkg = {
|
|
97
97
|
name,
|
|
98
98
|
version,
|