create-bestax 3.1.4 → 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.
@@ -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;
@@ -29,7 +30,12 @@ export declare const PROMPTS: {
29
30
  readonly SELECT_BULMA_FLAVOR: "Which Bulma CSS flavor would you like to use?";
30
31
  readonly INSTALL_SKILLS: "Install the bestax AI skills (.claude/skills) for Claude Code and other agents?";
31
32
  };
32
- export declare const CLAUDE_MD: (projectName: string) => string;
33
+ export declare const CONFIG_PROVIDER_ICON_VALUES: Record<string, string>;
34
+ export interface ClaudeMdOptions {
35
+ bulmaFlavor: string;
36
+ iconLibrary: string;
37
+ }
38
+ export declare const CLAUDE_MD: (projectName: string, { bulmaFlavor, iconLibrary }: ClaudeMdOptions) => string;
33
39
  export interface IconLibrary {
34
40
  name: string;
35
41
  display: string;
@@ -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,CAA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AAM,kBAAkB,QAAsB,CAAC;AAEtD,eAAO,MAAM,QAAQ;;;;;;wCAWQ,MAAM;uCAEP,MAAM;sCACP,MAAM;4CAEA,MAAM;;;;;CAM7B,CAAC;AAEX,eAAO,MAAM,OAAO;;;;;;CAOV,CAAC;AAOX,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAK9D,CAAC;AAKF,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,SAAS,GACpB,aAAa,MAAM,EACnB,8BAA8B,eAAe,KAC5C,MA8DF,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,eAAO,MAAM,cAAc,EAAE,WAAW,EAyCvC,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,OAAO,KAAK,CAAC,MAAM,CAAC;IAC3B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,CAAC,EAAE,OAAO,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)}`,
@@ -27,13 +31,57 @@ export const PROMPTS = {
27
31
  SELECT_BULMA_FLAVOR: 'Which Bulma CSS flavor would you like to use?',
28
32
  INSTALL_SKILLS: 'Install the bestax AI skills (.claude/skills) for Claude Code and other agents?',
29
33
  };
30
- // Minimal CLAUDE.md scaffolded alongside the skills so an AI agent knows the
31
- // stack and where the skills live.
32
- export const CLAUDE_MD = (projectName) => `# ${projectName}
34
+ // Icon libraries that require a `ConfigProvider iconLibrary` wrapper, mapped
35
+ // to the exact prop value the scaffolder writes into main.tsx/jsx ('none' and
36
+ // 'fontawesome' are the defaults and need no provider). Shared with
37
+ // project-creator.setupConfigProvider AND the CLAUDE_MD template below so the
38
+ // generated docs can never drift from the generated code.
39
+ export const CONFIG_PROVIDER_ICON_VALUES = {
40
+ mdi: 'mdi',
41
+ ionicons: 'ion',
42
+ 'material-icons': 'material-icons',
43
+ 'material-symbols': 'material-symbols',
44
+ };
45
+ export const CLAUDE_MD = (projectName, { bulmaFlavor, iconLibrary }) => {
46
+ const flavor = BULMA_FLAVORS.find(f => f.name === bulmaFlavor);
47
+ const icon = ICON_LIBRARIES.find(lib => lib.name === iconLibrary);
48
+ const setupLines = [
49
+ `- Bulma flavor: **${bulmaFlavor}** — the app imports **prebuilt** CSS` +
50
+ (flavor ? ` (\`${flavor.importStatement.trim()}\`)` : '') +
51
+ `; there is no Sass pipeline unless you add \`sass\`.`,
52
+ ];
53
+ if (flavor?.needsPrefix) {
54
+ setupLines.push(`- Every Bulma class carries the \`bestax-\` prefix and the app is wrapped in ` +
55
+ `\`<ConfigProvider classPrefix="bestax-">\` — custom CSS selectors must match the prefix.`);
56
+ }
57
+ const providerIconValue = CONFIG_PROVIDER_ICON_VALUES[iconLibrary];
58
+ setupLines.push(iconLibrary === 'none'
59
+ ? `- No icon library is installed — add one before using \`<Icon>\` ` +
60
+ `(https://bestax.io/docs/api/elements/icon).`
61
+ : `- Icon library: **${icon?.display ?? iconLibrary}** — use \`<Icon name="..." />\`.` +
62
+ (providerIconValue
63
+ ? ` The app is already wrapped in \`<ConfigProvider iconLibrary="${providerIconValue}">\` ` +
64
+ `— extend that provider rather than adding a second one.`
65
+ : ''));
66
+ return `# ${projectName}
33
67
 
34
68
  This app is built with [\`@allxsmith/bestax-bulma\`](https://bestax.io) — React components for
35
69
  Bulma 1.x.
36
70
 
71
+ ## This app's setup
72
+
73
+ ${setupLines.join('\n')}
74
+
75
+ ## House style
76
+
77
+ - Never inline \`style={{}}\` — use the helper props every component accepts (\`m*\`/\`p*\`
78
+ spacing, \`textColor\`/\`bgColor\`, \`display="flex"\`, \`flexDirection\`, \`alignItems\`).
79
+ Flex layouts have no \`gap\` helper — space children with margins (\`Grid\` has a real
80
+ \`gap\` prop and \`Columns\` has \`gapSize\`, so prefer those there).
81
+ - Compose existing components before writing custom CSS; theme via \`Theme\` and \`--bulma-*\`
82
+ variables, never hardcoded colors.
83
+ - There is no test runner or Storybook in this app — don't assume one.
84
+
37
85
  ## AI skills
38
86
 
39
87
  \`.claude/skills/\` contains Agent Skills that teach Claude how to build with this library. They load
@@ -52,6 +100,7 @@ Prefer the library's components and these skills over hand-written Bulma markup
52
100
  - LLM-ready docs: https://bestax.io/llms.txt (curated index) and https://bestax.io/llms-full.txt
53
101
  - Using bestax with AI tools: https://bestax.io/docs/guides/llms
54
102
  `;
103
+ };
55
104
  export const ICON_LIBRARIES = [
56
105
  {
57
106
  name: 'none',
@@ -1,3 +1,4 @@
1
+ import { type ClaudeMdOptions } from './constants.js';
1
2
  export interface ProjectConfig {
2
3
  projectName: string;
3
4
  template: string;
@@ -19,7 +20,7 @@ export declare class ProjectCreator {
19
20
  checkExistingDirectory(targetPath: string, targetDir: string): Promise<boolean>;
20
21
  getTemplatePath(template: string): string;
21
22
  copyTemplate(template: string, targetPath: string): Promise<void>;
22
- setupSkills(targetPath: string, projectName: string): Promise<void>;
23
+ setupSkills(targetPath: string, projectName: string, options: ClaudeMdOptions): Promise<void>;
23
24
  setupBulmaFlavor(targetPath: string, bulmaFlavor: string, template: string): Promise<void>;
24
25
  private getIconName;
25
26
  private getIconProps;
@@ -1 +1 @@
1
- {"version":3,"file":"project-creator.d.ts","sourceRoot":"","sources":["../src/project-creator.ts"],"names":[],"mappings":"AAoCA,MAAM,WAAW,aAAa;IAC5B,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED,qBAAa,cAAc;IACzB,OAAO,CAAC,YAAY,CAAS;gBAEjB,YAAY,CAAC,EAAE,MAAM;IAI3B,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAa3D,sBAAsB,CAC1B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;IAkBnB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAInC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO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AS;gBAEjB,YAAY,CAAC,EAAE,MAAM;IAI3B,cAAc,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAa3D,sBAAsB,CAC1B,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC;IAkBnB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAInC,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMjE,WAAW,CACf,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,eAAe,GACvB,OAAO,CAAC,IAAI,CAAC;IAiBV,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAmDhB,OAAO,CAAC,WAAW;IA2BnB,OAAO,CAAC,YAAY;IAYd,gBAAgB,CACpB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IA2IV,mBAAmB,CACvB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAmEV,MAAM,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAwIvE"}
@@ -6,7 +6,7 @@ import { checkDirectoryExists, isDirectoryEmpty, emptyDirectory, ensureDirectory
6
6
  import { promptProjectName, promptOverwriteDirectory, promptTemplate, promptIconLibrary, promptBulmaFlavor, promptInstallSkills, } from './prompts.js';
7
7
  import { displayHeader, displaySuccess, displayError, displayCancelled, } from './display.js';
8
8
  import { validateProjectName } from './validators.js';
9
- import { MESSAGES, ICON_LIBRARIES, BULMA_FLAVORS, CLAUDE_MD, } from './constants.js';
9
+ import { MESSAGES, ICON_LIBRARIES, BULMA_FLAVORS, CLAUDE_MD, CONFIG_PROVIDER_ICON_VALUES, } from './constants.js';
10
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
11
  export class ProjectCreator {
12
12
  templatesDir;
@@ -45,14 +45,14 @@ export class ProjectCreator {
45
45
  await ensureDirectory(targetPath);
46
46
  await copyDirectory(templatePath, targetPath);
47
47
  }
48
- async setupSkills(targetPath, projectName) {
48
+ async setupSkills(targetPath, projectName, options) {
49
49
  const skillsSrc = path.join(this.templatesDir, 'skills');
50
50
  if (!(await checkDirectoryExists(skillsSrc))) {
51
51
  console.log(chalk.yellow(' Skipping skills — bundle not found in this build.'));
52
52
  return;
53
53
  }
54
54
  await fs.copy(skillsSrc, path.join(targetPath, '.claude', 'skills'));
55
- await fs.writeFile(path.join(targetPath, 'CLAUDE.md'), CLAUDE_MD(projectName));
55
+ await fs.writeFile(path.join(targetPath, 'CLAUDE.md'), CLAUDE_MD(projectName, options));
56
56
  console.log(chalk.green(MESSAGES.SKILLS_ADDED));
57
57
  }
58
58
  async setupBulmaFlavor(targetPath, bulmaFlavor, template) {
@@ -264,14 +264,9 @@ export class ProjectCreator {
264
264
  configProps.push('classPrefix="bestax-"');
265
265
  }
266
266
  if (needsIconLibrary) {
267
- // Map the icon library name to the correct value for ConfigProvider
268
- const iconLibraryMap = {
269
- mdi: 'mdi',
270
- ionicons: 'ion',
271
- 'material-icons': 'material-icons',
272
- 'material-symbols': 'material-symbols',
273
- };
274
- const iconLibraryValue = iconLibraryMap[iconLibrary];
267
+ // Shared with the CLAUDE_MD template so the generated docs always
268
+ // name the same provider value the scaffolder writes here.
269
+ const iconLibraryValue = CONFIG_PROVIDER_ICON_VALUES[iconLibrary];
275
270
  if (iconLibraryValue) {
276
271
  configProps.push(`iconLibrary="${iconLibraryValue}"`);
277
272
  }
@@ -395,7 +390,10 @@ export class ProjectCreator {
395
390
  await this.setupIconLibrary(targetPath, iconLibrary, template);
396
391
  await this.setupConfigProvider(targetPath, bulmaFlavor, iconLibrary, template);
397
392
  if (installSkills) {
398
- await this.setupSkills(targetPath, projectName);
393
+ await this.setupSkills(targetPath, projectName, {
394
+ bulmaFlavor,
395
+ iconLibrary,
396
+ });
399
397
  }
400
398
  displaySuccess(targetDir);
401
399
  }
@@ -1 +1 @@
1
- {"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAWA,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUhE;AAED,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,OAAO,CAAC,CASlB;AAED,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,OAAO,CAAC,CAS5D;AAED,wBAAsB,cAAc,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAY7D;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAahE;AAED,wBAAsB,iBAAiB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAehE"}
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',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-bestax",
3
- "version": "3.1.4",
3
+ "version": "3.2.1",
4
4
  "description": "Create a new bestax-bulma project",
5
5
  "type": "module",
6
6
  "bin": {