@vyriy/create 0.5.3 → 0.5.4

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
@@ -18,6 +18,8 @@ vyriy-create app --dry-run
18
18
  vyriy-create . --overwrite
19
19
  vyriy-create app --no-install
20
20
  vyriy-create app --no-verify
21
+ vyriy-create --help
22
+ vyriy-create --version
21
23
  ```
22
24
 
23
25
  ## API
@@ -28,10 +30,10 @@ Install as a project dependency:
28
30
  npm install @vyriy/create
29
31
  ```
30
32
 
31
- Use the creator from code:
33
+ Use the creator and CLI helpers from code:
32
34
 
33
35
  ```ts
34
- import { create } from '@vyriy/create';
36
+ import { create, runCreateCli } from '@vyriy/create';
35
37
 
36
38
  const code = await create({
37
39
  directory: 'app',
@@ -41,6 +43,8 @@ const code = await create({
41
43
  install: true,
42
44
  verify: true,
43
45
  });
46
+
47
+ await runCreateCli(['app', '--dry-run']);
44
48
  ```
45
49
 
46
50
  `create(options)` creates a Vyriy project from the configured starter options and returns a process-style exit code.
package/bin/index.js ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ import { runCreateCli } from '../index.js';
3
+ await runCreateCli(process.argv.slice(2));
package/cli.d.ts ADDED
@@ -0,0 +1,5 @@
1
+ import type { CreateHelpText, ParseCreateBinArgs, RunCreateCli } from './types.js';
2
+ export declare const createVersion: string;
3
+ export declare const createCreateHelpText: CreateHelpText;
4
+ export declare const parseCreateBinArgs: ParseCreateBinArgs;
5
+ export declare const runCreateCli: RunCreateCli;
package/cli.js ADDED
@@ -0,0 +1,62 @@
1
+ import packageJson from './package.json' with { type: 'json' };
2
+ import { create } from './create.js';
3
+ export const createVersion = packageJson.version;
4
+ export const createCreateHelpText = (command = 'vyriy-create', alias = 'vc') => {
5
+ const aliasText = alias ? ` ${alias} [name] Alias for ${command}\n` : '';
6
+ const aliasExampleText = alias ? `\n ${alias} app` : '';
7
+ return `Vyriy Project Creator
8
+
9
+ Usage:
10
+ ${command} [name] Create a new Vyriy project
11
+ ${command} . Initialize a new Vyriy project in the current directory
12
+ ${aliasText}\
13
+ ${command} --help, -h Show help
14
+ ${command} --version, -v Show version
15
+
16
+ Options:
17
+ --dry-run Print the merged file plan without writing project files
18
+ --overwrite Overwrite existing generated paths
19
+ --skip-existing Leave existing generated paths untouched
20
+ --no-install Create files without installing dependencies
21
+ --no-verify Install dependencies without running checks
22
+
23
+ Examples:
24
+ ${command} app
25
+ ${command} app --dry-run
26
+ ${command} .
27
+ ${command} . --no-verify${aliasExampleText}`;
28
+ };
29
+ export const parseCreateBinArgs = (args) => {
30
+ if (args.includes('--help') || args.includes('-h')) {
31
+ return { type: 'help' };
32
+ }
33
+ if (args.includes('--version') || args.includes('-v')) {
34
+ return { type: 'version' };
35
+ }
36
+ const install = !args.includes('--no-install');
37
+ return {
38
+ type: 'create',
39
+ directory: args.find((arg) => !arg.startsWith('-')) ?? '',
40
+ dryRun: args.includes('--dry-run'),
41
+ overwrite: args.includes('--overwrite'),
42
+ skipExisting: args.includes('--skip-existing'),
43
+ install,
44
+ verify: install && !args.includes('--no-verify'),
45
+ };
46
+ };
47
+ export const runCreateCli = async (args = [], command = 'vyriy-create', alias = 'vc') => {
48
+ const parsed = parseCreateBinArgs(args);
49
+ switch (parsed.type) {
50
+ case 'help':
51
+ console.log(createCreateHelpText(command, alias));
52
+ process.exitCode = 0;
53
+ break;
54
+ case 'version':
55
+ console.log(createVersion);
56
+ process.exitCode = 0;
57
+ break;
58
+ case 'create':
59
+ process.exitCode = await create(parsed);
60
+ break;
61
+ }
62
+ };
package/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
+ export * from './cli.js';
1
2
  export * from './create.js';
