create-plasmic-app 0.0.42 → 0.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -202,8 +202,8 @@ function run() {
202
202
  const rawProjectId = yield maybePrompt({
203
203
  name: "projectId",
204
204
  message: `What is the URL of your project?
205
- (If you don't have a project yet, create one by going to
206
- https://studio.plasmic.app/starters/simple-light):
205
+ If you don't have a project yet, create one by going to
206
+ https://studio.plasmic.app/starters/simple-light
207
207
  `,
208
208
  });
209
209
  projectId = rawProjectId
@@ -48,7 +48,7 @@ const PlasmicGatsbyPage = ({ data }${file_utils_1.ifTs(ts, ": PlasmicGatsbyPageP
48
48
  {pageMetadata.description && <meta property="og:description" content={pageMetadata.description} />}
49
49
  {pageMetadata.openGraphImageUrl && <meta property="og:image" content={pageMetadata.openGraphImageUrl} />}
50
50
  </Helmet>
51
- <PlasmicComponent component={pageMeta.name} />
51
+ <PlasmicComponent component={pageMeta.displayName} />
52
52
  </PlasmicRootProvider>
53
53
  );
54
54
  };
@@ -140,16 +140,7 @@ exports.GATSBY_SSR_CONFIG = `
140
140
 
141
141
  const React = require("react")
142
142
 
143
- /**
144
- * Add preamble to allow functional code components in studio.
145
- *
146
- * See: https://docs.plasmic.app/learn/functional-code-components/
147
- */
148
143
  const HeadComponents = [
149
- <script
150
- key="plasmic-preamble"
151
- src="https://static1.plasmic.app/preamble.js"
152
- />,
153
144
  <script
154
145
  key="plasmic-hmr"
155
146
  type="text/javascript"
@@ -58,7 +58,7 @@ export default function PlasmicLoaderPage(props${file_utils_1.ifTs(ts, `: {
58
58
  prefetchedData={plasmicData}
59
59
  prefetchedQueryData={queryCache}
60
60
  >
61
- <PlasmicComponent component={plasmicData.entryCompMetas[0].name} />
61
+ <PlasmicComponent component={plasmicData.entryCompMetas[0].displayName} />
62
62
  </PlasmicRootProvider>
63
63
  );
64
64
  }
@@ -74,7 +74,7 @@ export const getStaticProps${file_utils_1.ifTs(ts, `: GetStaticProps`)} = async
74
74
  // Cache the necessary data fetched for the page
75
75
  const queryCache = await extractPlasmicQueryData(
76
76
  <PlasmicRootProvider loader={PLASMIC} prefetchedData={plasmicData}>
77
- <PlasmicComponent component={plasmicData.entryCompMetas[0].name} />
77
+ <PlasmicComponent component={plasmicData.entryCompMetas[0].displayName} />
78
78
  </PlasmicRootProvider>
79
79
  );
80
80
  // Use revalidate if you want incremental static regeneration
@@ -110,15 +110,7 @@ import { PlasmicCanvasHost } from '@plasmicapp/loader-nextjs';
110
110
  import { PLASMIC } from '../plasmic-init';
111
111
 
112
112
  export default function PlasmicHost() {
113
- return PLASMIC && (
114
- <div>
115
- <Script
116
- src="https://static1.plasmic.app/preamble.js"
117
- strategy="beforeInteractive"
118
- />
119
- <PlasmicCanvasHost />
120
- </div>
121
- );
113
+ return PLASMIC && <PlasmicCanvasHost />;
122
114
  }
123
115
  `;
124
116
  }
@@ -137,15 +129,7 @@ import { PlasmicCanvasHost, registerComponent } from '@plasmicapp/host';
137
129
  // registerComponent(...)
138
130
 
139
131
  export default function PlasmicHost() {
140
- return (
141
- <div>
142
- <Script
143
- src="https://static1.plasmic.app/preamble.js"
144
- strategy="beforeInteractive"
145
- />
146
- <PlasmicCanvasHost />
147
- </div>
148
- );
132
+ return <PlasmicCanvasHost />;
149
133
  }
150
134
  `;
151
135
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-plasmic-app",
3
- "version": "0.0.42",
3
+ "version": "0.0.45",
4
4
  "description": "Create Plasmic-powered React apps",
5
5
  "main": "./dist/lib.js",
6
6
  "types": "./dist/lib.d.ts",
package/src/index.ts CHANGED
@@ -185,8 +185,8 @@ async function run(): Promise<void> {
185
185
  const rawProjectId = await maybePrompt({
186
186
  name: "projectId",
187
187
  message: `What is the URL of your project?
188
- (If you don't have a project yet, create one by going to
189
- https://studio.plasmic.app/starters/simple-light):
188
+ If you don't have a project yet, create one by going to
189
+ https://studio.plasmic.app/starters/simple-light
190
190
  `,
191
191
  });
192
192
  projectId = rawProjectId
@@ -53,7 +53,7 @@ const PlasmicGatsbyPage = ({ data }${ifTs(ts, ": PlasmicGatsbyPageProps")}) => {
53
53
  {pageMetadata.description && <meta property="og:description" content={pageMetadata.description} />}
54
54
  {pageMetadata.openGraphImageUrl && <meta property="og:image" content={pageMetadata.openGraphImageUrl} />}
55
55
  </Helmet>
56
- <PlasmicComponent component={pageMeta.name} />
56
+ <PlasmicComponent component={pageMeta.displayName} />
57
57
  </PlasmicRootProvider>
58
58
  );
59
59
  };
@@ -157,16 +157,7 @@ export const GATSBY_SSR_CONFIG = `
157
157
 
158
158
  const React = require("react")
159
159
 
160
- /**
161
- * Add preamble to allow functional code components in studio.
162
- *
163
- * See: https://docs.plasmic.app/learn/functional-code-components/
164
- */
165
160
  const HeadComponents = [
166
- <script
167
- key="plasmic-preamble"
168
- src="https://static1.plasmic.app/preamble.js"
169
- />,
170
161
  <script
171
162
  key="plasmic-hmr"
172
163
  type="text/javascript"
@@ -235,7 +226,7 @@ export function initPlasmicLoaderWithRegistrations(plasmicOptions${ifTs(
235
226
  `.trim();
236
227
  };
