@stringtale/cli
Advanced tools
Comparing version 0.6.1 to 0.6.2
# @stringtale/cli | ||
## 0.6.2 | ||
### Patch Changes | ||
- 85f818d: CLI didn't tell the user to add the StringtaleProvider for NextJS | ||
## 0.6.1 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@stringtale/cli", | ||
"version": "0.6.1", | ||
"version": "0.6.2", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "publishConfig": { |
@@ -256,2 +256,5 @@ import { toValue } from "@stringtale/node" | ||
stdout.write(`Installing modules @stringtale/react @stringtale/next.\n`) | ||
await installModules(nextRoot, `@stringtale/react @stringtale/next`) | ||
if (isAppDir) { | ||
@@ -270,4 +273,24 @@ const apiRouteFilename = `stringtale.${ext}` | ||
POST | ||
}\n` | ||
}` | ||
) | ||
stdout.write( | ||
`Please add <StringtaleProvider> and Stringtale’s CSS to your RootLayout in app/layout.tsx as such:` | ||
) | ||
stdout.write(`import { StringtaleProvider } from "@stringtale/next" | ||
import "@stringtale/react/styles.css" | ||
export default async function RootLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode | ||
}) { | ||
return ( | ||
<html> | ||
<body> | ||
<StringtaleProvider>{children}</StringtaleProvider> | ||
</body> | ||
</html> | ||
) | ||
}\n`) | ||
} else { | ||
@@ -279,4 +302,3 @@ // Adding API ROUTE | ||
path.resolve(apiPath, apiRouteFilename), | ||
` | ||
import { setupRoute } from '@stringtale/next' | ||
`import { setupRoute } from '@stringtale/next' | ||
export default setupRoute({ | ||
@@ -287,5 +309,18 @@ apiKey: process.env.STRINGTALE_API_KEY${language === "ts" ? "!" : ""}, | ||
} | ||
stdout.write(`Installing modules @stringtale/react @stringtale/next.\n`) | ||
await installModules(nextRoot, `@stringtale/react @stringtale/next`) | ||
stdout.write( | ||
`Please update your App component in <PROJECT_DIRECTORY>/pages/_app.tsx and wrap your app using <StringtaleProvider> as follows:` | ||
) | ||
stdout.write(`import type { AppProps } from 'next/app' | ||
import { StringTaleProvider } from "@stringtale/next" | ||
import "@stringtale/react/styles.css" | ||
export default function MyApp({ Component, pageProps }: AppProps) { | ||
return ( | ||
<StringtaleProvider> | ||
<Component {...pageProps} /> | ||
</StringtaleProvider> | ||
) | ||
}\n`) | ||
// Find .env & add STRINGTALE_PROJECT_ID | ||
@@ -299,5 +334,5 @@ } else { | ||
stdout.write( | ||
`Please add the following API route api/stringtale to your Express server config:` | ||
`Please add the following API route api/stringtale to your Express server config: \n` | ||
) | ||
stdout.write(`import express from 'expres\ns' | ||
stdout.write(`import express from 'express' | ||
import { setupRoute } from "@stringtale/express" | ||
@@ -328,5 +363,5 @@ const app = express() | ||
stdout.write( | ||
`${toValue({ name: "init.success", value: "Project initialized" })}\n` | ||
`${toValue({ name: "init.success", value: "Project initialized." })}\n` | ||
) | ||
} | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
5412884
47661