vyriy 0.3.9 → 0.4.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.
Files changed (190) hide show
  1. package/README.md +75 -179
  2. package/bin/vyriy.js +2 -2
  3. package/cli/args.js +29 -0
  4. package/cli/cli.d.ts +2 -2
  5. package/cli/cli.js +18 -69
  6. package/cli/index.d.ts +1 -1
  7. package/cli/index.js +1 -1
  8. package/cli/types.d.ts +12 -3
  9. package/commands/check-env.d.ts +2 -0
  10. package/commands/check-env.js +65 -0
  11. package/commands/create/index.d.ts +2 -0
  12. package/commands/create/index.js +121 -0
  13. package/commands/create/plan/index.d.ts +4 -0
  14. package/commands/create/plan/index.js +3 -0
  15. package/commands/create/plan/plan.d.ts +9 -0
  16. package/commands/create/plan/plan.js +34 -0
  17. package/commands/create/plan/question.d.ts +2 -0
  18. package/commands/create/plan/question.js +25 -0
  19. package/commands/create/plan/types.d.ts +14 -0
  20. package/commands/create/preset/api.d.ts +2 -0
  21. package/commands/create/preset/api.js +168 -0
  22. package/commands/create/preset/base.d.ts +2 -0
  23. package/commands/create/preset/base.js +195 -0
  24. package/commands/create/preset/gql.d.ts +2 -0
  25. package/commands/create/preset/gql.js +16 -0
  26. package/commands/create/preset/index.d.ts +17 -0
  27. package/commands/create/preset/index.js +20 -0
  28. package/commands/create/preset/library.d.ts +2 -0
  29. package/commands/create/preset/library.js +252 -0
  30. package/commands/create/preset/mfe.d.ts +2 -0
  31. package/commands/create/preset/mfe.js +16 -0
  32. package/commands/create/preset/rest.d.ts +2 -0
  33. package/commands/create/preset/rest.js +16 -0
  34. package/commands/create/preset/spa.d.ts +2 -0
  35. package/commands/create/preset/spa.js +16 -0
  36. package/commands/create/preset/ssg.d.ts +2 -0
  37. package/commands/create/preset/ssg.js +16 -0
  38. package/commands/create/preset/ssr.d.ts +2 -0
  39. package/commands/create/preset/ssr.js +16 -0
  40. package/commands/create/preset/types.d.ts +15 -0
  41. package/commands/create/prompt/conflict-strategy.d.ts +5 -0
  42. package/commands/create/prompt/conflict-strategy.js +22 -0
  43. package/commands/create/prompt/index.d.ts +7 -0
  44. package/commands/create/prompt/index.js +6 -0
  45. package/commands/create/prompt/preset.d.ts +4 -0
  46. package/commands/create/prompt/preset.js +11 -0
  47. package/commands/create/prompt/prompt.d.ts +2 -0
  48. package/commands/create/prompt/prompt.js +4 -0
  49. package/commands/create/prompt/provider.d.ts +2 -0
  50. package/commands/create/prompt/provider.js +13 -0
  51. package/commands/create/prompt/resolve-option.d.ts +6 -0
  52. package/commands/create/prompt/resolve-option.js +8 -0
  53. package/commands/create/prompt/scope.d.ts +2 -0
  54. package/commands/create/prompt/scope.js +2 -0
  55. package/commands/create/prompt/types.d.ts +4 -0
  56. package/commands/dist.d.ts +2 -0
  57. package/commands/{publish/publish.js → dist.js} +22 -9
  58. package/commands/help.d.ts +3 -0
  59. package/commands/help.js +24 -0
  60. package/commands/index.d.ts +5 -0
  61. package/commands/index.js +5 -0
  62. package/commands/{publish/types.d.ts → types.d.ts} +18 -4
  63. package/commands/version.d.ts +2 -0
  64. package/commands/version.js +6 -0
  65. package/package.json +20 -588
  66. package/bin/vyriy.d.ts +0 -2
  67. package/checks/node/index.d.ts +0 -2
  68. package/checks/node/index.js +0 -1
  69. package/checks/node/node.d.ts +0 -2
  70. package/checks/node/node.js +0 -22
  71. package/checks/node/types.d.ts +0 -11
  72. package/checks/yarn/index.d.ts +0 -2
  73. package/checks/yarn/index.js +0 -1
  74. package/checks/yarn/types.d.ts +0 -7
  75. package/checks/yarn/yarn.d.ts +0 -2
  76. package/checks/yarn/yarn.js +0 -40
  77. package/cli/args/args.js +0 -40
  78. package/cli/args/index.d.ts +0 -2
  79. package/cli/args/index.js +0 -1
  80. package/cli/args/types.d.ts +0 -24
  81. package/commands/doctor/doctor.d.ts +0 -2
  82. package/commands/doctor/doctor.js +0 -9
  83. package/commands/doctor/index.d.ts +0 -2
  84. package/commands/doctor/index.js +0 -1
  85. package/commands/doctor/types.d.ts +0 -8
  86. package/commands/init/index.d.ts +0 -2
  87. package/commands/init/index.js +0 -1
  88. package/commands/init/init.d.ts +0 -2
  89. package/commands/init/init.js +0 -7
  90. package/commands/init/types.d.ts +0 -5
  91. package/commands/new/index.d.ts +0 -2
  92. package/commands/new/index.js +0 -1
  93. package/commands/new/new.d.ts +0 -3
  94. package/commands/new/new.js +0 -189
  95. package/commands/new/types.d.ts +0 -15
  96. package/commands/publish/index.d.ts +0 -2
  97. package/commands/publish/index.js +0 -1
  98. package/commands/publish/publish.d.ts +0 -2
  99. package/doctor/checkCorepack.d.ts +0 -2
  100. package/doctor/checkCorepack.js +0 -24
  101. package/doctor/checkGit.d.ts +0 -2
  102. package/doctor/checkGit.js +0 -23
  103. package/doctor/checkNodeVersion.d.ts +0 -5
  104. package/doctor/checkNodeVersion.js +0 -24
  105. package/doctor/checkYarn.d.ts +0 -10
  106. package/doctor/checkYarn.js +0 -45
  107. package/doctor/createDoctorReport.d.ts +0 -2
  108. package/doctor/createDoctorReport.js +0 -17
  109. package/doctor/index.d.ts +0 -7
  110. package/doctor/index.js +0 -6
  111. package/doctor/printDoctorReport.d.ts +0 -2
  112. package/doctor/printDoctorReport.js +0 -42
  113. package/doctor/types.d.ts +0 -25
  114. package/file-plan/createFilePlan.d.ts +0 -4
  115. package/file-plan/createFilePlan.js +0 -29
  116. package/file-plan/index.d.ts +0 -4
  117. package/file-plan/index.js +0 -3
  118. package/file-plan/printFilePlan.d.ts +0 -2
  119. package/file-plan/printFilePlan.js +0 -44
  120. package/file-plan/types.d.ts +0 -12
  121. package/file-plan/writeFilePlan.d.ts +0 -2
  122. package/file-plan/writeFilePlan.js +0 -12
  123. package/index.d.ts +0 -12
  124. package/index.js +0 -12
  125. package/presets/agentsTemplate.d.ts +0 -1
  126. package/presets/agentsTemplate.js +0 -105
  127. package/presets/base/createBaseFiles.d.ts +0 -3
  128. package/presets/base/createBaseFiles.js +0 -307
  129. package/presets/config.d.ts +0 -28
  130. package/presets/config.js +0 -7
  131. package/presets/createProjectFiles.d.ts +0 -2
  132. package/presets/createProjectFiles.js +0 -8
  133. package/presets/index.d.ts +0 -2
  134. package/presets/index.js +0 -1
  135. package/presets/library/createLibraryUiFiles.d.ts +0 -3
  136. package/presets/library/createLibraryUiFiles.js +0 -127
  137. package/presets/packages/createPackageFiles.d.ts +0 -3
  138. package/presets/packages/createPackageFiles.js +0 -39
  139. package/presets/packages/createPackageManifest.d.ts +0 -7
  140. package/presets/packages/createPackageManifest.js +0 -13
  141. package/presets/types.d.ts +0 -3
  142. package/presets/workspaces/createWorkspaceFiles.d.ts +0 -3
  143. package/presets/workspaces/createWorkspaceFiles.js +0 -98
  144. package/project-plan/api/api.d.ts +0 -6
  145. package/project-plan/api/api.js +0 -44
  146. package/project-plan/api/index.d.ts +0 -2
  147. package/project-plan/api/index.js +0 -1
  148. package/project-plan/api/types.d.ts +0 -11
  149. package/project-plan/ci/ci.d.ts +0 -3
  150. package/project-plan/ci/ci.js +0 -20
  151. package/project-plan/ci/index.d.ts +0 -2
  152. package/project-plan/ci/index.js +0 -1
  153. package/project-plan/ci/types.d.ts +0 -6
  154. package/project-plan/create/create.d.ts +0 -2
  155. package/project-plan/create/create.js +0 -129
  156. package/project-plan/create/index.d.ts +0 -2
  157. package/project-plan/create/index.js +0 -1
  158. package/project-plan/create/types.d.ts +0 -13
  159. package/project-plan/index.d.ts +0 -6
  160. package/project-plan/index.js +0 -5
  161. package/project-plan/kind/index.d.ts +0 -2
  162. package/project-plan/kind/index.js +0 -1
  163. package/project-plan/kind/kind.d.ts +0 -2
  164. package/project-plan/kind/kind.js +0 -1
  165. package/project-plan/kind/types.d.ts +0 -2
  166. package/project-plan/print/index.d.ts +0 -2
  167. package/project-plan/print/index.js +0 -1
  168. package/project-plan/print/print.d.ts +0 -2
  169. package/project-plan/print/print.js +0 -47
  170. package/project-plan/print/types.d.ts +0 -2
  171. package/project-plan/types.d.ts +0 -46
  172. package/prompts/project-plan/index.d.ts +0 -2
  173. package/prompts/project-plan/index.js +0 -1
  174. package/prompts/project-plan/project-plan.d.ts +0 -2
  175. package/prompts/project-plan/project-plan.js +0 -198
  176. package/prompts/project-plan/types.d.ts +0 -18
  177. package/shared/commandExists.d.ts +0 -2
  178. package/shared/commandExists.js +0 -10
  179. package/shared/execCommand.d.ts +0 -2
  180. package/shared/execCommand.js +0 -7
  181. package/shared/fileExists.d.ts +0 -2
  182. package/shared/fileExists.js +0 -10
  183. package/shared/index.d.ts +0 -6
  184. package/shared/index.js +0 -5
  185. package/shared/runCommand.d.ts +0 -9
  186. package/shared/runCommand.js +0 -34
  187. package/shared/semver.d.ts +0 -1
  188. package/shared/semver.js +0 -4
  189. package/shared/types.d.ts +0 -12
  190. /package/cli/{args/args.d.ts → args.d.ts} +0 -0