237
228
 
238
- export function wrapAppRootForCodegen() {
229
+ export function wrapAppRootForCodegen(): string {
239
230
  return `
240
231
  import React from "react";
241
232
  import { PlasmicRootProvider } from "@plasmicapp/react-web";
@@ -64,7 +64,7 @@ export default function PlasmicLoaderPage(props${ifTs(
64
64
  prefetchedData={plasmicData}
65
65
  prefetchedQueryData={queryCache}
66
66
  >
67
- <PlasmicComponent component={plasmicData.entryCompMetas[0].name} />
67
+ <PlasmicComponent component={plasmicData.entryCompMetas[0].displayName} />
68
68
  </PlasmicRootProvider>
69
69
  );
70
70
  }
@@ -83,7 +83,7 @@ export const getStaticProps${ifTs(
83
83
  // Cache the necessary data fetched for the page
84
84
  const queryCache = await extractPlasmicQueryData(
85
85
  <PlasmicRootProvider loader={PLASMIC} prefetchedData={plasmicData}>
86
- <PlasmicComponent component={plasmicData.entryCompMetas[0].name} />
86
+ <PlasmicComponent component={plasmicData.entryCompMetas[0].displayName} />
87
87
  </PlasmicRootProvider>
88
88
  );
89
89
  // Use revalidate if you want incremental static regeneration
@@ -120,15 +120,7 @@ import { PlasmicCanvasHost } from '@plasmicapp/loader-nextjs';
120
120
  import { PLASMIC } from '../plasmic-init';
121
121
 
122
122
  export default function PlasmicHost() {
123
- return PLASMIC && (
124
- <div>
125
- <Script
126
- src="https://static1.plasmic.app/preamble.js"
127
- strategy="beforeInteractive"
128
- />
129
- <PlasmicCanvasHost />
130
- </div>
131
- );
123
+ return PLASMIC && <PlasmicCanvasHost />;
132
124
  }
133
125
  `;
134
126
  } else {
@@ -146,21 +138,13 @@ import { PlasmicCanvasHost, registerComponent } from '@plasmicapp/host';
146
138
  // registerComponent(...)
147
139
 
148
140
  export default function PlasmicHost() {
149
- return (
150
- <div>
151
- <Script
152
- src="https://static1.plasmic.app/preamble.js"
153
- strategy="beforeInteractive"
154
- />
155
- <PlasmicCanvasHost />
156
- </div>
157
- );
141
+ return <PlasmicCanvasHost />;
158
142
  }
159
143
  `;
160
144
  }
161
145
  }
162
146
 
163
- export function wrapAppRootForCodegen() {
147
+ export function wrapAppRootForCodegen(): string {
164
148
  return `
165
149
  import '../styles/globals.css'
166
150
  import { PlasmicRootProvider } from "@plasmicapp/react-web";