@mastrojs/create-mastro 0.0.3 → 0.0.5

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 (3) hide show
  1. package/README.md +4 -0
  2. package/index.js +16 -8
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -7,3 +7,7 @@ Create a new [Mastro](https://mastrojs.github.io/) project. Usage:
7
7
  Node.js
8
8
 
9
9
  pnpm create @mastrojs/mastro@latest
10
+
11
+ Bun
12
+
13
+ bun create @mastrojs/mastro@latest
package/index.js CHANGED
@@ -3,10 +3,7 @@
3
3
  //@ts-check
4
4
 
5
5
  /**
6
- * This script initializes an empty Mastro project. Usage:
7
- *
8
- * Deno: `deno run -A npm:@mastrojs/init@latest`
9
- * Node.js: `npx @mastrojs/init@latest`
6
+ * This script initializes an empty Mastro project.
10
7
  *
11
8
  * This is an npm package until JSR has a way to create a "bin" field in the generated package.json
12
9
  * See https://github.com/jsr-io/jsr-npm/issues/76
@@ -20,6 +17,10 @@ import { stdin, stdout } from "node:process";
20
17
  import { createInterface } from "node:readline/promises";
21
18
  import { Readable } from "node:stream";
22
19
 
20
+ const runtime = typeof Deno === "object"
21
+ ? "deno"
22
+ : (process.versions.bun ? "bun" : "node");
23
+
23
24
  /**
24
25
  * @param {string} path
25
26
  * @param {ReadableStream<Uint8Array<ArrayBuffer>>} data
@@ -53,8 +54,7 @@ const execCmd = (cmd) =>
53
54
  }))
54
55
  );
55
56
 
56
- const isDeno = typeof Deno === "object";
57
- const repoName = `template-basic-${isDeno ? "deno" : "node"}`;
57
+ const repoName = `template-basic-${runtime}`;
58
58
  const repoUrl = `https://github.com/mastrojs/${repoName}/archive/refs/heads/main.zip`;
59
59
  const zipFilePromise = fetch(repoUrl);
60
60
 
@@ -83,13 +83,21 @@ if (dir) {
83
83
  if (unzipSuccess) {
84
84
  await fs.rename(outDir, dir);
85
85
 
86
+ const bunOrPnpm = runtime === "bun" ? "bun" : "pnpm";
87
+ const installInstr = runtime === "deno"
88
+ ? ""
89
+ : `\n\nThen install dependencies with: ${bunOrPnpm} install\n`;
90
+ const startInstr = runtime === "deno"
91
+ ? "deno task start"
92
+ : `${bunOrPnpm} run start`;
93
+
86
94
  const codeStyle = "color: blue";
87
95
  console.log(
88
96
  `
89
97
  Success!
90
98
 
91
- Enter the newly created folder with: %ccd ${dir}${isDeno ? "" : "\n\nThen install dependencies with: pnpm install\n"}
92
- %cThen start the dev server with: %c${isDeno ? "deno task" : "pnpm run"} start`,
99
+ Enter the newly created folder with: %ccd ${dir}${installInstr}
100
+ %cThen start the dev server with: %c${startInstr}`,
93
101
  codeStyle,
94
102
  "",
95
103
  codeStyle,
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@mastrojs/create-mastro",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "type": "module",
5
5
  "scripts": {
6
- "publish": "deno check && npm publish"
6
+ "npm-publish": "deno check && npm publish --access public"
7
7
  },
8
8
  "bin": {
9
9
  "create-mastro": "index.js"