vyriy 0.5.2 → 0.5.3
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 +23 -12
- package/args.js +40 -0
- package/bin/vyriy.js +1 -1
- package/cli.js +67 -0
- package/package.json +51 -6
- package/{cli/types.d.ts → types.d.ts} +7 -1
- package/cli/args.js +0 -29
- package/cli/cli.js +0 -28
- package/commands/check-env.d.ts +0 -2
- package/commands/check-env.js +0 -120
- package/commands/create/index.d.ts +0 -2
- package/commands/create/index.js +0 -130
- package/commands/create/plan/index.d.ts +0 -4
- package/commands/create/plan/index.js +0 -3
- package/commands/create/plan/plan.d.ts +0 -7
- package/commands/create/plan/plan.js +0 -35
- package/commands/create/plan/question.d.ts +0 -2
- package/commands/create/plan/question.js +0 -25
- package/commands/create/plan/types.d.ts +0 -12
- package/commands/create/preset/api.d.ts +0 -2
- package/commands/create/preset/api.js +0 -63
- package/commands/create/preset/base.d.ts +0 -2
- package/commands/create/preset/base.js +0 -159
- package/commands/create/preset/fullstack.d.ts +0 -2
- package/commands/create/preset/fullstack.js +0 -158
- package/commands/create/preset/gql.d.ts +0 -2
- package/commands/create/preset/gql.js +0 -744
- package/commands/create/preset/index.d.ts +0 -52
- package/commands/create/preset/index.js +0 -62
- package/commands/create/preset/library.d.ts +0 -2
- package/commands/create/preset/library.js +0 -247
- package/commands/create/preset/mfe.d.ts +0 -2
- package/commands/create/preset/mfe.js +0 -326
- package/commands/create/preset/rest.d.ts +0 -2
- package/commands/create/preset/rest.js +0 -242
- package/commands/create/preset/shared.d.ts +0 -116
- package/commands/create/preset/shared.js +0 -245
- package/commands/create/preset/spa.d.ts +0 -2
- package/commands/create/preset/spa.js +0 -132
- package/commands/create/preset/ssg.d.ts +0 -2
- package/commands/create/preset/ssg.js +0 -171
- package/commands/create/preset/ssr.d.ts +0 -2
- package/commands/create/preset/ssr.js +0 -179
- package/commands/create/preset/types.d.ts +0 -9
- package/commands/create/prompt/conflict-strategy.d.ts +0 -5
- package/commands/create/prompt/conflict-strategy.js +0 -22
- package/commands/create/prompt/index.d.ts +0 -6
- package/commands/create/prompt/index.js +0 -5
- package/commands/create/prompt/preset.d.ts +0 -4
- package/commands/create/prompt/preset.js +0 -11
- package/commands/create/prompt/prompt.d.ts +0 -2
- package/commands/create/prompt/prompt.js +0 -4
- package/commands/create/prompt/resolve-option.d.ts +0 -6
- package/commands/create/prompt/resolve-option.js +0 -8
- package/commands/create/prompt/scope.d.ts +0 -2
- package/commands/create/prompt/scope.js +0 -2
- package/commands/create/prompt/types.d.ts +0 -4
- package/commands/dist.d.ts +0 -2
- package/commands/dist.js +0 -287
- package/commands/help.d.ts +0 -3
- package/commands/help.js +0 -24
- package/commands/index.d.ts +0 -5
- package/commands/index.js +0 -5
- package/commands/types.d.ts +0 -44
- package/commands/version.d.ts +0 -2
- package/commands/version.js +0 -6
- /package/{cli/args.d.ts → args.d.ts} +0 -0
- /package/{cli/cli.d.ts → cli.d.ts} +0 -0
- /package/{cli/index.d.ts → index.d.ts} +0 -0
- /package/{cli/index.js → index.js} +0 -0
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
export declare const presets: {
|
|
2
|
-
base: {
|
|
3
|
-
name: string;
|
|
4
|
-
description: string;
|
|
5
|
-
preset: import("./types.js").Preset;
|
|
6
|
-
};
|
|
7
|
-
library: {
|
|
8
|
-
name: string;
|
|
9
|
-
description: string;
|
|
10
|
-
preset: import("./types.js").Preset;
|
|
11
|
-
};
|
|
12
|
-
api: {
|
|
13
|
-
name: string;
|
|
14
|
-
description: string;
|
|
15
|
-
preset: import("./types.js").Preset;
|
|
16
|
-
};
|
|
17
|
-
ssr: {
|
|
18
|
-
name: string;
|
|
19
|
-
description: string;
|
|
20
|
-
preset: import("./types.js").Preset;
|
|
21
|
-
};
|
|
22
|
-
ssg: {
|
|
23
|
-
name: string;
|
|
24
|
-
description: string;
|
|
25
|
-
preset: import("./types.js").Preset;
|
|
26
|
-
};
|
|
27
|
-
spa: {
|
|
28
|
-
name: string;
|
|
29
|
-
description: string;
|
|
30
|
-
preset: import("./types.js").Preset;
|
|
31
|
-
};
|
|
32
|
-
rest: {
|
|
33
|
-
name: string;
|
|
34
|
-
description: string;
|
|
35
|
-
preset: import("./types.js").Preset;
|
|
36
|
-
};
|
|
37
|
-
gql: {
|
|
38
|
-
name: string;
|
|
39
|
-
description: string;
|
|
40
|
-
preset: import("./types.js").Preset;
|
|
41
|
-
};
|
|
42
|
-
mfe: {
|
|
43
|
-
name: string;
|
|
44
|
-
description: string;
|
|
45
|
-
preset: import("./types.js").Preset;
|
|
46
|
-
};
|
|
47
|
-
fullstack: {
|
|
48
|
-
name: string;
|
|
49
|
-
description: string;
|
|
50
|
-
preset: import("./types.js").Preset;
|
|
51
|
-
};
|
|
52
|
-
};
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { base } from './base.js';
|
|
2
|
-
import { library } from './library.js';
|
|
3
|
-
import { api } from './api.js';
|
|
4
|
-
import { ssr } from './ssr.js';
|
|
5
|
-
import { ssg } from './ssg.js';
|
|
6
|
-
import { spa } from './spa.js';
|
|
7
|
-
import { rest } from './rest.js';
|
|
8
|
-
import { gql } from './gql.js';
|
|
9
|
-
import { mfe } from './mfe.js';
|
|
10
|
-
import { fullstack } from './fullstack.js';
|
|
11
|
-
export const presets = {
|
|
12
|
-
base: {
|
|
13
|
-
name: 'Base',
|
|
14
|
-
description: 'Only configuration',
|
|
15
|
-
preset: base,
|
|
16
|
-
},
|
|
17
|
-
library: {
|
|
18
|
-
name: 'Library',
|
|
19
|
-
description: 'Preset to generate JS/React library',
|
|
20
|
-
preset: library,
|
|
21
|
-
},
|
|
22
|
-
api: {
|
|
23
|
-
name: 'API',
|
|
24
|
-
description: 'Preset to generate simple API',
|
|
25
|
-
preset: api,
|
|
26
|
-
},
|
|
27
|
-
ssr: {
|
|
28
|
-
name: 'SSR',
|
|
29
|
-
description: 'Preset to generate simple Server Side Rendering (SSR) API',
|
|
30
|
-
preset: ssr,
|
|
31
|
-
},
|
|
32
|
-
ssg: {
|
|
33
|
-
name: 'SSG',
|
|
34
|
-
description: 'Preset for Static Site Generation (SSG)',
|
|
35
|
-
preset: ssg,
|
|
36
|
-
},
|
|
37
|
-
spa: {
|
|
38
|
-
name: 'SPA',
|
|
39
|
-
description: 'Preset for Single Page Application (SPA)',
|
|
40
|
-
preset: spa,
|
|
41
|
-
},
|
|
42
|
-
rest: {
|
|
43
|
-
name: 'REST',
|
|
44
|
-
description: 'Preset for simple REST API',
|
|
45
|
-
preset: rest,
|
|
46
|
-
},
|
|
47
|
-
gql: {
|
|
48
|
-
name: 'GraphQL',
|
|
49
|
-
description: 'Preset for GraphQL API',
|
|
50
|
-
preset: gql,
|
|
51
|
-
},
|
|
52
|
-
mfe: {
|
|
53
|
-
name: 'MFE',
|
|
54
|
-
description: 'Preset for Micro Frontend',
|
|
55
|
-
preset: mfe,
|
|
56
|
-
},
|
|
57
|
-
fullstack: {
|
|
58
|
-
name: 'Fullstack',
|
|
59
|
-
description: 'Preset for fullstack React application',
|
|
60
|
-
preset: fullstack,
|
|
61
|
-
},
|
|
62
|
-
};
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
import packageJson from '../../../package.json' with { type: 'json' };
|
|
2
|
-
import { base } from './base.js';
|
|
3
|
-
import { stylelintConfigFile } from './shared.js';
|
|
4
|
-
export const library = (options) => {
|
|
5
|
-
const packageScope = options.scope ?? `@${options.name}`;
|
|
6
|
-
const packageName = `${packageScope}/${options.name}`;
|
|
7
|
-
return {
|
|
8
|
-
...base(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
|
-
dependencies: {
|
|
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
|
-
...stylelintConfigFile(),
|
|
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
|
-
};
|