vyriy 0.4.4 → 0.4.7
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 +11 -16
- package/commands/check-env.js +58 -3
- package/commands/create/plan/plan.d.ts +1 -1
- package/commands/create/preset/api.js +0 -2
- package/commands/create/preset/gql.js +740 -6
- package/commands/create/preset/index.d.ts +10 -0
- package/commands/create/preset/index.js +12 -0
- package/commands/create/preset/rest.js +335 -7
- package/commands/create/preset/spa.js +40 -42
- package/commands/create/preset/ssg.js +69 -71
- package/commands/create/preset/ssr.js +0 -2
- package/commands/types.d.ts +4 -5
- package/package.json +5 -8
|
@@ -51,7 +51,6 @@ export const ssg = {
|
|
|
51
51
|
'@vyriy/storybook-config': `^${packageJson.version}`,
|
|
52
52
|
storybook: packageJson.peerDependencies.storybook,
|
|
53
53
|
'@vyriy/path': `^${packageJson.version}`,
|
|
54
|
-
vyriy: `^${packageJson.version}`,
|
|
55
54
|
husky: packageJson.peerDependencies.husky,
|
|
56
55
|
'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
|
|
57
56
|
'cross-env': packageJson.peerDependencies['cross-env'],
|
|
@@ -59,7 +58,6 @@ export const ssg = {
|
|
|
59
58
|
'@vyriy/webpack-config': `^${packageJson.version}`,
|
|
60
59
|
'@vyriy/script': `^${packageJson.version}`,
|
|
61
60
|
tsx: packageJson.peerDependencies.tsx,
|
|
62
|
-
webpack: packageJson.peerDependencies.webpack,
|
|
63
61
|
'webpack-cli': packageJson.peerDependencies['webpack-cli'],
|
|
64
62
|
react: packageJson.peerDependencies.react,
|
|
65
63
|
'react-dom': packageJson.peerDependencies['react-dom'],
|
|
@@ -82,84 +80,84 @@ export const ssg = {
|
|
|
82
80
|
'packages/components/index.ts': "export * from './page/index.js';\n",
|
|
83
81
|
'packages/components/index.test.tsx': `import { describe, expect, it } from '@jest/globals';
|
|
84
82
|
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
import { Page } from './index.js';
|
|
84
|
+
import { Page as PageImplementation } from './page/index.js';
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
});
|
|
86
|
+
describe('packages/components/page', () => {
|
|
87
|
+
it('re-exports the page component', () => {
|
|
88
|
+
expect(Page).toBe(PageImplementation);
|
|
92
89
|
});
|
|
93
|
-
|
|
90
|
+
});
|
|
91
|
+
`,
|
|
94
92
|
'packages/components/page/index.ts': `export * from './page.js';
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
export type * from './types.js';
|
|
94
|
+
`,
|
|
97
95
|
'packages/components/page/index.test.ts': `import { describe, expect, it } from '@jest/globals';
|
|
98
96
|
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
import { Page } from './index.js';
|
|
98
|
+
import { Page as PageImplementation } from './page.js';
|
|
101
99
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
});
|
|
100
|
+
describe('packages/components/page', () => {
|
|
101
|
+
it('re-exports the page component', () => {
|
|
102
|
+
expect(Page).toBe(PageImplementation);
|
|
106
103
|
});
|
|
107
|
-
|
|
104
|
+
});
|
|
105
|
+
`,
|
|
108
106
|
'packages/components/page/types.ts': `import { FC } from 'react';
|
|
109
107
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
export type PageProps = {
|
|
109
|
+
content: string;
|
|
110
|
+
};
|
|
113
111
|
|
|
114
|
-
|
|
115
|
-
|
|
112
|
+
export type PageType = FC<PageProps>;
|
|
113
|
+
`,
|
|
116
114
|
'packages/components/page/page.tsx': `import type { PageType } from './types.js';
|
|
117
115
|
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
export const Page: PageType = ({ content }) => <div className="content">{content}</div>;
|
|
117
|
+
`,
|
|
120
118
|
'packages/components/page/styles.scss': `.content {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
display: block;
|
|
120
|
+
}
|
|
121
|
+
`,
|
|
124
122
|
'packages/components/page/page.test.tsx': `import { renderToStaticMarkup } from 'react-dom/server';
|
|
125
|
-
|
|
123
|
+
import { describe, expect, it } from '@jest/globals';
|
|
126
124
|
|
|
127
|
-
|
|
125
|
+
import { Page } from './page.js';
|
|
128
126
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
});
|
|
127
|
+
describe('packages/components/page/page', () => {
|
|
128
|
+
it('renders content inside the page content container', () => {
|
|
129
|
+
expect(renderToStaticMarkup(<Page content="Page body" />)).toBe('<div class="content">Page body</div>');
|
|
133
130
|
});
|
|
134
|
-
|
|
131
|
+
});
|
|
132
|
+
`,
|
|
135
133
|
'packages/services/package.json': JSON.stringify({
|
|
136
134
|
name: '@p/services',
|
|
137
135
|
private: true,
|
|
138
136
|
type: 'module',
|
|
139
137
|
}, null, 2) + '\n',
|
|
140
138
|
'packages/services/cms/index.ts': `export const cms = {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
getContent: async () => {
|
|
140
|
+
// Placeholder for fetching content from a CMS
|
|
141
|
+
return Promise.resolve({
|
|
142
|
+
title: 'Sample Content',
|
|
143
|
+
body: 'This is a sample content fetched from the CMS.',
|
|
144
|
+
});
|
|
145
|
+
},
|
|
146
|
+
};
|
|
147
|
+
`,
|
|
150
148
|
'packages/services/cms/index.test.ts': `import { describe, expect, it } from '@jest/globals';
|
|
151
149
|
|
|
152
|
-
|
|
150
|
+
import { cms } from './index.js';
|
|
153
151
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
});
|
|
152
|
+
describe('packages/services/cms', () => {
|
|
153
|
+
it('returns content for rendering a page', async () => {
|
|
154
|
+
await expect(cms.getContent()).resolves.toEqual({
|
|
155
|
+
title: 'Sample Content',
|
|
156
|
+
body: 'This is a sample content fetched from the CMS.',
|
|
160
157
|
});
|
|
161
158
|
});
|
|
162
|
-
|
|
159
|
+
});
|
|
160
|
+
`,
|
|
163
161
|
'workspaces/ssg/bin/build.sh': `#!/usr/bin/env sh
|
|
164
162
|
|
|
165
163
|
set -e
|
|
@@ -187,29 +185,29 @@ yarn exec sass packages/components/page/styles.scss "$distdir/styles.css" --no-s
|
|
|
187
185
|
PROJECT_CWD="$distdir" NODE_ENV=production LOG_LEVEL=info "$PWD/node_modules/.bin/tsx" $scriptdir/index.tsx
|
|
188
186
|
`,
|
|
189
187
|
'workspaces/ssg/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
190
|
-
|
|
188
|
+
import ReadMe from './README.md?raw';
|
|
191
189
|
|
|
192
|
-
|
|
190
|
+
<Meta title="Workspaces/SSG" />
|
|
193
191
|
|
|
194
|
-
|
|
195
|
-
|
|
192
|
+
<Markdown>{ReadMe}</Markdown>
|
|
193
|
+
`,
|
|
196
194
|
'workspaces/ssg/README.md': `# ${options.name} SSG\n\n${options.description}\n`,
|
|
197
195
|
'workspaces/ssg/webpack.config.ts': `import { path } from '@vyriy/path';
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
196
|
+
import { ssr, external } from '@vyriy/webpack-config';
|
|
197
|
+
|
|
198
|
+
export default ssr(
|
|
199
|
+
'@w/ssg',
|
|
200
|
+
{
|
|
201
|
+
path: path('dist', 'ssg'),
|
|
202
|
+
filename: 'index.js',
|
|
203
|
+
library: { type: 'commonjs2' },
|
|
204
|
+
},
|
|
205
|
+
(config) => ({
|
|
206
|
+
...config,
|
|
207
|
+
externals: [external({ allowlist: [/^@p/, /^@w/, /^@vyriy/] })],
|
|
208
|
+
}),
|
|
209
|
+
);
|
|
210
|
+
`,
|
|
213
211
|
'workspaces/ssg/package.json': JSON.stringify({
|
|
214
212
|
name: '@w/ssg',
|
|
215
213
|
type: 'module',
|
|
@@ -51,7 +51,6 @@ export const ssr = {
|
|
|
51
51
|
'@vyriy/storybook-config': `^${packageJson.version}`,
|
|
52
52
|
storybook: packageJson.peerDependencies.storybook,
|
|
53
53
|
'@vyriy/path': `^${packageJson.version}`,
|
|
54
|
-
vyriy: `^${packageJson.version}`,
|
|
55
54
|
husky: packageJson.peerDependencies.husky,
|
|
56
55
|
'npm-run-all2': packageJson.peerDependencies['npm-run-all2'],
|
|
57
56
|
'cross-env': packageJson.peerDependencies['cross-env'],
|
|
@@ -60,7 +59,6 @@ export const ssr = {
|
|
|
60
59
|
'@vyriy/handler': `^${packageJson.version}`,
|
|
61
60
|
'@vyriy/server': `^${packageJson.version}`,
|
|
62
61
|
tsx: packageJson.peerDependencies.tsx,
|
|
63
|
-
webpack: packageJson.peerDependencies.webpack,
|
|
64
62
|
'webpack-cli': packageJson.peerDependencies['webpack-cli'],
|
|
65
63
|
react: packageJson.peerDependencies.react,
|
|
66
64
|
'react-dom': packageJson.peerDependencies['react-dom'],
|
package/commands/types.d.ts
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export type Command = () => Promise<number>;
|
|
2
|
-
export type
|
|
2
|
+
export type EnvironmentCheckResult = {
|
|
3
3
|
ok: boolean;
|
|
4
4
|
message: string;
|
|
5
5
|
};
|
|
6
|
-
export type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
}>;
|
|
6
|
+
export type Node = () => EnvironmentCheckResult;
|
|
7
|
+
export type Corepack = () => Promise<EnvironmentCheckResult>;
|
|
8
|
+
export type Yarn = () => Promise<EnvironmentCheckResult>;
|
|
10
9
|
export type CreateOptions = {
|
|
11
10
|
readonly directory: string;
|
|
12
11
|
readonly dryRun: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vyriy",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.7",
|
|
4
4
|
"description": "Interactive project master for calm cloud-ready applications.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./bin/vyriy.js",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"@types/react-dom": "^19.2.3",
|
|
14
14
|
"cross-env": "^10.1.0",
|
|
15
15
|
"eslint": "^10.4.0",
|
|
16
|
+
"graphql": "^16.14.0",
|
|
16
17
|
"husky": "^9.1.7",
|
|
17
18
|
"jest": "^30.4.2",
|
|
18
19
|
"npm-run-all2": "^9.0.1",
|
|
@@ -25,13 +26,9 @@
|
|
|
25
26
|
"stylelint": "^17.12.0",
|
|
26
27
|
"tsx": "^4.22.3",
|
|
27
28
|
"typescript": "^6.0.3",
|
|
28
|
-
"webpack": "^5.107.2",
|
|
29
29
|
"webpack-cli": "^7.0.2"
|
|
30
30
|
},
|
|
31
31
|
"peerDependenciesMeta": {
|
|
32
|
-
"@storybook/react-webpack5": {
|
|
33
|
-
"optional": true
|
|
34
|
-
},
|
|
35
32
|
"@types/react": {
|
|
36
33
|
"optional": true
|
|
37
34
|
},
|
|
@@ -44,6 +41,9 @@
|
|
|
44
41
|
"eslint": {
|
|
45
42
|
"optional": true
|
|
46
43
|
},
|
|
44
|
+
"graphql": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
47
47
|
"husky": {
|
|
48
48
|
"optional": true
|
|
49
49
|
},
|
|
@@ -80,9 +80,6 @@
|
|
|
80
80
|
"typescript": {
|
|
81
81
|
"optional": true
|
|
82
82
|
},
|
|
83
|
-
"webpack": {
|
|
84
|
-
"optional": true
|
|
85
|
-
},
|
|
86
83
|
"webpack-cli": {
|
|
87
84
|
"optional": true
|
|
88
85
|
}
|