2
3
  export type * from './types.js';
package/index.js CHANGED
@@ -1 +1,2 @@
1
+ export * from './cli.js';
1
2
  export * from './create.js';
package/package.json CHANGED
@@ -1,15 +1,18 @@
1
1
  {
2
2
  "name": "@vyriy/create",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "Vyriy project creation CLI.",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=24.0.0"
8
8
  },
9
- "packageManager": "yarn@4.15.0",
10
- "bin": "./bin/vyriy-create.js",
9
+ "packageManager": "yarn@4.16.0",
10
+ "bin": {
11
+ "vc": "./bin/index.js",
12
+ "vyriy-create": "./bin/index.js"
13
+ },
11
14
  "dependencies": {
12
- "@vyriy/check": "0.5.3"
15
+ "@vyriy/check": "0.5.4"
13
16
  },
14
17
  "peerDependencies": {
15
18
  "@testing-library/dom": "^10.4.1",
@@ -122,6 +125,16 @@
122
125
  "import": "./index.js",
123
126
  "default": "./index.js"
124
127
  },
128
+ "./cli": {
129
+ "types": "./cli.d.ts",
130
+ "import": "./cli.js",
131
+ "default": "./cli.js"
132
+ },
133
+ "./cli.js": {
134
+ "types": "./cli.d.ts",
135
+ "import": "./cli.js",
136
+ "default": "./cli.js"
137
+ },
125
138
  "./create": {
126
139
  "types": "./create.d.ts",
127
140
  "import": "./create.js",
package/preset/base.js CHANGED
@@ -53,11 +53,118 @@ export const base = ({ name, description }) => ({
53
53
  'cross-env': packageJson.peerDependencies['cross-env'],
54
54
  },
55
55
  }, null, 2) + '\n',
56
- 'README.md': `# ${name}\n\n${description}\n`,
56
+ 'README.md': `# Base
57
+
58
+ Base is a minimal project preset for starting new applications, packages, or workspaces with a calm shared foundation already in place.
59
+
60
+ The repository intentionally contains configuration and workflow glue instead of product code. Its main entry point is Storybook: it works as both living documentation and a playground for future components, UI states, examples, and integration notes.
61
+
62
+ ## Why Storybook
63
+
64
+ Storybook is configured from the start so the project has a visible documentation surface before any application-specific structure exists.
65
+
66
+ Use it to:
67
+
68
+ - document project decisions and package APIs with MDX;
69
+ - develop and review future components in isolation;
70
+ - capture component states, variants, and edge cases as stories;
71
+ - build a static documentation site that can be shared or deployed;
72
+ - keep README-driven documentation visible inside the same developer UI.
73
+
74
+ The root \`doc.mdx\` renders this README in Storybook, so the project overview is available both in the repository and in the local documentation playground.
75
+
76
+ ## Included Foundation
77
+
78
+ - TypeScript configuration from \`@vyriy/typescript-config\`.
79
+ - ESLint configuration from \`@vyriy/eslint-config\`.
80
+ - Prettier configuration from \`@vyriy/prettier-config\`.
81
+ - Jest configuration from \`@vyriy/jest-config\`.
82
+ - Storybook configuration from \`@vyriy/storybook-config\`.
83
+ - Husky hooks for dependency refresh after branch changes or merges and quality checks before commit or push.
84
+
85
+ ## Requirements
86
+
87
+ - Node.js \`>=24.0.0\`.
88
+ - Yarn \`4.16.0\`.
89
+
90
+ ## Install
91
+
92
+ \`\`\`bash
93
+ yarn
94
+ \`\`\`
95
+
96
+ ## Commands
97
+
98
+ \`\`\`bash
99
+ yarn storybook
100
+ \`\`\`
101
+
102
+ Starts the local Storybook playground on port \`6006\`.
103
+
104
+ \`\`\`bash
105
+ yarn build
106
+ \`\`\`
107
+
108
+ Builds the static Storybook output.
109
+
110
+ \`\`\`bash
111
+ yarn check
112
+ \`\`\`
113
+
114
+ Runs the full project validation pipeline: \`lint\`, \`build\`, and \`test\`.
115
+
116
+ \`\`\`bash
117
+ yarn fix
118
+ \`\`\`
119
+
120
+ Formats the project and applies available ESLint fixes.
121
+
122
+ \`\`\`bash
123
+ yarn lint
124
+ \`\`\`
125
+
126
+ Checks TypeScript, formatting, and ESLint rules.
127
+
128
+ \`\`\`bash
129
+ yarn test
130
+ \`\`\`
131
+
132
+ Runs Jest. The command is allowed to pass in an empty preset before tests are added.
133
+
134
+ ## Structure
135
+
136
+ \`\`\`text
137
+ .
138
+ ├── .storybook/
139
+ │ ├── main.ts
140
+ │ └── preview.tsx
141
+ ├── .husky/
142
+ ├── doc.mdx
143
+ ├── eslint.config.ts
144
+ ├── jest.config.ts
145
+ ├── prettier.config.ts
146
+ ├── tsconfig.json
147
+ └── package.json
148
+ \`\`\`
149
+
150
+ ## Adding Project Code
151
+
152
+ Add source code where it fits the final project shape, for example under \`packages/*\` or \`workspaces/*\`. These paths are already included in \`tsconfig.json\`.
153
+
154
+ When adding public components or package APIs, add matching stories or MDX documentation so Storybook remains the first place to inspect behavior, examples, and supported states.
155
+
156
+ ## Project Guidance
157
+
158
+ These articles describe the development approach behind this preset and provide practical guidance for evolving a project on top of it:
159
+
160
+ - [Calm Development Environment: Node.js, Corepack, Yarn and Static Preview](https://vyriy.dev/blog/calm-development-setup/) - how to keep the local development environment predictable and easy to reproduce.
161
+ - [Calm Component Structure](https://vyriy.dev/blog/calm-component-structure/) - how to organize component code, tests, stories, and public exports.
162
+ - [Storybook as Project Documentation](https://vyriy.dev/blog/storybook-as-project-documentation/) - how to use Storybook as living project documentation and a component playground.
163
+ `,
57
164
  'doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
