vyriy 0.5.1 → 0.5.2
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/commands/create/index.js +1 -6
- package/commands/create/plan/plan.d.ts +1 -3
- package/commands/create/plan/plan.js +8 -7
- package/commands/create/plan/types.d.ts +0 -2
- package/commands/create/preset/api.js +13 -19
- package/commands/create/preset/base.js +78 -114
- package/commands/create/preset/fullstack.d.ts +2 -0
- package/commands/create/preset/fullstack.js +158 -0
- package/commands/create/preset/gql.js +82 -88
- package/commands/create/preset/index.d.ts +5 -0
- package/commands/create/preset/index.js +6 -0
- package/commands/create/preset/library.js +115 -121
- package/commands/create/preset/mfe.js +97 -104
- package/commands/create/preset/rest.js +15 -21
- package/commands/create/preset/spa.js +31 -37
- package/commands/create/preset/ssg.js +32 -38
- package/commands/create/preset/ssr.js +32 -38
- package/commands/create/preset/types.d.ts +2 -8
- package/commands/create/prompt/index.d.ts +0 -1
- package/commands/create/prompt/index.js +0 -1
- package/package.json +1 -1
- package/commands/create/prompt/provider.d.ts +0 -2
- package/commands/create/prompt/provider.js +0 -13
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
import packageJson from '../../../package.json' with { type: 'json' };
|
|
2
2
|
import { base } from './base.js';
|
|
3
3
|
import { assetsDeclarationFile, baseToolingDeps, buildPackageJson, reactComponentFiles, reactDeps, reactServiceFiles, reactWorkspaceScripts, serverDeps, stylelintConfigFile, stylelintDeps, webpackDeps, } from './shared.js';
|
|
4
|
-
export const ssr = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
'
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
'workspaces/api/bin/build.sh': `#!/usr/bin/env sh
|
|
4
|
+
export const ssr = (options) => ({
|
|
5
|
+
...base(options),
|
|
6
|
+
...stylelintConfigFile(),
|
|
7
|
+
...assetsDeclarationFile(),
|
|
8
|
+
...reactComponentFiles(),
|
|
9
|
+
...reactServiceFiles(),
|
|
10
|
+
'package.json': buildPackageJson(options, [
|
|
11
|
+
'packages/*',
|
|
12
|
+
'workspaces/*',
|
|
13
|
+
], reactWorkspaceScripts('api'), {
|
|
14
|
+
...baseToolingDeps(),
|
|
15
|
+
...webpackDeps(),
|
|
16
|
+
...serverDeps(),
|
|
17
|
+
...reactDeps(),
|
|
18
|
+
...stylelintDeps(),
|
|
19
|
+
'@vyriy/cn': `^${packageJson.version}`,
|
|
20
|
+
'@vyriy/html': `^${packageJson.version}`,
|
|
21
|
+
sass: packageJson.peerDependencies.sass,
|
|
22
|
+
}),
|
|
23
|
+
'workspaces/api/bin/build.sh': `#!/usr/bin/env sh
|
|
25
24
|
|
|
26
25
|
set -e
|
|
27
26
|
|
|
@@ -35,7 +34,7 @@ cp $scriptdir/package.json "$distdir/package.json"
|
|
|
35
34
|
npm pkg delete "type" --prefix "$distdir"
|
|
36
35
|
npm pkg delete "private" --prefix "$distdir"
|
|
37
36
|
`,
|
|
38
|
-
|
|
37
|
+
'workspaces/api/bin/start.sh': `#!/usr/bin/env sh
|
|
39
38
|
|
|
40
39
|
set -e
|
|
41
40
|
|
|
@@ -47,15 +46,15 @@ yarn exec sass packages/components/page/styles.scss "$distdir/styles.css" --no-s
|
|
|
47
46
|
|
|
48
47
|
PROJECT_CWD="$distdir" NODE_ENV=production LOG_LEVEL=info "$PWD/node_modules/.bin/tsx" $scriptdir/index.tsx
|
|
49
48
|
`,
|
|
50
|
-
|
|
49
|
+
'workspaces/api/doc.mdx': `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
51
50
|
import ReadMe from './README.md?raw';
|
|
52
51
|
|
|
53
52
|
<Meta title="Workspaces/API" />
|
|
54
53
|
|
|
55
54
|
<Markdown>{ReadMe}</Markdown>
|
|
56
55
|
`,
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
'workspaces/api/README.md': `# ${options.name} API\n\n${options.description}\n`,
|
|
57
|
+
'workspaces/api/webpack.config.ts': `import { path } from '@vyriy/path';
|
|
59
58
|
import { ssr, external } from '@vyriy/webpack-config';
|
|
60
59
|
|
|
61
60
|
export default ssr(
|
|
@@ -71,12 +70,12 @@ export default ssr(
|
|
|
71
70
|
}),
|
|
72
71
|
);
|
|
73
72
|
`,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
73
|
+
'workspaces/api/package.json': JSON.stringify({
|
|
74
|
+
name: '@w/api',
|
|
75
|
+
type: 'module',
|
|
76
|
+
private: true,
|
|
77
|
+
}, null, 2) + '\n',
|
|
78
|
+
'workspaces/api/index.tsx': `import { readFileSync } from 'node:fs';
|
|
80
79
|
import { renderToString } from 'react-dom/server';
|
|
81
80
|
|
|
82
81
|
import { server } from '@vyriy/server';
|
|
@@ -111,7 +110,7 @@ server(
|
|
|
111
110
|
}),
|
|
112
111
|
);
|
|
113
112
|
`,
|
|
114
|
-
|
|
113
|
+
'workspaces/api/index.test.tsx': `import { describe, expect, it, jest } from '@jest/globals';
|
|
115
114
|
|
|
116
115
|
const apiMock = jest.fn((handler) => ({
|
|
117
116
|
handler,
|
|
@@ -177,9 +176,4 @@ describe('workspaces/api/index.tsx', () => {
|
|
|
177
176
|
});
|
|
178
177
|
});
|
|
179
178
|
`,
|
|
180
|
-
|
|
181
|
-
ci: {
|
|
182
|
-
...base.ci,
|
|
183
|
-
},
|
|
184
|
-
deploy: {},
|
|
185
|
-
};
|
|
179
|
+
});
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import type { PlanResult } from '../plan/types.js';
|
|
2
2
|
export type FileMap = Record<string, string>;
|
|
3
|
-
export type
|
|
4
|
-
export type
|
|
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';
|
|
3
|
+
export type Preset = (options: PlanResult) => FileMap;
|
|
4
|
+
export type PresetKey = 'base' | 'library' | 'api' | 'ssr' | 'rest' | 'gql' | 'ssg' | 'spa' | 'mfe' | 'fullstack';
|
|
11
5
|
export type Presets = Partial<Record<PresetKey, {
|
|
12
6
|
name: string;
|
|
13
7
|
description: string;
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
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
|
-
};
|