create-bestax 3.2.0 → 3.2.1
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/constants.d.ts +1 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +4 -0
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +18 -0
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -13,6 +13,7 @@ export declare const MESSAGES: {
|
|
|
13
13
|
readonly PROJECT_NAME_TOO_LONG: "Project name too long";
|
|
14
14
|
readonly PROJECT_NAME_INVALID_CHARS: "Project name can only contain letters, numbers, dots, dashes and underscores";
|
|
15
15
|
readonly OPERATION_CANCELLED: "✖ Operation cancelled";
|
|
16
|
+
readonly NO_TTY: string;
|
|
16
17
|
readonly DIRECTORY_NOT_EMPTY: (dir: string) => string;
|
|
17
18
|
readonly EMPTYING_DIRECTORY: (dir: string) => string;
|
|
18
19
|
readonly CREATING_PROJECT: (path: string) => string;
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,WAAW,QAAQ;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,KAAK,CAAC,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,SAAS,EAAE,QAAQ,EAG/B,CAAC;AAEF,eAAO,MAAM,oBAAoB,kBAAkB,CAAC;AACpD,eAAO,MAAM,uBAAuB,MAAM,CAAC;AAC3C,eAAO,MAAM,kBAAkB,QAAsB,CAAC;AAEtD,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;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AO,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,WAAW,EA0CtC,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -11,6 +11,10 @@ export const MESSAGES = {
|
|
|
11
11
|
PROJECT_NAME_TOO_LONG: 'Project name too long',
|
|
12
12
|
PROJECT_NAME_INVALID_CHARS: 'Project name can only contain letters, numbers, dots, dashes and underscores',
|
|
13
13
|
OPERATION_CANCELLED: '✖ Operation cancelled',
|
|
14
|
+
NO_TTY: 'No interactive terminal detected — cannot prompt for input.\n' +
|
|
15
|
+
'Re-run non-interactively with a project name and flags, e.g.:\n' +
|
|
16
|
+
' npm create bestax@latest my-app -- -t vite-ts -b complete -i none -y\n' +
|
|
17
|
+
'Run with --help to see all options.',
|
|
14
18
|
DIRECTORY_NOT_EMPTY: (dir) => `Directory ${chalk.yellow(dir)} is not empty. Remove existing files and continue?`,
|
|
15
19
|
EMPTYING_DIRECTORY: (dir) => `\n Emptying ${dir}...`,
|
|
16
20
|
CREATING_PROJECT: (path) => `✔ Creating project in ${chalk.bold(path)}`,
|
package/dist/prompts.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAwBA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAWhE;AAED,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CAUlB;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAU5D;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAa7D;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAchE;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAgBhE"}
|
package/dist/prompts.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
import prompts from 'prompts';
|
|
2
2
|
import { TEMPLATES, DEFAULT_PROJECT_NAME, PROMPTS as PROMPT_MESSAGES, MESSAGES, ICON_LIBRARIES, BULMA_FLAVORS, } from './constants.js';
|
|
3
3
|
import { validateProjectName } from './validators.js';
|
|
4
|
+
import { displayError } from './display.js';
|
|
5
|
+
/**
|
|
6
|
+
* Guard against hanging forever in non-interactive environments (CI, agents,
|
|
7
|
+
* piped stdin): every interactive question must fail fast with actionable
|
|
8
|
+
* guidance when stdin is not a TTY (#192).
|
|
9
|
+
*/
|
|
10
|
+
function ensureInteractive() {
|
|
11
|
+
if (!process.stdin.isTTY) {
|
|
12
|
+
displayError(MESSAGES.NO_TTY);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
4
16
|
export async function promptProjectName() {
|
|
17
|
+
ensureInteractive();
|
|
5
18
|
const response = await prompts({
|
|
6
19
|
type: 'text',
|
|
7
20
|
name: 'projectName',
|
|
@@ -12,6 +25,7 @@ export async function promptProjectName() {
|
|
|
12
25
|
return response.projectName || null;
|
|
13
26
|
}
|
|
14
27
|
export async function promptOverwriteDirectory(targetDir) {
|
|
28
|
+
ensureInteractive();
|
|
15
29
|
const response = await prompts({
|
|
16
30
|
type: 'confirm',
|
|
17
31
|
name: 'overwrite',
|
|
@@ -21,6 +35,7 @@ export async function promptOverwriteDirectory(targetDir) {
|
|
|
21
35
|
return response.overwrite === true;
|
|
22
36
|
}
|
|
23
37
|
export async function promptInstallSkills() {
|
|
38
|
+
ensureInteractive();
|
|
24
39
|
const response = await prompts({
|
|
25
40
|
type: 'confirm',
|
|
26
41
|
name: 'skills',
|
|
@@ -30,6 +45,7 @@ export async function promptInstallSkills() {
|
|
|
30
45
|
return response.skills === true;
|
|
31
46
|
}
|
|
32
47
|
export async function promptTemplate() {
|
|
48
|
+
ensureInteractive();
|
|
33
49
|
const response = await prompts({
|
|
34
50
|
type: 'select',
|
|
35
51
|
name: 'template',
|
|
@@ -42,6 +58,7 @@ export async function promptTemplate() {
|
|
|
42
58
|
return response.template || null;
|
|
43
59
|
}
|
|
44
60
|
export async function promptIconLibrary() {
|
|
61
|
+
ensureInteractive();
|
|
45
62
|
const response = await prompts({
|
|
46
63
|
type: 'select',
|
|
47
64
|
name: 'iconLibrary',
|
|
@@ -55,6 +72,7 @@ export async function promptIconLibrary() {
|
|
|
55
72
|
return response.iconLibrary || null;
|
|
56
73
|
}
|
|
57
74
|
export async function promptBulmaFlavor() {
|
|
75
|
+
ensureInteractive();
|
|
58
76
|
const response = await prompts({
|
|
59
77
|
type: 'select',
|
|
60
78
|
name: 'bulmaFlavor',
|