create-astro 3.1.8 → 3.1.10
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/README.md +11 -10
- package/dist/index.js +18 -18
- 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
|
|
42
|
-
|
|
43
|
-
| `--template <name>`
|
|
44
|
-
| `--install` / `--no-install` | Install dependencies (or not).
|
|
45
|
-
| `--git` / `--no-git`
|
|
46
|
-
| `--yes` (`-y`)
|
|
47
|
-
| `--no` (`-n`)
|
|
48
|
-
| `--dry-run`
|
|
49
|
-
| `--skip-houston`
|
|
50
|
-
| `--typescript <option>`
|
|
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
|
-
|
|
208
|
-
|
|
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) {
|
|
@@ -239,11 +243,11 @@ var welcome = [
|
|
|
239
243
|
`Awaiting further instructions.`
|
|
240
244
|
];
|
|
241
245
|
var getName = () => new Promise((resolve) => {
|
|
242
|
-
exec("git config user.name", { encoding: "utf-8" }, (_1, gitName
|
|
246
|
+
exec("git config user.name", { encoding: "utf-8" }, (_1, gitName) => {
|
|
243
247
|
if (gitName.trim()) {
|
|
244
248
|
return resolve(gitName.split(" ")[0].trim());
|
|
245
249
|
}
|
|
246
|
-
exec("whoami", { encoding: "utf-8" }, (_3, whoami
|
|
250
|
+
exec("whoami", { encoding: "utf-8" }, (_3, whoami) => {
|
|
247
251
|
if (whoami.trim()) {
|
|
248
252
|
return resolve(whoami.split(" ")[0].trim());
|
|
249
253
|
}
|
|
@@ -255,16 +259,12 @@ var v;
|
|
|
255
259
|
var getVersion = () => new Promise(async (resolve) => {
|
|
256
260
|
if (v)
|
|
257
261
|
return resolve(v);
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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.
|
|
359
|
+
`${title(commandName)} ${color.green(`v${"3.1.10"}`)} ${headline}`
|
|
360
360
|
);
|
|
361
361
|
}
|
|
362
362
|
if (usage) {
|
|
@@ -475,7 +475,7 @@ async function dependencies(ctx) {
|
|
|
475
475
|
await info("--dry-run", `Skipping dependency installation`);
|
|
476
476
|
} else if (deps) {
|
|
477
477
|
await spinner({
|
|
478
|
-
start: `
|
|
478
|
+
start: `Installing dependencies with ${ctx.pkgManager}...`,
|
|
479
479
|
end: "Dependencies installed",
|
|
480
480
|
while: () => {
|
|
481
481
|
return install({ pkgManager: ctx.pkgManager, cwd: ctx.cwd }).catch((e) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-astro",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.10",
|
|
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": {
|