create-plasmic-app 0.0.63 → 0.0.64

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 (209) hide show
  1. package/README.internal.md +6 -2
  2. package/cpa-out/.gitignore +15 -0
  3. package/cpa-out/gatsby-codegen-js/gatsby-browser.jsx +11 -0
  4. package/cpa-out/gatsby-codegen-js/gatsby-config.js +9 -0
  5. package/cpa-out/gatsby-codegen-js/gatsby-node.js +0 -0
  6. package/cpa-out/gatsby-codegen-js/gatsby-ssr.jsx +11 -0
  7. package/cpa-out/gatsby-codegen-js/package.json +26 -0
  8. package/cpa-out/gatsby-codegen-js/plasmic.json +79 -0
  9. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
  10. package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +206 -0
  11. package/cpa-out/gatsby-codegen-js/src/pages/404.js +4 -0
  12. package/cpa-out/gatsby-codegen-js/src/pages/index.jsx +39 -0
  13. package/cpa-out/gatsby-codegen-ts/gatsby-browser.tsx +11 -0
  14. package/cpa-out/gatsby-codegen-ts/gatsby-config.ts +14 -0
  15. package/cpa-out/gatsby-codegen-ts/gatsby-node.ts +0 -0
  16. package/cpa-out/gatsby-codegen-ts/gatsby-ssr.tsx +11 -0
  17. package/cpa-out/gatsby-codegen-ts/package.json +34 -0
  18. package/cpa-out/gatsby-codegen-ts/plasmic.json +79 -0
  19. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
  20. package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +290 -0
  21. package/cpa-out/gatsby-codegen-ts/src/pages/404.js +4 -0
  22. package/cpa-out/gatsby-codegen-ts/src/pages/index.tsx +41 -0
  23. package/cpa-out/gatsby-codegen-ts/tsconfig.json +102 -0
  24. package/cpa-out/gatsby-loader-js/gatsby-config.js +25 -0
  25. package/cpa-out/gatsby-loader-js/gatsby-node.js +0 -0
  26. package/cpa-out/gatsby-loader-js/gatsby-ssr.jsx +44 -0
  27. package/cpa-out/gatsby-loader-js/package.json +24 -0
  28. package/cpa-out/gatsby-loader-js/src/pages/404.js +4 -0
  29. package/cpa-out/gatsby-loader-js/src/pages/plasmic-host.jsx +19 -0
  30. package/cpa-out/gatsby-loader-js/src/plasmic-init.js +18 -0
  31. package/cpa-out/gatsby-loader-js/src/templates/defaultPlasmicPage.jsx +44 -0
  32. package/cpa-out/gatsby-loader-ts/gatsby-config.ts +31 -0
  33. package/cpa-out/gatsby-loader-ts/gatsby-node.ts +0 -0
  34. package/cpa-out/gatsby-loader-ts/gatsby-ssr.tsx +44 -0
  35. package/cpa-out/gatsby-loader-ts/package.json +32 -0
  36. package/cpa-out/gatsby-loader-ts/src/pages/404.ts +4 -0
  37. package/cpa-out/gatsby-loader-ts/src/pages/plasmic-host.tsx +24 -0
  38. package/cpa-out/gatsby-loader-ts/src/plasmic-init.ts +19 -0
  39. package/cpa-out/gatsby-loader-ts/src/templates/defaultPlasmicPage.tsx +52 -0
  40. package/cpa-out/gatsby-loader-ts/tsconfig.json +102 -0
  41. package/cpa-out/nextjs-app-loader-js/app/[[...catchall]]/page.jsx +56 -0
  42. package/cpa-out/nextjs-app-loader-js/app/head.js +10 -0
  43. package/cpa-out/nextjs-app-loader-js/app/layout.js +14 -0
  44. package/cpa-out/nextjs-app-loader-js/app/plasmic-host/page.jsx +6 -0
  45. package/cpa-out/nextjs-app-loader-js/next.config.js +13 -0
  46. package/cpa-out/nextjs-app-loader-js/package.json +20 -0
  47. package/cpa-out/nextjs-app-loader-js/pages/api/hello.js +5 -0
  48. package/cpa-out/nextjs-app-loader-js/plasmic-init-client.jsx +65 -0
  49. package/cpa-out/nextjs-app-loader-js/plasmic-init.js +16 -0
  50. package/cpa-out/nextjs-app-loader-ts/app/[[...catchall]]/page.tsx +59 -0
  51. package/cpa-out/nextjs-app-loader-ts/app/head.tsx +10 -0
  52. package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +18 -0
  53. package/cpa-out/nextjs-app-loader-ts/app/plasmic-host/page.tsx +6 -0
  54. package/cpa-out/nextjs-app-loader-ts/next.config.js +13 -0
  55. package/cpa-out/nextjs-app-loader-ts/package.json +24 -0
  56. package/cpa-out/nextjs-app-loader-ts/pages/api/hello.ts +13 -0
  57. package/cpa-out/nextjs-app-loader-ts/plasmic-init-client.tsx +65 -0
  58. package/cpa-out/nextjs-app-loader-ts/plasmic-init.ts +16 -0
  59. package/cpa-out/nextjs-app-loader-ts/tsconfig.json +29 -0
  60. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
  61. package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +205 -0
  62. package/cpa-out/nextjs-pages-codegen-js/next.config.js +10 -0
  63. package/cpa-out/nextjs-pages-codegen-js/package.json +22 -0
  64. package/cpa-out/nextjs-pages-codegen-js/pages/_app.jsx +11 -0
  65. package/cpa-out/nextjs-pages-codegen-js/pages/api/hello.js +5 -0
  66. package/cpa-out/nextjs-pages-codegen-js/pages/index.jsx +35 -0
  67. package/cpa-out/nextjs-pages-codegen-js/pages/plasmic-host.jsx +15 -0
  68. package/cpa-out/nextjs-pages-codegen-js/plasmic.json +79 -0
  69. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
  70. package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +287 -0
  71. package/cpa-out/nextjs-pages-codegen-ts/next.config.js +10 -0
  72. package/cpa-out/nextjs-pages-codegen-ts/package.json +26 -0
  73. package/cpa-out/nextjs-pages-codegen-ts/pages/_app.tsx +12 -0
  74. package/cpa-out/nextjs-pages-codegen-ts/pages/api/hello.ts +13 -0
  75. package/cpa-out/nextjs-pages-codegen-ts/pages/index.tsx +37 -0
  76. package/cpa-out/nextjs-pages-codegen-ts/pages/plasmic-host.tsx +15 -0
  77. package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +79 -0
  78. package/cpa-out/nextjs-pages-codegen-ts/tsconfig.json +24 -0
  79. package/cpa-out/nextjs-pages-loader-js/next.config.js +10 -0
  80. package/cpa-out/nextjs-pages-loader-js/package.json +20 -0
  81. package/cpa-out/nextjs-pages-loader-js/pages/[[...catchall]].jsx +66 -0
  82. package/cpa-out/nextjs-pages-loader-js/pages/api/hello.js +5 -0
  83. package/cpa-out/nextjs-pages-loader-js/pages/plasmic-host.jsx +7 -0
  84. package/cpa-out/nextjs-pages-loader-js/plasmic-init.js +25 -0
  85. package/cpa-out/nextjs-pages-loader-ts/next.config.js +10 -0
  86. package/cpa-out/nextjs-pages-loader-ts/package.json +24 -0
  87. package/cpa-out/nextjs-pages-loader-ts/pages/[[...catchall]].tsx +70 -0
  88. package/cpa-out/nextjs-pages-loader-ts/pages/api/hello.ts +13 -0
  89. package/cpa-out/nextjs-pages-loader-ts/pages/plasmic-host.tsx +7 -0
  90. package/cpa-out/nextjs-pages-loader-ts/plasmic-init.ts +25 -0
  91. package/cpa-out/nextjs-pages-loader-ts/tsconfig.json +24 -0
  92. package/cpa-out/react-codegen-js/package.json +41 -0
  93. package/cpa-out/react-codegen-js/plasmic.json +76 -0
  94. package/cpa-out/react-codegen-js/src/App.jsx +9 -0
  95. package/cpa-out/react-codegen-js/src/components/Homepage.jsx +26 -0
  96. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
  97. package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +196 -0
  98. package/cpa-out/react-codegen-js/src/index.js +17 -0
  99. package/cpa-out/react-codegen-js/src/reportWebVitals.js +13 -0
  100. package/cpa-out/react-codegen-js/src/setupTests.js +5 -0
  101. package/cpa-out/react-codegen-ts/package.json +46 -0
  102. package/cpa-out/react-codegen-ts/plasmic.json +76 -0
  103. package/cpa-out/react-codegen-ts/src/App.tsx +9 -0
  104. package/cpa-out/react-codegen-ts/src/components/Homepage.tsx +45 -0
  105. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
  106. package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +280 -0
  107. package/cpa-out/react-codegen-ts/src/index.tsx +19 -0
  108. package/cpa-out/react-codegen-ts/src/react-app-env.d.ts +1 -0
  109. package/cpa-out/react-codegen-ts/src/reportWebVitals.ts +15 -0
  110. package/cpa-out/react-codegen-ts/src/setupTests.ts +5 -0
  111. package/cpa-out/react-codegen-ts/tsconfig.json +26 -0
  112. package/cpa-out/react-loader-js/package.json +41 -0
  113. package/cpa-out/react-loader-js/plasmic.json +76 -0
  114. package/cpa-out/react-loader-js/src/App.jsx +9 -0
  115. package/cpa-out/react-loader-js/src/components/Homepage.jsx +26 -0
  116. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
  117. package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +196 -0
  118. package/cpa-out/react-loader-js/src/index.js +17 -0
  119. package/cpa-out/react-loader-js/src/reportWebVitals.js +13 -0
  120. package/cpa-out/react-loader-js/src/setupTests.js +5 -0
  121. package/cpa-out/react-loader-ts/package.json +46 -0
  122. package/cpa-out/react-loader-ts/plasmic.json +76 -0
  123. package/cpa-out/react-loader-ts/src/App.tsx +9 -0
  124. package/cpa-out/react-loader-ts/src/components/Homepage.tsx +45 -0
  125. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
  126. package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +280 -0
  127. package/cpa-out/react-loader-ts/src/index.tsx +19 -0
  128. package/cpa-out/react-loader-ts/src/react-app-env.d.ts +1 -0
  129. package/cpa-out/react-loader-ts/src/reportWebVitals.ts +15 -0
  130. package/cpa-out/react-loader-ts/src/setupTests.ts +5 -0
  131. package/cpa-out/react-loader-ts/tsconfig.json +26 -0
  132. package/dist/gatsby/gatsby.d.ts +6 -0
  133. package/dist/{strategies → gatsby}/gatsby.js +26 -29
  134. package/dist/gatsby/template.d.ts +11 -0
  135. package/dist/{templates/gatsby.js → gatsby/template.js} +34 -42
  136. package/dist/index.d.ts +1 -1
  137. package/dist/index.js +57 -27
  138. package/dist/lib.d.ts +3 -4
  139. package/dist/lib.js +22 -12
  140. package/dist/nextjs/nextjs.d.ts +2 -0
  141. package/dist/nextjs/nextjs.js +155 -0
  142. package/dist/nextjs/templates/app-loader/catchall-page.d.ts +2 -0
  143. package/dist/nextjs/templates/app-loader/catchall-page.js +67 -0
  144. package/dist/nextjs/templates/app-loader/plasmic-host.d.ts +1 -0
  145. package/dist/nextjs/templates/app-loader/plasmic-host.js +13 -0
  146. package/dist/nextjs/templates/app-loader/plasmic-init-client.d.ts +2 -0
  147. package/dist/nextjs/templates/app-loader/plasmic-init-client.js +73 -0
  148. package/dist/nextjs/templates/app-loader/plasmic-init.d.ts +1 -0
  149. package/dist/nextjs/templates/app-loader/plasmic-init.js +23 -0
  150. package/dist/nextjs/templates/pages-codegen/app.d.ts +2 -0
  151. package/dist/nextjs/templates/pages-codegen/app.js +20 -0
  152. package/dist/nextjs/templates/pages-codegen/plasmic-host.d.ts +1 -0
  153. package/dist/nextjs/templates/pages-codegen/plasmic-host.js +22 -0
  154. package/dist/nextjs/templates/pages-loader/catchall-page.d.ts +2 -0
  155. package/dist/nextjs/templates/pages-loader/catchall-page.js +77 -0
  156. package/dist/nextjs/templates/pages-loader/plasmic-host.d.ts +1 -0
  157. package/dist/nextjs/templates/pages-loader/plasmic-host.js +14 -0
  158. package/dist/nextjs/templates/pages-loader/plasmic-init.d.ts +1 -0
  159. package/dist/nextjs/templates/pages-loader/plasmic-init.js +32 -0
  160. package/dist/react/react.d.ts +2 -0
  161. package/dist/{strategies → react}/react.js +10 -10
  162. package/dist/templates/readme.d.ts +2 -2
  163. package/dist/templates/readme.js +5 -4
  164. package/dist/templates/welcomePage.d.ts +2 -2
  165. package/dist/templates/welcomePage.js +5 -5
  166. package/dist/{strategies/common.d.ts → utils/codegen.d.ts} +0 -0
  167. package/dist/{strategies/common.js → utils/codegen.js} +0 -0
  168. package/dist/utils/file-utils.d.ts +2 -2
  169. package/dist/utils/file-utils.js +3 -3
  170. package/dist/{strategies/types.d.ts → utils/strategy.d.ts} +16 -14
  171. package/dist/{strategies/types.js → utils/strategy.js} +0 -0
  172. package/dist/utils/types.d.ts +9 -0
  173. package/dist/utils/types.js +7 -0
  174. package/package.json +4 -3
  175. package/run-cpa.ts +151 -0
  176. package/src/{strategies → gatsby}/gatsby.ts +28 -46
  177. package/src/{templates/gatsby.ts → gatsby/template.ts} +41 -51
  178. package/src/index.ts +86 -56
  179. package/src/lib.ts +30 -15
  180. package/src/nextjs/nextjs.ts +180 -0
  181. package/src/nextjs/templates/app-loader/catchall-page.ts +71 -0
  182. package/src/nextjs/templates/app-loader/plasmic-host.ts +9 -0
  183. package/src/nextjs/templates/app-loader/plasmic-init-client.ts +74 -0
  184. package/src/nextjs/templates/app-loader/plasmic-init.ts +22 -0
  185. package/src/nextjs/templates/pages-codegen/app.ts +24 -0
  186. package/src/nextjs/templates/pages-codegen/plasmic-host.ts +18 -0
  187. package/src/nextjs/templates/pages-loader/catchall-page.ts +81 -0
  188. package/src/nextjs/templates/pages-loader/plasmic-host.ts +10 -0
  189. package/src/nextjs/templates/pages-loader/plasmic-init.ts +31 -0
  190. package/src/{strategies → react}/react.ts +8 -10
  191. package/src/templates/readme.ts +5 -5
  192. package/src/templates/welcomePage.ts +6 -7
  193. package/src/{strategies/common.ts → utils/codegen.ts} +0 -0
  194. package/src/utils/file-utils.ts +4 -4
  195. package/src/utils/strategy.ts +48 -0
  196. package/src/utils/types.ts +12 -0
  197. package/dist/strategies/gatsby.d.ts +0 -7
  198. package/dist/strategies/index.d.ts +0 -2
  199. package/dist/strategies/index.js +0 -22
  200. package/dist/strategies/nextjs.d.ts +0 -3
  201. package/dist/strategies/nextjs.js +0 -104
  202. package/dist/strategies/react.d.ts +0 -3
  203. package/dist/templates/gatsby.d.ts +0 -11
  204. package/dist/templates/nextjs.d.ts +0 -5
  205. package/dist/templates/nextjs.js +0 -162
  206. package/src/strategies/index.ts +0 -21
  207. package/src/strategies/nextjs.ts +0 -131
  208. package/src/strategies/types.ts +0 -42
  209. package/src/templates/nextjs.ts +0 -170
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeCatchallPage_app_loader = void 0;
4
+ const file_utils_1 = require("../../../utils/file-utils");
5
+ function makeCatchallPage_app_loader(jsOrTs) {
6
+ return `import { PlasmicComponent } from "@plasmicapp/loader-nextjs";
7
+ import { notFound } from "next/navigation";
8
+ import { PLASMIC } from "plasmic-init";
9
+ import { ClientPlasmicRootProvider } from "plasmic-init-client";
10
+
11
+ // Use revalidate if you want incremental static regeneration
12
+ export const revalidate = 60;
13
+
14
+ export default async function PlasmicLoaderPage({
15
+ params,
16
+ searchParams,
17
+ }${(0, file_utils_1.ifTs)(jsOrTs, `: {
18
+ params?: { catchall: string[] | undefined };
19
+ searchParams?: Record<string, string | string[]>;
20
+ }`)}) {
21
+ const plasmicComponentData = await fetchPlasmicComponentData(params?.catchall);
22
+ if (!plasmicComponentData) {
23
+ notFound();
24
+ }
25
+
26
+ const { prefetchedData } = plasmicComponentData;
27
+ if (prefetchedData.entryCompMetas.length === 0) {
28
+ notFound();
29
+ }
30
+
31
+ const pageMeta = prefetchedData.entryCompMetas[0];
32
+ return (
33
+ <ClientPlasmicRootProvider
34
+ prefetchedData={prefetchedData}
35
+ pageParams={pageMeta.params}
36
+ pageQuery={searchParams}
37
+ >
38
+ <PlasmicComponent
39
+ component={pageMeta.displayName}
40
+ />
41
+ </ClientPlasmicRootProvider>
42
+ );
43
+ }
44
+
45
+ async function fetchPlasmicComponentData(catchall${(0, file_utils_1.ifTs)(jsOrTs, ": string[] | undefined")}) {
46
+ const plasmicPath = "/" + (catchall ? catchall.join("/") : "");
47
+ const prefetchedData = await PLASMIC.maybeFetchComponentData(plasmicPath);
48
+ if (!prefetchedData) {
49
+ notFound();
50
+ }
51
+
52
+ return { prefetchedData };
53
+ }
54
+
55
+ export async function generateStaticParams() {
56
+ const pageModules = await PLASMIC.fetchPages();
57
+ return pageModules.map((mod) => {
58
+ const catchall =
59
+ mod.path === "/" ? undefined : mod.path.substring(1).split("/");
60
+ return {
61
+ catchall,
62
+ };
63
+ });
64
+ }
65
+ `;
66
+ }
67
+ exports.makeCatchallPage_app_loader = makeCatchallPage_app_loader;
@@ -0,0 +1 @@
1
+ export declare function makePlasmicHostPage_app_loader(): string;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePlasmicHostPage_app_loader = void 0;
4
+ function makePlasmicHostPage_app_loader() {
5
+ return `import { PlasmicCanvasHost } from "@plasmicapp/loader-nextjs";
6
+ import "plasmic-init-client";
7
+
8
+ export default function PlasmicHost() {
9
+ return <PlasmicCanvasHost />;
10
+ }
11
+ `;
12
+ }
13
+ exports.makePlasmicHostPage_app_loader = makePlasmicHostPage_app_loader;
@@ -0,0 +1,2 @@
1
+ import { JsOrTs } from "../../../utils/types";
2
+ export declare function makePlasmicInitClient_app_loader(jsOrTs: JsOrTs): string;
@@ -0,0 +1,73 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePlasmicInitClient_app_loader = void 0;
4
+ const file_utils_1 = require("../../../utils/file-utils");
5
+ function makePlasmicInitClient_app_loader(jsOrTs) {
6
+ return `"use client";
7
+
8
+ import { PlasmicRootProvider } from "@plasmicapp/loader-nextjs";
9
+ import { PLASMIC } from "plasmic-init";
10
+
11
+ // You can register any code components that you want to use here; see
12
+ // https://docs.plasmic.app/learn/code-components-ref/
13
+ // And configure your Plasmic project to use the host url pointing at
14
+ // the /plasmic-host page of your nextjs app (for example,
15
+ // http://localhost:3000/plasmic-host). See
16
+ // https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
17
+
18
+ // PLASMIC.registerComponent(...);
19
+
20
+ /**
21
+ * ClientPlasmicRootProvider is a Client Component that passes in the loader for you.
22
+ *
23
+ * Why? Props passed from Server to Client Components must be serializable.
24
+ * https://beta.nextjs.org/docs/rendering/server-and-client-components#passing-props-from-server-to-client-components-serialization
25
+ * However, PlasmicRootProvider requires a loader, but the loader is NOT serializable.
26
+ *
27
+ * In a Server Component like app/<your-path>/path.tsx, rendering the following would not work:
28
+ *
29
+ * \`\`\`tsx
30
+ * import { PLASMIC } from "plasmic-init";
31
+ * import { PlasmicRootProvider } from "plasmicapp/loader-nextjs";
32
+ * export default function MyPage() {
33
+ * const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
34
+ * return (
35
+ * <PlasmicRootProvider
36
+ * loader={PLASMIC} // ERROR: loader is not serializable
37
+ * prefetchedData={prefetchedData}
38
+ * >
39
+ * {yourContent()}
40
+ * </PlasmicRootProvider>;
41
+ * );
42
+ * }
43
+ * \`\`\`
44
+ *
45
+ * Therefore, we define ClientPlasmicRootProvider as a Client Component (this file is marked "use client").
46
+ * ClientPlasmicRootProvider wraps the PlasmicRootProvider and passes in the loader for you,
47
+ * while allowing your Server Component to pass in prefetched data and other serializable props:
48
+ *
49
+ * \`\`\`tsx
50
+ * import { PLASMIC } from "plasmic-init";
51
+ * import { ClientPlasmicRootProvider } from "plasmic-init-client"; // changed
52
+ * export default function MyPage() {
53
+ * const prefetchedData = await PLASMIC.fetchComponentData("YourPage");
54
+ * return (
55
+ * <ClientPlasmicRootProvider // don't pass in loader
56
+ * prefetchedData={prefetchedData}
57
+ * >
58
+ * {yourContent()}
59
+ * </ClientPlasmicRootProvider>;
60
+ * );
61
+ * }
62
+ * \`\`\`
63
+ */
64
+ export function ClientPlasmicRootProvider(
65
+ props${(0, file_utils_1.ifTs)(jsOrTs, ': Omit<React.ComponentProps<typeof PlasmicRootProvider>, "loader">')}
66
+ ) {
67
+ return (
68
+ <PlasmicRootProvider loader={PLASMIC} {...props}></PlasmicRootProvider>
69
+ );
70
+ }
71
+ `;
72
+ }
73
+ exports.makePlasmicInitClient_app_loader = makePlasmicInitClient_app_loader;
@@ -0,0 +1 @@
1
+ export declare function makePlasmicInit_app_loader(projectId: string, projectApiToken: string): string;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePlasmicInit_app_loader = void 0;
4
+ function makePlasmicInit_app_loader(projectId, projectApiToken) {
5
+ return `import { initPlasmicLoader } from "@plasmicapp/loader-nextjs/react-server-conditional";
6
+
7
+ export const PLASMIC = initPlasmicLoader({
8
+ projects: [
9
+ {
10
+ id: "${projectId}",
11
+ token: "${projectApiToken}",
12
+ },
13
+ ],
14
+
15
+ // By default Plasmic will use the last published version of your project.
16
+ // For development, you can set preview to true, which will use the unpublished
17
+ // project, allowing you to see your designs without publishing. Please
18
+ // only use this for development, as this is significantly slower.
19
+ preview: false,
20
+ });
21
+ `;
22
+ }
23
+ exports.makePlasmicInit_app_loader = makePlasmicInit_app_loader;
@@ -0,0 +1,2 @@
1
+ import { JsOrTs } from "../../../utils/types";
2
+ export declare function makeCustomApp_pages_codegen(jsOrTs: JsOrTs): string;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeCustomApp_pages_codegen = void 0;
4
+ const file_utils_1 = require("../../../utils/file-utils");
5
+ function makeCustomApp_pages_codegen(jsOrTs) {
6
+ return `import 'styles/globals.css'
7
+ import { PlasmicRootProvider } from "@plasmicapp/react-web";${(0, file_utils_1.ifTs)(jsOrTs, `
8
+ import type { AppProps } from "next/app";`)}
9
+ import Head from "next/head";
10
+
11
+ export default function MyApp({ Component, pageProps }${(0, file_utils_1.ifTs)(jsOrTs, `: AppProps`)}) {
12
+ return (
13
+ <PlasmicRootProvider Head={Head}>
14
+ <Component {...pageProps} />
15
+ </PlasmicRootProvider>
16
+ );
17
+ }
18
+ `;
19
+ }
20
+ exports.makeCustomApp_pages_codegen = makeCustomApp_pages_codegen;
@@ -0,0 +1 @@
1
+ export declare function makePlasmicHostPage_pages_codegen(): string;
@@ -0,0 +1,22 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePlasmicHostPage_pages_codegen = void 0;
4
+ function makePlasmicHostPage_pages_codegen() {
5
+ return `import * as React from 'react';
6
+ import { PlasmicCanvasHost, registerComponent } from '@plasmicapp/host';
7
+
8
+ // You can register any code components that you want to use here; see
9
+ // https://docs.plasmic.app/learn/code-components-ref/
10
+ // And configure your Plasmic project to use the host url pointing at
11
+ // the /plasmic-host page of your nextjs app (for example,
12
+ // http://localhost:3000/plasmic-host). See
13
+ // https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
14
+
15
+ // registerComponent(...)
16
+
17
+ export default function PlasmicHost() {
18
+ return <PlasmicCanvasHost />;
19
+ }
20
+ `;
21
+ }
22
+ exports.makePlasmicHostPage_pages_codegen = makePlasmicHostPage_pages_codegen;
@@ -0,0 +1,2 @@
1
+ import { JsOrTs } from "../../../utils/types";
2
+ export declare function makeCatchallPage_pages_loader(jsOrTs: JsOrTs): string;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makeCatchallPage_pages_loader = void 0;
4
+ const file_utils_1 = require("../../../utils/file-utils");
5
+ function makeCatchallPage_pages_loader(jsOrTs) {
6
+ return `import * as React from "react";
7
+ import {
8
+ PlasmicComponent,
9
+ extractPlasmicQueryData,
10
+ ComponentRenderData,
11
+ PlasmicRootProvider,
12
+ } from "@plasmicapp/loader-nextjs";
13
+ ${(0, file_utils_1.ifTs)(jsOrTs, `import type { GetStaticPaths, GetStaticProps } from "next";\n`)}
14
+ import Error from "next/error";
15
+ import { useRouter } from "next/router";
16
+ import { PLASMIC } from "plasmic-init";
17
+
18
+ export default function PlasmicLoaderPage(props${(0, file_utils_1.ifTs)(jsOrTs, `: {
19
+ plasmicData?: ComponentRenderData;
20
+ queryCache?: Record<string, any>;
21
+ }`)}) {
22
+ const { plasmicData, queryCache } = props;
23
+ const router = useRouter();
24
+ if (!plasmicData || plasmicData.entryCompMetas.length === 0) {
25
+ return <Error statusCode={404} />;
26
+ }
27
+ const pageMeta = plasmicData.entryCompMetas[0];
28
+ return (
29
+ <PlasmicRootProvider
30
+ loader={PLASMIC}
31
+ prefetchedData={plasmicData}
32
+ prefetchedQueryData={queryCache}
33
+ pageParams={pageMeta.params}
34
+ pageQuery={router.query}
35
+ >
36
+ <PlasmicComponent component={pageMeta.displayName} />
37
+ </PlasmicRootProvider>
38
+ );
39
+ }
40
+
41
+ export const getStaticProps${(0, file_utils_1.ifTs)(jsOrTs, `: GetStaticProps`)} = async (context) => {
42
+ const { catchall } = context.params ?? {};
43
+ const plasmicPath = typeof catchall === 'string' ? catchall : Array.isArray(catchall) ? \`/\${catchall.join('/')}\` : '/';
44
+ const plasmicData = await PLASMIC.maybeFetchComponentData(plasmicPath);
45
+ if (!plasmicData) {
46
+ // non-Plasmic catch-all
47
+ return { props: {} };
48
+ }
49
+ const pageMeta = plasmicData.entryCompMetas[0];
50
+ // Cache the necessary data fetched for the page
51
+ const queryCache = await extractPlasmicQueryData(
52
+ <PlasmicRootProvider
53
+ loader={PLASMIC}
54
+ prefetchedData={plasmicData}
55
+ pageParams={pageMeta.params}
56
+ >
57
+ <PlasmicComponent component={pageMeta.displayName} />
58
+ </PlasmicRootProvider>
59
+ );
60
+ // Use revalidate if you want incremental static regeneration
61
+ return { props: { plasmicData, queryCache }, revalidate: 60 };
62
+ }
63
+
64
+ export const getStaticPaths${(0, file_utils_1.ifTs)(jsOrTs, `: GetStaticPaths`)} = async () => {
65
+ const pageModules = await PLASMIC.fetchPages();
66
+ return {
67
+ paths: pageModules.map((mod) => ({
68
+ params: {
69
+ catchall: mod.path.substring(1).split("/"),
70
+ },
71
+ })),
72
+ fallback: "blocking",
73
+ };
74
+ }
75
+ `;
76
+ }
77
+ exports.makeCatchallPage_pages_loader = makeCatchallPage_pages_loader;
@@ -0,0 +1 @@
1
+ export declare function makePlasmicHostPage_pages_loader(): string;
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePlasmicHostPage_pages_loader = void 0;
4
+ function makePlasmicHostPage_pages_loader() {
5
+ return `import * as React from 'react';
6
+ import { PlasmicCanvasHost } from '@plasmicapp/loader-nextjs';
7
+ import { PLASMIC } from 'plasmic-init';
8
+
9
+ export default function PlasmicHost() {
10
+ return PLASMIC && <PlasmicCanvasHost />;
11
+ }
12
+ `;
13
+ }
14
+ exports.makePlasmicHostPage_pages_loader = makePlasmicHostPage_pages_loader;
@@ -0,0 +1 @@
1
+ export declare function makePlasmicInit_pages_loader(projectId: string, projectApiToken: string): string;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.makePlasmicInit_pages_loader = void 0;
4
+ function makePlasmicInit_pages_loader(projectId, projectApiToken) {
5
+ return `import { initPlasmicLoader } from "@plasmicapp/loader-nextjs";
6
+
7
+ export const PLASMIC = initPlasmicLoader({
8
+ projects: [
9
+ {
10
+ id: "${projectId}",
11
+ token: "${projectApiToken}",
12
+ },
13
+ ],
14
+
15
+ // By default Plasmic will use the last published version of your project.
16
+ // For development, you can set preview to true, which will use the unpublished
17
+ // project, allowing you to see your designs without publishing. Please
18
+ // only use this for development, as this is significantly slower.
19
+ preview: false,
20
+ });
21
+
22
+ // You can register any code components that you want to use here; see
23
+ // https://docs.plasmic.app/learn/code-components-ref/
24
+ // And configure your Plasmic project to use the host url pointing at
25
+ // the /plasmic-host page of your nextjs app (for example,
26
+ // http://localhost:3000/plasmic-host). See
27
+ // https://docs.plasmic.app/learn/app-hosting/#set-a-plasmic-project-to-use-your-app-host
28
+
29
+ // PLASMIC.registerComponent(...);
30
+ `;
31
+ }
32
+ exports.makePlasmicInit_pages_loader = makePlasmicInit_pages_loader;
@@ -0,0 +1,2 @@
1
+ import { CPAStrategy } from "../utils/strategy";
2
+ export declare const reactStrategy: CPAStrategy;
@@ -12,18 +12,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.reactStrategy = void 0;
15
16
  const fs_1 = __importDefault(require("fs"));
