@mushi-mushi/cli 0.10.0 → 0.11.1
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/CONTRIBUTING.md +0 -11
- package/README.md +106 -382
- package/dist/chunk-EXLNHPSC.js +6 -0
- package/dist/{chunk-XHD3H54W.js → chunk-NYPX5KXR.js} +78 -0
- package/dist/detect.d.ts +1 -1
- package/dist/detect.js +1 -1
- package/dist/index.js +730 -7
- package/dist/init.js +6 -7
- package/dist/version.js +1 -1
- package/package.json +10 -10
- package/dist/chunk-GHDS4VGP.js +0 -6
|
@@ -12,6 +12,9 @@ var FRAMEWORK_IDS = [
|
|
|
12
12
|
"expo",
|
|
13
13
|
"react-native",
|
|
14
14
|
"capacitor",
|
|
15
|
+
"express",
|
|
16
|
+
"fastify",
|
|
17
|
+
"hono",
|
|
15
18
|
"vanilla"
|
|
16
19
|
];
|
|
17
20
|
function isFrameworkId(value) {
|
|
@@ -176,6 +179,71 @@ export default function App() {
|
|
|
176
179
|
import { Mushi } from '@mushi-mushi/capacitor'
|
|
177
180
|
|
|
178
181
|
await Mushi.configure({ projectId: '${projectId}', apiKey: '${apiKey}' })`
|
|
182
|
+
},
|
|
183
|
+
express: {
|
|
184
|
+
id: "express",
|
|
185
|
+
label: "Express",
|
|
186
|
+
packageName: "@mushi-mushi/node",
|
|
187
|
+
needsWebPackage: false,
|
|
188
|
+
snippet: (apiKey, projectId) => `// src/instrument.ts \u2014 load with: node --import ./dist/instrument.js
|
|
189
|
+
import { MushiNodeClient, attachUnhandledHook } from '@mushi-mushi/node'
|
|
190
|
+
import { mushiExpressErrorHandler } from '@mushi-mushi/node/express'
|
|
191
|
+
import type { Express } from 'express'
|
|
192
|
+
|
|
193
|
+
export const mushi = new MushiNodeClient({
|
|
194
|
+
projectId: '${projectId}',
|
|
195
|
+
apiKey: '${apiKey}',
|
|
196
|
+
environment: process.env.NODE_ENV ?? 'production',
|
|
197
|
+
})
|
|
198
|
+
attachUnhandledHook({ client: mushi })
|
|
199
|
+
|
|
200
|
+
export function attachMushi(app: Express) {
|
|
201
|
+
app.use(mushiExpressErrorHandler({ client: mushi }))
|
|
202
|
+
}`
|
|
203
|
+
},
|
|
204
|
+
fastify: {
|
|
205
|
+
id: "fastify",
|
|
206
|
+
label: "Fastify",
|
|
207
|
+
packageName: "@mushi-mushi/node",
|
|
208
|
+
needsWebPackage: false,
|
|
209
|
+
snippet: (apiKey, projectId) => `// src/instrument.ts \u2014 load with: node --import ./dist/instrument.js
|
|
210
|
+
import { MushiNodeClient, attachUnhandledHook } from '@mushi-mushi/node'
|
|
211
|
+
import { mushiFastifyPlugin } from '@mushi-mushi/node/fastify'
|
|
212
|
+
import Fastify from 'fastify'
|
|
213
|
+
|
|
214
|
+
export const mushi = new MushiNodeClient({
|
|
215
|
+
projectId: '${projectId}',
|
|
216
|
+
apiKey: '${apiKey}',
|
|
217
|
+
environment: process.env.NODE_ENV ?? 'production',
|
|
218
|
+
})
|
|
219
|
+
attachUnhandledHook({ client: mushi })
|
|
220
|
+
|
|
221
|
+
const app = Fastify()
|
|
222
|
+
mushiFastifyPlugin(app, { client: mushi })`
|
|
223
|
+
},
|
|
224
|
+
hono: {
|
|
225
|
+
id: "hono",
|
|
226
|
+
label: "Hono",
|
|
227
|
+
packageName: "@mushi-mushi/node",
|
|
228
|
+
needsWebPackage: false,
|
|
229
|
+
snippet: (apiKey, projectId) => `// src/instrument.ts \u2014 load with: node --import ./dist/instrument.js
|
|
230
|
+
import { MushiNodeClient, attachUnhandledHook } from '@mushi-mushi/node'
|
|
231
|
+
import { mushiHonoErrorHandler } from '@mushi-mushi/node/hono'
|
|
232
|
+
import { Hono } from 'hono'
|
|
233
|
+
|
|
234
|
+
export const mushi = new MushiNodeClient({
|
|
235
|
+
projectId: '${projectId}',
|
|
236
|
+
apiKey: '${apiKey}',
|
|
237
|
+
environment: process.env.NODE_ENV ?? 'production',
|
|
238
|
+
})
|
|
239
|
+
attachUnhandledHook({ client: mushi })
|
|
240
|
+
|
|
241
|
+
const app = new Hono()
|
|
242
|
+
app.onError(
|
|
243
|
+
mushiHonoErrorHandler({ client: mushi }, (err, c) =>
|
|
244
|
+
c.text('Internal Server Error', 500),
|
|
245
|
+
),
|
|
246
|
+
)`
|
|
179
247
|
},
|
|
180
248
|
vanilla: {
|
|
181
249
|
id: "vanilla",
|
|
@@ -209,6 +277,9 @@ function detectFramework(cwd, pkg) {
|
|
|
209
277
|
if (deps.has("svelte")) return FRAMEWORKS.svelte;
|
|
210
278
|
if (deps.has("vue")) return FRAMEWORKS.vue;
|
|
211
279
|
if (deps.has("react")) return FRAMEWORKS.react;
|
|
280
|
+
if (deps.has("express")) return FRAMEWORKS.express;
|
|
281
|
+
if (deps.has("fastify")) return FRAMEWORKS.fastify;
|
|
282
|
+
if (deps.has("hono") || deps.has("@hono/hono")) return FRAMEWORKS.hono;
|
|
212
283
|
if (existsSync(join(cwd, "next.config.js")) || existsSync(join(cwd, "next.config.ts"))) {
|
|
213
284
|
return FRAMEWORKS.next;
|
|
214
285
|
}
|
|
@@ -234,7 +305,14 @@ function installCommand(pm, packages) {
|
|
|
234
305
|
const verb = pm === "npm" ? "install" : "add";
|
|
235
306
|
return `${pm} ${verb} ${packages.join(" ")}`;
|
|
236
307
|
}
|
|
308
|
+
var SERVER_FRAMEWORK_IDS = /* @__PURE__ */ new Set(["express", "fastify", "hono"]);
|
|
237
309
|
function envVarsToWrite(apiKey, projectId, framework) {
|
|
310
|
+
if (SERVER_FRAMEWORK_IDS.has(framework.id)) {
|
|
311
|
+
return [
|
|
312
|
+
`MUSHI_PROJECT_ID=${projectId}`,
|
|
313
|
+
`MUSHI_API_KEY=${apiKey}`
|
|
314
|
+
].join("\n");
|
|
315
|
+
}
|
|
238
316
|
const prefix = framework.id === "next" ? "NEXT_PUBLIC_" : framework.id === "nuxt" ? "NUXT_PUBLIC_" : "VITE_";
|
|
239
317
|
return [
|
|
240
318
|
`${prefix}MUSHI_PROJECT_ID=${projectId}`,
|
package/dist/detect.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* PURPOSE: Pure detection helpers for framework, package manager, and project state.
|
|
4
4
|
* Kept side-effect-free so the wizard remains unit-testable.
|
|
5
5
|
*/
|
|
6
|
-
type FrameworkId = 'next' | 'react' | 'vue' | 'nuxt' | 'svelte' | 'sveltekit' | 'angular' | 'expo' | 'react-native' | 'capacitor' | 'vanilla';
|
|
6
|
+
type FrameworkId = 'next' | 'react' | 'vue' | 'nuxt' | 'svelte' | 'sveltekit' | 'angular' | 'expo' | 'react-native' | 'capacitor' | 'express' | 'fastify' | 'hono' | 'vanilla';
|
|
7
7
|
interface Framework {
|
|
8
8
|
id: FrameworkId;
|
|
9
9
|
label: string;
|