@stackframe/init-stack 1.0.1 → 1.0.3

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.
Files changed (2) hide show
  1. package/index.mjs +25 -23
  2. package/package.json +7 -6
package/index.mjs CHANGED
@@ -4,6 +4,7 @@ import inquirer from 'inquirer';
4
4
  import * as fs from 'fs';
5
5
  import * as child_process from 'child_process';
6
6
  import * as path from 'path';
7
+ import open from 'open';
7
8
 
8
9
  const jsLikeFileExtensions = ['mtsx', 'ctsx', 'tsx', 'mts', 'cts', 'ts', 'mjsx', 'cjsx', 'jsx', 'mjs', 'cjs', 'js'];
9
10
 
@@ -86,6 +87,10 @@ async function main() {
86
87
  } catch (err) {
87
88
  throw new Error(`Could not run the package manager command ${versionCommand}. Please make sure ${packageManager} is installed on your system.`);
88
89
  }
90
+
91
+ console.log();
92
+ console.log("Installing dependencies...");
93
+ await shellNicelyFormatted(`${installCommand} @stackframe/stack`, { shell: true, cwd: projectPath });
89
94
 
90
95
  console.log();
91
96
  console.log("Writing files...");
@@ -95,29 +100,8 @@ async function main() {
95
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`);
96
101
  await writeFile(layoutPath, updatedLayoutContent);
97
102
  console.log("Files written successfully!");
98
-
99
- console.log();
100
- console.log("Installing dependencies...");
101
- await shellNicelyFormatted(`${installCommand} @stackframe/stack`, { shell: true, cwd: projectPath });
102
103
  }
103
- main().catch((err) => {
104
- console.error(err);
105
- console.error();
106
- console.error();
107
- console.error();
108
- console.error();
109
- console.error("===============================================");
110
- console.error();
111
- console.error("[ERR] An error occured during the initialization process. Please try manually installing Stack as described in https://docs.stack-auth.com/docs/getting-started/setup");
112
- console.error("[ERR]");
113
- console.error("[ERR] If you need assistance, please join our Discord where we're happy to help: https://discord.stack-auth.com");
114
- console.error("[ERR]");
115
- console.error(`[ERR] Error message: ${err.message}`);
116
- console.error();
117
- console.error("===============================================");
118
- console.error();
119
- process.exit(1);
120
- }).then(() => {
104
+ main().then(async() => {
121
105
  console.log();
122
106
  console.log();
123
107
  console.log();
@@ -134,6 +118,24 @@ main().catch((err) => {
134
118
  console.log();
135
119
  console.log("===============================================");
136
120
  console.log();
121
+ await open("https://app.stack-auth.com/wizard-congrats");
122
+ }).catch((err) => {
123
+ console.error(err);
124
+ console.error();
125
+ console.error();
126
+ console.error();
127
+ console.error();
128
+ console.error("===============================================");
129
+ console.error();
130
+ console.error("[ERR] An error occured during the initialization process. Please try manually installing Stack as described in https://docs.stack-auth.com/docs/getting-started/setup");
131
+ console.error("[ERR]");
132
+ console.error("[ERR] If you need assistance, please join our Discord where we're happy to help: https://discord.stack-auth.com");
133
+ console.error("[ERR]");
134
+ console.error(`[ERR] Error message: ${err.message}`);
135
+ console.error();
136
+ console.error("===============================================");
137
+ console.error();
138
+ process.exit(1);
137
139
  });
138
140
 
139
141
  async function getUpdatedLayout(originalLayout) {
@@ -170,7 +172,7 @@ async function getUpdatedLayout(originalLayout) {
170
172
  layout = layout.slice(0, bodyOpenEndIndex) + insertOpen + layout.slice(bodyOpenEndIndex);
171
173
 
172
174
  return {
173
- content: `// Below is the old layout file.\n\n${layout}`,
175
+ content: `${layout}`,
174
176
  indentation,
175
177
  };
176
178
  }
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@stackframe/init-stack",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "The setup wizard for Stack. https://stack-auth.com",
5
5
  "main": "index.mjs",
6
6
  "bin": "./index.mjs",
7
+ "scripts": {
8
+ "init-stack": "node index.mjs"
9
+ },
7
10
  "files": [
8
11
  "index.mjs"
9
12
  ],
@@ -12,9 +15,7 @@
12
15
  "author": "",
13
16
  "license": "MIT",
14
17
  "dependencies": {
15
- "inquirer": "^9.2.19"
16
- },
17
- "scripts": {
18
- "init-stack": "node index.mjs"
18
+ "inquirer": "^9.2.19",
19
+ "open": "^10.1.0"
19
20
  }
20
- }
21
+ }