create-plasmic-app 0.0.48 → 0.0.49

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.
@@ -62,25 +62,24 @@ const gatsbyStrategy = {
62
62
  yield cmd_utils_1.spawnOrFail(`${createCommand}`, parent);
63
63
  }),
64
64
  installDeps: ({ projectPath, scheme, useTypescript }) => __awaiter(void 0, void 0, void 0, function* () {
65
- if (scheme === "loader") {
66
- const installedLoader = yield npm_utils_1.installUpgrade("@plasmicapp/loader-gatsby", {
67
- workingDir: projectPath,
68
- });
69
- const installedHelmet = yield npm_utils_1.installUpgrade("react-helmet", {
65
+ const installedHelmet = yield npm_utils_1.installUpgrade("react-helmet", {
66
+ workingDir: projectPath,
67
+ });
68
+ const installedHelmetTypes = !useTypescript ||
69
+ (yield npm_utils_1.installUpgrade("@types/react-helmet", {
70
70
  workingDir: projectPath,
71
- });
72
- const installedHelmetTypes = !useTypescript ||
73
- (yield npm_utils_1.installUpgrade("@types/react-helmet", {
74
- workingDir: projectPath,
75
- dev: true,
76
- }));
77
- const installedHelmetPlugin = yield npm_utils_1.installUpgrade("gatsby-plugin-react-helmet", {
71
+ dev: true,
72
+ }));
73
+ const installedHelmetPlugin = yield npm_utils_1.installUpgrade("gatsby-plugin-react-helmet", {
74
+ workingDir: projectPath,
75
+ });
76
+ if (!installedHelmet || !installedHelmetPlugin || !installedHelmetTypes) {
77
+ return false;
78
+ }
79
+ if (scheme === "loader") {
80
+ return yield npm_utils_1.installUpgrade("@plasmicapp/loader-gatsby", {
78
81
  workingDir: projectPath,
79
82
  });
80
- return (installedLoader &&
81
- installedHelmet &&
82
- installedHelmetPlugin &&
83
- installedHelmetTypes);
84
83
  }
85
84
  else {
86
85
  return yield common_1.installCodegenDeps({ projectPath });
@@ -43,6 +43,7 @@ const PlasmicGatsbyPage = ({ data, location }${file_utils_1.ifTs(ts, ": PlasmicG
43
43
  prefetchedData={plasmicComponents}
44
44
  pageParams={pageMeta.params}
45
45
  pageQuery={Object.fromEntries(new URLSearchParams(location.search))}
46
+ Head={Helmet}
46
47
  >
47
48
  <Helmet>
48
49
  {pageMetadata?.title && <title>{pageMetadata.title}</title>}
@@ -212,10 +213,11 @@ function wrapAppRootForCodegen() {
212
213
  return `
213
214
  import React from "react";
214
215
  import { PlasmicRootProvider } from "@plasmicapp/react-web";
216
+ import Helmet from "react-helmet";
215
217
 
216
218
  export const wrapRootElement = ({ element }) => {
217
219
  return (
218
- <PlasmicRootProvider>
220
+ <PlasmicRootProvider Head={Helmet}>
219
221
  {element}
220
222
  </PlasmicRootProvider>
221
223
  );
@@ -42,6 +42,7 @@ import {
42
42
  } from "@plasmicapp/loader-nextjs";
43
43
  ${file_utils_1.ifTs(ts, `import type { GetStaticPaths, GetStaticProps } from "next";\n`)}
44
44
  import Error from "next/error";
45
+ import Head from "next/head";
45
46
  import { useRouter } from "next/router";
46
47
  import { PLASMIC } from "../plasmic-init";
47
48
 
@@ -62,6 +63,7 @@ export default function PlasmicLoaderPage(props${file_utils_1.ifTs(ts, `: {
62
63
  prefetchedQueryData={queryCache}
63
64
  pageParams={pageMeta.params}
64
65
  pageQuery={router.query}
66
+ Head={Head}
65
67
  >
66
68
  <PlasmicComponent component={pageMeta.displayName} />
67
69
  </PlasmicRootProvider>
@@ -83,6 +85,7 @@ export const getStaticProps${file_utils_1.ifTs(ts, `: GetStaticProps`)} = async
83
85
  loader={PLASMIC}
84
86
  prefetchedData={plasmicData}
85
87
  pageParams={pageMeta.params}
88
+ Head={Head}
86
89
  >
87
90
  <PlasmicComponent component={pageMeta.displayName} />
88
91
  </PlasmicRootProvider>
@@ -146,10 +149,11 @@ function wrapAppRootForCodegen() {
146
149
  return `
147
150
  import '../styles/globals.css'
148
151
  import { PlasmicRootProvider } from "@plasmicapp/react-web";
152
+ import Head from "next/head";
149
153
 
150
154
  function MyApp({ Component, pageProps }) {
151
155
  return (
152
- <PlasmicRootProvider>
156
+ <PlasmicRootProvider Head={Head}>
153
157
  <Component {...pageProps} />
154
158
  </PlasmicRootProvider>
155
159
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-plasmic-app",
3
- "version": "0.0.48",
3
+ "version": "0.0.49",
4
4
  "description": "Create Plasmic-powered React apps",
5
5
  "main": "./dist/lib.js",
6
6
  "types": "./dist/lib.d.ts",
@@ -37,34 +37,29 @@ const gatsbyStrategy: CPAStrategy = {
37
37
  await spawnOrFail(`${createCommand}`, parent);
38
38
  },
39
39
  installDeps: async ({ projectPath, scheme, useTypescript }) => {
40
+ const installedHelmet = await installUpgrade("react-helmet", {
41
+ workingDir: projectPath,
42
+ });
43
+ const installedHelmetTypes =
44
+ !useTypescript ||
45
+ (await installUpgrade("@types/react-helmet", {
46
+ workingDir: projectPath,
47
+ dev: true,
48
+ }));
49
+ const installedHelmetPlugin = await installUpgrade(
50
+ "gatsby-plugin-react-helmet",
51
+ {
52
+ workingDir: projectPath,
53
+ }
54
+ );
55
+ if (!installedHelmet || !installedHelmetPlugin || !installedHelmetTypes) {
56
+ return false;
57
+ }
58
+
40
59
  if (scheme === "loader") {
41
- const installedLoader = await installUpgrade(
42
- "@plasmicapp/loader-gatsby",
43
- {
44
- workingDir: projectPath,
45
- }
46
- );
47
- const installedHelmet = await installUpgrade("react-helmet", {
60
+ return await installUpgrade("@plasmicapp/loader-gatsby", {
48
61
  workingDir: projectPath,
49
62
  });
50
- const installedHelmetTypes =
51
- !useTypescript ||
52
- (await installUpgrade("@types/react-helmet", {
53
- workingDir: projectPath,
54
- dev: true,
55
- }));
56
- const installedHelmetPlugin = await installUpgrade(
57
- "gatsby-plugin-react-helmet",
58
- {
59
- workingDir: projectPath,
60
- }
61
- );
62
- return (
63
- installedLoader &&
64
- installedHelmet &&
65
- installedHelmetPlugin &&
66
- installedHelmetTypes
67
- );
68
63
  } else {
69
64
  return await installCodegenDeps({ projectPath });
70
65
  }
@@ -51,6 +51,7 @@ const PlasmicGatsbyPage = ({ data, location }${ifTs(
51
51
  prefetchedData={plasmicComponents}
52
52
  pageParams={pageMeta.params}
53
53
  pageQuery={Object.fromEntries(new URLSearchParams(location.search))}
54
+ Head={Helmet}
54
55
  >
55
56
  <Helmet>
56
57
  {pageMetadata?.title && <title>{pageMetadata.title}</title>}
@@ -241,10 +242,11 @@ export function wrapAppRootForCodegen(): string {
241
242
  return `
242
243
  import React from "react";
243
244
  import { PlasmicRootProvider } from "@plasmicapp/react-web";
245
+ import Helmet from "react-helmet";
244
246
 
245
247
  export const wrapRootElement = ({ element }) => {
246
248
  return (
247
- <PlasmicRootProvider>
249
+ <PlasmicRootProvider Head={Helmet}>
248
250
  {element}
249
251
  </PlasmicRootProvider>
250
252
  );
@@ -45,6 +45,7 @@ import {
45
45
  } from "@plasmicapp/loader-nextjs";
46
46
  ${ifTs(ts, `import type { GetStaticPaths, GetStaticProps } from "next";\n`)}
47
47
  import Error from "next/error";
48
+ import Head from "next/head";
48
49
  import { useRouter } from "next/router";
49
50
  import { PLASMIC } from "../plasmic-init";
50
51
 
@@ -68,6 +69,7 @@ export default function PlasmicLoaderPage(props${ifTs(
68
69
  prefetchedQueryData={queryCache}
69
70
  pageParams={pageMeta.params}
70
71
  pageQuery={router.query}
72
+ Head={Head}
71
73
  >
72
74
  <PlasmicComponent component={pageMeta.displayName} />
73
75
  </PlasmicRootProvider>
@@ -92,6 +94,7 @@ export const getStaticProps${ifTs(
92
94
  loader={PLASMIC}
93
95
  prefetchedData={plasmicData}
94
96
  pageParams={pageMeta.params}
97
+ Head={Head}
95
98
  >
96
99
  <PlasmicComponent component={pageMeta.displayName} />
97
100
  </PlasmicRootProvider>
@@ -155,10 +158,11 @@ export function wrapAppRootForCodegen(): string {
155
158
  return `
156
159
  import '../styles/globals.css'
157
160
  import { PlasmicRootProvider } from "@plasmicapp/react-web";
161
+ import Head from "next/head";
158
162
 
159
163
  function MyApp({ Component, pageProps }) {
160
164
  return (
161
- <PlasmicRootProvider>
165
+ <PlasmicRootProvider Head={Head}>
162
166
  <Component {...pageProps} />
163
167
  </PlasmicRootProvider>
164
168
  );