create-astro 0.12.4 → 0.14.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 CHANGED
@@ -1,10 +1,11 @@
1
1
  import degit from "degit";
2
2
  import { execa, execaCommand } from "execa";
3
3
  import fs from "fs";
4
- import { bgCyan, black, bold, cyan, dim, gray, green, red, yellow } from "kleur/colors";
4
+ import { bgCyan, black, bold, cyan, dim, gray, green, red, reset, yellow } from "kleur/colors";
5
5
  import ora from "ora";
6
6
  import path from "path";
7
7
  import prompts from "prompts";
8
+ import detectPackageManager from "which-pm-runs";
8
9
  import yargs from "yargs-parser";
9
10
  import { loadWithRocketGradient, rocketAscii } from "./gradient.js";
10
11
  import { defaultLogLevel, logger } from "./logger.js";
@@ -34,7 +35,8 @@ function isEmpty(dirPath) {
34
35
  const { version } = JSON.parse(fs.readFileSync(new URL("../package.json", import.meta.url), "utf-8"));
35
36
  const FILES_TO_REMOVE = [".stackblitzrc", "sandbox.config.json", "CHANGELOG.md"];
36
37
  async function main() {
37
- const pkgManager = pkgManagerFromUserAgent(process.env.npm_config_user_agent);
38
+ var _a;
39
+ const pkgManager = ((_a = detectPackageManager()) == null ? void 0 : _a.name) || "npm";
38
40
  logger.debug("Verbose logging turned on");
39
41
  console.log(`
40
42
  ${bold("Welcome to Astro!")} ${gray(`(create-astro v${version})`)}`);
@@ -127,7 +129,7 @@ ${bold("Welcome to Astro!")} ${gray(`(create-astro v${version})`)}`);
127
129
  const installResponse = await prompts({
128
130
  type: "confirm",
129
131
  name: "install",
130
- message: `Would you like us to run "${pkgManager} install?"`,
132
+ message: `Would you like to install ${pkgManager} dependencies? ${reset(dim("(recommended)"))}`,
131
133
  initial: true
132
134
  });
133
135
  if (args.dryRun) {
@@ -137,8 +139,8 @@ ${bold("Welcome to Astro!")} ${gray(`(create-astro v${version})`)}`);
137
139
  const installingPackagesMsg = `Installing packages${emojiWithFallback(" \u{1F4E6}", "...")}`;
138
140
  const installSpinner = await loadWithRocketGradient(installingPackagesMsg);
139
141
  await new Promise((resolve, reject) => {
140
- var _a;
141
- (_a = installExec.stdout) == null ? void 0 : _a.on("data", function(data) {
142
+ var _a2;
143
+ (_a2 = installExec.stdout) == null ? void 0 : _a2.on("data", function(data) {
142
144
  installSpinner.text = `${rocketAscii} ${installingPackagesMsg}
143
145
  ${bold(`[${pkgManager}]`)} ${data}`;
144
146
  });
@@ -148,12 +150,12 @@ ${bold(`[${pkgManager}]`)} ${data}`;
148
150
  installSpinner.text = green("Packages installed!");
149
151
  installSpinner.succeed();
150
152
  } else {
151
- ora().info(dim(`No problem! You can install dependencies yourself after setup.`));
153
+ ora().info(dim(`No problem! Remember to install dependencies after setup.`));
152
154
  }
153
155
  const gitResponse = await prompts({
154
156
  type: "confirm",
155
157
  name: "git",
156
- message: `Initialize a new git repository? ${dim("This can be useful to track changes.")}`,
158
+ message: `Would you like to initialize a new git repository? ${reset(dim("(optional)"))}`,
157
159
  initial: true
158
160
  });
159
161
  if (args.dryRun) {
@@ -182,20 +184,6 @@ ${bgCyan(black(" Next steps "))}
182
184
  function emojiWithFallback(char, fallback) {
183
185
  return process.platform !== "win32" ? char : fallback;
184
186
  }
185
- function pkgManagerFromUserAgent(userAgent) {
186
- if (!userAgent)
187
- return "npm";
188
- const pkgSpec = userAgent.split(" ")[0];
189
- const pkgSpecArr = pkgSpec.split("/");
190
- return pkgSpecArr[0];
191
- }
192
- function pkgManagerExecCommand(pkgManager) {
193
- if (pkgManager === "pnpm") {
194
- return "pnpx";
195
- } else {
196
- return "npx";
197
- }
198
- }
199
187
  export {
200
188
  main,
201
189
  mkdirp
package/dist/templates.js CHANGED
@@ -1,22 +1,22 @@
1
1
  const TEMPLATES = [
2
2
  {
3
- title: "Just the basics",
3
+ title: "Just the basics (recommended)",
4
4
  value: "basics"
5
5
  },
6
6
  {
7
7
  title: "Blog",
8
8
  value: "blog"
9
9
  },
10
- {
11
- title: "Documentation",
12
- value: "docs"
13
- },
14
10
  {
15
11
  title: "Portfolio",
16
12
  value: "portfolio"
17
13
  },
18
14
  {
19
- title: "Completely empty",
15
+ title: "Documentation Site",
16
+ value: "docs"
17
+ },
18
+ {
19
+ title: "Empty project",
20
20
  value: "minimal"
21
21
  }
22
22
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astro",
3
- "version": "0.12.4",
3
+ "version": "0.14.0",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -22,27 +22,29 @@
22
22
  "create-astro.js"
23
23
  ],
24
24
  "dependencies": {
25
- "@types/degit": "^2.8.3",
26
- "@types/prompts": "^2.0.14",
27
25
  "chalk": "^5.0.1",
28
26
  "degit": "^2.8.4",
29
27
  "execa": "^6.1.0",
30
28
  "kleur": "^4.1.4",
31
29
  "ora": "^6.1.0",
32
30
  "prompts": "^2.4.2",
31
+ "which-pm-runs": "^1.1.0",
33
32
  "yargs-parser": "^21.0.1"
34
33
  },
35
34
  "devDependencies": {
36
35
  "@types/chai": "^4.3.1",
36
+ "@types/degit": "^2.8.3",
37
37
  "@types/mocha": "^9.1.1",
38
+ "@types/prompts": "^2.0.14",
39
+ "@types/which-pm-runs": "^1.0.0",
38
40
  "@types/yargs-parser": "^21.0.0",
39
- "astro-scripts": "0.0.5",
41
+ "astro-scripts": "0.0.6",
40
42
  "chai": "^4.3.6",
41
43
  "mocha": "^9.2.2",
42
44
  "uvu": "^0.5.3"
43
45
  },
44
46
  "engines": {
45
- "node": "^14.15.0 || >=16.0.0"
47
+ "node": "^14.20.0 || >=16.14.0"
46
48
  },
47
49
  "scripts": {
48
50
  "build": "astro-scripts build \"src/**/*.ts\" && tsc",