58
165
  import ReadMe from './README.md?raw';
59
166
 
60
- <Meta title="${name}" />
167
+ <Meta title="Base" />
61
168
 
62
169
  <Markdown>{ReadMe}</Markdown>
63
170
  `,
package/prompt/preset.js CHANGED
@@ -5,9 +5,10 @@ export const preset = async (question, output) => {
5
5
  const defaultPreset = 'base';
6
6
  const presetNames = Object.keys(appPreset);
7
7
  output.write('\nProject preset:\n\n');
8
- const maxWidth = Math.max(...presetNames.map((n, i) => `${i + 1}. ${appPreset[n].name}`.length));
8
+ const numWidth = String(presetNames.length).length;
9
+ const maxWidth = Math.max(...presetNames.map((n, i) => `${String(i + 1).padStart(numWidth)}. ${appPreset[n].name}`.length));
9
10
  presetNames.forEach((presetName, index) => {
10
- const label = `${index + 1}. ${appPreset[presetName].name}`;
11
+ const label = `${String(index + 1).padStart(numWidth)}. ${appPreset[presetName].name}`;
11
12
  output.write(` ${label.padEnd(maxWidth)} - ${appPreset[presetName].description}\n`);
12
13
  });
13
14
  const presetValue = await prompt(question, '\nPreset number or name', defaultPreset);
package/types.d.ts CHANGED
@@ -7,3 +7,11 @@ export type CreateOptions = {
7
7
  readonly verify: boolean;
8
8
  };
9
9
  export type Create = (options: CreateOptions) => Promise<number>;
10
+ export type CreateBinCommand = {
11
+ readonly type: 'help' | 'version';
12
+ } | ({
13
+ readonly type: 'create';
14
+ } & CreateOptions);
15
+ export type ParseCreateBinArgs = (args: readonly string[]) => CreateBinCommand;
16
+ export type CreateHelpText = (command?: string, alias?: false | string) => string;
17
+ export type RunCreateCli = (args?: readonly string[], command?: string, alias?: false | string) => Promise<void>;
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
- import { create } from '../index.js';
3
- const args = process.argv.slice(2);
4
- const directory = args.find((arg) => !arg.startsWith('-')) ?? '';
5
- const dryRun = args.includes('--dry-run');
6
- const overwrite = args.includes('--overwrite');
7
- const skipExisting = args.includes('--skip-existing');
8
- const install = !args.includes('--no-install');
9
- const verify = install && !args.includes('--no-verify');
10
- process.exitCode = await create({
11
- directory,
12
- dryRun,
13
- overwrite,
14
- skipExisting,
15
- install,
16
- verify,
17
- });