@@ -0,0 +1,252 @@
1
+ import packageJson from '../../../package.json' with { type: 'json' };
2
+ import { base } from './base.js';
3
+ export const library = {
4
+ files: (options) => {
5
+ const packageScope = options.scope ?? `@${options.name}`;
6
+ const packageName = `${packageScope}/${options.name}`;
7
+ return {
8
+ ...base.files(options),
9
+ 'package.json': JSON.stringify({
10
+ name: options.name,
11
+ version: '0.0.0',
12
+ description: options.description,
13
+ private: true,
14
+ type: 'module',
15
+ agents: './AGENTS.md',
16
+ packageManager: packageJson.packageManager,
17
+ engines: {
18
+ node: packageJson.engines.node,
19
+ },
20
+ workspaces: [
21
+ 'packages/*',
22
+ ],
23
+ license: 'MIT',
24
+ repository: {
25
+ type: 'git',
26
+ url: `https://github.com/${options.name}/${options.name}`,
27
+ },
28
+ scripts: {
29
+ storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
30
+ check: 'run-s lint build test',
31
+ fix: "run-s 'fix:*'",
32
+ lint: "run-s 'lint:*'",
33
+ build: "run-s 'build:*'",
34
+ test: "run-s 'test:*'",
35
+ 'fix:prettier': 'prettier . --write',
36
+ 'fix:eslint': 'eslint . --fix',
37
+ 'fix:stylelint': 'stylelint "**/*.{css,scss}" --fix',
38
+ 'lint:ts': 'tsc',
39
+ 'lint:prettier': 'prettier . --check',
40
+ 'lint:eslint': 'eslint .',
41
+ 'lint:stylelint': 'stylelint "**/*.{css,scss}"',
42
+ 'build:dist': 'rimraf dist && tsc -p tsconfig.build.json && vyriy -d',
43
+ 'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
44
+ 'test:jest': 'jest',
45
+ postinstall: 'husky',
46
+ },
47
+ devDependencies: {
48
+ '@vyriy/typescript-config': `^${packageJson.version}`,
49
+ typescript: packageJson.peerDependencies.typescript,
50
+ '@vyriy/prettier-config': `^${packageJson.version}`,
51
+ prettier: packageJson.peerDependencies.prettier,
52
+ '@vyriy/eslint-config': `^${packageJson.version}`,
53
+ eslint: packageJson.peerDependencies.eslint,
54
+ '@vyriy/jest-config': `^${packageJson.version}`,
55
+ jest: packageJson.peerDependencies.jest,
56
+ '@vyriy/storybook-config': `^${packageJson.version}`,
57
+ storybook: packageJson.peerDependencies.storybook,
58
+ '@vyriy/path': `^${packageJson.version}`,
59
+ vyriy: `^${packageJson.version}`,
60
+ husky: packageJson.peerDependencies.husky,
61
+ 'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
62
+ 'cross-env': packageJson.peerDependencies['cross-env'],
63
+ react: packageJson.peerDependencies.react,
64
+ 'react-dom': packageJson.peerDependencies['react-dom'],
65
+ '@types/react': packageJson.peerDependencies['@types/react'],
66
+ '@types/react-dom': packageJson.peerDependencies['@types/react-dom'],
67
+ '@vyriy/stylelint-config': `^${packageJson.version}`,
68
+ stylelint: packageJson.peerDependencies.stylelint,
69
+ rimraf: packageJson.peerDependencies.rimraf,
70
+ },
71
+ }, null, 2) + '\n',
72
+ 'tsconfig.build.json': JSON.stringify({
73
+ extends: './tsconfig.json',
74
+ include: [
75
+ 'packages/**/*.ts',
76
+ 'packages/**/*.tsx',
77
+ 'packages/**/*.json',
78
+ ],
79
+ exclude: [
80
+ '**/*.test.ts',
81
+ '**/*.test.tsx',
82
+ '**/*.stories.ts',
83
+ '**/*.stories.tsx',
84
+ ],
85
+ compilerOptions: {
86
+ rootDir: './packages',
87
+ outDir: './dist',
88
+ noEmit: false,
89
+ declaration: true,
90
+ allowImportingTsExtensions: false,
91
+ },
92
+ }, null, 2) + '\n',
93
+ 'stylelint.config.ts': "export { default } from '@vyriy/stylelint-config';\n",
94
+ [`packages/${options.name}/package.json`]: JSON.stringify({
95
+ name: packageName,
96
+ version: '0.0.0',
97
+ description: options.description,
98
+ private: true,
99
+ type: 'module',
100
+ main: 'index.js',
101
+ dependencies: {
102
+ '@vyriy/cn': `^${packageJson.version}`,
103
+ },
104
+ peerDependencies: {
105
+ react: packageJson.peerDependencies.react,
106
+ },
107
+ }, null, 2) + '\n',
108
+ [`packages/${options.name}/README.md`]: `# ${packageName}\n\n${options.description}\n`,
109
+ [`packages/${options.name}/doc.mdx`]: `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
110
+ import ReadMe from './README.md?raw';
111
+
112
+ <Meta title="UI/Button" />
113
+
114
+ <Markdown>{ReadMe}</Markdown>
115
+ `,
116
+ [`packages/${options.name}/index.ts`]: "export * from './button.js';\nexport type * from './types.js';\n",
117
+ [`packages/${options.name}/types.ts`]: `import type { ComponentProps, FC } from 'react';
118
+
119
+ export type ButtonProps = ComponentProps<'button'> & {
120
+ readonly variant?: 'primary' | 'secondary';
121
+ };
122
+
123
+ export type ButtonType = FC<ButtonProps>;
124
+ `,
125
+ [`packages/${options.name}/button.tsx`]: `import { cn } from '@vyriy/cn';
126
+
127
+ import type { ButtonType } from './types.js';
128
+
129
+ import './button.scss';
130
+
131
+ export const Button: ButtonType = ({ className, variant = 'primary', ...props }) => (
132
+ <button type="button" className={cn('button', \`button--\${variant}\`, className)} {...props} />
133
+ );
134
+ `,
135
+ [`packages/${options.name}/index.test.ts`]: `import { describe, expect, it } from '@jest/globals';
136
+
137
+ import { Button } from './button.js';
138
+ import { Button as PublicButton } from './index.js';
139
+
140
+ describe('ui entry point', () => {
141
+ it('exports Button', () => {
142
+ expect(PublicButton).toBe(Button);
143
+ });
144
+ });
145
+ `,
146
+ [`packages/${options.name}/button.scss`]: `.button {
147
+ border: 1px solid transparent;
148
+ border-radius: 6px;
149
+ cursor: pointer;
150
+ font: inherit;
151
+ padding: 0.5rem 0.875rem;
152
+ }
153
+
154
+ .button--primary {
155
+ background: #1f6feb;
156
+ color: #fff;
157
+ }
158
+
159
+ .button--secondary {
160
+ background: #fff;
161
+ border-color: #d0d7de;
162
+ color: #24292f;
163
+ }
164
+ `,
165
+ [`packages/${options.name}/styles.d.ts`]: "declare module '*.scss';\n",
166
+ [`packages/${options.name}/button.stories.tsx`]: `import type { Meta, StoryObj } from '@storybook/react-webpack5';
167
+
168
+ import { Button } from './button.js';
169
+
170
+ const meta = {
171
+ title: 'UI/Button',
172
+ component: Button,
173
+ args: {
174
+ children: 'Button',
175
+ },
176
+ argTypes: {
177
+ children: {
178
+ control: 'text',
179
+ description: 'Button label.',
180
+ table: {
181
+ type: { summary: 'ReactNode' },
182
+ },
183
+ },
184
+ variant: {
185
+ control: 'select',
186
+ options: ['primary', 'secondary'],
187
+ description: 'Visual style of the button.',
188
+ table: {
189
+ type: { summary: "'primary' | 'secondary'" },
190
+ defaultValue: { summary: 'primary' },
191
+ },
192
+ },
193
+ className: {
194
+ table: { disable: true },
195
+ },
196
+ },
197
+ } satisfies Meta<typeof Button>;
198
+
199
+ export default meta;
200
+
201
+ type Story = StoryObj<typeof meta>;
202
+
203
+ export const Primary: Story = {
204
+ args: {
205
+ variant: 'primary',
206
+ },
207
+ };
208
+
209
+ export const Secondary: Story = {
210
+ args: {
211
+ variant: 'secondary',
212
+ },
213
+ };
214
+ `,
215
+ [`packages/${options.name}/button.test.tsx`]: `import type { ReactElement } from 'react';
216
+ import { describe, expect, it } from '@jest/globals';
217
+
218
+ import { Button } from './button.js';
219
+
220
+ type ButtonElement = ReactElement<{
221
+ readonly className: string;
222
+ readonly type: string;
223
+ }>;
224
+
225
+ describe('Button', () => {
226
+ it('creates a primary button by default', () => {
227
+ const element = Button({ children: 'Save' }) as ButtonElement;
228
+
229
+ expect(element.props.className).toBe('button button--primary');
230
+ expect(element.props.type).toBe('button');
231
+ });
232
+
233
+ it('composes secondary and custom classes', () => {
234
+ const element = Button({
235
+ children: 'Cancel',
236
+ className: 'wide',
237
+ type: 'submit',
238
+ variant: 'secondary',
239
+ }) as ButtonElement;
240
+
241
+ expect(element.props.className).toBe('button button--secondary wide');
242
+ expect(element.props.type).toBe('submit');
243
+ });
244
+ });
245
+ `,
246
+ };
247
+ },
248
+ ci: {
249
+ ...base.ci,
250
+ },
251
+ deploy: {},
252
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const mfe: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const mfe = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const rest: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const rest = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const spa: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const spa = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const ssg: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const ssg = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,2 @@
1
+ import { Preset } from './types.js';
2
+ export declare const ssr: Preset;
@@ -0,0 +1,16 @@
1
+ import { base } from './base.js';
2
+ export const ssr = {
3
+ files: (options) => ({
4
+ ...base.files(options),
5
+ }),
6
+ ci: {
7
+ github: {
8
+ '.gitlab-ci.yml': 'code',
9
+ },
10
+ },
11
+ deploy: {
12
+ docker: {
13
+ Dockerfile: 'code',
14
+ },
15
+ },
16
+ };
@@ -0,0 +1,15 @@
1
+ import type { PlanResult } from '../plan/types.js';
2
+ export type FileMap = Record<string, string>;
3
+ export type CiProvider = 'gitlab' | 'github';
4
+ export type DeployProvider = 'aws' | 'docker';
5
+ export type Preset = {
6
+ files: (options: PlanResult) => FileMap;
7
+ ci: Partial<Record<CiProvider, FileMap>>;
8
+ deploy: Partial<Record<DeployProvider, FileMap>>;
9
+ };
10
+ export type PresetKey = 'base' | 'library' | 'api' | 'ssr' | 'rest' | 'gql' | 'ssg' | 'spa' | 'mfe';
11
+ export type Presets = Partial<Record<PresetKey, {
12
+ name: string;
13
+ description: string;
14
+ preset: Preset;
15
+ }>>;
@@ -0,0 +1,5 @@
1
+ export type ConflictStrategy = {
2
+ readonly overwrite: boolean;
3
+ readonly skipExisting: boolean;
4
+ };
5
+ export declare const conflictStrategy: () => Promise<ConflictStrategy | undefined>;
@@ -0,0 +1,22 @@
1
+ import { stdin, stdout } from 'node:process';
2
+ import { createInterface } from 'node:readline/promises';
3
+ export const conflictStrategy = async () => {
4
+ console.log('\nWhat should Vyriy do?\n');
5
+ console.log(' 1. overwrite existing files');
6
+ console.log(' 2. skip existing files');
7
+ console.log(' 3. abort');
8
+ const readline = createInterface({ input: stdin, output: stdout });
9
+ try {
10
+ const answer = (await readline.question('\nWhat should Vyriy do? (abort): ')).trim().toLowerCase();
11
+ if (answer === '1' || answer === 'overwrite') {
12
+ return { overwrite: true, skipExisting: false };
13
+ }
14
+ if (answer === '2' || answer === 'skip') {
15
+ return { overwrite: false, skipExisting: true };
16
+ }
17
+ return undefined;
18
+ }
19
+ finally {
20
+ readline.close();
21
+ }
22
+ };
@@ -0,0 +1,7 @@
1
+ export * from './conflict-strategy.js';
2
+ export * from './prompt.js';
3
+ export * from './provider.js';
4
+ export * from './preset.js';
5
+ export * from './resolve-option.js';
6
+ export * from './scope.js';
7
+ export type * from './types.js';
@@ -0,0 +1,6 @@
1
+ export * from './conflict-strategy.js';
2
+ export * from './prompt.js';
3
+ export * from './provider.js';
4
+ export * from './preset.js';
5
+ export * from './resolve-option.js';
6
+ export * from './scope.js';
@@ -0,0 +1,4 @@
1
+ import { presets as appPreset } from '../preset/index.js';
2
+ import type { PromptOutput, PromptQuestion } from './types.js';
3
+ export type PresetName = keyof typeof appPreset;
4
+ export declare const preset: (question: PromptQuestion, output: PromptOutput) => Promise<PresetName>;
@@ -0,0 +1,11 @@
1
+ import { presets as appPreset } from '../preset/index.js';
2
+ import { prompt } from './prompt.js';
3
+ import { resolveOption } from './resolve-option.js';
4
+ export const preset = async (question, output) => {
5
+ const defaultPreset = 'base';
6
+ const presetNames = Object.keys(appPreset);
7
+ output.write('\nProject preset:\n\n');
8
+ presetNames.forEach((presetName, index) => output.write(` ${index + 1}. ${appPreset[presetName].name} - ${appPreset[presetName].description}\n`));
9
+ const presetValue = await prompt(question, '\nPreset number or name', defaultPreset);
10
+ return resolveOption(presetValue, presetNames, defaultPreset);
11
+ };
@@ -0,0 +1,2 @@
1
+ import type { Prompt } from '../plan/types.js';
2
+ export declare const prompt: Prompt;
@@ -0,0 +1,4 @@
1
+ export const prompt = async (question, label, defaultValue) => {
2
+ const answer = (await question(`${label} (${defaultValue}): `)).trim();
3
+ return answer || defaultValue;
4
+ };
@@ -0,0 +1,2 @@
1
+ import type { PromptOutput, PromptQuestion } from './types.js';
2
+ export declare const provider: <OptionName extends string>(question: PromptQuestion, output: PromptOutput, label: string, options: Partial<Record<OptionName, unknown>>) => Promise<OptionName | undefined>;
@@ -0,0 +1,13 @@
1
+ import { prompt } from './prompt.js';
2
+ import { resolveOption } from './resolve-option.js';
3
+ export const provider = async (question, output, label, options) => {
4
+ const optionNames = Object.keys(options);
5
+ const defaultOption = optionNames[0];
6
+ if (defaultOption === undefined) {
7
+ return undefined;
8
+ }
9
+ output.write(`\n${label}:\n\n`);
10
+ optionNames.forEach((optionName, index) => output.write(` ${index + 1}. ${optionName}\n`));
11
+ const optionValue = await prompt(question, `\n${label} number or name`, defaultOption);
12
+ return resolveOption(optionValue, optionNames);
13
+ };
@@ -0,0 +1,6 @@
1
+ type ResolveOption = {
2
+ <OptionName extends string>(value: string, optionNames: readonly OptionName[], fallback: OptionName): OptionName;
3
+ <OptionName extends string>(value: string, optionNames: readonly OptionName[]): OptionName | undefined;
4
+ };
5
+ export declare const resolveOption: ResolveOption;
6
+ export {};
@@ -0,0 +1,8 @@
1
+ export const resolveOption = (value, optionNames, fallback) => {
2
+ const normalizedValue = value.trim();
3
+ const numericValue = Number.parseInt(normalizedValue, 10);
4
+ if (Number.isInteger(numericValue)) {
5
+ return optionNames[numericValue - 1] ?? fallback;
6
+ }
7
+ return optionNames.find((optionName) => optionName === normalizedValue) ?? fallback;
8
+ };
@@ -0,0 +1,2 @@
1
+ import type { PromptQuestion } from './types.js';
2
+ export declare const scope: (question: PromptQuestion, preset: string, name: string) => Promise<string | undefined>;
@@ -0,0 +1,2 @@
1
+ import { prompt } from './prompt.js';
2
+ export const scope = async (question, preset, name) => preset === 'library' ? prompt(question, 'Package scope', `@${name}`) : undefined;
@@ -0,0 +1,4 @@
1
+ export type PromptQuestion = (query: string) => Promise<string>;
2
+ export type PromptOutput = {
3
+ write: (chunk: string) => unknown;
4
+ };
@@ -0,0 +1,2 @@
1
+ import type { Command } from './types.js';
2
+ export declare const dist: Command;
@@ -60,6 +60,9 @@ const getPackageMain = async (packageDirectory, packageJson, javaScriptFiles) =>
60
60
  if (javaScriptFiles.includes('index.js')) {
61
61
  return 'index.js';
62
62
  }
63
+ if (getPackageBinFiles(packageJson).length > 0) {
64
+ return undefined;
65
+ }
63
66
  return javaScriptFiles[0];
64
67
  };
