prismic 1.2.1 → 1.3.0

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.
Files changed (47) hide show
  1. package/dist/{builders-hKD4IrLX-cdTCGdwG.mjs → builders-hKD4IrLX-CiOmsZQP.mjs} +1 -1
  2. package/dist/index.mjs +119 -58
  3. package/dist/nextjs-c8JOjFCt.mjs +413 -0
  4. package/dist/nuxt-BhwnOusi.mjs +90 -0
  5. package/dist/string-CFNpwnbk.mjs +7 -0
  6. package/dist/sveltekit-BW5_-HtZ.mjs +263 -0
  7. package/package.json +1 -1
  8. package/src/adapters/index.ts +6 -0
  9. package/src/adapters/nextjs.templates.ts +170 -38
  10. package/src/adapters/nextjs.ts +33 -3
  11. package/src/adapters/nuxt.templates.ts +48 -0
  12. package/src/adapters/nuxt.ts +42 -20
  13. package/src/adapters/sveltekit.templates.ts +92 -35
  14. package/src/adapters/sveltekit.ts +38 -3
  15. package/src/auth.ts +1 -2
  16. package/src/clients/locale.ts +64 -0
  17. package/src/clients/user.ts +1 -0
  18. package/src/clients/wroom.ts +212 -0
  19. package/src/commands/gen-setup.ts +38 -0
  20. package/src/commands/gen-types.ts +35 -0
  21. package/src/commands/gen.ts +18 -0
  22. package/src/commands/init.ts +7 -1
  23. package/src/commands/locale-add.ts +47 -0
  24. package/src/commands/locale-list.ts +43 -0
  25. package/src/commands/locale-remove.ts +45 -0
  26. package/src/commands/locale-set-master.ts +61 -0
  27. package/src/commands/locale.ts +28 -0
  28. package/src/commands/repo-create.ts +60 -0
  29. package/src/commands/repo-list.ts +58 -0
  30. package/src/commands/repo-set-api-access.ts +53 -0
  31. package/src/commands/repo-set-name.ts +46 -0
  32. package/src/commands/repo-view.ts +74 -0
  33. package/src/commands/repo.ts +33 -0
  34. package/src/commands/sync.ts +4 -2
  35. package/src/commands/token-create.ts +55 -0
  36. package/src/commands/token-delete.ts +61 -0
  37. package/src/commands/token-list.ts +67 -0
  38. package/src/commands/token.ts +23 -0
  39. package/src/config.ts +53 -0
  40. package/src/env.ts +2 -0
  41. package/src/index.ts +20 -0
  42. package/src/lib/codegen.ts +6 -5
  43. package/src/lib/url.ts +7 -0
  44. package/dist/nextjs-DrbOdw3q.mjs +0 -318
  45. package/dist/nuxt-DO5Kp4yy.mjs +0 -59
  46. package/dist/string-CnZrLYLV.mjs +0 -7
  47. package/dist/sveltekit-KHG7YUoX.mjs +0 -236
@@ -1,3 +1,5 @@
1
+ import type { CustomType } from "@prismicio/types-internal/lib/customtypes";
2
+
1
3
  import { pascalCase } from "change-case";
2
4
 
3
5
  import { dedent } from "../lib/string";
@@ -56,6 +58,169 @@ export function sliceTemplate(args: { name: string; typescript: boolean }): stri
56
58
  return typescript ? TS : JS;
57
59
  }
58
60
 
