vyriy 0.0.0 → 0.2.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.
- package/AGENTS.md +65 -0
- package/LICENSE +21 -0
- package/README.md +159 -0
- package/bin/vyriy.d.ts +2 -0
- package/bin/vyriy.js +3 -0
- package/checks/node/index.d.ts +2 -0
- package/checks/node/index.js +1 -0
- package/checks/node/node.d.ts +2 -0
- package/checks/node/node.js +22 -0
- package/checks/node/types.d.ts +11 -0
- package/checks/yarn/index.d.ts +2 -0
- package/checks/yarn/index.js +1 -0
- package/checks/yarn/types.d.ts +7 -0
- package/checks/yarn/yarn.d.ts +2 -0
- package/checks/yarn/yarn.js +40 -0
- package/cli/args/args.d.ts +2 -0
- package/cli/args/args.js +23 -0
- package/cli/args/index.d.ts +2 -0
- package/cli/args/index.js +1 -0
- package/cli/args/types.d.ts +10 -0
- package/cli/cli.d.ts +2 -0
- package/cli/cli.js +49 -0
- package/cli/index.d.ts +3 -0
- package/cli/index.js +2 -0
- package/cli/types.d.ts +4 -0
- package/commands/doctor/doctor.d.ts +2 -0
- package/commands/doctor/doctor.js +20 -0
- package/commands/doctor/index.d.ts +2 -0
- package/commands/doctor/index.js +1 -0
- package/commands/doctor/types.d.ts +8 -0
- package/commands/init/index.d.ts +2 -0
- package/commands/init/index.js +1 -0
- package/commands/init/init.d.ts +2 -0
- package/commands/init/init.js +7 -0
- package/commands/init/types.d.ts +5 -0
- package/commands/new/index.d.ts +2 -0
- package/commands/new/index.js +1 -0
- package/commands/new/new.d.ts +2 -0
- package/commands/new/new.js +32 -0
- package/commands/new/types.d.ts +7 -0
- package/index.d.ts +8 -0
- package/index.js +8 -1
- package/package.json +309 -9
- package/project-plan/api/api.d.ts +6 -0
- package/project-plan/api/api.js +56 -0
- package/project-plan/api/index.d.ts +2 -0
- package/project-plan/api/index.js +1 -0
- package/project-plan/api/types.d.ts +10 -0
- package/project-plan/ci/ci.d.ts +3 -0
- package/project-plan/ci/ci.js +19 -0
- package/project-plan/ci/index.d.ts +2 -0
- package/project-plan/ci/index.js +1 -0
- package/project-plan/ci/types.d.ts +6 -0
- package/project-plan/create/create.d.ts +2 -0
- package/project-plan/create/create.js +133 -0
- package/project-plan/create/index.d.ts +2 -0
- package/project-plan/create/index.js +1 -0
- package/project-plan/create/types.d.ts +13 -0
- package/project-plan/index.d.ts +6 -0
- package/project-plan/index.js +5 -0
- package/project-plan/kind/index.d.ts +2 -0
- package/project-plan/kind/index.js +1 -0
- package/project-plan/kind/kind.d.ts +2 -0
- package/project-plan/kind/kind.js +16 -0
- package/project-plan/kind/types.d.ts +2 -0
- package/project-plan/print/index.d.ts +2 -0
- package/project-plan/print/index.js +1 -0
- package/project-plan/print/print.d.ts +2 -0
- package/project-plan/print/print.js +47 -0
- package/project-plan/print/types.d.ts +2 -0
- package/project-plan/types.d.ts +46 -0
- package/prompts/project-plan/index.d.ts +2 -0
- package/prompts/project-plan/index.js +1 -0
- package/prompts/project-plan/project-plan.d.ts +2 -0
- package/prompts/project-plan/project-plan.js +132 -0
- package/prompts/project-plan/types.d.ts +18 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Vyriy Package Agent Guide
|
|
2
|
+
|
|
3
|
+
This package belongs to the Vyriy toolkit. Keep changes calm, explicit, reusable, and easy to reason about.
|
|
4
|
+
|
|
5
|
+
## Architecture
|
|
6
|
+
|
|
7
|
+
- Prefer simple modules over clever frameworks or hidden conventions.
|
|
8
|
+
- Keep package boundaries explicit and avoid project-specific coupling.
|
|
9
|
+
- Extract only proven reusable behavior.
|
|
10
|
+
- Keep public APIs small, typed, documented, and stable.
|
|
11
|
+
- Prefer SSR-friendly and SSG-friendly code paths.
|
|
12
|
+
- Keep integrations replaceable and avoid hard coupling to a CMS or runtime host.
|
|
13
|
+
- Prefer AWS serverless-compatible assumptions when infrastructure concerns appear.
|
|
14
|
+
|
|
15
|
+
## File Shape
|
|
16
|
+
|
|
17
|
+
- Prefer one exported runtime method, component, or helper per production file when it stays readable.
|
|
18
|
+
- Prefer one matching test file per production file, for example `feature.ts` and `feature.test.ts`.
|
|
19
|
+
- Use focused folders when behavior naturally splits into several related files.
|
|
20
|
+
- Keep `index.ts` as a public re-export surface only. Do not place implementation logic in it.
|
|
21
|
+
- Use `.js` relative import and export specifiers in TypeScript source where package style requires it.
|
|
22
|
+
- Add `types.ts` when public shared types are part of the package contract.
|
|
23
|
+
- Keep constants near the code that owns them unless they are shared or clarify repeated behavior.
|
|
24
|
+
|
|
25
|
+
## Public Surface
|
|
26
|
+
|
|
27
|
+
- Every new public export should be re-exported from `index.ts`.
|
|
28
|
+
- Add or update `index.test.ts` when the public export surface changes.
|
|
29
|
+
- Add JSDoc for public exports when behavior, parameters, return values, or usage expectations need explanation.
|
|
30
|
+
- Do not hand-maintain source package `exports` maps unless the package has a real custom publishing need.
|
|
31
|
+
|
|
32
|
+
## Tests
|
|
33
|
+
|
|
34
|
+
- Tests use Jest and `@jest/globals`.
|
|
35
|
+
- Cover public behavior and meaningful edge cases.
|
|
36
|
+
- Prefer behavior-focused tests over private implementation lock-in.
|
|
37
|
+
- When mocking modules, install mocks before loading the module under test.
|
|
38
|
+
- Use focused validation when changing package behavior:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
yarn jest packages/<package> --runInBand --coverage=false
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Documentation
|
|
45
|
+
|
|
46
|
+
- Keep `README.md` concise and usage-oriented.
|
|
47
|
+
- Start package READMEs with `# @vyriy/<package>`.
|
|
48
|
+
- Document real public exports, supported options, and examples that actually work.
|
|
49
|
+
- Keep `doc.mdx` as the Storybook/docs wrapper for the README when the package participates in docs.
|
|
50
|
+
- For component packages, include Storybook coverage for supported states and common usage.
|
|
51
|
+
|
|
52
|
+
## Components
|
|
53
|
+
|
|
54
|
+
- Prefer lightweight React 19+ components with TypeScript.
|
|
55
|
+
- Keep components SSR-friendly and avoid browser globals during render.
|
|
56
|
+
- Prefer composable props and Bootstrap-compatible ergonomics where practical.
|
|
57
|
+
- Put each public component in its own file with a matching test.
|
|
58
|
+
- Add Storybook stories when a component has visual states, variants, or interaction states.
|
|
59
|
+
|
|
60
|
+
## Change Discipline
|
|
61
|
+
|
|
62
|
+
- Keep changes scoped to the requested behavior.
|
|
63
|
+
- Avoid unrelated refactors and metadata churn.
|
|
64
|
+
- Sync implementation, tests, README, `doc.mdx`, and public re-exports together.
|
|
65
|
+
- Prefer the option that is simpler to explain, easier to evolve, and calmer to maintain.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Vyriy contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
# vyriy
|
|
2
|
+
|
|
3
|
+
Interactive project master for calm cloud-ready applications.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
`vyriy` is the user-facing CLI entry point for the Vyriy ecosystem.
|
|
8
|
+
|
|
9
|
+
The first implementation focuses on project planning rather than file generation. It checks the local environment, runs a small project wizard, creates a normalized `VyriyProjectPlan`, prints the summary, and exits without writing generated project files.
|
|
10
|
+
|
|
11
|
+
## Install
|
|
12
|
+
|
|
13
|
+
Install globally:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm i -g vyriy
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Or run the package temporarily:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx vyriy new my-app
|
|
23
|
+
yarn dlx vyriy new my-app
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Commands
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
vyriy new
|
|
30
|
+
vyriy new my-app
|
|
31
|
+
vyriy .
|
|
32
|
+
vyriy init
|
|
33
|
+
vyriy doctor
|
|
34
|
+
vyriy --help
|
|
35
|
+
vyriy --version
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### `vyriy`
|
|
39
|
+
|
|
40
|
+
Runs the same flow as `vyriy new`.
|
|
41
|
+
|
|
42
|
+
### `vyriy new [name]`
|
|
43
|
+
|
|
44
|
+
Starts the project planning wizard.
|
|
45
|
+
|
|
46
|
+
If `name` is provided, it is used as the default project name and target directory.
|
|
47
|
+
|
|
48
|
+
### `vyriy init`
|
|
49
|
+
|
|
50
|
+
Starts the same planning wizard for the current directory.
|
|
51
|
+
|
|
52
|
+
The current directory name is used as the default project name.
|
|
53
|
+
|
|
54
|
+
### `vyriy .`
|
|
55
|
+
|
|
56
|
+
Alias for `vyriy init`.
|
|
57
|
+
|
|
58
|
+
### `vyriy doctor`
|
|
59
|
+
|
|
60
|
+
Runs environment checks only.
|
|
61
|
+
|
|
62
|
+
Current checks:
|
|
63
|
+
|
|
64
|
+
- Node.js `>=24`
|
|
65
|
+
- Yarn `>=4`
|
|
66
|
+
|
|
67
|
+
## Wizard
|
|
68
|
+
|
|
69
|
+
The wizard collects:
|
|
70
|
+
|
|
71
|
+
- project name
|
|
72
|
+
- target directory
|
|
73
|
+
- package scope
|
|
74
|
+
- description
|
|
75
|
+
- project preset
|
|
76
|
+
- API style for API-capable presets
|
|
77
|
+
- CI/CD provider
|
|
78
|
+
- optional extra features
|
|
79
|
+
- confirmation
|
|
80
|
+
|
|
81
|
+
After confirmation, the CLI prints the project plan and exits.
|
|
82
|
+
|
|
83
|
+
File generation is not implemented yet.
|
|
84
|
+
|
|
85
|
+
## Project Presets
|
|
86
|
+
|
|
87
|
+
Supported presets:
|
|
88
|
+
|
|
89
|
+
- `library`
|
|
90
|
+
- `api`
|
|
91
|
+
- `react-csr`
|
|
92
|
+
- `react-ssr`
|
|
93
|
+
- `react-ssg`
|
|
94
|
+
- `mfe`
|
|
95
|
+
- `openmfe`
|
|
96
|
+
- `mfe-bff`
|
|
97
|
+
- `openmfe-bff`
|
|
98
|
+
- `fullstack`
|
|
99
|
+
- `aws-serverless`
|
|
100
|
+
- `empty`
|
|
101
|
+
|
|
102
|
+
The preset is the concrete future generated setup. The project kind is the broader architecture category.
|
|
103
|
+
|
|
104
|
+
Examples:
|
|
105
|
+
|
|
106
|
+
- `react-csr` -> `csr`
|
|
107
|
+
- `react-ssr` -> `ssr`
|
|
108
|
+
- `react-ssg` -> `ssg`
|
|
109
|
+
- `openmfe-bff` -> `mfe`
|
|
110
|
+
- `aws-serverless` -> `aws-serverless`
|
|
111
|
+
|
|
112
|
+
## Public API
|
|
113
|
+
|
|
114
|
+
The package exports the CLI runner, command helpers, environment checks, prompt helper, and project-plan utilities.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
import {
|
|
118
|
+
askProjectPlan,
|
|
119
|
+
checkNodeVersion,
|
|
120
|
+
checkYarnVersion,
|
|
121
|
+
createApiPlan,
|
|
122
|
+
createCiPlan,
|
|
123
|
+
createProjectPlanFromPreset,
|
|
124
|
+
getProjectKindFromPreset,
|
|
125
|
+
parseArgs,
|
|
126
|
+
printProjectPlan,
|
|
127
|
+
runDoctorCommand,
|
|
128
|
+
runInitCommand,
|
|
129
|
+
runNewCommand,
|
|
130
|
+
runVyriyCli,
|
|
131
|
+
} from 'vyriy';
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Project Plan
|
|
135
|
+
|
|
136
|
+
The central model is `VyriyProjectPlan`.
|
|
137
|
+
|
|
138
|
+
It includes:
|
|
139
|
+
|
|
140
|
+
- project identity: `projectName`, `targetDirectory`, `packageScope`, `description`
|
|
141
|
+
- architecture: `preset`, `projectKind`
|
|
142
|
+
- selected features
|
|
143
|
+
- CI/CD planning: enabled state, providers, and validation pipelines
|
|
144
|
+
- API planning for API-capable presets: REST, GraphQL, or mixed API style
|
|
145
|
+
- future package plans
|
|
146
|
+
- future workspace plans
|
|
147
|
+
|
|
148
|
+
This model is intentionally useful before generation exists. It gives future generator steps a stable contract to build from.
|
|
149
|
+
|
|
150
|
+
## Current Non-Goals
|
|
151
|
+
|
|
152
|
+
The CLI does not yet:
|
|
153
|
+
|
|
154
|
+
- write project files
|
|
155
|
+
- initialize Git
|
|
156
|
+
- run `yarn install`
|
|
157
|
+
- generate AWS CDK stacks
|
|
158
|
+
- generate Docker files
|
|
159
|
+
- generate React, OpenMFE, API, or service workspaces
|
package/bin/vyriy.d.ts
ADDED
package/bin/vyriy.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './node.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const getMajorVersion = (version) => {
|
|
2
|
+
const majorVersion = /^v?(\d+)/.exec(version)?.[1];
|
|
3
|
+
return majorVersion ? Number.parseInt(majorVersion, 10) : undefined;
|
|
4
|
+
};
|
|
5
|
+
export const checkNodeVersion = ({ minimumMajor = 24, version = process.version } = {}) => {
|
|
6
|
+
const majorVersion = getMajorVersion(version);
|
|
7
|
+
const normalizedVersion = version.replace(/^v/, '');
|
|
8
|
+
if (majorVersion && majorVersion >= minimumMajor) {
|
|
9
|
+
return {
|
|
10
|
+
ok: true,
|
|
11
|
+
name: 'Node.js',
|
|
12
|
+
version: normalizedVersion,
|
|
13
|
+
message: `Node.js ${normalizedVersion}`,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
ok: false,
|
|
18
|
+
name: 'Node.js',
|
|
19
|
+
version: normalizedVersion,
|
|
20
|
+
message: `Vyriy requires Node.js >= ${minimumMajor}.\n\nCurrent version: ${normalizedVersion}\n\nPlease upgrade Node.js and run the command again.`,
|
|
21
|
+
};
|
|
22
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type EnvironmentCheckResult = {
|
|
2
|
+
readonly ok: boolean;
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly version?: string;
|
|
5
|
+
readonly message: string;
|
|
6
|
+
};
|
|
7
|
+
export type CheckNodeVersionOptions = {
|
|
8
|
+
readonly version?: string;
|
|
9
|
+
readonly minimumMajor?: number;
|
|
10
|
+
};
|
|
11
|
+
export type CheckNodeVersion = (options?: CheckNodeVersionOptions) => EnvironmentCheckResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './yarn.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { EnvironmentCheckResult } from '../node/index.js';
|
|
2
|
+
export type CheckYarnVersionOptions = {
|
|
3
|
+
readonly version?: string;
|
|
4
|
+
readonly minimumMajor?: number;
|
|
5
|
+
readonly run?: () => Promise<string>;
|
|
6
|
+
};
|
|
7
|
+
export type CheckYarnVersion = (options?: CheckYarnVersionOptions) => Promise<EnvironmentCheckResult>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
3
|
+
const execFileAsync = promisify(execFile);
|
|
4
|
+
const getMajorVersion = (version) => {
|
|
5
|
+
const majorVersion = /^(\d+)/.exec(version.trim())?.[1];
|
|
6
|
+
return majorVersion ? Number.parseInt(majorVersion, 10) : undefined;
|
|
7
|
+
};
|
|
8
|
+
const getYarnVersion = async () => {
|
|
9
|
+
const { stdout } = await execFileAsync('yarn', ['--version']);
|
|
10
|
+
return stdout.trim();
|
|
11
|
+
};
|
|
12
|
+
export const checkYarnVersion = async ({ minimumMajor = 4, run = getYarnVersion, version } = {}) => {
|
|
13
|
+
let currentVersion = version;
|
|
14
|
+
try {
|
|
15
|
+
currentVersion ??= await run();
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return {
|
|
19
|
+
ok: false,
|
|
20
|
+
name: 'Yarn',
|
|
21
|
+
message: 'Yarn was not found.\n\nVyriy requires Yarn >= 4.\n\nTry:\n corepack enable\n yarn set version stable',
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
const normalizedVersion = currentVersion.trim();
|
|
25
|
+
const majorVersion = getMajorVersion(normalizedVersion);
|
|
26
|
+
if (majorVersion && majorVersion >= minimumMajor) {
|
|
27
|
+
return {
|
|
28
|
+
ok: true,
|
|
29
|
+
name: 'Yarn',
|
|
30
|
+
version: normalizedVersion,
|
|
31
|
+
message: `Yarn ${normalizedVersion}`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
ok: false,
|
|
36
|
+
name: 'Yarn',
|
|
37
|
+
version: normalizedVersion,
|
|
38
|
+
message: `Vyriy requires Yarn >= ${minimumMajor}.\n\nCurrent version: ${normalizedVersion}\n\nTry:\n corepack enable\n yarn set version stable`,
|
|
39
|
+
};
|
|
40
|
+
};
|
package/cli/args/args.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export const parseArgs = (args) => {
|
|
2
|
+
const [command, projectName] = args;
|
|
3
|
+
if (!command) {
|
|
4
|
+
return { type: 'new' };
|
|
5
|
+
}
|
|
6
|
+
switch (command) {
|
|
7
|
+
case 'new':
|
|
8
|
+
return { type: 'new', projectName };
|
|
9
|
+
case '.':
|
|
10
|
+
case 'init':
|
|
11
|
+
return { type: 'init' };
|
|
12
|
+
case 'doctor':
|
|
13
|
+
return { type: 'doctor' };
|
|
14
|
+
case '--help':
|
|
15
|
+
case '-h':
|
|
16
|
+
return { type: 'help' };
|
|
17
|
+
case '--version':
|
|
18
|
+
case '-v':
|
|
19
|
+
return { type: 'version' };
|
|
20
|
+
default:
|
|
21
|
+
return { type: 'unknown', command };
|
|
22
|
+
}
|
|
23
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './args.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type VyriyCliCommand = {
|
|
2
|
+
readonly type: 'new';
|
|
3
|
+
readonly projectName?: string;
|
|
4
|
+
} | {
|
|
5
|
+
readonly type: 'init' | 'doctor' | 'help' | 'version';
|
|
6
|
+
} | {
|
|
7
|
+
readonly type: 'unknown';
|
|
8
|
+
readonly command: string;
|
|
9
|
+
};
|
|
10
|
+
export type ParseArgs = (args: readonly string[]) => VyriyCliCommand;
|
package/cli/cli.d.ts
ADDED
package/cli/cli.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { runDoctorCommand } from '../commands/doctor/index.js';
|
|
2
|
+
import { runInitCommand } from '../commands/init/index.js';
|
|
3
|
+
import { runNewCommand } from '../commands/new/index.js';
|
|
4
|
+
import packageJson from '../package.json' with { type: 'json' };
|
|
5
|
+
import { parseArgs } from './args/index.js';
|
|
6
|
+
const helpText = `Vyriy Project Master
|
|
7
|
+
|
|
8
|
+
Usage:
|
|
9
|
+
vyriy new [name] Create a new Vyriy project
|
|
10
|
+
vyriy init Initialize the current directory
|
|
11
|
+
vyriy . Initialize the current directory
|
|
12
|
+
vyriy doctor Check local environment
|
|
13
|
+
vyriy --help Show help
|
|
14
|
+
vyriy --version Show version
|
|
15
|
+
|
|
16
|
+
Examples:
|
|
17
|
+
vyriy new my-app
|
|
18
|
+
vyriy .
|
|
19
|
+
vyriy init`;
|
|
20
|
+
export const runVyriyCli = async (args = [], { output = console } = {}) => {
|
|
21
|
+
const command = parseArgs(args);
|
|
22
|
+
let code = 0;
|
|
23
|
+
switch (command.type) {
|
|
24
|
+
case 'new':
|
|
25
|
+
code = await runNewCommand({ output, projectName: command.projectName });
|
|
26
|
+
break;
|
|
27
|
+
case 'init':
|
|
28
|
+
code = await runInitCommand({ output });
|
|
29
|
+
break;
|
|
30
|
+
case 'doctor': {
|
|
31
|
+
const result = await runDoctorCommand({ output });
|
|
32
|
+
code = result.code;
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
case 'help':
|
|
36
|
+
output.log(helpText);
|
|
37
|
+
break;
|
|
38
|
+
case 'version':
|
|
39
|
+
output.log(packageJson.version);
|
|
40
|
+
break;
|
|
41
|
+
case 'unknown':
|
|
42
|
+
output.error(`Unknown command: ${command.command}\n`);
|
|
43
|
+
output.error(helpText);
|
|
44
|
+
code = 1;
|
|
45
|
+
break;
|
|
46
|
+
}
|
|
47
|
+
process.exitCode = code;
|
|
48
|
+
return code;
|
|
49
|
+
};
|
package/cli/index.d.ts
ADDED
package/cli/index.js
ADDED
package/cli/types.d.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { checkNodeVersion } from '../../checks/node/index.js';
|
|
2
|
+
import { checkYarnVersion } from '../../checks/yarn/index.js';
|
|
3
|
+
export const runDoctorCommand = async ({ output = console } = {}) => {
|
|
4
|
+
const checks = [checkNodeVersion(), await checkYarnVersion()];
|
|
5
|
+
const failedCheck = checks.find((check) => !check.ok);
|
|
6
|
+
output.log('Vyriy Project Master\n');
|
|
7
|
+
for (const check of checks) {
|
|
8
|
+
output.log(`${check.ok ? 'OK' : 'ERROR'} ${check.message}`);
|
|
9
|
+
}
|
|
10
|
+
if (failedCheck) {
|
|
11
|
+
return {
|
|
12
|
+
code: 1,
|
|
13
|
+
checks,
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
code: 0,
|
|
18
|
+
checks,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './doctor.js';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EnvironmentCheckResult } from '../../checks/node/index.js';
|
|
2
|
+
export type RunDoctorCommandOptions = {
|
|
3
|
+
readonly output?: Pick<typeof console, 'log' | 'error'>;
|
|
4
|
+
};
|
|
5
|
+
export type RunDoctorCommand = (options?: RunDoctorCommandOptions) => Promise<{
|
|
6
|
+
readonly code: number;
|
|
7
|
+
readonly checks: readonly EnvironmentCheckResult[];
|
|
8
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './init.js';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { cwd as getCwd } from 'node:process';
|
|
3
|
+
import { runNewCommand } from '../new/index.js';
|
|
4
|
+
export const runInitCommand = async ({ cwd = getCwd(), ...options } = {}) => runNewCommand({
|
|
5
|
+
...options,
|
|
6
|
+
projectName: path.basename(cwd),
|
|
7
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './new.js';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { checkNodeVersion } from '../../checks/node/index.js';
|
|
2
|
+
import { checkYarnVersion } from '../../checks/yarn/index.js';
|
|
3
|
+
import { askProjectPlan as askProjectPlanDefault } from '../../prompts/project-plan/index.js';
|
|
4
|
+
import { printProjectPlan } from '../../project-plan/index.js';
|
|
5
|
+
export const runNewCommand = async ({ askProjectPlan = askProjectPlanDefault, output = console, projectName = 'my-app', } = {}) => {
|
|
6
|
+
const nodeCheck = checkNodeVersion();
|
|
7
|
+
if (!nodeCheck.ok) {
|
|
8
|
+
output.error(nodeCheck.message);
|
|
9
|
+
return 1;
|
|
10
|
+
}
|
|
11
|
+
const yarnCheck = await checkYarnVersion();
|
|
12
|
+
if (!yarnCheck.ok) {
|
|
13
|
+
output.error(yarnCheck.message);
|
|
14
|
+
return 1;
|
|
15
|
+
}
|
|
16
|
+
output.log(`OK ${nodeCheck.message}`);
|
|
17
|
+
output.log(`OK ${yarnCheck.message}\n`);
|
|
18
|
+
const plan = await askProjectPlan({
|
|
19
|
+
defaults: {
|
|
20
|
+
projectName,
|
|
21
|
+
targetDirectory: projectName,
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
if (!plan) {
|
|
25
|
+
output.log('Project planning cancelled.');
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
output.log(`\n${printProjectPlan(plan)}`);
|
|
29
|
+
output.log('Project plan created.\n');
|
|
30
|
+
output.log('File generation is not implemented yet.');
|
|
31
|
+
return 0;
|
|
32
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { PromptProjectPlan } from '../../prompts/project-plan/index.js';
|
|
2
|
+
export type RunNewCommandOptions = {
|
|
3
|
+
readonly projectName?: string;
|
|
4
|
+
readonly askProjectPlan?: PromptProjectPlan;
|
|
5
|
+
readonly output?: Pick<typeof console, 'log' | 'error'>;
|
|
6
|
+
};
|
|
7
|
+
export type RunNewCommand = (options?: RunNewCommandOptions) => Promise<number>;
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export * from './cli/index.js';
|
|
2
|
+
export * from './commands/doctor/index.js';
|
|
3
|
+
export * from './commands/init/index.js';
|
|
4
|
+
export * from './commands/new/index.js';
|
|
5
|
+
export * from './checks/node/index.js';
|
|
6
|
+
export * from './checks/yarn/index.js';
|
|
7
|
+
export * from './project-plan/index.js';
|
|
8
|
+
export * from './prompts/project-plan/index.js';
|
package/index.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
export * from './cli/index.js';
|
|
2
|
+
export * from './commands/doctor/index.js';
|
|
3
|
+
export * from './commands/init/index.js';
|
|
4
|
+
export * from './commands/new/index.js';
|
|
5
|
+
export * from './checks/node/index.js';
|
|
6
|
+
export * from './checks/yarn/index.js';
|
|
7
|
+
export * from './project-plan/index.js';
|
|
8
|
+
export * from './prompts/project-plan/index.js';
|