create-astro 3.1.8 → 3.1.9

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 +11 -10
  2. package/dist/index.js +15 -15
  3. package/package.json +2 -1
package/README.md CHANGED
@@ -26,6 +26,7 @@ npm create astro@latest my-astro-project -- --template minimal
26
26
  # yarn
27
27
  yarn create astro my-astro-project --template minimal
28
28
  ```
29
+
29
30
  [Check out the full list][examples] of example templates, available on GitHub.
30
31
 
31
32
  You can also use any GitHub repo as a template:
@@ -38,16 +39,16 @@ npm create astro@latest my-astro-project -- --template cassidoo/shopify-react-as
38
39
 
39
40
  May be provided in place of prompts
40
41
 
41
- | Name | Description |
42
- |:-------------|:----------------------------------------------------|
43
- | `--template <name>` | Specify your template. |
44
- | `--install` / `--no-install` | Install dependencies (or not). |
45
- | `--git` / `--no-git` | Initialize git repo (or not). |
46
- | `--yes` (`-y`) | Skip all prompt by accepting defaults. |
47
- | `--no` (`-n`) | Skip all prompt by declining defaults. |
48
- | `--dry-run` | Walk through steps without executing. |
49
- | `--skip-houston` | Skip Houston animation. |
50
- | `--typescript <option>` | TypeScript option: `strict` / `strictest` / `relaxed`. |
42
+ | Name | Description |
43
+ | :--------------------------- | :----------------------------------------------------- |
44
+ | `--template <name>` | Specify your template. |
45
+ | `--install` / `--no-install` | Install dependencies (or not). |
46
+ | `--git` / `--no-git` | Initialize git repo (or not). |
47
+ | `--yes` (`-y`) | Skip all prompt by accepting defaults. |
48
+ | `--no` (`-n`) | Skip all prompt by declining defaults. |
49
+ | `--dry-run` | Walk through steps without executing. |
50
+ | `--skip-houston` | Skip Houston animation. |
51
+ | `--typescript <option>` | TypeScript option: `strict` / `strictest` / `relaxed`. |
51
52
 
52
53
  [examples]: https://github.com/withastro/astro/tree/main/examples
53
54
  [typescript]: https://github.com/withastro/astro/tree/main/packages/astro/tsconfigs
package/dist/index.js CHANGED
@@ -178,8 +178,8 @@ import detectPackageManager2 from "which-pm-runs";
178
178
  import { color, label, say as houston, spinner as load } from "@astrojs/cli-kit";
179
179
  import { align, sleep } from "@astrojs/cli-kit/utils";
180
180
  import { execa } from "execa";
181
+ import fetch from "node-fetch-native";
181
182
  import { exec } from "node:child_process";
182
- import { get } from "node:https";
183
183
 
184
184
  // ../../node_modules/.pnpm/ansi-regex@6.0.1/node_modules/ansi-regex/index.js
185
185
  function ansiRegex({ onlyFirst = false } = {}) {
@@ -202,10 +202,14 @@ function stripAnsi(string) {
202
202
  // src/messages.ts
203
203
  import detectPackageManager from "which-pm-runs";
204
204
  async function getRegistry() {
205
- var _a;
205
+ var _a, _b;
206
206
  const packageManager = ((_a = detectPackageManager()) == null ? void 0 : _a.name) || "npm";
207
- const { stdout: stdout2 } = await execa(packageManager, ["config", "get", "registry"]);
208
- return stdout2 || "https://registry.npmjs.org";
207
+ try {
208
+ const { stdout: stdout2 } = await execa(packageManager, ["config", "get", "registry"]);
209
+ return ((_b = stdout2 == null ? void 0 : stdout2.trim()) == null ? void 0 : _b.replace(/\/$/, "")) || "https://registry.npmjs.org";
210
+ } catch (e) {
211
+ return "https://registry.npmjs.org";
212
+ }
209
213
  }
210
214
  var stdout = process.stdout;
211
215
  function setStdout(writable) {
@@ -255,16 +259,12 @@ var v;
255
259
  var getVersion = () => new Promise(async (resolve) => {
256
260
  if (v)
257
261
  return resolve(v);
258
- const registry = await getRegistry();
259
- get(`${registry}/astro/latest`, (res) => {
260
- let body = "";
261
- res.on("data", (chunk) => body += chunk);
262
- res.on("end", () => {
263
- const { version } = JSON.parse(body);
264
- v = version;
265
- resolve(version);
266
- });
267
- });
262
+ let registry = await getRegistry();
263
+ const { version } = await fetch(`${registry}/astro/latest`, { redirect: "follow" }).then(
264
+ (res) => res.json()
265
+ );
266
+ v = version;
267
+ resolve(version);
268
268
  });
269
269
  var log = (message) => stdout.write(message + "\n");
270
270
  var banner = async (version) => log(
@@ -356,7 +356,7 @@ function printHelp({
356
356
  if (headline) {
357
357
  message.push(
358
358
  linebreak(),
359
- `${title(commandName)} ${color.green(`v${"3.1.8"}`)} ${headline}`
359
+ `${title(commandName)} ${color.green(`v${"3.1.9"}`)} ${headline}`
360
360
  );
361
361
  }
362
362
  if (usage) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astro",
3
- "version": "3.1.8",
3
+ "version": "3.1.9",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -30,6 +30,7 @@
30
30
  "execa": "^6.1.0",
31
31
  "giget": "1.0.0",
32
32
  "mocha": "^9.2.2",
33
+ "node-fetch-native": "^1.2.0",
33
34
  "which-pm-runs": "^1.1.0"
34
35
  },
35
36
  "devDependencies": {