65
68
  const createExportTarget = (javaScriptFile) => {
@@ -174,9 +177,18 @@ const getPackageBinFiles = (packageJson) => {
174
177
  }
175
178
  return [];
176
179
  };
180
+ const toPackageLocalPath = (filePath) => filePath.replace(/^\.\//, '');
181
+ const removePackageBinDeclarationFiles = async (packageDirectory, packageJson) => {
182
+ for (const binFile of getPackageBinFiles(packageJson)) {
183
+ const declarationFilePath = path.join(packageDirectory, toPackageLocalPath(binFile).replace(/\.js$/, '.d.ts'));
184
+ if (await hasFile(declarationFilePath)) {
185
+ await unlink(declarationFilePath);
186
+ }
187
+ }
188
+ };
177
189
  const makePackageBinsExecutable = async (packageDirectory, packageJson) => {
178
190
  for (const binFile of getPackageBinFiles(packageJson)) {
179
- const binFilePath = path.join(packageDirectory, binFile.replace(/^\.\//, ''));
191
+ const binFilePath = path.join(packageDirectory, toPackageLocalPath(binFile));
180
192
  if (await hasFile(binFilePath)) {
181
193
  await chmod(binFilePath, 0o755);
182
194
  }
@@ -187,7 +199,7 @@ const copyRootFile = async (fileName) => {
187
199
  await copyFile(fileName, path.join(DIST_DIR, fileName));
188
200
  }
189
201
  };
190
- const publishRootPackageJson = async () => {
202
+ const distRootPackageJson = async () => {
191
203
  const packageJson = await readJson(PACKAGE_JSON_FILE);
192
204
  delete packageJson.agents;
193
205
  delete packageJson.dependencies;
@@ -196,10 +208,10 @@ const publishRootPackageJson = async () => {
196
208
  delete packageJson.devDependencies;
197
209
  await writeJson(path.join(DIST_DIR, PACKAGE_JSON_FILE), packageJson);
198
210
  };
199
- const publishRoot = async () => {
211
+ const distRoot = async () => {
200
212
  await copyRootFile(README_FILE);
201
213
  await copyRootFile(LICENSE_FILE);
202
- await publishRootPackageJson();
214
+ await distRootPackageJson();
203
215
  };
204
216
  const syncPackageRuntimeMetadata = (packageJson, rootPackageJson) => {
205
217
  if (packageJson.name !== 'vyriy') {
@@ -208,12 +220,13 @@ const syncPackageRuntimeMetadata = (packageJson, rootPackageJson) => {
208
220
  packageJson.packageManager = rootPackageJson.packageManager;
209
221
  packageJson.engines = rootPackageJson.engines;
210
222
  };
211
- const publishPackage = async (packageJsonPath, rootPackageJson) => {
223
+ const distPackage = async (packageJsonPath, rootPackageJson) => {
212
224
  const packageDirectory = path.dirname(packageJsonPath);
213
225
  const packageJson = await readJson(packageJsonPath);
214
226
  await removeEmptyJavaScriptFiles(packageDirectory);
215
227
  await removeMissingJavaScriptExports(packageDirectory);
216
228
  await removeEmptyJavaScriptFiles(packageDirectory);
229
+ await removePackageBinDeclarationFiles(packageDirectory, packageJson);
217
230
  const javaScriptFiles = await getJavaScriptFiles(packageDirectory);
218
231
  await copyLicense(packageDirectory);
219
232
  await copyReadme(packageDirectory);
@@ -250,12 +263,12 @@ const publishPackage = async (packageJsonPath, rootPackageJson) => {
250
263
  await makePackageBinsExecutable(packageDirectory, packageJson);
251
264
  await writeJson(packageJsonPath, packageJson);
252
265
  };
253
- export const runPublishCommand = async ({ cwd = process.cwd() } = {}) => {
266
+ export const dist = async () => {
254
267
  const previousCwd = process.cwd();
255
268
  try {
256
- process.chdir(cwd);
269
+ process.chdir(process.cwd());
257
270
  const rootPackageJson = await readJson(PACKAGE_JSON_FILE);
258
- await publishRoot();
271
+ await distRoot();
259
272
  const entries = await readdir(DIST_DIR, { withFileTypes: true });
260
273
  const packageJsonPaths = entries
261
274
  .filter((entry) => entry.isDirectory())
@@ -263,7 +276,7 @@ export const runPublishCommand = async ({ cwd = process.cwd() } = {}) => {
263
276
  .sort((left, right) => left.localeCompare(right));
264
277
  for (const packageJsonPath of packageJsonPaths) {
265
278
  if (await hasFile(packageJsonPath)) {
266
- await publishPackage(packageJsonPath, rootPackageJson);
279
+ await distPackage(packageJsonPath, rootPackageJson);
267
280
  }
268
281
  }
269
282
  return 0;
@@ -0,0 +1,3 @@
1
+ import { Command } from './types.js';
2
+ export declare const text = "Vyriy Project Master\n\nUsage:\n vyriy [name] Create a new Vyriy project\n vyriy . Initialize a new Vyriy project in the current directory\n vyriy --help, -h Show help\n vyriy --version, -v Show version\n vyriy --check-env, -c Check local environment\n vyriy --dist, -d Prepare dist package metadata without publishing to npm\n vyriy --dry-run Print checks and file plan without writing\n vyriy --overwrite Overwrite existing generated paths\n vyriy --skip-existing Leave existing generated paths untouched\n vyriy --no-install Create files without installing dependencies\n vyriy --no-verify Install dependencies without running checks\n\nExamples:\n vyriy app\n vyriy .\n vyriy -d";
3
+ export declare const help: Command;
@@ -0,0 +1,24 @@
1
+ export const text = `Vyriy Project Master
2
+
3
+ Usage:
4
+ vyriy [name] Create a new Vyriy project
5
+ vyriy . Initialize a new Vyriy project in the current directory
6
+ vyriy --help, -h Show help
7
+ vyriy --version, -v Show version
8
+ vyriy --check-env, -c Check local environment
9
+ vyriy --dist, -d Prepare dist package metadata without publishing to npm
10
+ vyriy --dry-run Print checks and file plan without writing
11
+ vyriy --overwrite Overwrite existing generated paths
12
+ vyriy --skip-existing Leave existing generated paths untouched
13
+ vyriy --no-install Create files without installing dependencies
14
+ vyriy --no-verify Install dependencies without running checks
15
+
16
+ Examples:
17
+ vyriy app
18
+ vyriy .
19
+ vyriy -d`;
20
+ export const help = async () => {
21
+ console.log(text);
22
+ await Promise.resolve();
23
+ return 0;
24
+ };
@@ -0,0 +1,5 @@
1
+ export * from './help.js';
2
+ export * from './version.js';
3
+ export * from './dist.js';
4
+ export * from './check-env.js';
5
+ export * from './create/index.js';
@@ -0,0 +1,5 @@
1
+ export * from './help.js';
2
+ export * from './version.js';
3
+ export * from './dist.js';
4
+ export * from './check-env.js';
5
+ export * from './create/index.js';