create-astro 1.2.0 → 1.2.2

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 CHANGED
@@ -42,6 +42,7 @@ May be provided in place of prompts
42
42
  |:-------------|:----------------------------------------------------|
43
43
  | `--template` | Specify the template name ([list][examples]) |
44
44
  | `--commit` | Specify a specific Git commit or branch to use from this repo (by default, `main` branch of this repo will be used) |
45
+ | `--fancy` | For Windows users, `--fancy` will enable full unicode support |
45
46
 
46
47
  ### Debugging
47
48
 
package/create-astro.mjs CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
2
+ /* eslint-disable no-console */
2
3
  'use strict';
3
4
 
4
5
  const currentVersion = process.versions.node;
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { color, generateProjectName, label, say } from "@astrojs/cli-kit";
2
- import { random } from "@astrojs/cli-kit/utils";
2
+ import { forceUnicode, random } from "@astrojs/cli-kit/utils";
3
3
  import { assign, parse, stringify } from "comment-json";
4
4
  import { execa, execaCommand } from "execa";
5
5
  import fs from "fs";
@@ -23,8 +23,11 @@ import {
23
23
  } from "./messages.js";
24
24
  import { TEMPLATES } from "./templates.js";
25
25
  const cleanArgv = process.argv.filter((arg) => arg !== "--");
26
- const args = yargs(cleanArgv);
26
+ const args = yargs(cleanArgv, { boolean: ["fancy"] });
27
27
  prompts.override(args);
28
+ if (args.fancy) {
29
+ forceUnicode();
30
+ }
28
31
  function mkdirp(dir) {
29
32
  try {
30
33
  fs.mkdirSync(dir, { recursive: true });
@@ -75,16 +78,19 @@ async function main() {
75
78
  const [username, version] = await Promise.all([getName(), getVersion()]);
76
79
  logger.debug("Verbose logging turned on");
77
80
  if (!args.skipHouston) {
78
- await say([
81
+ await say(
79
82
  [
80
- "Welcome",
81
- "to",
82
- label("astro", color.bgGreen, color.black),
83
- color.green(`v${version}`) + ",",
84
- `${username}!`
83
+ [
84
+ "Welcome",
85
+ "to",
86
+ label("astro", color.bgGreen, color.black),
87
+ color.green(`v${version}`) + ",",
88
+ `${username}!`
89
+ ],
90
+ random(welcome)
85
91
  ],
86
- random(welcome)
87
- ]);
92
+ { hat: args.fancy ? "\u{1F3A9}" : void 0 }
93
+ );
88
94
  await banner(version);
89
95
  }
90
96
  let cwd = args["_"][2];
@@ -106,7 +112,7 @@ async function main() {
106
112
  type: "text",
107
113
  name: "directory",
108
114
  message: "Where would you like to create your new project?",
109
- initial: `./${generateProjectName()}`,
115
+ initial: generateProjectName(),
110
116
  validate(value) {
111
117
  if (!isValidProjectDirectory(value)) {
112
118
  return notEmptyMsg(value);
@@ -119,6 +125,7 @@ async function main() {
119
125
  cwd = dirResponse.directory;
120
126
  }
121
127
  if (!cwd) {
128
+ ora().info(dim("No directory provided. See you later, astronaut!"));
122
129
  process.exit(1);
123
130
  }
124
131
  const options = await prompts(
@@ -133,6 +140,7 @@ async function main() {
133
140
  { onCancel: () => ora().info(dim("Operation cancelled. See you later, astronaut!")) }
134
141
  );
135
142
  if (!options.template) {
143
+ ora().info(dim("No template provided. See you later, astronaut!"));
136
144
  process.exit(1);
137
145
  }
138
146
  let templateSpinner = await loadWithRocketGradient("Copying project files...");
@@ -294,7 +302,9 @@ ${bold(
294
302
  let projectDir = path.relative(process.cwd(), cwd);
295
303
  const devCmd = pkgManager === "npm" ? "npm run dev" : `${pkgManager} dev`;
296
304
  await nextSteps({ projectDir, devCmd });
297
- await say(["Good luck out there, astronaut!"]);
305
+ if (!args.skipHouston) {
306
+ await say(["Good luck out there, astronaut!"]);
307
+ }
298
308
  }
299
309
  function emojiWithFallback(char, fallback) {
300
310
  return process.platform !== "win32" ? char : fallback;
package/dist/messages.js CHANGED
@@ -12,7 +12,7 @@ const welcome = [
12
12
  `Let's make the web weird!`,
13
13
  `Let's make the web a better place!`,
14
14
  `Let's create a new project!`,
15
- `Let's create something unqiue!`,
15
+ `Let's create something unique!`,
16
16
  `Time to build a new website.`,
17
17
  `Time to build a faster website.`,
18
18
  `Time to build a sweet new website.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-astro",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "author": "withastro",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  "tsconfigs"
24
24
  ],
25
25
  "dependencies": {
26
- "@astrojs/cli-kit": "^0.1.0",
26
+ "@astrojs/cli-kit": "^0.1.4",
27
27
  "chalk": "^5.0.1",
28
28
  "comment-json": "^4.2.3",
29
29
  "execa": "^6.1.0",
@@ -42,7 +42,7 @@
42
42
  "@types/prompts": "^2.0.14",
43
43
  "@types/which-pm-runs": "^1.0.0",
44
44
  "@types/yargs-parser": "^21.0.0",
45
- "astro-scripts": "0.0.8",
45
+ "astro-scripts": "0.0.9",
46
46
  "chai": "^4.3.6",
47
47
  "mocha": "^9.2.2",
48
48
  "uvu": "^0.5.3"