create-plasmic-app 0.0.62 → 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.
- package/README.internal.md +6 -2
- package/cpa-out/.gitignore +15 -0
- package/cpa-out/gatsby-codegen-js/gatsby-browser.jsx +11 -0
- package/cpa-out/gatsby-codegen-js/gatsby-config.js +9 -0
- package/cpa-out/gatsby-codegen-js/gatsby-node.js +0 -0
- package/cpa-out/gatsby-codegen-js/gatsby-ssr.jsx +11 -0
- package/cpa-out/gatsby-codegen-js/package.json +26 -0
- package/cpa-out/gatsby-codegen-js/plasmic.json +79 -0
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
- package/cpa-out/gatsby-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +206 -0
- package/cpa-out/gatsby-codegen-js/src/pages/404.js +4 -0
- package/cpa-out/gatsby-codegen-js/src/pages/index.jsx +39 -0
- package/cpa-out/gatsby-codegen-ts/gatsby-browser.tsx +11 -0
- package/cpa-out/gatsby-codegen-ts/gatsby-config.ts +14 -0
- package/cpa-out/gatsby-codegen-ts/gatsby-node.ts +0 -0
- package/cpa-out/gatsby-codegen-ts/gatsby-ssr.tsx +11 -0
- package/cpa-out/gatsby-codegen-ts/package.json +34 -0
- package/cpa-out/gatsby-codegen-ts/plasmic.json +79 -0
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
- package/cpa-out/gatsby-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +290 -0
- package/cpa-out/gatsby-codegen-ts/src/pages/404.js +4 -0
- package/cpa-out/gatsby-codegen-ts/src/pages/index.tsx +41 -0
- package/cpa-out/gatsby-codegen-ts/tsconfig.json +102 -0
- package/cpa-out/gatsby-loader-js/gatsby-config.js +25 -0
- package/cpa-out/gatsby-loader-js/gatsby-node.js +0 -0
- package/cpa-out/gatsby-loader-js/gatsby-ssr.jsx +44 -0
- package/cpa-out/gatsby-loader-js/package.json +24 -0
- package/cpa-out/gatsby-loader-js/src/pages/404.js +4 -0
- package/cpa-out/gatsby-loader-js/src/pages/plasmic-host.jsx +19 -0
- package/cpa-out/gatsby-loader-js/src/plasmic-init.js +18 -0
- package/cpa-out/gatsby-loader-js/src/templates/defaultPlasmicPage.jsx +44 -0
- package/cpa-out/gatsby-loader-ts/gatsby-config.ts +31 -0
- package/cpa-out/gatsby-loader-ts/gatsby-node.ts +0 -0
- package/cpa-out/gatsby-loader-ts/gatsby-ssr.tsx +44 -0
- package/cpa-out/gatsby-loader-ts/package.json +32 -0
- package/cpa-out/gatsby-loader-ts/src/pages/404.ts +4 -0
- package/cpa-out/gatsby-loader-ts/src/pages/plasmic-host.tsx +24 -0
- package/cpa-out/gatsby-loader-ts/src/plasmic-init.ts +19 -0
- package/cpa-out/gatsby-loader-ts/src/templates/defaultPlasmicPage.tsx +52 -0
- package/cpa-out/gatsby-loader-ts/tsconfig.json +102 -0
- package/cpa-out/nextjs-app-loader-js/app/[[...catchall]]/page.jsx +56 -0
- package/cpa-out/nextjs-app-loader-js/app/head.js +10 -0
- package/cpa-out/nextjs-app-loader-js/app/layout.js +14 -0
- package/cpa-out/nextjs-app-loader-js/app/plasmic-host/page.jsx +6 -0
- package/cpa-out/nextjs-app-loader-js/next.config.js +13 -0
- package/cpa-out/nextjs-app-loader-js/package.json +20 -0
- package/cpa-out/nextjs-app-loader-js/pages/api/hello.js +5 -0
- package/cpa-out/nextjs-app-loader-js/plasmic-init-client.jsx +65 -0
- package/cpa-out/nextjs-app-loader-js/plasmic-init.js +16 -0
- package/cpa-out/nextjs-app-loader-ts/app/[[...catchall]]/page.tsx +59 -0
- package/cpa-out/nextjs-app-loader-ts/app/head.tsx +10 -0
- package/cpa-out/nextjs-app-loader-ts/app/layout.tsx +18 -0
- package/cpa-out/nextjs-app-loader-ts/app/plasmic-host/page.tsx +6 -0
- package/cpa-out/nextjs-app-loader-ts/next.config.js +13 -0
- package/cpa-out/nextjs-app-loader-ts/package.json +24 -0
- package/cpa-out/nextjs-app-loader-ts/pages/api/hello.ts +13 -0
- package/cpa-out/nextjs-app-loader-ts/plasmic-init-client.tsx +65 -0
- package/cpa-out/nextjs-app-loader-ts/plasmic-init.ts +16 -0
- package/cpa-out/nextjs-app-loader-ts/tsconfig.json +29 -0
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
- package/cpa-out/nextjs-pages-codegen-js/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +205 -0
- package/cpa-out/nextjs-pages-codegen-js/next.config.js +10 -0
- package/cpa-out/nextjs-pages-codegen-js/package.json +22 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/_app.jsx +11 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/api/hello.js +5 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/index.jsx +35 -0
- package/cpa-out/nextjs-pages-codegen-js/pages/plasmic-host.jsx +15 -0
- package/cpa-out/nextjs-pages-codegen-js/plasmic.json +79 -0
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
- package/cpa-out/nextjs-pages-codegen-ts/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +287 -0
- package/cpa-out/nextjs-pages-codegen-ts/next.config.js +10 -0
- package/cpa-out/nextjs-pages-codegen-ts/package.json +26 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/_app.tsx +12 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/api/hello.ts +13 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/index.tsx +37 -0
- package/cpa-out/nextjs-pages-codegen-ts/pages/plasmic-host.tsx +15 -0
- package/cpa-out/nextjs-pages-codegen-ts/plasmic.json +79 -0
- package/cpa-out/nextjs-pages-codegen-ts/tsconfig.json +24 -0
- package/cpa-out/nextjs-pages-loader-js/next.config.js +10 -0
- package/cpa-out/nextjs-pages-loader-js/package.json +20 -0
- package/cpa-out/nextjs-pages-loader-js/pages/[[...catchall]].jsx +66 -0
- package/cpa-out/nextjs-pages-loader-js/pages/api/hello.js +5 -0
- package/cpa-out/nextjs-pages-loader-js/pages/plasmic-host.jsx +7 -0
- package/cpa-out/nextjs-pages-loader-js/plasmic-init.js +25 -0
- package/cpa-out/nextjs-pages-loader-ts/next.config.js +10 -0
- package/cpa-out/nextjs-pages-loader-ts/package.json +24 -0
- package/cpa-out/nextjs-pages-loader-ts/pages/[[...catchall]].tsx +70 -0
- package/cpa-out/nextjs-pages-loader-ts/pages/api/hello.ts +13 -0
- package/cpa-out/nextjs-pages-loader-ts/pages/plasmic-host.tsx +7 -0
- package/cpa-out/nextjs-pages-loader-ts/plasmic-init.ts +25 -0
- package/cpa-out/nextjs-pages-loader-ts/tsconfig.json +24 -0
- package/cpa-out/react-codegen-js/package.json +41 -0
- package/cpa-out/react-codegen-js/plasmic.json +76 -0
- package/cpa-out/react-codegen-js/src/App.jsx +9 -0
- package/cpa-out/react-codegen-js/src/components/Homepage.jsx +26 -0
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
- package/cpa-out/react-codegen-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +196 -0
- package/cpa-out/react-codegen-js/src/index.js +17 -0
- package/cpa-out/react-codegen-js/src/reportWebVitals.js +13 -0
- package/cpa-out/react-codegen-js/src/setupTests.js +5 -0
- package/cpa-out/react-codegen-ts/package.json +46 -0
- package/cpa-out/react-codegen-ts/plasmic.json +76 -0
- package/cpa-out/react-codegen-ts/src/App.tsx +9 -0
- package/cpa-out/react-codegen-ts/src/components/Homepage.tsx +45 -0
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
- package/cpa-out/react-codegen-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +280 -0
- package/cpa-out/react-codegen-ts/src/index.tsx +19 -0
- package/cpa-out/react-codegen-ts/src/react-app-env.d.ts +1 -0
- package/cpa-out/react-codegen-ts/src/reportWebVitals.ts +15 -0
- package/cpa-out/react-codegen-ts/src/setupTests.ts +5 -0
- package/cpa-out/react-codegen-ts/tsconfig.json +26 -0
- package/cpa-out/react-loader-js/package.json +41 -0
- package/cpa-out/react-loader-js/plasmic.json +76 -0
- package/cpa-out/react-loader-js/src/App.jsx +9 -0
- package/cpa-out/react-loader-js/src/components/Homepage.jsx +26 -0
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.jsx +29 -0
- package/cpa-out/react-loader-js/src/components/plasmic/create_plasmic_app/PlasmicHomepage.jsx +196 -0
- package/cpa-out/react-loader-js/src/index.js +17 -0
- package/cpa-out/react-loader-js/src/reportWebVitals.js +13 -0
- package/cpa-out/react-loader-js/src/setupTests.js +5 -0
- package/cpa-out/react-loader-ts/package.json +46 -0
- package/cpa-out/react-loader-ts/plasmic.json +76 -0
- package/cpa-out/react-loader-ts/src/App.tsx +9 -0
- package/cpa-out/react-loader-ts/src/components/Homepage.tsx +45 -0
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicGlobalVariant__Screen.tsx +30 -0
- package/cpa-out/react-loader-ts/src/components/plasmic/create_plasmic_app/PlasmicHomepage.tsx +280 -0
- package/cpa-out/react-loader-ts/src/index.tsx +19 -0
- package/cpa-out/react-loader-ts/src/react-app-env.d.ts +1 -0
- package/cpa-out/react-loader-ts/src/reportWebVitals.ts +15 -0
- package/cpa-out/react-loader-ts/src/setupTests.ts +5 -0
- package/cpa-out/react-loader-ts/tsconfig.json +26 -0
- package/dist/gatsby/gatsby.d.ts +6 -0
- package/dist/{strategies → gatsby}/gatsby.js +26 -29
- package/dist/gatsby/template.d.ts +11 -0
- package/dist/{templates/gatsby.js → gatsby/template.js} +34 -42
- package/dist/index.d.ts +1 -1
- package/dist/index.js +57 -27
- package/dist/lib.d.ts +3 -4
- package/dist/lib.js +22 -12
- package/dist/nextjs/nextjs.d.ts +2 -0
- package/dist/nextjs/nextjs.js +155 -0
- package/dist/nextjs/templates/app-loader/catchall-page.d.ts +2 -0
- package/dist/nextjs/templates/app-loader/catchall-page.js +67 -0
- package/dist/nextjs/templates/app-loader/plasmic-host.d.ts +1 -0
- package/dist/nextjs/templates/app-loader/plasmic-host.js +13 -0
- package/dist/nextjs/templates/app-loader/plasmic-init-client.d.ts +2 -0
- package/dist/nextjs/templates/app-loader/plasmic-init-client.js +73 -0
- package/dist/nextjs/templates/app-loader/plasmic-init.d.ts +1 -0
- package/dist/nextjs/templates/app-loader/plasmic-init.js +23 -0
- package/dist/nextjs/templates/pages-codegen/app.d.ts +2 -0
- package/dist/nextjs/templates/pages-codegen/app.js +20 -0
- package/dist/nextjs/templates/pages-codegen/plasmic-host.d.ts +1 -0
- package/dist/nextjs/templates/pages-codegen/plasmic-host.js +22 -0
- package/dist/nextjs/templates/pages-loader/catchall-page.d.ts +2 -0
- package/dist/nextjs/templates/pages-loader/catchall-page.js +77 -0
- package/dist/nextjs/templates/pages-loader/plasmic-host.d.ts +1 -0
- package/dist/nextjs/templates/pages-loader/plasmic-host.js +14 -0
- package/dist/nextjs/templates/pages-loader/plasmic-init.d.ts +1 -0
- package/dist/nextjs/templates/pages-loader/plasmic-init.js +32 -0
- package/dist/react/react.d.ts +2 -0
- package/dist/{strategies → react}/react.js +10 -10
- package/dist/templates/readme.d.ts +2 -2
- package/dist/templates/readme.js +5 -4
- package/dist/templates/welcomePage.d.ts +2 -2
- package/dist/templates/welcomePage.js +5 -5
- package/dist/{strategies/common.d.ts → utils/codegen.d.ts} +0 -0
- package/dist/{strategies/common.js → utils/codegen.js} +0 -0
- package/dist/utils/file-utils.d.ts +2 -2
- package/dist/utils/file-utils.js +3 -3
- package/dist/{strategies/types.d.ts → utils/strategy.d.ts} +16 -14
- package/dist/{strategies/types.js → utils/strategy.js} +0 -0
- package/dist/utils/types.d.ts +9 -0
- package/dist/utils/types.js +7 -0
- package/package.json +4 -3
- package/run-cpa.ts +151 -0
- package/src/{strategies → gatsby}/gatsby.ts +28 -46
- package/src/{templates/gatsby.ts → gatsby/template.ts} +41 -51
- package/src/index.ts +86 -56
- package/src/lib.ts +30 -15
- package/src/nextjs/nextjs.ts +180 -0
- package/src/nextjs/templates/app-loader/catchall-page.ts +71 -0
- package/src/nextjs/templates/app-loader/plasmic-host.ts +9 -0
- package/src/nextjs/templates/app-loader/plasmic-init-client.ts +74 -0
- package/src/nextjs/templates/app-loader/plasmic-init.ts +22 -0
- package/src/nextjs/templates/pages-codegen/app.ts +24 -0
- package/src/nextjs/templates/pages-codegen/plasmic-host.ts +18 -0
- package/src/nextjs/templates/pages-loader/catchall-page.ts +81 -0
- package/src/nextjs/templates/pages-loader/plasmic-host.ts +10 -0
- package/src/nextjs/templates/pages-loader/plasmic-init.ts +31 -0
- package/src/{strategies → react}/react.ts +8 -10
- package/src/templates/readme.ts +5 -5
- package/src/templates/welcomePage.ts +6 -7
- package/src/{strategies/common.ts → utils/codegen.ts} +0 -0
- package/src/utils/file-utils.ts +4 -4
- package/src/utils/strategy.ts +48 -0
- package/src/utils/types.ts +12 -0
- package/dist/strategies/gatsby.d.ts +0 -7
- package/dist/strategies/index.d.ts +0 -2
- package/dist/strategies/index.js +0 -22
- package/dist/strategies/nextjs.d.ts +0 -3
- package/dist/strategies/nextjs.js +0 -104
- package/dist/strategies/react.d.ts +0 -3
- package/dist/templates/gatsby.d.ts +0 -11
- package/dist/templates/nextjs.d.ts +0 -5
- package/dist/templates/nextjs.js +0 -162
- package/src/strategies/index.ts +0 -21
- package/src/strategies/nextjs.ts +0 -131
- package/src/strategies/types.ts +0 -42
- package/src/templates/nextjs.ts +0 -170
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* prettier-ignore-start */
|
|
5
|
+
|
|
6
|
+
/** @jsxRuntime classic */
|
|
7
|
+
/** @jsx createPlasmicElementProxy */
|
|
8
|
+
/** @jsxFrag React.Fragment */
|
|
9
|
+
|
|
10
|
+
// This class is auto-generated by Plasmic; please do not edit!
|
|
11
|
+
// Plasmic Project: 47tFXWjN2C4NyHFGGpaYQ3
|
|
12
|
+
// Component: 6uuAAE1jiCew
|
|
13
|
+
import * as React from "react";
|
|
14
|
+
|
|
15
|
+
import * as p from "@plasmicapp/react-web";
|
|
16
|
+
import * as ph from "@plasmicapp/host";
|
|
17
|
+
|
|
18
|
+
import {
|
|
19
|
+
hasVariant,
|
|
20
|
+
classNames,
|
|
21
|
+
wrapWithClassName,
|
|
22
|
+
createPlasmicElementProxy,
|
|
23
|
+
makeFragment,
|
|
24
|
+
MultiChoiceArg,
|
|
25
|
+
SingleBooleanChoiceArg,
|
|
26
|
+
SingleChoiceArg,
|
|
27
|
+
pick,
|
|
28
|
+
omit,
|
|
29
|
+
useTrigger,
|
|
30
|
+
StrictProps,
|
|
31
|
+
deriveRenderOpts,
|
|
32
|
+
ensureGlobalVariants
|
|
33
|
+
} from "@plasmicapp/react-web";
|
|
34
|
+
|
|
35
|
+
import { useScreenVariants as useScreenVariantsscBjPxgdxdzbv } from "./PlasmicGlobalVariant__Screen"; // plasmic-import: SCBjPXGDXDZBV/globalVariant
|
|
36
|
+
|
|
37
|
+
import "@plasmicapp/react-web/lib/plasmic.css";
|
|
38
|
+
|
|
39
|
+
import projectcss from "./plasmic_create_plasmic_app.module.css"; // plasmic-import: 47tFXWjN2C4NyHFGGpaYQ3/projectcss
|
|
40
|
+
import sty from "./PlasmicHomepage.module.css"; // plasmic-import: 6uuAAE1jiCew/css
|
|
41
|
+
|
|
42
|
+
export type PlasmicHomepage__VariantMembers = {};
|
|
43
|
+
export type PlasmicHomepage__VariantsArgs = {};
|
|
44
|
+
type VariantPropType = keyof PlasmicHomepage__VariantsArgs;
|
|
45
|
+
export const PlasmicHomepage__VariantProps = new Array<VariantPropType>();
|
|
46
|
+
|
|
47
|
+
export type PlasmicHomepage__ArgsType = {};
|
|
48
|
+
type ArgPropType = keyof PlasmicHomepage__ArgsType;
|
|
49
|
+
export const PlasmicHomepage__ArgProps = new Array<ArgPropType>();
|
|
50
|
+
|
|
51
|
+
export type PlasmicHomepage__OverridesType = {
|
|
52
|
+
root?: p.Flex<"div">;
|
|
53
|
+
section?: p.Flex<"section">;
|
|
54
|
+
h1?: p.Flex<"h1">;
|
|
55
|
+
text?: p.Flex<"div">;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export interface DefaultHomepageProps {
|
|
59
|
+
className?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const __wrapUserFunction =
|
|
63
|
+
globalThis.__PlasmicWrapUserFunction ?? ((loc, fn) => fn());
|
|
64
|
+
const __wrapUserPromise =
|
|
65
|
+
globalThis.__PlasmicWrapUserPromise ??
|
|
66
|
+
(async (loc, promise) => {
|
|
67
|
+
return await promise;
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
function PlasmicHomepage__RenderFunc(props: {
|
|
71
|
+
variants: PlasmicHomepage__VariantsArgs;
|
|
72
|
+
args: PlasmicHomepage__ArgsType;
|
|
73
|
+
overrides: PlasmicHomepage__OverridesType;
|
|
74
|
+
|
|
75
|
+
forNode?: string;
|
|
76
|
+
}) {
|
|
77
|
+
const { variants, overrides, forNode } = props;
|
|
78
|
+
|
|
79
|
+
const $ctx = ph.useDataEnv?.() || {};
|
|
80
|
+
const args = React.useMemo(() => Object.assign({}, props.args), [props.args]);
|
|
81
|
+
|
|
82
|
+
const $props = {
|
|
83
|
+
...args,
|
|
84
|
+
...variants
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const currentUser = p.useCurrentUser?.() || {};
|
|
88
|
+
|
|
89
|
+
const [$queries, setDollarQueries] = React.useState({});
|
|
90
|
+
|
|
91
|
+
const globalVariants = ensureGlobalVariants({
|
|
92
|
+
screen: useScreenVariantsscBjPxgdxdzbv()
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
return (
|
|
96
|
+
<React.Fragment>
|
|
97
|
+
{}
|
|
98
|
+
|
|
99
|
+
<div className={projectcss.plasmic_page_wrapper}>
|
|
100
|
+
<div
|
|
101
|
+
data-plasmic-name={"root"}
|
|
102
|
+
data-plasmic-override={overrides.root}
|
|
103
|
+
data-plasmic-root={true}
|
|
104
|
+
data-plasmic-for-node={forNode}
|
|
105
|
+
className={classNames(
|
|
106
|
+
projectcss.all,
|
|
107
|
+
projectcss.root_reset,
|
|
108
|
+
projectcss.plasmic_default_styles,
|
|
109
|
+
projectcss.plasmic_mixins,
|
|
110
|
+
sty.root
|
|
111
|
+
)}
|
|
112
|
+
>
|
|
113
|
+
<p.Stack
|
|
114
|
+
as={"section"}
|
|
115
|
+
data-plasmic-name={"section"}
|
|
116
|
+
data-plasmic-override={overrides.section}
|
|
117
|
+
hasGap={true}
|
|
118
|
+
className={classNames(projectcss.all, sty.section)}
|
|
119
|
+
>
|
|
120
|
+
<h1
|
|
121
|
+
data-plasmic-name={"h1"}
|
|
122
|
+
data-plasmic-override={overrides.h1}
|
|
123
|
+
className={classNames(
|
|
124
|
+
projectcss.all,
|
|
125
|
+
projectcss.h1,
|
|
126
|
+
projectcss.__wab_text,
|
|
127
|
+
sty.h1
|
|
128
|
+
)}
|
|
129
|
+
>
|
|
130
|
+
{"create-plasmic-app"}
|
|
131
|
+
</h1>
|
|
132
|
+
|
|
133
|
+
<div
|
|
134
|
+
data-plasmic-name={"text"}
|
|
135
|
+
data-plasmic-override={overrides.text}
|
|
136
|
+
className={classNames(
|
|
137
|
+
projectcss.all,
|
|
138
|
+
projectcss.__wab_text,
|
|
139
|
+
sty.text
|
|
140
|
+
)}
|
|
141
|
+
>
|
|
142
|
+
{hasVariant(globalVariants, "screen", "desktopOnly") ? (
|
|
143
|
+
<React.Fragment>
|
|
144
|
+
<React.Fragment>
|
|
145
|
+
{
|
|
146
|
+
"This project is used by run-cpa.ts in the create-plasmic-app repo.\n\nrun-cpa.ts runs create-plasmic-app for many combinations of args (e.g. nextjs + appDir + loader + typescript) to check for changes in generated files. Any changes to this project will result in lots of changes to the generated files. "
|
|
147
|
+
}
|
|
148
|
+
</React.Fragment>
|
|
149
|
+
<span
|
|
150
|
+
className={"plasmic_default__all plasmic_default__span"}
|
|
151
|
+
style={{ fontWeight: 700 }}
|
|
152
|
+
>
|
|
153
|
+
{"Therefore, please avoid changing this project."}
|
|
154
|
+
</span>
|
|
155
|
+
</React.Fragment>
|
|
156
|
+
) : (
|
|
157
|
+
<React.Fragment>
|
|
158
|
+
<React.Fragment>
|
|
159
|
+
{
|
|
160
|
+
"If you haven't already done so, go back and learn the basics by going through the Plasmic Levels tutorial.\n\nIt's always easier to start from examples! Add a new page using a template—do this from the list of pages in the top left (the gray + button).\n\nOr press the big blue + button to start dragging items into this page.\n\nIntegrate this project into your codebase—press the "
|
|
161
|
+
}
|
|
162
|
+
</React.Fragment>
|
|
163
|
+
<span
|
|
164
|
+
className={"plasmic_default__all plasmic_default__span"}
|
|
165
|
+
style={{ fontWeight: 700 }}
|
|
166
|
+
>
|
|
167
|
+
{"Code"}
|
|
168
|
+
</span>
|
|
169
|
+
<React.Fragment>
|
|
170
|
+
{
|
|
171
|
+
" button in the top right and follow the quickstart instructions.\n\nJoin our Slack community (icon in bottom left) for help any time."
|
|
172
|
+
}
|
|
173
|
+
</React.Fragment>
|
|
174
|
+
</React.Fragment>
|
|
175
|
+
)}
|
|
176
|
+
</div>
|
|
177
|
+
</p.Stack>
|
|
178
|
+
</div>
|
|
179
|
+
</div>
|
|
180
|
+
</React.Fragment>
|
|
181
|
+
) as React.ReactElement | null;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
const PlasmicDescendants = {
|
|
185
|
+
root: ["root", "section", "h1", "text"],
|
|
186
|
+
section: ["section", "h1", "text"],
|
|
187
|
+
h1: ["h1"],
|
|
188
|
+
text: ["text"]
|
|
189
|
+
} as const;
|
|
190
|
+
type NodeNameType = keyof typeof PlasmicDescendants;
|
|
191
|
+
type DescendantsType<T extends NodeNameType> =
|
|
192
|
+
(typeof PlasmicDescendants)[T][number];
|
|
193
|
+
type NodeDefaultElementType = {
|
|
194
|
+
root: "div";
|
|
195
|
+
section: "section";
|
|
196
|
+
h1: "h1";
|
|
197
|
+
text: "div";
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
type ReservedPropsType = "variants" | "args" | "overrides";
|
|
201
|
+
type NodeOverridesType<T extends NodeNameType> = Pick<
|
|
202
|
+
PlasmicHomepage__OverridesType,
|
|
203
|
+
DescendantsType<T>
|
|
204
|
+
>;
|
|
205
|
+
type NodeComponentProps<T extends NodeNameType> =
|
|
206
|
+
// Explicitly specify variants, args, and overrides as objects
|
|
207
|
+
{
|
|
208
|
+
variants?: PlasmicHomepage__VariantsArgs;
|
|
209
|
+
args?: PlasmicHomepage__ArgsType;
|
|
210
|
+
overrides?: NodeOverridesType<T>;
|
|
211
|
+
} & Omit<PlasmicHomepage__VariantsArgs, ReservedPropsType> & // Specify variants directly as props
|
|
212
|
+
/* Specify args directly as props*/ Omit<
|
|
213
|
+
PlasmicHomepage__ArgsType,
|
|
214
|
+
ReservedPropsType
|
|
215
|
+
> &
|
|
216
|
+
/* Specify overrides for each element directly as props*/ Omit<
|
|
217
|
+
NodeOverridesType<T>,
|
|
218
|
+
ReservedPropsType | VariantPropType | ArgPropType
|
|
219
|
+
> &
|
|
220
|
+
/* Specify props for the root element*/ Omit<
|
|
221
|
+
Partial<React.ComponentProps<NodeDefaultElementType[T]>>,
|
|
222
|
+
ReservedPropsType | VariantPropType | ArgPropType | DescendantsType<T>
|
|
223
|
+
>;
|
|
224
|
+
|
|
225
|
+
function makeNodeComponent<NodeName extends NodeNameType>(nodeName: NodeName) {
|
|
226
|
+
type PropsType = NodeComponentProps<NodeName> & { key?: React.Key };
|
|
227
|
+
const func = function <T extends PropsType>(
|
|
228
|
+
props: T & StrictProps<T, PropsType>
|
|
229
|
+
) {
|
|
230
|
+
const { variants, args, overrides } = React.useMemo(
|
|
231
|
+
() =>
|
|
232
|
+
deriveRenderOpts(props, {
|
|
233
|
+
name: nodeName,
|
|
234
|
+
descendantNames: [...PlasmicDescendants[nodeName]],
|
|
235
|
+
internalArgPropNames: PlasmicHomepage__ArgProps,
|
|
236
|
+
internalVariantPropNames: PlasmicHomepage__VariantProps
|
|
237
|
+
}),
|
|
238
|
+
[props, nodeName]
|
|
239
|
+
);
|
|
240
|
+
|
|
241
|
+
return PlasmicHomepage__RenderFunc({
|
|
242
|
+
variants,
|
|
243
|
+
args,
|
|
244
|
+
overrides,
|
|
245
|
+
forNode: nodeName
|
|
246
|
+
});
|
|
247
|
+
};
|
|
248
|
+
if (nodeName === "root") {
|
|
249
|
+
func.displayName = "PlasmicHomepage";
|
|
250
|
+
} else {
|
|
251
|
+
func.displayName = `PlasmicHomepage.${nodeName}`;
|
|
252
|
+
}
|
|
253
|
+
return func;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export const PlasmicHomepage = Object.assign(
|
|
257
|
+
// Top-level PlasmicHomepage renders the root element
|
|
258
|
+
makeNodeComponent("root"),
|
|
259
|
+
{
|
|
260
|
+
// Helper components rendering sub-elements
|
|
261
|
+
section: makeNodeComponent("section"),
|
|
262
|
+
h1: makeNodeComponent("h1"),
|
|
263
|
+
text: makeNodeComponent("text"),
|
|
264
|
+
|
|
265
|
+
// Metadata about props expected for PlasmicHomepage
|
|
266
|
+
internalVariantProps: PlasmicHomepage__VariantProps,
|
|
267
|
+
internalArgProps: PlasmicHomepage__ArgProps,
|
|
268
|
+
|
|
269
|
+
// Page metadata
|
|
270
|
+
pageMetadata: {
|
|
271
|
+
title: "",
|
|
272
|
+
description: "",
|
|
273
|
+
ogImageSrc: "",
|
|
274
|
+
canonical: ""
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
|
|
279
|
+
export default PlasmicHomepage;
|
|
280
|
+
/* prettier-ignore-end */
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import ReactDOM from 'react-dom/client';
|
|
3
|
+
import './index.css';
|
|
4
|
+
import App from './App';
|
|
5
|
+
import reportWebVitals from './reportWebVitals';
|
|
6
|
+
|
|
7
|
+
const root = ReactDOM.createRoot(
|
|
8
|
+
document.getElementById('root') as HTMLElement
|
|
9
|
+
);
|
|
10
|
+
root.render(
|
|
11
|
+
|
|
12
|
+
<App />
|
|
13
|
+
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
// If you want to start measuring performance in your app, pass a function
|
|
17
|
+
// to log results (for example: reportWebVitals(console.log))
|
|
18
|
+
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
|
19
|
+
reportWebVitals();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="react-scripts" />
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ReportHandler } from 'web-vitals';
|
|
2
|
+
|
|
3
|
+
const reportWebVitals = (onPerfEntry?: ReportHandler) => {
|
|
4
|
+
if (onPerfEntry && onPerfEntry instanceof Function) {
|
|
5
|
+
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
|
6
|
+
getCLS(onPerfEntry);
|
|
7
|
+
getFID(onPerfEntry);
|
|
8
|
+
getFCP(onPerfEntry);
|
|
9
|
+
getLCP(onPerfEntry);
|
|
10
|
+
getTTFB(onPerfEntry);
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export default reportWebVitals;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es5",
|
|
4
|
+
"lib": [
|
|
5
|
+
"dom",
|
|
6
|
+
"dom.iterable",
|
|
7
|
+
"esnext"
|
|
8
|
+
],
|
|
9
|
+
"allowJs": true,
|
|
10
|
+
"skipLibCheck": true,
|
|
11
|
+
"esModuleInterop": true,
|
|
12
|
+
"allowSyntheticDefaultImports": true,
|
|
13
|
+
"strict": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"noFallthroughCasesInSwitch": true,
|
|
16
|
+
"module": "esnext",
|
|
17
|
+
"moduleResolution": "node",
|
|
18
|
+
"resolveJsonModule": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"noEmit": true,
|
|
21
|
+
"jsx": "react-jsx"
|
|
22
|
+
},
|
|
23
|
+
"include": [
|
|
24
|
+
"src"
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -42,38 +42,38 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
42
42
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
43
43
|
};
|
|
44
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
-
exports.GATSBY_TEMPLATES = void 0;
|
|
45
|
+
exports.gatsbyStrategy = exports.GATSBY_TEMPLATES = void 0;
|
|
46
46
|
const fs_1 = require("fs");
|
|
47
47
|
const path_1 = __importDefault(require("path"));
|
|
48
48
|
const readline = __importStar(require("readline"));
|
|
49
|
-
const gatsby_1 = require("../templates/gatsby");
|
|
50
49
|
const cmd_utils_1 = require("../utils/cmd-utils");
|
|
50
|
+
const codegen_1 = require("../utils/codegen");
|
|
51
51
|
const file_utils_1 = require("../utils/file-utils");
|
|
52
52
|
const lang_utils_1 = require("../utils/lang-utils");
|
|
53
53
|
const npm_utils_1 = require("../utils/npm-utils");
|
|
54
|
-
const
|
|
54
|
+
const template_1 = require("./template");
|
|
55
55
|
exports.GATSBY_TEMPLATES = {
|
|
56
56
|
js: `https://github.com/gatsbyjs/gatsby-starter-minimal.git`,
|
|
57
57
|
ts: `https://github.com/gatsbyjs/gatsby-starter-minimal-ts.git`,
|
|
58
58
|
};
|
|
59
|
-
|
|
59
|
+
exports.gatsbyStrategy = {
|
|
60
60
|
create: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
61
|
-
const { projectPath, template,
|
|
61
|
+
const { projectPath, template, jsOrTs } = args;
|
|
62
62
|
if (template) {
|
|
63
63
|
console.log(`Warning: Ignoring template '${template}' (argument is not supported by Gatsby).`);
|
|
64
64
|
}
|
|
65
|
-
const gatsbyTemplate = exports.GATSBY_TEMPLATES[
|
|
65
|
+
const gatsbyTemplate = exports.GATSBY_TEMPLATES[jsOrTs];
|
|
66
66
|
const createCommand = `git clone ${gatsbyTemplate} ${projectPath} --recursive --depth 1 --quiet`;
|
|
67
67
|
yield (0, cmd_utils_1.spawnOrFail)(`${createCommand}`);
|
|
68
68
|
// Remove .git and LICENSE so that we don't generate linked outputs
|
|
69
69
|
yield (0, cmd_utils_1.spawnOrFail)(`rm -rf ${projectPath}/.git`);
|
|
70
70
|
yield (0, cmd_utils_1.spawnOrFail)(`rm -rf ${projectPath}/LICENSE`);
|
|
71
71
|
}),
|
|
72
|
-
installDeps: ({ projectPath, scheme,
|
|
72
|
+
installDeps: ({ projectPath, scheme, jsOrTs }) => __awaiter(void 0, void 0, void 0, function* () {
|
|
73
73
|
const installedHelmet = yield (0, npm_utils_1.installUpgrade)("react-helmet", {
|
|
74
74
|
workingDir: projectPath,
|
|
75
75
|
});
|
|
76
|
-
const installedHelmetTypes =
|
|
76
|
+
const installedHelmetTypes = jsOrTs === "js" ||
|
|
77
77
|
(yield (0, npm_utils_1.installUpgrade)("@types/react-helmet", {
|
|
78
78
|
workingDir: projectPath,
|
|
79
79
|
dev: true,
|
|
@@ -90,13 +90,12 @@ const gatsbyStrategy = {
|
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
92
|
else {
|
|
93
|
-
return yield (0,
|
|
93
|
+
return yield (0, codegen_1.installCodegenDeps)({ projectPath });
|
|
94
94
|
}
|
|
95
95
|
}),
|
|
96
96
|
overwriteConfig: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
97
97
|
var _a, e_1, _b, _c;
|
|
98
|
-
const { projectId, projectPath, projectApiToken,
|
|
99
|
-
const extension = useTypescript ? "ts" : "js";
|
|
98
|
+
const { projectId, projectPath, projectApiToken, jsOrTs, scheme } = args;
|
|
100
99
|
const packageName = path_1.default.basename(projectPath);
|
|
101
100
|
// Update package.json: adding name and description, removing license and author
|
|
102
101
|
const packageJsonPath = path_1.default.join(projectPath, "package.json");
|
|
@@ -109,15 +108,15 @@ const gatsbyStrategy = {
|
|
|
109
108
|
yield fs_1.promises.writeFile(packageJsonPath, JSON.stringify(packageJsonObject, null, 2));
|
|
110
109
|
if (scheme === "loader") {
|
|
111
110
|
// create-gatsby will create a default gatsby-config that we need to modify
|
|
112
|
-
const gatsbyConfigFile = path_1.default.join(projectPath, `gatsby-config.${
|
|
111
|
+
const gatsbyConfigFile = path_1.default.join(projectPath, `gatsby-config.${jsOrTs}`);
|
|
113
112
|
const rl = readline.createInterface({
|
|
114
113
|
input: (0, fs_1.createReadStream)(gatsbyConfigFile),
|
|
115
114
|
crlfDelay: Infinity,
|
|
116
115
|
});
|
|
117
116
|
// Typescript doesn't accept require.resolve
|
|
118
117
|
// https://www.gatsbyjs.com/docs/how-to/custom-configuration/typescript/#requireresolve
|
|
119
|
-
let result =
|
|
120
|
-
const pluginConfig = (0,
|
|
118
|
+
let result = (0, file_utils_1.ifTs)(jsOrTs, `import path from "path";\n`);
|
|
119
|
+
const pluginConfig = (0, template_1.GATSBY_PLUGIN_CONFIG)(projectId, (0, lang_utils_1.ensure)(projectApiToken), jsOrTs);
|
|
121
120
|
try {
|
|
122
121
|
for (var _d = true, rl_1 = __asyncValues(rl), rl_1_1; rl_1_1 = yield rl_1.next(), _a = rl_1_1.done, !_a;) {
|
|
123
122
|
_c = rl_1_1.value;
|
|
@@ -152,31 +151,30 @@ const gatsbyStrategy = {
|
|
|
152
151
|
generateFiles: (args) => __awaiter(void 0, void 0, void 0, function* () {
|
|
153
152
|
// in gatsby we can delete all existing pages/components, since all pages are going
|
|
154
153
|
// to be handled by templates/defaultPlasmicPage
|
|
155
|
-
const { projectId, projectApiToken, projectPath,
|
|
156
|
-
const extension = useTypescript ? "ts" : "js";
|
|
154
|
+
const { projectId, projectApiToken, projectPath, jsOrTs, scheme } = args;
|
|
157
155
|
(0, file_utils_1.deleteGlob)(path_1.default.join(projectPath, "src/@(pages|components|templates)/*.*"));
|
|
158
156
|
// Create a very basic 404 page - `gatsby build` fails without it.
|
|
159
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `src/pages/404.${
|
|
157
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `src/pages/404.${jsOrTs}`), template_1.GATSBY_404);
|
|
160
158
|
// Add plasmic-host page
|
|
161
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `src/pages/plasmic-host.${
|
|
162
|
-
|
|
159
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `src/pages/plasmic-host.${jsOrTs}x`), (0, template_1.makeGatsbyHostPage)({
|
|
160
|
+
jsOrTs,
|
|
163
161
|
scheme,
|
|
164
162
|
}));
|
|
165
163
|
// Start with an empty gatsby-node
|
|
166
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `gatsby-node.${
|
|
164
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `gatsby-node.${jsOrTs}`), "");
|
|
167
165
|
// Updates `gatsby-ssr` to include script tag for preamble
|
|
168
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `gatsby-ssr.${
|
|
166
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `gatsby-ssr.${jsOrTs}x`), template_1.GATSBY_SSR_CONFIG);
|
|
169
167
|
if (scheme === "loader") {
|
|
170
|
-
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `src/plasmic-init.${
|
|
168
|
+
yield fs_1.promises.writeFile(path_1.default.join(projectPath, `src/plasmic-init.${jsOrTs}`), (0, template_1.makeGatsbyPlasmicInit)(jsOrTs));
|
|
171
169
|
const templatesFolder = path_1.default.join(projectPath, "src/templates");
|
|
172
170
|
if (!(0, fs_1.existsSync)(templatesFolder)) {
|
|
173
171
|
yield fs_1.promises.mkdir(templatesFolder);
|
|
174
172
|
}
|
|
175
|
-
const defaultPagePath = path_1.default.join(templatesFolder, `defaultPlasmicPage.${
|
|
176
|
-
yield fs_1.promises.writeFile(defaultPagePath, (0,
|
|
173
|
+
const defaultPagePath = path_1.default.join(templatesFolder, `defaultPlasmicPage.${jsOrTs}x`);
|
|
174
|
+
yield fs_1.promises.writeFile(defaultPagePath, (0, template_1.makeGatsbyDefaultPage)(jsOrTs));
|
|
177
175
|
}
|
|
178
176
|
else {
|
|
179
|
-
yield (0,
|
|
177
|
+
yield (0, codegen_1.runCodegenSync)({
|
|
180
178
|
projectId,
|
|
181
179
|
projectApiToken,
|
|
182
180
|
projectPath,
|
|
@@ -184,10 +182,10 @@ const gatsbyStrategy = {
|
|
|
184
182
|
// Overwrite the index file
|
|
185
183
|
yield (0, file_utils_1.overwriteIndex)(projectPath, "gatsby", scheme);
|
|
186
184
|
// Overwrite the wrapper files to wrap PlasmicRootProvider
|
|
187
|
-
const wrapperContent = (0,
|
|
188
|
-
const browserFilePath = path_1.default.join(projectPath, `gatsby-browser.${
|
|
185
|
+
const wrapperContent = (0, template_1.wrapAppRootForCodegen)();
|
|
186
|
+
const browserFilePath = path_1.default.join(projectPath, `gatsby-browser.${jsOrTs}x`);
|
|
189
187
|
yield fs_1.promises.writeFile(browserFilePath, wrapperContent);
|
|
190
|
-
const ssrFilePath = path_1.default.join(projectPath, `gatsby-ssr.${
|
|
188
|
+
const ssrFilePath = path_1.default.join(projectPath, `gatsby-ssr.${jsOrTs}x`);
|
|
191
189
|
yield fs_1.promises.writeFile(ssrFilePath, wrapperContent);
|
|
192
190
|
}
|
|
193
191
|
}),
|
|
@@ -200,4 +198,3 @@ const gatsbyStrategy = {
|
|
|
200
198
|
yield (0, cmd_utils_1.spawnOrFail)(`${npmRunCmd} build`, projectPath);
|
|
201
199
|
}),
|
|
202
200
|
};
|
|
203
|
-
exports.default = gatsbyStrategy;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { JsOrTs, SchemeType } from "../utils/types";
|
|
2
|
+
export declare function makeGatsbyDefaultPage(jsOrTs: JsOrTs): string;
|
|
3
|
+
export declare const GATSBY_404 = "const NotFound = () => {\n return \"Not Found\";\n};\nexport default NotFound;\n";
|
|
4
|
+
export declare function GATSBY_PLUGIN_CONFIG(projectId: string, projectApiToken: string, jsOrTs: JsOrTs): string;
|
|
5
|
+
export declare function makeGatsbyHostPage(opts: {
|
|
6
|
+
jsOrTs: JsOrTs;
|
|
7
|
+
scheme: SchemeType;
|
|
8
|
+
}): string;
|
|
9
|
+
export declare const GATSBY_SSR_CONFIG = "/**\n * Implement Gatsby's SSR (Server Side Rendering) APIs in this file.\n *\n * See: https://www.gatsbyjs.com/docs/ssr-apis/\n */\n\nconst React = require(\"react\")\n\nconst HeadComponents = [\n <script\n key=\"plasmic-hmr\"\n type=\"text/javascript\"\n dangerouslySetInnerHTML={{\n __html: `\n if (typeof window !== \"undefined\" && /\\\\/plasmic-host\\\\/?$/.test(window.location.pathname)) {\n const RealEventSource = window.EventSource;\n window.EventSource = function(url, config) {\n if (/[^a-zA-Z]hmr($|[^a-zA-Z])/.test(url)) {\n console.warn(\"Plasmic: disabled EventSource request for\", url);\n return {\n onerror() {}, onmessage() {}, onopen() {}, close() {}\n };\n } else {\n return new RealEventSource(url, config);\n }\n }\n }\n `,\n }}\n />\n]\n\nconst isProduction = process.env.NODE_ENV === \"production\"\n\nexports.onRenderBody = ({ pathname, setHeadComponents }) => {\n /**\n * We add the preamble tag script to all pages during development mode\n * because during development all pages are dynamically rendered based\n * on `/` route, during production we add it only in `/plasmic-host/`\n */\n if (!isProduction || pathname === \"/plasmic-host/\") {\n setHeadComponents(HeadComponents)\n }\n}\n";
|
|
10
|
+
export declare function makeGatsbyPlasmicInit(jsOrTs: JsOrTs): string;
|
|
11
|
+
export declare function wrapAppRootForCodegen(): string;
|