61
+ export function pageTemplate(args: {
62
+ model: CustomType;
63
+ routePath: string;
64
+ typescript: boolean;
65
+ appRouter: boolean;
66
+ }): string {
67
+ const { model, routePath, typescript, appRouter } = args;
68
+
69
+ if (appRouter) {
70
+ if (model.repeatable) {
71
+ if (typescript) {
72
+ return dedent`
73
+ import { SliceZone } from "@prismicio/react";
74
+ import { createClient } from "@/prismicio";
75
+ import { components } from "@/slices";
76
+
77
+ export default async function Page({ params }: PageProps<"/${routePath}">) {
78
+ const { uid } = await params;
79
+ const client = createClient();
80
+ const page = await client.getByUID("${model.id}", uid);
81
+
82
+ return <SliceZone slices={page.data.slices} components={components} />;
83
+ }
84
+ `;
85
+ }
86
+
87
+ return dedent`
88
+ import { SliceZone } from "@prismicio/react";
89
+ import { createClient } from "@/prismicio";
90
+ import { components } from "@/slices";
91
+
92
+ /**
93
+ * @type {PageProps<"/${routePath}">}
94
+ */
95
+ export default async function Page({ params }) {
96
+ const { uid } = await params;
97
+ const client = createClient();
98
+ const page = await client.getByUID("${model.id}", uid);
99
+
100
+ return <SliceZone slices={page.data.slices} components={components} />;
101
+ }
102
+ `;
103
+ }
104
+
105
+ return dedent`
106
+ import { SliceZone } from "@prismicio/react";
107
+ import { createClient } from "@/prismicio";
108
+ import { components } from "@/slices";
109
+
110
+ export default async function Page() {
111
+ const client = createClient();
112
+ const page = await client.getSingle("${model.id}");
113
+
114
+ return <SliceZone slices={page.data.slices} components={components} />;
115
+ }
116
+ `;
117
+ }
118
+
119
+ if (model.repeatable) {
120
+ if (typescript) {
121
+ return dedent`
122
+ import type { InferGetStaticPropsType, GetStaticPropsContext } from "next";
123
+ import { SliceZone } from "@prismicio/react";
124
+ import { createClient } from "@/prismicio";
125
+ import { components } from "@/slices";
126
+
127
+ type Params = { uid: string };
128
+
129
+ export async function getStaticProps({ params, previewData }: GetStaticPropsContext<Params>) {
130
+ const client = createClient({ previewData });
131
+ const page = await client.getByUID("${model.id}", params.uid);
132
+
133
+ return { props: { page } };
134
+ }
135
+
136
+ export default function Page({ page }: InferGetStaticPropsType<typeof getStaticProps>) {
137
+ return <SliceZone slices={page.data.slices} components={components} />;
138
+ }
139
+
140
+ export async function getStaticPaths() {
141
+ const client = createClient();
142
+ const pages = await client.getAllByType("${model.id}");
143
+
144
+ return {
145
+ paths: pages.map((page) => ({ params: { uid: page.uid } })),
146
+ fallback: false,
147
+ };
148
+ }
149
+ `;
150
+ }
151
+
152
+ return dedent`
153
+ import { SliceZone } from "@prismicio/react";
154
+ import { createClient } from "@/prismicio";
155
+ import { components } from "@/slices";
156
+
157
+ /**
158
+ * @param {import("next").InferGetStaticPropsType<typeof getStaticProps>} props
159
+ */
160
+ export default function Page({ page }) {
161
+ return <SliceZone slices={page.data.slices} components={components} />;
162
+ }
163
+
164
+ export async function getStaticProps({ params, previewData }) {
165
+ const client = createClient({ previewData });
166
+ const page = await client.getByUID("${model.id}", params.uid);
167
+
168
+ return { props: { page } };
169
+ }
170
+
171
+ export async function getStaticPaths() {
172
+ const client = createClient();
173
+ const pages = await client.getAllByType("${model.id}");
174
+
175
+ return {
176
+ paths: pages.map((page) => ({ params: { uid: page.uid } })),
177
+ fallback: false,
178
+ };
179
+ }
180
+ `;
181
+ }
182
+
183
+ if (typescript) {
184
+ return dedent`
185
+ import type { InferGetStaticPropsType, GetStaticPropsContext } from "next";
186
+ import { SliceZone } from "@prismicio/react";
187
+ import { createClient } from "@/prismicio";
188
+ import { components } from "@/slices";
189
+
190
+ export async function getStaticProps({ previewData }: GetStaticPropsContext) {
191
+ const client = createClient({ previewData });
192
+ const page = await client.getSingle("${model.id}");
193
+
194
+ return { props: { page } };
195
+ }
196
+
197
+ export default function Page({ page }: InferGetStaticPropsType<typeof getStaticProps>) {
198
+ return <SliceZone slices={page.data.slices} components={components} />;
199
+ }
200
+ `;
201
+ }
202
+
203
+ return dedent`
204
+ import { SliceZone } from "@prismicio/react";
205
+ import { createClient } from "@/prismicio";
206
+ import { components } from "@/slices";
207
+
208
+ /**
209
+ * @param {import("next").InferGetStaticPropsType<typeof getStaticProps>} props
210
+ */
211
+ export default function Page({ page }) {
212
+ return <SliceZone slices={page.data.slices} components={components} />;
213
+ }
214
+
215
+ export async function getStaticProps({ previewData }) {
216
+ const client = createClient({ previewData });
217
+ const page = await client.getSingle("${model.id}");
218
+
219
+ return { props: { page } };
220
+ }
221
+ `;
222
+ }
223
+
59
224
  export function prismicIOFileTemplate(args: {
60
225
  typescript: boolean;
61
226
  appRouter: boolean;
@@ -73,7 +238,6 @@ export function prismicIOFileTemplate(args: {
73
238
  import {
74
239
  createClient as baseCreateClient,
75
240
  type ClientConfig,
76
- type Route,
77
241
  } from "@prismicio/client";
78
242
  import { enableAutoPreviews } from "@prismicio/next";
79
243
  import prismicConfig from "${configImportPath}";
@@ -88,7 +252,7 @@ export function prismicIOFileTemplate(args: {
88
252
  */
89
253
  export const createClient = (config: ClientConfig = {}) => {
90
254
  const client = baseCreateClient(repositoryName, {
91
- routes,
255
+ routes: prismicConfig.routes,
92
256
  fetchOptions:
93
257
  process.env.NODE_ENV === 'production'
94
258
  ? { next: { tags: ['prismic'] }, cache: 'force-cache' }
@@ -117,7 +281,7 @@ export function prismicIOFileTemplate(args: {
117
281
  */
118
282
  export const createClient = (config = {}) => {
119
283
  const client = baseCreateClient(repositoryName, {
120
- routes,
284
+ routes: prismicConfig.routes,
121
285
  fetchOptions:
122
286
  process.env.NODE_ENV === 'production'
123
287
  ? { next: { tags: ['prismic'] }, cache: 'force-cache' }
@@ -134,7 +298,7 @@ export function prismicIOFileTemplate(args: {
134
298
  } else {
135
299
  if (typescript) {
136
300
  importsContents = dedent`
137
- import { createClient as baseCreateClient, type Routes } from "@prismicio/client";
301
+ import { createClient as baseCreateClient } from "@prismicio/client";
138
302
  import { enableAutoPreviews, type CreateClientConfig } from "@prismicio/next/pages";
139
303
  import prismicConfig from "${configImportPath}";
140
304
  `;
@@ -148,7 +312,7 @@ export function prismicIOFileTemplate(args: {
148
312
  */
149
313
  export const createClient = ({ previewData, req, ...config }: CreateClientConfig = {}) => {
150
314
  const client = baseCreateClient(repositoryName, {
151
- routes,
315
+ routes: prismicConfig.routes,
152
316
  ...config,
153
317
  });
154
318
 
@@ -173,7 +337,7 @@ export function prismicIOFileTemplate(args: {
173
337
  */
174
338
  export const createClient = ({ previewData, req, ...config } = {}) => {
175
339
  const client = baseCreateClient(repositoryName, {
176
- routes,
340
+ routes: prismicConfig.routes,
177
341
  ...config,
178
342
  });
179
343
 
@@ -194,21 +358,6 @@ export function prismicIOFileTemplate(args: {
194
358
  */
195
359
  export const repositoryName = prismicConfig.repositoryName;
196
360
 
197
- /**
198
- * A list of Route Resolver objects that define how a document's \`url\` field is resolved.
199
- *
200
- * {@link https://prismic.io/docs/route-resolver#route-resolver}
201
- *
202
- * Note: \`prismic sync\` may append new default routes for Page Types. Feel free
203
- * to edit these to match your site's routing structure.
204
- */
205
- // TODO: Update the routes array to match your project's route structure.
206
- const routes: Route[] = [
207
- // Examples:
208
- // { type: "homepage", path: "/" },
209
- // { type: "page", path: "/:uid" },
210
- ];
211
-
212
361
  ${createClientContents}
213
362
  `;
214
363
  }
@@ -221,23 +370,6 @@ export function prismicIOFileTemplate(args: {
221
370
  */
222
371
  export const repositoryName = prismicConfig.repositoryName;
223
372
 
224
- /**
225
- * A list of Route Resolver objects that define how a document's \`url\` field is resolved.
226
- *
227
- * {@link https://prismic.io/docs/route-resolver#route-resolver}
228
- *
229
- * Note: \`prismic sync\` may append new default routes for Page Types. Feel free
230
- * to edit these to match your site's routing structure.
231
- *
232
- * @type {import("@prismicio/client").Route[]}
233
- */
234
- // TODO: Update the routes array to match your project's route structure.
235
- const routes = [
236
- // Examples:
237
- // { type: "homepage", path: "/" },
238
- // { type: "page", path: "/:uid" },
239
- ];
240
-
241
373
  ${createClientContents}
242
374
  `;
243
375
  }
@@ -1,4 +1,4 @@
1
- import type { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
1
+ import type { CustomType, SharedSlice } from "@prismicio/types-internal/lib/customtypes";
2
2
 
3
3
  import { pascalCase } from "change-case";
4
4
  import { createRequire } from "node:module";
@@ -6,12 +6,14 @@ import { relative } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
7
7
 
8
8
  import { Adapter } from ".";
9
+ import { buildRoutePath } from "../config";
9
10
  import { exists, writeFileRecursive } from "../lib/file";
10
11
  import { addDependencies, findPackageJson, getNpmPackageVersion } from "../lib/packageJson";
11
12
  import { dedent } from "../lib/string";
12
13
  import { appendTrailingSlash } from "../lib/url";
13
14
  import { checkIsTypeScriptProject, findProjectRoot } from "../project";
14
15
  import {
16
+ pageTemplate,
15
17
  revalidateRouteTemplate,
16
18
  exitPreviewRouteTemplate,
17
19
  previewRouteTemplate,
@@ -23,7 +25,7 @@ import {
23
25
  export class NextJsAdapter extends Adapter {
24
26
  readonly id = "next";
25
27
 
26
- async onProjectInitialized(): Promise<void> {
28
+ async setupProject(): Promise<void> {
27
29
  await addDependencies({
28
30
  "@prismicio/client": `^${await getNpmPackageVersion("@prismicio/client")}`,
29
31
  "@prismicio/react": `^${await getNpmPackageVersion("@prismicio/react")}`,
@@ -36,6 +38,8 @@ export class NextJsAdapter extends Adapter {
36
38
  await createRevalidateRoute();
37
39
  }
38
40
 
41
+ onProjectInitialized(): void {}
42
+
39
43
  async onSliceCreated(model: SharedSlice, library: URL): Promise<void> {
40
44
  const sliceDirectoryName = pascalCase(model.name);
41
45
  const sliceDirectory = new URL(sliceDirectoryName, appendTrailingSlash(library));
@@ -53,7 +57,9 @@ export class NextJsAdapter extends Adapter {
53
57
 
54
58
  onSliceDeleted(): void {}
55
59
 
56
- onCustomTypeCreated(): void {}
60
+ async onCustomTypeCreated(model: CustomType): Promise<void> {
61
+ if (model.format === "page") await createPageFile(model);
62
+ }
57
63
 
58
64
  onCustomTypeUpdated(): void {}
59
65
 
@@ -177,6 +183,30 @@ async function createPrismicIoFile(): Promise<void> {
177
183
  await writeFileRecursive(filePath, contents);
178
184
  }
179
185
 
186
+ async function createPageFile(model: CustomType): Promise<void> {
187
+ const routePath = buildRoutePath(model)
188
+ .split("/")
189
+ .filter(Boolean)
190
+ .map((segment) => (segment.startsWith(":") ? `[${segment.slice(1)}]` : segment))
191
+ .join("/");
192
+ const sourceRoot = await getSourceRoot();
193
+ const extension = `${await getJsFileExtension()}x`;
194
+ const usesAppRouter = await checkUsesAppRouter();
195
+ const pageFilePath = usesAppRouter
196
+ ? new URL(`app/${routePath}/page.${extension}`, sourceRoot)
197
+ : new URL(`pages/${routePath || "index"}.${extension}`, sourceRoot);
198
+
199
+ if (await exists(pageFilePath)) return;
200
+
201
+ const contents = pageTemplate({
202
+ model,
203
+ routePath,
204
+ typescript: await checkIsTypeScriptProject(),
205
+ appRouter: usesAppRouter,
206
+ });
207
+ await writeFileRecursive(pageFilePath, contents);
208
+ }
209
+
180
210
  async function checkUsesAppRouter() {
181
211
  const sourceDirectory = await getSourceRoot();
182
212
  const appDirectory = new URL("app/", sourceDirectory);
@@ -1,3 +1,5 @@
1
+ import type { CustomType } from "@prismicio/types-internal/lib/customtypes";
2
+
1
3
  import { pascalCase } from "change-case";
2
4
 
3
5
  import { dedent } from "../lib/string";
@@ -52,6 +54,52 @@ export function sliceTemplate(args: { name: string; typescript: boolean }): stri
52
54
  `;
53
55
  }
54
56
 
57
+ export function pageTemplate(args: { model: CustomType; typescript: boolean }): string {
58
+ const { model, typescript } = args;
59
+
60
+ const scriptAttributes = ["setup"];
61
+ if (typescript) scriptAttributes.push('lang="ts"');
62
+
63
+ if (model.repeatable) {
64
+ const uidExpression = typescript ? "route.params.uid as string" : "route.params.uid";
65
+
66
+ return dedent`
67
+ <script ${scriptAttributes.join(" ")}>
68
+ import { components } from "~/slices";
69
+
70
+ const prismic = usePrismic();
71
+ const route = useRoute();
72
+ const { data: page } = await useAsyncData(${uidExpression}, () =>
73
+ prismic.client.getByUID("${model.id}", ${uidExpression}),
74
+ );
75
+ </script>
76
+
77
+ <template>
78
+ <main>
79
+ <SliceZone :slices="page?.data.slices ?? []" :components="components" />
80
+ </main>
81
+ </template>
82
+ `;
83
+ }
84
+
85
+ return dedent`
86
+ <script ${scriptAttributes.join(" ")}>
87
+ import { components } from "~/slices";
88
+
89
+ const prismic = usePrismic();
90
+ const { data: page } = await useAsyncData("${model.id}", () =>
91
+ prismic.client.getSingle("${model.id}"),
92
+ );
93
+ </script>
94
+
95
+ <template>
96
+ <main>
97
+ <SliceZone :slices="page?.data.slices ?? []" :components="components" />
98
+ </main>
99
+ </template>
100
+ `;
101
+ }
102
+
55
103
  export function sliceSimulatorPageTemplate(args: { typescript: boolean }): string {
56
104
  const { typescript } = args;
57
105
 
@@ -1,4 +1,4 @@
1
- import type { SharedSlice } from "@prismicio/types-internal/lib/customtypes";
1
+ import type { CustomType, SharedSlice } from "@prismicio/types-internal/lib/customtypes";
2
2
 
3
3
  import { pascalCase } from "change-case";
4
4
  import { builders, loadFile, writeFile as magicastWriteFile } from "magicast";
@@ -7,20 +7,20 @@ import { relative } from "node:path";
7
7
  import { fileURLToPath } from "node:url";
8
8
 
9
9
  import { Adapter } from ".";
10
- import { readConfig, updateConfig } from "../config";
10
+ import { buildRoutePath, readConfig, updateConfig } from "../config";
11
11
  import { exists, writeFileRecursive } from "../lib/file";
12
12
  import { addDependencies, getNpmPackageVersion } from "../lib/packageJson";
13
13
  import { dedent } from "../lib/string";
14
14
  import { appendTrailingSlash } from "../lib/url";
15
15
  import { checkIsTypeScriptProject, findProjectRoot } from "../project";
16
- import { sliceSimulatorPageTemplate, sliceTemplate } from "./nuxt.templates";
16
+ import { pageTemplate, sliceSimulatorPageTemplate, sliceTemplate } from "./nuxt.templates";
17
17
 
18
18
  const NUXT_PRISMIC = "@nuxtjs/prismic";
19
19
 
20
20
  export class NuxtAdapter extends Adapter {
21
21
  readonly id = "nuxt";
22
22
 
23
- async onProjectInitialized(): Promise<void> {
23
+ async setupProject(): Promise<void> {
24
24
  await addDependencies({
25
25
  "@prismicio/client": `^${await getNpmPackageVersion("@prismicio/client")}`,
26
26
  [NUXT_PRISMIC]: `^${await getNpmPackageVersion(NUXT_PRISMIC)}`,
@@ -31,6 +31,8 @@ export class NuxtAdapter extends Adapter {
31
31
  await modifySliceLibraryPath(this);
32
32
  }
33
33
 
34
+ onProjectInitialized(): void {}
35
+
34
36
  async onSliceCreated(model: SharedSlice, library: URL): Promise<void> {
35
37
  const sliceDirectoryName = pascalCase(model.name);
36
38
  const sliceDirectory = new URL(sliceDirectoryName, appendTrailingSlash(library));
@@ -47,7 +49,9 @@ export class NuxtAdapter extends Adapter {
47
49
 
48
50
  onSliceDeleted(): void {}
49
51
 
50
- onCustomTypeCreated(): void {}
52
+ async onCustomTypeCreated(model: CustomType): Promise<void> {
53
+ if (model.format === "page") await createPageFile(model);
54
+ }
51
55
 
52
56
  onCustomTypeUpdated(): void {}
53
57
 
@@ -132,35 +136,35 @@ async function configureNuxtModule(): Promise<void> {
132
136
  if (!hasInlinedConfiguration) {
133
137
  mod.imports.$prepend({
134
138
  from: "./prismic.config.json",
135
- imported: "repositoryName",
139
+ imported: "default",
140
+ local: "prismicConfig",
136
141
  });
137
142
 
138
143
  config.prismic ||= {};
139
- config.prismic.endpoint = builders.raw("repositoryName");
144
+ config.prismic.endpoint = builders.raw("prismicConfig.repositoryName");
145
+ config.prismic.clientConfig ||= {};
146
+ config.prismic.clientConfig.routes = builders.raw("prismicConfig.routes");
140
147
  }
141
148
 
142
149
  await magicastWriteFile(mod, filepath);
143
150
  }
144
151
 
145
- async function createSliceSimulatorPage(): Promise<void> {
152
+ async function getPagesDir(): Promise<URL> {
146
153
  const projectRoot = await findProjectRoot();
147
- const typescript = await checkIsTypeScriptProject();
148
154
 
149
- // Check for existing pages directories in priority order
150
155
  const appPagesDir = new URL("app/pages/", projectRoot);
151
156
  const srcPagesDir = new URL("src/pages/", projectRoot);
152
157
  const pagesDir = new URL("pages/", projectRoot);
153
158
 
154
- let targetDir: URL;
155
- if (await exists(appPagesDir)) {
156
- targetDir = appPagesDir;
157
- } else if (await exists(srcPagesDir)) {
158
- targetDir = srcPagesDir;
159
- } else if (await exists(pagesDir)) {
160
- targetDir = pagesDir;
161
- } else {
162
- targetDir = new URL("pages/", await getSrcDir());
163
- }
159
+ if (await exists(appPagesDir)) return appPagesDir;
160
+ if (await exists(srcPagesDir)) return srcPagesDir;
161
+ if (await exists(pagesDir)) return pagesDir;
162
+ return new URL("pages/", await getSrcDir());
163
+ }
164
+
165
+ async function createSliceSimulatorPage(): Promise<void> {
166
+ const typescript = await checkIsTypeScriptProject();
167
+ const targetDir = await getPagesDir();
164
168
 
165
169
  const filePath = new URL("slice-simulator.vue", targetDir);
166
170
 
@@ -226,6 +230,24 @@ async function modifySliceLibraryPath(adapter: NuxtAdapter): Promise<void> {
226
230
  await updateConfig({ libraries: [newLibrary] });
227
231
  }
228
232
 
233
+ async function createPageFile(model: CustomType): Promise<void> {
234
+ const routePath = buildRoutePath(model)
235
+ .split("/")
236
+ .filter(Boolean)
237
+ .map((segment) => (segment.startsWith(":") ? `[${segment.slice(1)}]` : segment))
238
+ .join("/");
239
+ const pagesDir = await getPagesDir();
240
+ const pageFilePath = new URL(`${routePath || "index"}.vue`, pagesDir);
241
+
242
+ if (await exists(pageFilePath)) return;
243
+
244
+ const contents = pageTemplate({
245
+ model,
246
+ typescript: await checkIsTypeScriptProject(),
247
+ });
248
+ await writeFileRecursive(pageFilePath, contents);
249
+ }
250
+
229
251
  async function getJsFileExtension(): Promise<string> {
230
252
  const isTypeScriptProject = await checkIsTypeScriptProject();
231
253
  return isTypeScriptProject ? "ts" : "js";