create-mushi-mushi 0.5.21 → 0.6.0
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/dist/index.js +15 -85
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2,101 +2,31 @@
|
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
4
|
import { runInit } from "@mushi-mushi/cli/init";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import {
|
|
6
|
+
parseArgs,
|
|
7
|
+
assertNodeVersion,
|
|
8
|
+
FLAGS_HELP
|
|
9
|
+
} from "@mushi-mushi/cli/wizard-args";
|
|
10
|
+
var VERSION = true ? "0.6.0" : "0.0.0-dev";
|
|
11
|
+
var BIN = "create-mushi-mushi";
|
|
8
12
|
var ISSUES_URL = "https://github.com/kensaurus/mushi-mushi/issues";
|
|
9
13
|
var HELP = `create-mushi-mushi \u2014 add Mushi Mushi to your existing project
|
|
10
14
|
|
|
15
|
+
This does NOT scaffold a new app. It runs the setup wizard in your current
|
|
16
|
+
project: detects your framework and installs the right Mushi package.
|
|
17
|
+
|
|
11
18
|
Usage:
|
|
12
|
-
npm create mushi-mushi
|
|
13
|
-
npm create mushi-mushi -- --help
|
|
19
|
+
npm create mushi-mushi run the wizard
|
|
20
|
+
npm create mushi-mushi -- --help show all flags
|
|
14
21
|
|
|
15
22
|
Note: \`npm create\` requires the \`--\` separator before flags.
|
|
16
23
|
\`yarn create mushi-mushi --help\` works without it on Yarn 1.
|
|
17
24
|
\`pnpm create mushi-mushi -- --help\` mirrors npm.
|
|
18
25
|
\`bun create mushi-mushi --help\` works without it.
|
|
19
26
|
|
|
20
|
-
|
|
21
|
-
--project-id <id> skip the project ID prompt
|
|
22
|
-
--api-key <key> skip the API key prompt (CI only)
|
|
23
|
-
--framework <id> force a framework (${FRAMEWORK_IDS.join(", ")})
|
|
24
|
-
--skip-install print the install command instead of running it
|
|
25
|
-
--skip-test-report don't offer to send a test report at the end
|
|
26
|
-
--cwd <path> run in a different directory
|
|
27
|
-
--endpoint <url> override the Mushi API endpoint (self-hosted)
|
|
28
|
-
-y, --yes accept the detected framework without prompting
|
|
29
|
-
-v, --version print the version and exit
|
|
30
|
-
|
|
31
|
-
Docs: https://github.com/kensaurus/mushi-mushi
|
|
32
|
-
Console: https://kensaur.us/mushi-mushi/`;
|
|
33
|
-
function parseArgs(args) {
|
|
34
|
-
const out = { showHelp: false, showVersion: false };
|
|
35
|
-
for (let i = 0; i < args.length; i++) {
|
|
36
|
-
const a = args[i];
|
|
37
|
-
if (a === "-h" || a === "--help") {
|
|
38
|
-
out.showHelp = true;
|
|
39
|
-
continue;
|
|
40
|
-
}
|
|
41
|
-
if (a === "-v" || a === "--version") {
|
|
42
|
-
out.showVersion = true;
|
|
43
|
-
continue;
|
|
44
|
-
}
|
|
45
|
-
if (a === "-y" || a === "--yes") {
|
|
46
|
-
out.yes = true;
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
if (a === "--skip-install") {
|
|
50
|
-
out.skipInstall = true;
|
|
51
|
-
continue;
|
|
52
|
-
}
|
|
53
|
-
if (a === "--skip-test-report") {
|
|
54
|
-
out.skipTestReport = true;
|
|
55
|
-
continue;
|
|
56
|
-
}
|
|
57
|
-
if (a === "--project-id") {
|
|
58
|
-
out.projectId = args[++i];
|
|
59
|
-
continue;
|
|
60
|
-
}
|
|
61
|
-
if (a === "--api-key") {
|
|
62
|
-
out.apiKey = args[++i];
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (a === "--cwd") {
|
|
66
|
-
out.cwd = args[++i];
|
|
67
|
-
continue;
|
|
68
|
-
}
|
|
69
|
-
if (a === "--endpoint") {
|
|
70
|
-
out.endpoint = args[++i];
|
|
71
|
-
continue;
|
|
72
|
-
}
|
|
73
|
-
if (a === "--framework") {
|
|
74
|
-
const fw = args[++i];
|
|
75
|
-
if (!isFrameworkId(fw)) {
|
|
76
|
-
throw new Error(`Unknown framework: ${fw}. Valid: ${FRAMEWORK_IDS.join(", ")}`);
|
|
77
|
-
}
|
|
78
|
-
out.framework = fw;
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
if (a.startsWith("-")) {
|
|
82
|
-
throw new Error(`Unknown flag: ${a}. Try --help.`);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
return out;
|
|
86
|
-
}
|
|
87
|
-
function assertNodeVersion() {
|
|
88
|
-
const major = Number(process.versions.node.split(".")[0]);
|
|
89
|
-
if (!Number.isFinite(major) || major < MIN_NODE_MAJOR) {
|
|
90
|
-
process.stderr.write(
|
|
91
|
-
`create-mushi-mushi requires Node.js ${MIN_NODE_MAJOR} or newer. You are on ${process.versions.node}.
|
|
92
|
-
Upgrade Node (https://nodejs.org/) and try again.
|
|
93
|
-
`
|
|
94
|
-
);
|
|
95
|
-
process.exit(1);
|
|
96
|
-
}
|
|
97
|
-
}
|
|
27
|
+
${FLAGS_HELP}`;
|
|
98
28
|
async function main() {
|
|
99
|
-
assertNodeVersion();
|
|
29
|
+
assertNodeVersion(BIN);
|
|
100
30
|
let parsed;
|
|
101
31
|
try {
|
|
102
32
|
parsed = parseArgs(process.argv.slice(2));
|
|
@@ -127,7 +57,7 @@ async function main() {
|
|
|
127
57
|
main().catch((err) => {
|
|
128
58
|
const message = err instanceof Error ? err.message : String(err);
|
|
129
59
|
process.stderr.write(`
|
|
130
|
-
|
|
60
|
+
${BIN}: ${message}
|
|
131
61
|
`);
|
|
132
62
|
if (process.env.DEBUG?.includes("mushi") && err instanceof Error && err.stack) {
|
|
133
63
|
process.stderr.write(err.stack + "\n");
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-mushi-mushi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Run `npm create mushi-mushi` to add the Mushi Mushi bug-reporting SDK to your existing project — the wizard auto-detects your framework (React, Vue, Svelte, Angular, React Native, Expo, Capacitor) and installs the right package.",
|
|
6
6
|
"bin": {
|
|
7
7
|
"create-mushi-mushi": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@mushi-mushi/cli": "^0.
|
|
10
|
+
"@mushi-mushi/cli": "^0.26.0"
|
|
11
11
|
},
|
|
12
12
|
"devDependencies": {
|
|
13
13
|
"@types/node": "^22.20.0",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
],
|
|
78
78
|
"type": "module",
|
|
79
79
|
"engines": {
|
|
80
|
-
"node": ">=
|
|
80
|
+
"node": ">=20"
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "tsup",
|