16
17
  const path_1 = __importDefault(require("path"));
17
18
  const cmd_utils_1 = require("../utils/cmd-utils");
19
+ const codegen_1 = require("../utils/codegen");
18
20
  const file_utils_1 = require("../utils/file-utils");
19
21
  const npm_utils_1 = require("../utils/npm-utils");
20
- const common_1 = require("./common");
21
- const reactStrategy = {
22
+ exports.reactStrategy = {
22
23
  create: (args) => __awaiter(void 0, void 0, void 0, function* () {
23
- const { projectPath, useTypescript } = args;
24
+ const { projectPath, jsOrTs } = args;
24
25
  let { template } = args;
25
26
  const createCommand = `npx create-react-app@latest ${projectPath}`;
26
- if (!template && useTypescript) {
27
+ if (!template && jsOrTs === "ts") {
27
28
  template = "typescript";
28
29
  }
29
30
  const templateArg = template ? ` --template ${template}` : "";
@@ -36,18 +37,18 @@ const reactStrategy = {
36
37
  });
37
38
  }
38
39
  else {
39
- return yield (0, common_1.installCodegenDeps)({ projectPath });
40
+ return yield (0, codegen_1.installCodegenDeps)({ projectPath });
40
41
  }
41
42
  }),
42
43
  overwriteConfig: (args) => __awaiter(void 0, void 0, void 0, function* () {
43
44
  // No config to overwrite
44
45
  }),
45
- generateFiles: ({ scheme, projectApiToken, projectId, projectPath, useTypescript, }) => __awaiter(void 0, void 0, void 0, function* () {
46
+ generateFiles: ({ scheme, projectApiToken, projectId, projectPath, jsOrTs, }) => __awaiter(void 0, void 0, void 0, function* () {
46
47
  if (scheme === "loader") {
47
48
  // Nothing to do
48
49
  }
49
50
  else {
50
- yield (0, common_1.runCodegenSync)({
51
+ yield (0, codegen_1.runCodegenSync)({
51
52
  projectId,
52
53
  projectApiToken,
53
54
  projectPath,
@@ -55,8 +56,8 @@ const reactStrategy = {
55
56
  // Overwrite the App.tsx
56
57
  yield (0, file_utils_1.overwriteIndex)(projectPath, "react", scheme);
57
58
  }
58
- // Deactivate React.StrictMode from index.tsx
59
- const indexFileName = path_1.default.join(projectPath, "src", `index.${useTypescript ? "tsx" : "js"}`);
59
+ // Deactivate React.StrictMode from index.js or index.tsx
60
+ const indexFileName = path_1.default.join(projectPath, "src", `index.${jsOrTs === "js" ? "js" : "tsx"}`);
60
61
  let indexFile = fs_1.default.readFileSync(indexFileName).toString();
61
62
  indexFile = indexFile.replace("<React.StrictMode>", "");
62
63
  indexFile = indexFile.replace("</React.StrictMode>", "");
@@ -68,4 +69,3 @@ const reactStrategy = {
68
69
  yield (0, cmd_utils_1.spawnOrFail)(`${npmRunCmd} build`, projectPath);
69
70
  }),
70
71
  };
71
- exports.default = reactStrategy;
@@ -1,2 +1,2 @@
1
- import { PlatformType } from "../lib";
2
- export declare const README: (platform: PlatformType, buildCommand: string) => string;
1
+ import { PlatformType } from "../utils/types";
2
+ export declare function README(platform: PlatformType, buildCommand: string): string;
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.README = void 0;
4
- const lib_1 = require("../lib");
5
- const README = (platform, buildCommand) => `
6
- This is a ${(0, lib_1.toString)(platform)} project bootstrapped with [\`create-plasmic-app\`](https://www.npmjs.com/package/create-plasmic-app).
4
+ const types_1 = require("../utils/types");
5
+ function README(platform, buildCommand) {
6
+ return `This is a ${(0, types_1.platformTypeToString)(platform)} project bootstrapped with [\`create-plasmic-app\`](https://www.npmjs.com/package/create-plasmic-app).
7
7
 
8
8
  ## Getting Started
9
9
 
@@ -28,5 +28,6 @@ To learn more about Plasmic, take a look at the following resources:
28
28
  - [Plasmic Slack Community](https://www.plasmic.app/slack)
29
29
 
30
30
  You can check out [the Plasmic GitHub repository](https://github.com/plasmicapp/plasmic) - your feedback and contributions are welcome!
31
- `.trim();
31
+ `;
32
+ }
32
33
  exports.README = README;
@@ -1,2 +1,2 @@
1
- export declare const PLASMIC_LOGO = "\nfunction PlasmicLogo() {\n return (\n <svg\n width={40}\n height={40}\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M34 26h-2v-1c0-6.627-5.373-12-12-12S8 18.374 8 25v1H6a1 1 0 01-1-1c0-8.284 6.716-15 15-15 8.284 0 15 6.716 15 15a1 1 0 01-1 1z\"\n fill=\"url(#paint0_linear)\"\n />\n <path\n d=\"M27 25a7 7 0 00-14 0v1h2a1 1 0 001-1 4 4 0 018 0 1 1 0 001 1h2v-1z\"\n fill=\"url(#paint1_linear)\"\n />\n <path\n d=\"M30.999 25C30.999 18.925 26.075 14 20 14S9.001 18.926 9.001 25H9v1h3v-1a8 8 0 0116 0v1h3v-1h-.001z\"\n fill=\"url(#paint2_linear)\"\n />\n <defs>\n <linearGradient\n id=\"paint0_linear\"\n x1={5}\n y1={26}\n x2={35}\n y2={26}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#1877F2\" />\n <stop offset={1} stopColor=\"#04A4F4\" />\n </linearGradient>\n <linearGradient\n id=\"paint1_linear\"\n x1={13}\n y1={26}\n x2={27}\n y2={26}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#F02849\" />\n <stop offset={1} stopColor=\"#F5533D\" />\n </linearGradient>\n <linearGradient\n id=\"paint2_linear\"\n x1={9}\n y1={26}\n x2={31}\n y2={26}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#45BD62\" />\n <stop offset={1} stopColor=\"#2ABBA7\" />\n </linearGradient>\n </defs>\n </svg>\n );\n}\n";
2
- export declare const WELCOME_PAGE: (hasPages: boolean, platform: string, pageSection: string) => string;
1
+ export declare const PLASMIC_LOGO = "function PlasmicLogo() {\n return (\n <svg\n width={40}\n height={40}\n viewBox=\"0 0 40 40\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n >\n <path\n fillRule=\"evenodd\"\n clipRule=\"evenodd\"\n d=\"M34 26h-2v-1c0-6.627-5.373-12-12-12S8 18.374 8 25v1H6a1 1 0 01-1-1c0-8.284 6.716-15 15-15 8.284 0 15 6.716 15 15a1 1 0 01-1 1z\"\n fill=\"url(#paint0_linear)\"\n />\n <path\n d=\"M27 25a7 7 0 00-14 0v1h2a1 1 0 001-1 4 4 0 018 0 1 1 0 001 1h2v-1z\"\n fill=\"url(#paint1_linear)\"\n />\n <path\n d=\"M30.999 25C30.999 18.925 26.075 14 20 14S9.001 18.926 9.001 25H9v1h3v-1a8 8 0 0116 0v1h3v-1h-.001z\"\n fill=\"url(#paint2_linear)\"\n />\n <defs>\n <linearGradient\n id=\"paint0_linear\"\n x1={5}\n y1={26}\n x2={35}\n y2={26}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#1877F2\" />\n <stop offset={1} stopColor=\"#04A4F4\" />\n </linearGradient>\n <linearGradient\n id=\"paint1_linear\"\n x1={13}\n y1={26}\n x2={27}\n y2={26}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#F02849\" />\n <stop offset={1} stopColor=\"#F5533D\" />\n </linearGradient>\n <linearGradient\n id=\"paint2_linear\"\n x1={9}\n y1={26}\n x2={31}\n y2={26}\n gradientUnits=\"userSpaceOnUse\"\n >\n <stop stopColor=\"#45BD62\" />\n <stop offset={1} stopColor=\"#2ABBA7\" />\n </linearGradient>\n </defs>\n </svg>\n );\n}\n";
2
+ export declare function WELCOME_PAGE(hasPages: boolean, platform: string, pageSection: string): string;
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.WELCOME_PAGE = exports.PLASMIC_LOGO = void 0;
4
- exports.PLASMIC_LOGO = `
5
- function PlasmicLogo() {
4
+ exports.PLASMIC_LOGO = `function PlasmicLogo() {
6
5
  return (
7
6
  <svg
8
7
  width={40}
@@ -64,8 +63,8 @@ function PlasmicLogo() {
64
63
  );
65
64
  }
66
65
  `;
67
- const WELCOME_PAGE = (hasPages, platform, pageSection) => `
68
- import React from "react";
66
+ function WELCOME_PAGE(hasPages, platform, pageSection) {
67
+ return `import React from "react";
69
68
  ${hasPages && platform === "nextjs" ? `import Link from "next/link";` : ""}
70
69
  ${exports.PLASMIC_LOGO}
71
70
 
@@ -95,5 +94,6 @@ function Index() {
95
94
  }
96
95
 
97
96
  export default Index;
98
- `.trim();
97
+ `;
98
+ }
99
99
  exports.WELCOME_PAGE = WELCOME_PAGE;
File without changes
@@ -1,4 +1,4 @@
1
- import { PlatformType } from "../lib";
1
+ import { JsOrTs, PlatformType } from "../utils/types";
2
2
  /**
3
3
  * Runs the search pattern through `glob` and deletes all resulting files
4
4
  * @param searchPattern - glob search query
@@ -24,4 +24,4 @@ export declare function overwriteIndex(projectPath: string, platform: string, sc
24
24
  */
25
25
  export declare function overwriteReadme(projectPath: string, platform: PlatformType, buildCommand: string): Promise<void>;
26
26
  export declare function ensureTsconfig(projectPath: string): Promise<void>;
27
- export declare function ifTs(ts: boolean, str: string): string;
27
+ export declare function ifTs(ts: JsOrTs, str: string): string;
@@ -40,7 +40,7 @@ const fs_1 = require("fs");
40
40
  const glob_1 = __importDefault(require("glob"));
41
41
  const lodash_1 = __importDefault(require("lodash"));
42
42
  const path = __importStar(require("upath"));
43
- const gatsby_1 = require("../templates/gatsby");
43
+ const template_1 = require("../gatsby/template");
44
44
  const readme_1 = require("../templates/readme");
45
45
  const welcomePage_1 = require("../templates/welcomePage");
46
46
  const lang_utils_1 = require("./lang-utils");
@@ -124,7 +124,7 @@ function overwriteIndex(projectPath, platform, scheme) {
124
124
  // Create a very basic 404 page - `gatsby build` fails without it.
125
125
  // We've deleted the components that the default 404 page depended
126
126
  // on, so
127
- yield fs_1.promises.writeFile(path.join(projectPath, "src/pages/404.js"), gatsby_1.GATSBY_404);
127
+ yield fs_1.promises.writeFile(path.join(projectPath, "src/pages/404.js"), template_1.GATSBY_404);
128
128
  }
129
129
  // We're done if we can already render an index page
130
130
  if ((isNextjs || isGatsby) &&
@@ -253,6 +253,6 @@ function ensureTsconfig(projectPath) {
253
253
  }
254
254
  exports.ensureTsconfig = ensureTsconfig;
255
255
  function ifTs(ts, str) {
256
- return ts ? str : "";
256
+ return ts === "ts" ? str : "";
257
257
  }
258
258
  exports.ifTs = ifTs;
@@ -1,31 +1,34 @@
1
- import { CodeScheme } from "..";
2
- interface CreateArgs {
1
+ import { JsOrTs, PlatformOptions, SchemeType } from "./types";
2
+ export interface CreateArgs {
3
3
  projectPath: string;
4
4
  template?: string;
5
- useTypescript: boolean;
5
+ jsOrTs: JsOrTs;
6
+ platformOptions: PlatformOptions;
6
7
  }
7
- interface ConfigArgs {
8
+ export interface ConfigArgs {
8
9
  projectId: string;
9
10
  projectPath: string;
10
- useTypescript: boolean;
11
- scheme: CodeScheme;
11
+ jsOrTs: JsOrTs;
12
+ scheme: SchemeType;
12
13
  projectApiToken: string | undefined;
14
+ platformOptions: PlatformOptions;
13
15
  }
14
- interface GenerateFilesArgs {
16
+ export interface GenerateFilesArgs {
15
17
  projectPath: string;
16
- useTypescript: boolean;
17
- scheme: CodeScheme;
18
+ jsOrTs: JsOrTs;
19
+ scheme: SchemeType;
18
20
  projectId: string;
19
21
  projectApiToken: string | undefined;
22
+ platformOptions: PlatformOptions;
20
23
  }
21
- interface BuildArgs {
24
+ export interface BuildArgs {
22
25
  projectPath: string;
23
26
  npmRunCmd: string;
24
27
  }
25
- interface InstallArgs {
26
- scheme: CodeScheme;
28
+ export interface InstallArgs {
29
+ scheme: SchemeType;
27
30
  projectPath: string;
28
- useTypescript: boolean;
31
+ jsOrTs: JsOrTs;
29
32
  }
30
33
  export interface CPAStrategy {
31
34
  create: (args: CreateArgs) => Promise<void>;
@@ -34,4 +37,3 @@ export interface CPAStrategy {
34
37
  generateFiles: (args: GenerateFilesArgs) => Promise<void>;
35
38
  build: (args: BuildArgs) => Promise<void>;
36
39
  }
37
- export {};
File without changes
@@ -0,0 +1,9 @@
1
+ export type JsOrTs = "js" | "ts";
2
+ export type PlatformType = "nextjs" | "gatsby" | "react";
3
+ export type PlatformOptions = {
4
+ nextjs?: {
5
+ appDir: boolean;
6
+ };
7
+ };
8
+ export type SchemeType = "codegen" | "loader";
9
+ export declare function platformTypeToString(s: PlatformType): string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.platformTypeToString = void 0;
4
+ function platformTypeToString(s) {
5
+ return s === "nextjs" ? "Next.js" : s === "gatsby" ? "Gatsby" : "React";
6
+ }
7
+ exports.platformTypeToString = platformTypeToString;