create-message-kit 1.1.7-beta.22 → 1.1.7-beta.23

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.js +29 -28
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -15,9 +15,16 @@ const packageJson = JSON.parse(
15
15
  );
16
16
  const version = packageJson.version;
17
17
  program
18
- .name("byob")
18
+ .name("message-kit")
19
19
  .description("CLI to initialize projects")
20
20
  .action(async () => {
21
+ // Add Yarn 4 check at the start of the action
22
+ const pkgManager = detectPackageManager();
23
+ if (pkgManager.startsWith("yarn@4")) {
24
+ log.error("Yarn 4 is not supported. Please use bun, npm, or yarn v1");
25
+ process.exit(1);
26
+ }
27
+
21
28
  log.info(pc.cyan(`Welcome to MessageKit CLI v${version}!`));
22
29
  const coolLogo = `
23
30
  ███╗ ███╗███████╗███████╗███████╗ █████╗ ██████╗ ███████╗██╗ ██╗██╗████████╗
@@ -32,11 +39,6 @@ Powered by XMTP`;
32
39
 
33
40
  const { templateType, displayName, destDir } = await gatherProjectInfo();
34
41
 
35
- console.log("detected package manager", detectPackageManager());
36
-
37
- // Add package.json
38
- addPackagejson(destDir, displayName);
39
-
40
42
  // Create .gitignore
41
43
  createGitignore(destDir);
42
44
 
@@ -49,7 +51,8 @@ Powered by XMTP`;
49
51
  // Wrap up
50
52
  log.success(`Project launched in ${pc.red(destDir)}!`);
51
53
 
52
- const pkgManager = detectPackageManager();
54
+ // Add package.json
55
+ addPackagejson(destDir, displayName, pkgManager);
53
56
 
54
57
  // Create README.md file
55
58
  createReadme(destDir, templateType, displayName, pkgManager);
@@ -62,7 +65,7 @@ Powered by XMTP`;
62
65
 
63
66
  program.parse(process.argv);
64
67
 
65
- async function addPackagejson(destDir, name) {
68
+ async function addPackagejson(destDir, name, pkgManager) {
66
69
  // Create package.json based on the template
67
70
  let packageTemplate = {
68
71
  name: name,
@@ -77,12 +80,14 @@ async function addPackagejson(destDir, name) {
77
80
  dependencies: {
78
81
  "@xmtp/message-kit": "latest",
79
82
  },
83
+ devDependencies: {
84
+ typescript: "^5.4.5",
85
+ },
80
86
  engines: {
81
87
  node: ">=20",
82
88
  },
83
89
  };
84
- // Only add packageManager field if using yarn
85
- const pkgManager = detectPackageManager();
90
+
86
91
  if (pkgManager.startsWith("yarn")) {
87
92
  packageTemplate.packageManager = pkgManager;
88
93
  }
@@ -199,27 +204,23 @@ yarn-error.log*
199
204
  function detectPackageManager() {
200
205
  const userAgent = process.env.npm_config_user_agent;
201
206
  if (!userAgent) return "npm";
202
-
203
- // Improve package manager detection
204
- const managers = {
205
- bun: "bun",
206
- yarn: "yarn",
207
- pnpm: "pnpm",
208
- npm: "npm",
209
- };
210
-
211
- for (const [manager, value] of Object.entries(managers)) {
212
- if (userAgent.includes(manager)) {
213
- // Extract version for yarn
214
- if (manager === "yarn") {
215
- const version =
216
- userAgent.match(/yarn\/(\d+\.\d+\.\d+)/)?.[1] || "4.5.1";
217
- return `${value}@${version}`;
207
+ if (userAgent.includes("bun")) return "bun";
208
+ if (userAgent.includes("pnpm")) return "pnpm";
209
+ if (userAgent.includes("npm")) return "npm";
210
+
211
+ if (userAgent.includes("yarn")) {
212
+ for (const [manager, value] of Object.entries(managers)) {
213
+ if (userAgent.includes(manager)) {
214
+ // Extract version for yarn
215
+ if (manager === "yarn") {
216
+ const version =
217
+ userAgent.match(/yarn\/(\d+\.\d+\.\d+)/)?.[1] || "4.5.1";
218
+ return `${value}@${version}`;
219
+ }
220
+ return value;
218
221
  }
219
- return value;
220
222
  }
221
223
  }
222
-
223
224
  return "npm";
224
225
  }
225
226
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-message-kit",
3
- "version": "1.1.7-beta.22",
3
+ "version": "1.1.7-beta.23",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "index.js",