MCPcopy Create free account
hub / github.com/ProNextJS/declarative-routing / setupNext

Function setupNext

src/nextjs/init.ts:132–175  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

130}
131
132export async function setupNext() {
133 let src = "./src/app";
134 let routes = "./src/routes";
135 if (fs.existsSync("./app")) {
136 src = "./app";
137 routes = "./routes";
138 }
139
140 const response = await prompts([
141 {
142 type: "text",
143 name: "src",
144 message: "What is your source directory?",
145 initial: src
146 },
147 {
148 type: "text",
149 name: "routes",
150 message: "Where do you want the routes directory?",
151 initial: routes
152 },
153 {
154 type: "confirm",
155 name: "openapi",
156 message: "Add OpenAPI output?",
157 initial: true
158 }
159 ]);
160
161 writeConfig({
162 mode: "nextjs",
163 src: response.src ?? src,
164 routes: response.routes ?? routes,
165 openapi:
166 response.openapi ?? true
167 ? {
168 target: `${routes}/openapi.ts`,
169 template: `${routes}/openapi.template.ts`
170 }
171 : undefined
172 });
173
174 await setup();
175}

Callers 1

init.tsFile · 0.90

Calls 2

writeConfigFunction · 0.90
setupFunction · 0.70

Tested by

no test coverage detected