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.
- package/README.md +75 -179
- package/bin/vyriy.js +2 -2
- package/cli/args.js +29 -0
- package/cli/cli.d.ts +2 -2
- package/cli/cli.js +18 -69
- package/cli/index.d.ts +1 -1
- package/cli/index.js +1 -1
- package/cli/types.d.ts +12 -3
- package/commands/check-env.d.ts +2 -0
- package/commands/check-env.js +65 -0
- package/commands/create/index.d.ts +2 -0
- package/commands/create/index.js +121 -0
- package/commands/create/plan/index.d.ts +4 -0
- package/commands/create/plan/index.js +3 -0
- package/commands/create/plan/plan.d.ts +9 -0
- package/commands/create/plan/plan.js +34 -0
- package/commands/create/plan/question.d.ts +2 -0
- package/commands/create/plan/question.js +25 -0
- package/commands/create/plan/types.d.ts +14 -0
- package/commands/create/preset/api.d.ts +2 -0
- package/commands/create/preset/api.js +168 -0
- package/commands/create/preset/base.d.ts +2 -0
- package/commands/create/preset/base.js +195 -0
- package/commands/create/preset/gql.d.ts +2 -0
- package/commands/create/preset/gql.js +16 -0
- package/commands/create/preset/index.d.ts +17 -0
- package/commands/create/preset/index.js +20 -0
- package/commands/create/preset/library.d.ts +2 -0
- package/commands/create/preset/library.js +252 -0
- package/commands/create/preset/mfe.d.ts +2 -0
- package/commands/create/preset/mfe.js +16 -0
- package/commands/create/preset/rest.d.ts +2 -0
- package/commands/create/preset/rest.js +16 -0
- package/commands/create/preset/spa.d.ts +2 -0
- package/commands/create/preset/spa.js +16 -0
- package/commands/create/preset/ssg.d.ts +2 -0
- package/commands/create/preset/ssg.js +16 -0
- package/commands/create/preset/ssr.d.ts +2 -0
- package/commands/create/preset/ssr.js +16 -0
- package/commands/create/preset/types.d.ts +15 -0
- package/commands/create/prompt/conflict-strategy.d.ts +5 -0
- package/commands/create/prompt/conflict-strategy.js +22 -0
- package/commands/create/prompt/index.d.ts +7 -0
- package/commands/create/prompt/index.js +6 -0
- package/commands/create/prompt/preset.d.ts +4 -0
- package/commands/create/prompt/preset.js +11 -0
- package/commands/create/prompt/prompt.d.ts +2 -0
- package/commands/create/prompt/prompt.js +4 -0
- package/commands/create/prompt/provider.d.ts +2 -0
- package/commands/create/prompt/provider.js +13 -0
- package/commands/create/prompt/resolve-option.d.ts +6 -0
- package/commands/create/prompt/resolve-option.js +8 -0
- package/commands/create/prompt/scope.d.ts +2 -0
- package/commands/create/prompt/scope.js +2 -0
- package/commands/create/prompt/types.d.ts +4 -0
- package/commands/dist.d.ts +2 -0
- package/commands/{publish/publish.js → dist.js} +22 -9
- package/commands/help.d.ts +3 -0
- package/commands/help.js +24 -0
- package/commands/index.d.ts +5 -0
- package/commands/index.js +5 -0
- package/commands/{publish/types.d.ts → types.d.ts} +18 -4
- package/commands/version.d.ts +2 -0
- package/commands/version.js +6 -0
- package/package.json +20 -588
- package/bin/vyriy.d.ts +0 -2
- package/checks/node/index.d.ts +0 -2
- package/checks/node/index.js +0 -1
- package/checks/node/node.d.ts +0 -2
- package/checks/node/node.js +0 -22
- package/checks/node/types.d.ts +0 -11
- package/checks/yarn/index.d.ts +0 -2
- package/checks/yarn/index.js +0 -1
- package/checks/yarn/types.d.ts +0 -7
- package/checks/yarn/yarn.d.ts +0 -2
- package/checks/yarn/yarn.js +0 -40
- package/cli/args/args.js +0 -40
- package/cli/args/index.d.ts +0 -2
- package/cli/args/index.js +0 -1
- package/cli/args/types.d.ts +0 -24
- package/commands/doctor/doctor.d.ts +0 -2
- package/commands/doctor/doctor.js +0 -9
- package/commands/doctor/index.d.ts +0 -2
- package/commands/doctor/index.js +0 -1
- package/commands/doctor/types.d.ts +0 -8
- package/commands/init/index.d.ts +0 -2
- package/commands/init/index.js +0 -1
- package/commands/init/init.d.ts +0 -2
- package/commands/init/init.js +0 -7
- package/commands/init/types.d.ts +0 -5
- package/commands/new/index.d.ts +0 -2
- package/commands/new/index.js +0 -1
- package/commands/new/new.d.ts +0 -3
- package/commands/new/new.js +0 -189
- package/commands/new/types.d.ts +0 -15
- package/commands/publish/index.d.ts +0 -2
- package/commands/publish/index.js +0 -1
- package/commands/publish/publish.d.ts +0 -2
- package/doctor/checkCorepack.d.ts +0 -2
- package/doctor/checkCorepack.js +0 -24
- package/doctor/checkGit.d.ts +0 -2
- package/doctor/checkGit.js +0 -23
- package/doctor/checkNodeVersion.d.ts +0 -5
- package/doctor/checkNodeVersion.js +0 -24
- package/doctor/checkYarn.d.ts +0 -10
- package/doctor/checkYarn.js +0 -45
- package/doctor/createDoctorReport.d.ts +0 -2
- package/doctor/createDoctorReport.js +0 -17
- package/doctor/index.d.ts +0 -7
- package/doctor/index.js +0 -6
- package/doctor/printDoctorReport.d.ts +0 -2
- package/doctor/printDoctorReport.js +0 -42
- package/doctor/types.d.ts +0 -25
- package/file-plan/createFilePlan.d.ts +0 -4
- package/file-plan/createFilePlan.js +0 -29
- package/file-plan/index.d.ts +0 -4
- package/file-plan/index.js +0 -3
- package/file-plan/printFilePlan.d.ts +0 -2
- package/file-plan/printFilePlan.js +0 -44
- package/file-plan/types.d.ts +0 -12
- package/file-plan/writeFilePlan.d.ts +0 -2
- package/file-plan/writeFilePlan.js +0 -12
- package/index.d.ts +0 -12
- package/index.js +0 -12
- package/presets/agentsTemplate.d.ts +0 -1
- package/presets/agentsTemplate.js +0 -105
- package/presets/base/createBaseFiles.d.ts +0 -3
- package/presets/base/createBaseFiles.js +0 -307
- package/presets/config.d.ts +0 -28
- package/presets/config.js +0 -7
- package/presets/createProjectFiles.d.ts +0 -2
- package/presets/createProjectFiles.js +0 -8
- package/presets/index.d.ts +0 -2
- package/presets/index.js +0 -1
- package/presets/library/createLibraryUiFiles.d.ts +0 -3
- package/presets/library/createLibraryUiFiles.js +0 -127
- package/presets/packages/createPackageFiles.d.ts +0 -3
- package/presets/packages/createPackageFiles.js +0 -39
- package/presets/packages/createPackageManifest.d.ts +0 -7
- package/presets/packages/createPackageManifest.js +0 -13
- package/presets/types.d.ts +0 -3
- package/presets/workspaces/createWorkspaceFiles.d.ts +0 -3
- package/presets/workspaces/createWorkspaceFiles.js +0 -98
- package/project-plan/api/api.d.ts +0 -6
- package/project-plan/api/api.js +0 -44
- package/project-plan/api/index.d.ts +0 -2
- package/project-plan/api/index.js +0 -1
- package/project-plan/api/types.d.ts +0 -11
- package/project-plan/ci/ci.d.ts +0 -3
- package/project-plan/ci/ci.js +0 -20
- package/project-plan/ci/index.d.ts +0 -2
- package/project-plan/ci/index.js +0 -1
- package/project-plan/ci/types.d.ts +0 -6
- package/project-plan/create/create.d.ts +0 -2
- package/project-plan/create/create.js +0 -129
- package/project-plan/create/index.d.ts +0 -2
- package/project-plan/create/index.js +0 -1
- package/project-plan/create/types.d.ts +0 -13
- package/project-plan/index.d.ts +0 -6
- package/project-plan/index.js +0 -5
- package/project-plan/kind/index.d.ts +0 -2
- package/project-plan/kind/index.js +0 -1
- package/project-plan/kind/kind.d.ts +0 -2
- package/project-plan/kind/kind.js +0 -1
- package/project-plan/kind/types.d.ts +0 -2
- package/project-plan/print/index.d.ts +0 -2
- package/project-plan/print/index.js +0 -1
- package/project-plan/print/print.d.ts +0 -2
- package/project-plan/print/print.js +0 -47
- package/project-plan/print/types.d.ts +0 -2
- package/project-plan/types.d.ts +0 -46
- package/prompts/project-plan/index.d.ts +0 -2
- package/prompts/project-plan/index.js +0 -1
- package/prompts/project-plan/project-plan.d.ts +0 -2
- package/prompts/project-plan/project-plan.js +0 -198
- package/prompts/project-plan/types.d.ts +0 -18
- package/shared/commandExists.d.ts +0 -2
- package/shared/commandExists.js +0 -10
- package/shared/execCommand.d.ts +0 -2
- package/shared/execCommand.js +0 -7
- package/shared/fileExists.d.ts +0 -2
- package/shared/fileExists.js +0 -10
- package/shared/index.d.ts +0 -6
- package/shared/index.js +0 -5
- package/shared/runCommand.d.ts +0 -9
- package/shared/runCommand.js +0 -34
- package/shared/semver.d.ts +0 -1
- package/shared/semver.js +0 -4
- package/shared/types.d.ts +0 -12
- /package/cli/{args/args.d.ts → args.d.ts} +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
const statusMark = {
|
|
2
|
-
ok: '✓',
|
|
3
|
-
warning: '!',
|
|
4
|
-
error: '✘',
|
|
5
|
-
};
|
|
6
|
-
const groups = ['Runtime', 'Package manager', 'Git'];
|
|
7
|
-
export const printDoctorReport = (report) => {
|
|
8
|
-
const lines = ['Vyriy Doctor', ''];
|
|
9
|
-
for (const group of groups) {
|
|
10
|
-
const checks = report.checks.filter((check) => check.group === group);
|
|
11
|
-
if (checks.length === 0) {
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
lines.push(`${group}:`);
|
|
15
|
-
for (const check of checks) {
|
|
16
|
-
lines.push(` ${statusMark[check.level]} ${check.message}`);
|
|
17
|
-
if (check.detail) {
|
|
18
|
-
lines.push(` ${check.detail}`);
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
lines.push('');
|
|
22
|
-
}
|
|
23
|
-
const fixes = report.checks.flatMap((check) => (check.fix ? [check.fix] : []));
|
|
24
|
-
if (fixes.length > 0) {
|
|
25
|
-
lines.push('Suggested fix:');
|
|
26
|
-
for (const fix of fixes) {
|
|
27
|
-
lines.push(` ${fix.command.replaceAll('\n', '\n ')}`);
|
|
28
|
-
}
|
|
29
|
-
lines.push('');
|
|
30
|
-
}
|
|
31
|
-
lines.push('Result:');
|
|
32
|
-
if (report.hasErrors) {
|
|
33
|
-
lines.push(' Environment is not usable.');
|
|
34
|
-
}
|
|
35
|
-
else if (report.hasWarnings) {
|
|
36
|
-
lines.push(' Environment is usable, but warnings should be reviewed.');
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
lines.push(' Environment is usable.');
|
|
40
|
-
}
|
|
41
|
-
return lines.join('\n');
|
|
42
|
-
};
|
package/doctor/types.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { ExecCommand } from '../shared/index.js';
|
|
2
|
-
export type DoctorCheckLevel = 'ok' | 'warning' | 'error';
|
|
3
|
-
export type DoctorFix = {
|
|
4
|
-
readonly label: string;
|
|
5
|
-
readonly command: string;
|
|
6
|
-
readonly safeToRun: boolean;
|
|
7
|
-
};
|
|
8
|
-
export type DoctorCheck = {
|
|
9
|
-
readonly name: 'node' | 'corepack' | 'yarn' | 'git';
|
|
10
|
-
readonly label: string;
|
|
11
|
-
readonly group: 'Runtime' | 'Package manager' | 'Git';
|
|
12
|
-
readonly level: DoctorCheckLevel;
|
|
13
|
-
readonly message: string;
|
|
14
|
-
readonly detail?: string;
|
|
15
|
-
readonly version?: string;
|
|
16
|
-
readonly fix?: DoctorFix;
|
|
17
|
-
};
|
|
18
|
-
export type DoctorReport = {
|
|
19
|
-
readonly checks: readonly DoctorCheck[];
|
|
20
|
-
readonly hasErrors: boolean;
|
|
21
|
-
readonly hasWarnings: boolean;
|
|
22
|
-
};
|
|
23
|
-
export type DoctorCheckOptions = {
|
|
24
|
-
readonly execCommand?: ExecCommand;
|
|
25
|
-
};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { FilePlanItem, FilePlanOptions, ProjectFile } from './types.js';
|
|
2
|
-
export declare const createFilePlan: (targetDirectory: string, files: readonly ProjectFile[], options?: FilePlanOptions & {
|
|
3
|
-
readonly fileExists?: (filePath: string) => Promise<boolean>;
|
|
4
|
-
}) => Promise<FilePlanItem[]>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import path from 'node:path';
|
|
2
|
-
import { fileExists as fileExistsDefault } from '../shared/index.js';
|
|
3
|
-
const getFilePlanStatus = (exists, { overwrite, skipExisting, }) => {
|
|
4
|
-
if (!exists) {
|
|
5
|
-
return 'create';
|
|
6
|
-
}
|
|
7
|
-
if (overwrite) {
|
|
8
|
-
return 'overwrite';
|
|
9
|
-
}
|
|
10
|
-
if (skipExisting) {
|
|
11
|
-
return 'skip';
|
|
12
|
-
}
|
|
13
|
-
return 'conflict';
|
|
14
|
-
};
|
|
15
|
-
export const createFilePlan = async (targetDirectory, files, options = {}) => {
|
|
16
|
-
const { fileExists = fileExistsDefault, overwrite = false, skipExisting = false } = options;
|
|
17
|
-
if (overwrite && skipExisting) {
|
|
18
|
-
throw new Error('Cannot use overwrite and skipExisting together.');
|
|
19
|
-
}
|
|
20
|
-
const plan = [];
|
|
21
|
-
for (const file of files) {
|
|
22
|
-
const exists = await fileExists(path.join(targetDirectory, file.path));
|
|
23
|
-
plan.push({
|
|
24
|
-
...file,
|
|
25
|
-
status: getFilePlanStatus(exists, { overwrite, skipExisting }),
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return plan;
|
|
29
|
-
};
|
package/file-plan/index.d.ts
DELETED
package/file-plan/index.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
const sections = [
|
|
2
|
-
[
|
|
3
|
-
'create',
|
|
4
|
-
'CREATE',
|
|
5
|
-
'+',
|
|
6
|
-
'to create',
|
|
7
|
-
],
|
|
8
|
-
[
|
|
9
|
-
'overwrite',
|
|
10
|
-
'OVERWRITE',
|
|
11
|
-
'~',
|
|
12
|
-
'to overwrite',
|
|
13
|
-
],
|
|
14
|
-
[
|
|
15
|
-
'skip',
|
|
16
|
-
'SKIP',
|
|
17
|
-
'-',
|
|
18
|
-
'to skip',
|
|
19
|
-
],
|
|
20
|
-
[
|
|
21
|
-
'conflict',
|
|
22
|
-
'CONFLICT',
|
|
23
|
-
'!',
|
|
24
|
-
'conflict',
|
|
25
|
-
],
|
|
26
|
-
];
|
|
27
|
-
export const printFilePlan = (plan) => {
|
|
28
|
-
const lines = ['File plan:', ''];
|
|
29
|
-
for (const [status, title, marker] of sections) {
|
|
30
|
-
const items = plan.filter((item) => item.status === status);
|
|
31
|
-
if (items.length === 0) {
|
|
32
|
-
continue;
|
|
33
|
-
}
|
|
34
|
-
lines.push(title, ...items.map((item) => ` ${marker} ${item.path}`), '');
|
|
35
|
-
}
|
|
36
|
-
lines.push('Summary:');
|
|
37
|
-
for (const [status, , , label,] of sections) {
|
|
38
|
-
const count = plan.filter((item) => item.status === status).length;
|
|
39
|
-
if (count > 0) {
|
|
40
|
-
lines.push(` ${count} ${label}${status === 'conflict' && count !== 1 ? 's' : ''}`);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
return lines.join('\n');
|
|
44
|
-
};
|
package/file-plan/types.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export type FilePlanItemStatus = 'create' | 'overwrite' | 'skip' | 'conflict';
|
|
2
|
-
export type ProjectFile = {
|
|
3
|
-
readonly path: string;
|
|
4
|
-
readonly content: string;
|
|
5
|
-
};
|
|
6
|
-
export type FilePlanItem = ProjectFile & {
|
|
7
|
-
readonly status: FilePlanItemStatus;
|
|
8
|
-
};
|
|
9
|
-
export type FilePlanOptions = {
|
|
10
|
-
readonly overwrite?: boolean;
|
|
11
|
-
readonly skipExisting?: boolean;
|
|
12
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
export const writeFilePlan = async (targetDirectory, plan) => {
|
|
4
|
-
for (const item of plan) {
|
|
5
|
-
if (item.status === 'skip' || item.status === 'conflict') {
|
|
6
|
-
continue;
|
|
7
|
-
}
|
|
8
|
-
const absolutePath = path.join(targetDirectory, item.path);
|
|
9
|
-
await fs.mkdir(path.dirname(absolutePath), { recursive: true });
|
|
10
|
-
await fs.writeFile(absolutePath, item.content, 'utf8');
|
|
11
|
-
}
|
|
12
|
-
};
|
package/index.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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 './commands/publish/index.js';
|
|
6
|
-
export * from './checks/yarn/index.js';
|
|
7
|
-
export * from './doctor/index.js';
|
|
8
|
-
export * from './file-plan/index.js';
|
|
9
|
-
export * from './presets/index.js';
|
|
10
|
-
export * from './project-plan/index.js';
|
|
11
|
-
export * from './prompts/project-plan/index.js';
|
|
12
|
-
export * from './shared/index.js';
|
package/index.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
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 './commands/publish/index.js';
|
|
6
|
-
export * from './checks/yarn/index.js';
|
|
7
|
-
export * from './doctor/index.js';
|
|
8
|
-
export * from './file-plan/index.js';
|
|
9
|
-
export * from './presets/index.js';
|
|
10
|
-
export * from './project-plan/index.js';
|
|
11
|
-
export * from './prompts/project-plan/index.js';
|
|
12
|
-
export * from './shared/index.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const agentsTemplate: string;
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
export const agentsTemplate = [
|
|
2
|
-
'# Project Agent Guide',
|
|
3
|
-
'',
|
|
4
|
-
'This repository follows a calm engineering style: changes should be explicit, reusable, typed, documented, tested, and easy to reason about.',
|
|
5
|
-
'',
|
|
6
|
-
'Use this guide as the default behavior for AI agents and contributors working in this repository. Prefer local package conventions when they are more specific than this document.',
|
|
7
|
-
'',
|
|
8
|
-
'## Core Principles',
|
|
9
|
-
'',
|
|
10
|
-
'- Prefer simple modules over clever frameworks or hidden conventions.',
|
|
11
|
-
'- Keep package and project boundaries explicit.',
|
|
12
|
-
'- Avoid project-specific coupling in reusable code.',
|
|
13
|
-
'- Extract only proven reusable behavior.',
|
|
14
|
-
'- Keep public APIs small, typed, documented, and stable.',
|
|
15
|
-
'- Prefer SSR-friendly and SSG-friendly code paths when working with frontend or shared code.',
|
|
16
|
-
'- Keep integrations replaceable and avoid hard coupling to a CMS, framework, vendor, or runtime host.',
|
|
17
|
-
'- Prefer infrastructure assumptions that are easy to deploy, observe, and replace.',
|
|
18
|
-
'- Prefer the option that is simpler to explain, easier to evolve, and calmer to maintain.',
|
|
19
|
-
'',
|
|
20
|
-
'## File Shape',
|
|
21
|
-
'',
|
|
22
|
-
'- Prefer one exported runtime method, component, helper, or class per production file when it stays readable.',
|
|
23
|
-
'- Prefer one matching test file per production file, for example `feature.ts` and `feature.test.ts`.',
|
|
24
|
-
'- Use focused folders when behavior naturally splits into several related files.',
|
|
25
|
-
'- Keep `index.ts` as a public re-export surface only. Do not place implementation logic in it.',
|
|
26
|
-
'- Use relative import and export specifiers that match the package module style.',
|
|
27
|
-
'- Use `.js` relative specifiers in TypeScript source for ESM/NodeNext packages.',
|
|
28
|
-
'- Add `types.ts` when public shared types are part of the package contract.',
|
|
29
|
-
'- Keep constants near the code that owns them unless they are shared or clarify repeated behavior.',
|
|
30
|
-
'',
|
|
31
|
-
'## Public Surface',
|
|
32
|
-
'',
|
|
33
|
-
'- Every new public export must be re-exported from the package or module public entry point.',
|
|
34
|
-
'- Add or update public-surface tests when exports change.',
|
|
35
|
-
'- Add JSDoc for public exports when behavior, parameters, return values, or usage expectations need explanation.',
|
|
36
|
-
'- Avoid exporting internal helpers only to make tests easier.',
|
|
37
|
-
'- Do not hand-maintain package `exports` maps unless the project has a real custom publishing need.',
|
|
38
|
-
'',
|
|
39
|
-
'## Tests',
|
|
40
|
-
'',
|
|
41
|
-
'- Cover public behavior and meaningful edge cases.',
|
|
42
|
-
'- Prefer behavior-focused tests over private implementation lock-in.',
|
|
43
|
-
'- Keep tests deterministic.',
|
|
44
|
-
'- Avoid real network, filesystem, timers, browser, or cloud dependencies unless the behavior specifically requires them.',
|
|
45
|
-
'- When mocking modules, install mocks before loading the module under test.',
|
|
46
|
-
'- Use focused validation when changing behavior.',
|
|
47
|
-
'',
|
|
48
|
-
'Example validation commands:',
|
|
49
|
-
'',
|
|
50
|
-
'```bash',
|
|
51
|
-
'yarn test',
|
|
52
|
-
'```',
|
|
53
|
-
'',
|
|
54
|
-
'For workspaces, prefer the project convention, for example:',
|
|
55
|
-
'',
|
|
56
|
-
'```bash',
|
|
57
|
-
'yarn workspace <package-name> test',
|
|
58
|
-
'```',
|
|
59
|
-
'',
|
|
60
|
-
'For Jest-based packages, focused validation may look like:',
|
|
61
|
-
'',
|
|
62
|
-
'```bash',
|
|
63
|
-
'yarn jest packages/<package> --runInBand --coverage=false',
|
|
64
|
-
'```',
|
|
65
|
-
'',
|
|
66
|
-
'## Documentation',
|
|
67
|
-
'',
|
|
68
|
-
'- Keep `README.md` concise and usage-oriented.',
|
|
69
|
-
'- Start package READMEs with `# <package>`.',
|
|
70
|
-
'- Document real public exports, supported options, and examples that actually work.',
|
|
71
|
-
'- Update docs when public behavior changes.',
|
|
72
|
-
'- Keep generated docs wrappers, such as `doc.mdx`, aligned with the README when the project uses them.',
|
|
73
|
-
'- For component packages, include visual documentation or stories for supported states and common usage.',
|
|
74
|
-
'',
|
|
75
|
-
'## Components',
|
|
76
|
-
'',
|
|
77
|
-
'- Prefer lightweight React components with TypeScript when working in React packages.',
|
|
78
|
-
'- Keep components SSR-friendly and avoid browser globals during render.',
|
|
79
|
-
'- Prefer composable props and predictable ergonomics.',
|
|
80
|
-
'- Put each public component in its own file with a matching test.',
|
|
81
|
-
'- Add stories or examples when a component has visual states, variants, or interaction states.',
|
|
82
|
-
'- Keep styling explicit and reusable. Avoid hidden theme assumptions unless they are part of the package contract.',
|
|
83
|
-
'',
|
|
84
|
-
'## Change Discipline',
|
|
85
|
-
'',
|
|
86
|
-
'- Keep changes scoped to the requested behavior.',
|
|
87
|
-
'- Avoid unrelated refactors and metadata churn.',
|
|
88
|
-
'- Sync implementation, tests, docs, examples, and public re-exports together.',
|
|
89
|
-
'- Do not introduce new dependencies unless they clearly reduce complexity or are already part of the project direction.',
|
|
90
|
-
'- Prefer small, reviewable changes over broad rewrites.',
|
|
91
|
-
'- Preserve existing conventions unless there is a clear reason to change them.',
|
|
92
|
-
'',
|
|
93
|
-
'## Before Finishing',
|
|
94
|
-
'',
|
|
95
|
-
'Check that the change is complete:',
|
|
96
|
-
'',
|
|
97
|
-
'- Public exports are updated.',
|
|
98
|
-
'- Public-surface tests are updated when exports change.',
|
|
99
|
-
'- Matching unit tests exist for new behavior.',
|
|
100
|
-
'- README examples still match the real API.',
|
|
101
|
-
'- Visual docs, stories, or examples are updated for visible component behavior.',
|
|
102
|
-
'- TypeScript imports follow the package module style.',
|
|
103
|
-
'- No unrelated files, formatting churn, or generated artifacts were changed.',
|
|
104
|
-
'',
|
|
105
|
-
].join('\n');
|
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
import { agentsTemplate } from '../agentsTemplate.js';
|
|
2
|
-
import { json, packageVersion, peerDependencies, publishedPackageJson } from '../config.js';
|
|
3
|
-
const baseRootDevDependencies = {
|
|
4
|
-
'@vyriy/typescript-config': packageVersion(publishedPackageJson.version),
|
|
5
|
-
typescript: peerDependencies.typescript,
|
|
6
|
-
'@vyriy/prettier-config': packageVersion(publishedPackageJson.version),
|
|
7
|
-
prettier: peerDependencies.prettier,
|
|
8
|
-
'@vyriy/eslint-config': packageVersion(publishedPackageJson.version),
|
|
9
|
-
eslint: peerDependencies.eslint,
|
|
10
|
-
'@vyriy/jest-config': packageVersion(publishedPackageJson.version),
|
|
11
|
-
jest: peerDependencies.jest,
|
|
12
|
-
'@vyriy/storybook-config': packageVersion(publishedPackageJson.version),
|
|
13
|
-
storybook: peerDependencies.storybook,
|
|
14
|
-
'@storybook/react-webpack5': peerDependencies['@storybook/react-webpack5'],
|
|
15
|
-
react: peerDependencies.react,
|
|
16
|
-
'react-dom': peerDependencies['react-dom'],
|
|
17
|
-
'@types/react': peerDependencies['@types/react'],
|
|
18
|
-
'@types/react-dom': peerDependencies['@types/react-dom'],
|
|
19
|
-
'@vyriy/path': packageVersion(publishedPackageJson.version),
|
|
20
|
-
husky: peerDependencies.husky,
|
|
21
|
-
'npm-run-all2': peerDependencies['npm-run-all2'],
|
|
22
|
-
'cross-env': peerDependencies['cross-env'],
|
|
23
|
-
};
|
|
24
|
-
const buildDistDevDependencies = {
|
|
25
|
-
vyriy: packageVersion(publishedPackageJson.version),
|
|
26
|
-
rimraf: peerDependencies.rimraf,
|
|
27
|
-
};
|
|
28
|
-
const stylelintDevDependencies = {
|
|
29
|
-
'@vyriy/stylelint-config': packageVersion(publishedPackageJson.version),
|
|
30
|
-
stylelint: peerDependencies.stylelint,
|
|
31
|
-
};
|
|
32
|
-
const shouldCreateStylelintConfig = (plan) => plan.features.some((feature) => [
|
|
33
|
-
'react',
|
|
34
|
-
'webpack',
|
|
35
|
-
].includes(feature));
|
|
36
|
-
const getStylePackageName = (plan) => plan.packages.find((packagePlan) => packagePlan.kind === 'ui')?.name ?? 'ui';
|
|
37
|
-
const shouldCreateResetStyles = (plan) => shouldCreateStylelintConfig(plan) && plan.preset !== 'library';
|
|
38
|
-
const hasPublishablePackages = (plan) => plan.packages.some((packagePlan) => packagePlan.publishable);
|
|
39
|
-
const createRootPackageJson = (plan) => {
|
|
40
|
-
const publishable = hasPublishablePackages(plan);
|
|
41
|
-
const stylelint = shouldCreateStylelintConfig(plan);
|
|
42
|
-
return {
|
|
43
|
-
path: 'package.json',
|
|
44
|
-
content: json({
|
|
45
|
-
name: `${plan.packageScope}/${plan.projectName}`,
|
|
46
|
-
version: '0.0.0',
|
|
47
|
-
description: plan.description,
|
|
48
|
-
private: true,
|
|
49
|
-
type: 'module',
|
|
50
|
-
packageManager: publishedPackageJson.packageManager,
|
|
51
|
-
engines: {
|
|
52
|
-
node: publishedPackageJson.engines.node,
|
|
53
|
-
},
|
|
54
|
-
workspaces: [
|
|
55
|
-
'packages/*',
|
|
56
|
-
'workspaces/*',
|
|
57
|
-
],
|
|
58
|
-
scripts: {
|
|
59
|
-
storybook: 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook dev -p 6006 --disable-telemetry',
|
|
60
|
-
check: 'run-s lint build test',
|
|
61
|
-
fix: "run-s 'fix:*'",
|
|
62
|
-
lint: "run-s 'lint:*'",
|
|
63
|
-
build: "run-s 'build:*'",
|
|
64
|
-
test: "run-s 'test:*'",
|
|
65
|
-
'fix:prettier': 'prettier . --write',
|
|
66
|
-
'fix:eslint': 'eslint . --fix',
|
|
67
|
-
'lint:ts': 'tsc --pretty false',
|
|
68
|
-
'lint:prettier': 'prettier . --check',
|
|
69
|
-
'lint:eslint': 'eslint .',
|
|
70
|
-
...(stylelint ? { 'lint:stylelint': 'stylelint "packages/**/*.{scss,css}"' } : {}),
|
|
71
|
-
'build:dist': publishable
|
|
72
|
-
? 'rimraf dist && tsc -p tsconfig.build.json && vyriy publish'
|
|
73
|
-
: 'echo "Build dist is not configured yet."',
|
|
74
|
-
'build:storybook': 'cross-env STORYBOOK_DISABLE_TELEMETRY=1 storybook build --quiet --disable-telemetry',
|
|
75
|
-
'test:jest': 'jest --passWithNoTests',
|
|
76
|
-
postinstall: 'husky',
|
|
77
|
-
},
|
|
78
|
-
devDependencies: {
|
|
79
|
-
...baseRootDevDependencies,
|
|
80
|
-
...(publishable ? buildDistDevDependencies : {}),
|
|
81
|
-
...(stylelint ? stylelintDevDependencies : {}),
|
|
82
|
-
},
|
|
83
|
-
}),
|
|
84
|
-
};
|
|
85
|
-
};
|
|
86
|
-
const createBuildTsConfig = () => ({
|
|
87
|
-
path: 'tsconfig.build.json',
|
|
88
|
-
content: json({
|
|
89
|
-
extends: './tsconfig.json',
|
|
90
|
-
include: [
|
|
91
|
-
'packages/**/*.ts',
|
|
92
|
-
'packages/**/*.tsx',
|
|
93
|
-
'packages/**/*.json',
|
|
94
|
-
],
|
|
95
|
-
exclude: [
|
|
96
|
-
'**/*.test.ts',
|
|
97
|
-
'**/*.test.tsx',
|
|
98
|
-
'**/*.stories.ts',
|
|
99
|
-
'**/*.stories.tsx',
|
|
100
|
-
],
|
|
101
|
-
compilerOptions: {
|
|
102
|
-
rootDir: './packages',
|
|
103
|
-
outDir: './dist',
|
|
104
|
-
noEmit: false,
|
|
105
|
-
declaration: true,
|
|
106
|
-
allowImportingTsExtensions: false,
|
|
107
|
-
},
|
|
108
|
-
}),
|
|
109
|
-
});
|
|
110
|
-
const createStyleFiles = (plan) => shouldCreateStylelintConfig(plan)
|
|
111
|
-
? [
|
|
112
|
-
{
|
|
113
|
-
path: 'stylelint.config.ts',
|
|
114
|
-
content: "export { default } from '@vyriy/stylelint-config';\n",
|
|
115
|
-
},
|
|
116
|
-
...(shouldCreateResetStyles(plan)
|
|
117
|
-
? [
|
|
118
|
-
{
|
|
119
|
-
path: `packages/${getStylePackageName(plan)}/reset.scss`,
|
|
120
|
-
content: `html {
|
|
121
|
-
box-sizing: border-box;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
*,
|
|
125
|
-
*::before,
|
|
126
|
-
*::after {
|
|
127
|
-
box-sizing: inherit;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
body {
|
|
131
|
-
margin: 0;
|
|
132
|
-
}
|
|
133
|
-
`,
|
|
134
|
-
},
|
|
135
|
-
]
|
|
136
|
-
: []),
|
|
137
|
-
]
|
|
138
|
-
: [];
|
|
139
|
-
export const createBaseFiles = (plan) => [
|
|
140
|
-
createRootPackageJson(plan),
|
|
141
|
-
{
|
|
142
|
-
path: 'README.md',
|
|
143
|
-
content: `# ${plan.projectName}\n\n${plan.description}\n`,
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
path: 'doc.mdx',
|
|
147
|
-
content: `import { Meta, Markdown } from '@storybook/addon-docs/blocks';
|
|
148
|
-
import ReadMe from './README.md?raw';
|
|
149
|
-
|
|
150
|
-
<Meta title="${plan.projectName}" />
|
|
151
|
-
|
|
152
|
-
<Markdown>{ReadMe}</Markdown>
|
|
153
|
-
`,
|
|
154
|
-
},
|
|
155
|
-
{
|
|
156
|
-
path: 'AGENTS.md',
|
|
157
|
-
content: agentsTemplate,
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
path: '.editorconfig',
|
|
161
|
-
content: `# https://editorconfig.org
|
|
162
|
-
root = true
|
|
163
|
-
|
|
164
|
-
[*]
|
|
165
|
-
charset = utf-8
|
|
166
|
-
end_of_line = lf
|
|
167
|
-
insert_final_newline = true
|
|
168
|
-
trim_trailing_whitespace = true
|
|
169
|
-
|
|
170
|
-
indent_style = space
|
|
171
|
-
indent_size = 2
|
|
172
|
-
|
|
173
|
-
max_line_length = 100
|
|
174
|
-
|
|
175
|
-
# Markdown
|
|
176
|
-
[*.md]
|
|
177
|
-
trim_trailing_whitespace = false
|
|
178
|
-
max_line_length = off
|
|
179
|
-
|
|
180
|
-
# YAML / YML
|
|
181
|
-
[*.{yml,yaml}]
|
|
182
|
-
indent_size = 2
|
|
183
|
-
|
|
184
|
-
# JSON
|
|
185
|
-
[*.json]
|
|
186
|
-
indent_size = 2
|
|
187
|
-
|
|
188
|
-
# TypeScript / JavaScript
|
|
189
|
-
[*.{ts,tsx,js,jsx}]
|
|
190
|
-
indent_size = 2
|
|
191
|
-
|
|
192
|
-
# Shell / Bash
|
|
193
|
-
[*.sh]
|
|
194
|
-
indent_size = 2`,
|
|
195
|
-
},
|
|
196
|
-
{
|
|
197
|
-
path: '.gitignore',
|
|
198
|
-
content: `.yarn/*
|
|
199
|
-
!.yarn/cache
|
|
200
|
-
!.yarn/patches
|
|
201
|
-
!.yarn/plugins
|
|
202
|
-
!.yarn/releases
|
|
203
|
-
!.yarn/sdks
|
|
204
|
-
!.yarn/versions
|
|
205
|
-
|
|
206
|
-
.DS_Store
|
|
207
|
-
.idea
|
|
208
|
-
node_modules
|
|
209
|
-
coverage
|
|
210
|
-
dist
|
|
211
|
-
storybook-static
|
|
212
|
-
*storybook.log
|
|
213
|
-
consumer
|
|
214
|
-
|
|
215
|
-
cdk.out
|
|
216
|
-
cdk.context.json
|
|
217
|
-
|
|
218
|
-
!/**/.gitkeep`,
|
|
219
|
-
},
|
|
220
|
-
{
|
|
221
|
-
path: '.npmrc',
|
|
222
|
-
content: 'engine-strict=true\n',
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
path: '.nvmrc',
|
|
226
|
-
content: 'lts/krypton',
|
|
227
|
-
},
|
|
228
|
-
{
|
|
229
|
-
path: '.yarnrc.yml',
|
|
230
|
-
content: 'nodeLinker: node-modules\nnpmMinimalAgeGate: 0\n',
|
|
231
|
-
},
|
|
232
|
-
{
|
|
233
|
-
path: '.husky/commit-msg',
|
|
234
|
-
content: '#!/bin/sh\n',
|
|
235
|
-
},
|
|
236
|
-
{
|
|
237
|
-
path: '.husky/post-checkout',
|
|
238
|
-
content: '#!/bin/sh\n\nyarn\n',
|
|
239
|
-
},
|
|
240
|
-
{
|
|
241
|
-
path: '.husky/post-merge',
|
|
242
|
-
content: '#!/bin/sh\n\nyarn\n',
|
|
243
|
-
},
|
|
244
|
-
{
|
|
245
|
-
path: '.husky/pre-commit',
|
|
246
|
-
content: '#!/bin/sh\n\nyarn check\n',
|
|
247
|
-
},
|
|
248
|
-
{
|
|
249
|
-
path: '.husky/pre-push',
|
|
250
|
-
content: '#!/bin/sh\n\nyarn check\n',
|
|
251
|
-
},
|
|
252
|
-
{
|
|
253
|
-
path: '.storybook/main.ts',
|
|
254
|
-
content: `import config from '@vyriy/storybook-config';
|
|
255
|
-
import { path } from '@vyriy/path';
|
|
256
|
-
|
|
257
|
-
export default {
|
|
258
|
-
...config,
|
|
259
|
-
stories: [
|
|
260
|
-
path('**/*.mdx'),
|
|
261
|
-
path('**/*.stories.@(js|jsx|mjs|ts|tsx)'),
|
|
262
|
-
],
|
|
263
|
-
};
|
|
264
|
-
`,
|
|
265
|
-
},
|
|
266
|
-
{
|
|
267
|
-
path: '.storybook/preview.tsx',
|
|
268
|
-
content: "export { default } from '@vyriy/storybook-config/preview';\n",
|
|
269
|
-
},
|
|
270
|
-
{
|
|
271
|
-
path: 'yarn.lock',
|
|
272
|
-
content: '',
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
path: 'tsconfig.json',
|
|
276
|
-
content: json({
|
|
277
|
-
extends: '@vyriy/typescript-config/index.json',
|
|
278
|
-
include: [
|
|
279
|
-
'.storybook/**/*.ts',
|
|
280
|
-
'.storybook/**/*.tsx',
|
|
281
|
-
'packages/**/*.ts',
|
|
282
|
-
'packages/**/*.tsx',
|
|
283
|
-
'workspaces/**/*.ts',
|
|
284
|
-
'workspaces/**/*.tsx',
|
|
285
|
-
'*.ts',
|
|
286
|
-
],
|
|
287
|
-
}),
|
|
288
|
-
},
|
|
289
|
-
...(hasPublishablePackages(plan) ? [createBuildTsConfig()] : []),
|
|
290
|
-
{
|
|
291
|
-
path: 'prettier.config.ts',
|
|
292
|
-
content: "export { default } from '@vyriy/prettier-config';\n",
|
|
293
|
-
},
|
|
294
|
-
{
|
|
295
|
-
path: '.prettierignore',
|
|
296
|
-
content: 'node_modules\ndist\ncoverage\nstorybook-static\n',
|
|
297
|
-
},
|
|
298
|
-
{
|
|
299
|
-
path: 'eslint.config.ts',
|
|
300
|
-
content: "export { default } from '@vyriy/eslint-config';\n",
|
|
301
|
-
},
|
|
302
|
-
{
|
|
303
|
-
path: 'jest.config.ts',
|
|
304
|
-
content: "export { default } from '@vyriy/jest-config';\n",
|
|
305
|
-
},
|
|
306
|
-
...createStyleFiles(plan),
|
|
307
|
-
];
|
package/presets/config.d.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import packageJson from '../package.json';
|
|
2
|
-
type PublishedPackageJson = typeof packageJson & {
|
|
3
|
-
readonly engines: {
|
|
4
|
-
readonly node: string;
|
|
5
|
-
};
|
|
6
|
-
readonly packageManager: string;
|
|
7
|
-
};
|
|
8
|
-
export declare const json: (value: unknown) => string;
|
|
9
|
-
export declare const packageVersion: (version: string) => string;
|
|
10
|
-
export declare const publishedPackageJson: PublishedPackageJson;
|
|
11
|
-
export declare const peerDependencies: {
|
|
12
|
-
"@storybook/react-webpack5": string;
|
|
13
|
-
"@types/react": string;
|
|
14
|
-
"@types/react-dom": string;
|
|
15
|
-
"cross-env": string;
|
|
16
|
-
eslint: string;
|
|
17
|
-
husky: string;
|
|
18
|
-
jest: string;
|
|
19
|
-
"npm-run-all2": string;
|
|
20
|
-
prettier: string;
|
|
21
|
-
react: string;
|
|
22
|
-
"react-dom": string;
|
|
23
|
-
rimraf: string;
|
|
24
|
-
storybook: string;
|
|
25
|
-
stylelint: string;
|
|
26
|
-
typescript: string;
|
|
27
|
-
};
|
|
28
|
-
export {};
|