@stackframe/init-stack 1.0.2 → 1.0.4
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/index.mjs +6 -6
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -87,19 +87,19 @@ async function main() {
|
|
|
87
87
|
} catch (err) {
|
|
88
88
|
throw new Error(`Could not run the package manager command ${versionCommand}. Please make sure ${packageManager} is installed on your system.`);
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
console.log();
|
|
92
|
+
console.log("Installing dependencies...");
|
|
93
|
+
await shellNicelyFormatted(`${installCommand} @stackframe/stack`, { shell: true, cwd: projectPath });
|
|
90
94
|
|
|
91
95
|
console.log();
|
|
92
96
|
console.log("Writing files...");
|
|
93
97
|
await writeFileIfNotExists(envLocalPath, "NEXT_PUBLIC_STACK_PROJECT_ID=\nNEXT_PUBLIC_STACK_PUBLISHABLE_CLIENT_KEY=\nSTACK_SECRET_SERVER_KEY=\n");
|
|
94
98
|
await writeFileIfNotExists(loadingPath, `export default function Loading() {\n${ind}// Stack uses React Suspense, which will render this page while user data is being fetched.\n${ind}// See: https://nextjs.org/docs/app/api-reference/file-conventions/loading\n${ind}return <></>;\n}\n`);
|
|
95
|
-
await writeFileIfNotExists(handlerPath, `import { StackHandler } from "@stackframe/stack";\nimport { stackServerApp } from "../../../stack";\nexport default function Handler(props) {\n${ind}return <StackHandler app={stackServerApp} {...props} />;\n}\n`);
|
|
99
|
+
await writeFileIfNotExists(handlerPath, `import { StackHandler } from "@stackframe/stack";\nimport { stackServerApp } from "../../../stack";\nexport default function Handler(props${handlerFileExtension.includes("ts") ? ": any" : ""}) {\n${ind}return <StackHandler app={stackServerApp} {...props} />;\n}\n`);
|
|
96
100
|
await writeFileIfNotExists(stackAppPath, `import "server-only";\n\nimport { StackServerApp } from "@stackframe/stack";\n\nexport const stackServerApp = new StackServerApp({\n${ind}tokenStore: "nextjs-cookie",\n});\n`);
|
|
97
101
|
await writeFile(layoutPath, updatedLayoutContent);
|
|
98
102
|
console.log("Files written successfully!");
|
|
99
|
-
|
|
100
|
-
console.log();
|
|
101
|
-
console.log("Installing dependencies...");
|
|
102
|
-
await shellNicelyFormatted(`${installCommand} @stackframe/stack`, { shell: true, cwd: projectPath });
|
|
103
103
|
}
|
|
104
104
|
main().then(async() => {
|
|
105
105
|
console.log();
|
|
@@ -172,7 +172,7 @@ async function getUpdatedLayout(originalLayout) {
|
|
|
172
172
|
layout = layout.slice(0, bodyOpenEndIndex) + insertOpen + layout.slice(bodyOpenEndIndex);
|
|
173
173
|
|
|
174
174
|
return {
|
|
175
|
-
content:
|
|
175
|
+
content: `${layout}`,
|
|
176
176
|
indentation,
|
|
177
177
|
};
|
|
178
178
|
}
|