vyriy 0.3.9 → 0.4.0
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 +74 -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 +16 -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 +12 -0
- package/commands/create/preset/index.js +14 -0
- package/commands/create/preset/library.d.ts +2 -0
- package/commands/create/preset/library.js +227 -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} +8 -8
- 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 +280 -551
- 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
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PlanResult } from '../plan/types.js';
|
|
2
|
+
export type FileMap = Record<string, string>;
|
|
3
|
+
export type CiProvider = 'gitlab' | 'github';
|
|
4
|
+
export type DeployProvider = 'aws' | 'docker';
|
|
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';
|
|
11
|
+
export type Presets = Partial<Record<PresetKey, {
|
|
12
|
+
name: string;
|
|
13
|
+
description: string;
|
|
14
|
+
preset: Preset;
|
|
15
|
+
}>>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { stdin, stdout } from 'node:process';
|
|
2
|
+
import { createInterface } from 'node:readline/promises';
|
|
3
|
+
export const conflictStrategy = async () => {
|
|
4
|
+
console.log('\nWhat should Vyriy do?\n');
|
|
5
|
+
console.log(' 1. overwrite existing files');
|
|
6
|
+
console.log(' 2. skip existing files');
|
|
7
|
+
console.log(' 3. abort');
|
|
8
|
+
const readline = createInterface({ input: stdin, output: stdout });
|
|
9
|
+
try {
|
|
10
|
+
const answer = (await readline.question('\nWhat should Vyriy do? (abort): ')).trim().toLowerCase();
|
|
11
|
+
if (answer === '1' || answer === 'overwrite') {
|
|
12
|
+
return { overwrite: true, skipExisting: false };
|
|
13
|
+
}
|
|
14
|
+
if (answer === '2' || answer === 'skip') {
|
|
15
|
+
return { overwrite: false, skipExisting: true };
|
|
16
|
+
}
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
finally {
|
|
20
|
+
readline.close();
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { presets as appPreset } from '../preset/index.js';
|
|
2
|
+
import type { PromptOutput, PromptQuestion } from './types.js';
|
|
3
|
+
export type PresetName = keyof typeof appPreset;
|
|
4
|
+
export declare const preset: (question: PromptQuestion, output: PromptOutput) => Promise<PresetName>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { presets as appPreset } from '../preset/index.js';
|
|
2
|
+
import { prompt } from './prompt.js';
|
|
3
|
+
import { resolveOption } from './resolve-option.js';
|
|
4
|
+
export const preset = async (question, output) => {
|
|
5
|
+
const defaultPreset = 'base';
|
|
6
|
+
const presetNames = Object.keys(appPreset);
|
|
7
|
+
output.write('\nProject preset:\n\n');
|
|
8
|
+
presetNames.forEach((presetName, index) => output.write(` ${index + 1}. ${appPreset[presetName].name} - ${appPreset[presetName].description}\n`));
|
|
9
|
+
const presetValue = await prompt(question, '\nPreset number or name', defaultPreset);
|
|
10
|
+
return resolveOption(presetValue, presetNames, defaultPreset);
|
|
11
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
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
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
type ResolveOption = {
|
|
2
|
+
<OptionName extends string>(value: string, optionNames: readonly OptionName[], fallback: OptionName): OptionName;
|
|
3
|
+
<OptionName extends string>(value: string, optionNames: readonly OptionName[]): OptionName | undefined;
|
|
4
|
+
};
|
|
5
|
+
export declare const resolveOption: ResolveOption;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export const resolveOption = (value, optionNames, fallback) => {
|
|
2
|
+
const normalizedValue = value.trim();
|
|
3
|
+
const numericValue = Number.parseInt(normalizedValue, 10);
|
|
4
|
+
if (Number.isInteger(numericValue)) {
|
|
5
|
+
return optionNames[numericValue - 1] ?? fallback;
|
|
6
|
+
}
|
|
7
|
+
return optionNames.find((optionName) => optionName === normalizedValue) ?? fallback;
|
|
8
|
+
};
|
|
@@ -187,7 +187,7 @@ const copyRootFile = async (fileName) => {
|
|
|
187
187
|
await copyFile(fileName, path.join(DIST_DIR, fileName));
|
|
188
188
|
}
|
|
189
189
|
};
|
|
190
|
-
const
|
|
190
|
+
const distRootPackageJson = async () => {
|
|
191
191
|
const packageJson = await readJson(PACKAGE_JSON_FILE);
|
|
192
192
|
delete packageJson.agents;
|
|
193
193
|
delete packageJson.dependencies;
|
|
@@ -196,10 +196,10 @@ const publishRootPackageJson = async () => {
|
|
|
196
196
|
delete packageJson.devDependencies;
|
|
197
197
|
await writeJson(path.join(DIST_DIR, PACKAGE_JSON_FILE), packageJson);
|
|
198
198
|
};
|
|
199
|
-
const
|
|
199
|
+
const distRoot = async () => {
|
|
200
200
|
await copyRootFile(README_FILE);
|
|
201
201
|
await copyRootFile(LICENSE_FILE);
|
|
202
|
-
await
|
|
202
|
+
await distRootPackageJson();
|
|
203
203
|
};
|
|
204
204
|
const syncPackageRuntimeMetadata = (packageJson, rootPackageJson) => {
|
|
205
205
|
if (packageJson.name !== 'vyriy') {
|
|
@@ -208,7 +208,7 @@ const syncPackageRuntimeMetadata = (packageJson, rootPackageJson) => {
|
|
|
208
208
|
packageJson.packageManager = rootPackageJson.packageManager;
|
|
209
209
|
packageJson.engines = rootPackageJson.engines;
|
|
210
210
|
};
|
|
211
|
-
const
|
|
211
|
+
const distPackage = async (packageJsonPath, rootPackageJson) => {
|
|
212
212
|
const packageDirectory = path.dirname(packageJsonPath);
|
|
213
213
|
const packageJson = await readJson(packageJsonPath);
|
|
214
214
|
await removeEmptyJavaScriptFiles(packageDirectory);
|
|
@@ -250,12 +250,12 @@ const publishPackage = async (packageJsonPath, rootPackageJson) => {
|
|
|
250
250
|
await makePackageBinsExecutable(packageDirectory, packageJson);
|
|
251
251
|
await writeJson(packageJsonPath, packageJson);
|
|
252
252
|
};
|
|
253
|
-
export const
|
|
253
|
+
export const dist = async () => {
|
|
254
254
|
const previousCwd = process.cwd();
|
|
255
255
|
try {
|
|
256
|
-
process.chdir(cwd);
|
|
256
|
+
process.chdir(process.cwd());
|
|
257
257
|
const rootPackageJson = await readJson(PACKAGE_JSON_FILE);
|
|
258
|
-
await
|
|
258
|
+
await distRoot();
|
|
259
259
|
const entries = await readdir(DIST_DIR, { withFileTypes: true });
|
|
260
260
|
const packageJsonPaths = entries
|
|
261
261
|
.filter((entry) => entry.isDirectory())
|
|
@@ -263,7 +263,7 @@ export const runPublishCommand = async ({ cwd = process.cwd() } = {}) => {
|
|
|
263
263
|
.sort((left, right) => left.localeCompare(right));
|
|
264
264
|
for (const packageJsonPath of packageJsonPaths) {
|
|
265
265
|
if (await hasFile(packageJsonPath)) {
|
|
266
|
-
await
|
|
266
|
+
await distPackage(packageJsonPath, rootPackageJson);
|
|
267
267
|
}
|
|
268
268
|
}
|
|
269
269
|
return 0;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { Command } from './types.js';
|
|
2
|
+
export declare const text = "Vyriy Project Master\n\nUsage:\n vyriy [name] Create a new Vyriy project\n vyriy . Initialize a new Vyriy project in the current directory\n vyriy --help, -h Show help\n vyriy --version, -v Show version\n vyriy --check-env, -c Check local environment\n vyriy --dist, -d Prepare dist package metadata without publishing to npm\n vyriy --dry-run Print checks and file plan without writing\n vyriy --overwrite Overwrite existing generated paths\n vyriy --skip-existing Leave existing generated paths untouched\n vyriy --no-install Create files without installing dependencies\n vyriy --no-verify Install dependencies without running checks\n\nExamples:\n vyriy app\n vyriy .\n vyriy -d";
|
|
3
|
+
export declare const help: Command;
|
package/commands/help.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const text = `Vyriy Project Master
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
vyriy [name] Create a new Vyriy project
|
|
5
|
+
vyriy . Initialize a new Vyriy project in the current directory
|
|
6
|
+
vyriy --help, -h Show help
|
|
7
|
+
vyriy --version, -v Show version
|
|
8
|
+
vyriy --check-env, -c Check local environment
|
|
9
|
+
vyriy --dist, -d Prepare dist package metadata without publishing to npm
|
|
10
|
+
vyriy --dry-run Print checks and file plan without writing
|
|
11
|
+
vyriy --overwrite Overwrite existing generated paths
|
|
12
|
+
vyriy --skip-existing Leave existing generated paths untouched
|
|
13
|
+
vyriy --no-install Create files without installing dependencies
|
|
14
|
+
vyriy --no-verify Install dependencies without running checks
|
|
15
|
+
|
|
16
|
+
Examples:
|
|
17
|
+
vyriy app
|
|
18
|
+
vyriy .
|
|
19
|
+
vyriy -d`;
|
|
20
|
+
export const help = async () => {
|
|
21
|
+
console.log(text);
|
|
22
|
+
await Promise.resolve();
|
|
23
|
+
return 0;
|
|
24
|
+
};
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
export type Command = () => Promise<number>;
|
|
2
|
+
export type Node = () => {
|
|
3
|
+
ok: boolean;
|
|
4
|
+
message: string;
|
|
5
|
+
};
|
|
6
|
+
export type Yarn = () => Promise<{
|
|
7
|
+
ok: boolean;
|
|
8
|
+
message: string;
|
|
9
|
+
}>;
|
|
10
|
+
export type CreateOptions = {
|
|
11
|
+
readonly directory: string;
|
|
12
|
+
readonly dryRun: boolean;
|
|
13
|
+
readonly overwrite: boolean;
|
|
14
|
+
readonly skipExisting: boolean;
|
|
15
|
+
readonly install: boolean;
|
|
16
|
+
readonly verify: boolean;
|
|
17
|
+
};
|
|
18
|
+
export type Create = (options: CreateOptions) => Promise<number>;
|
|
1
19
|
export type ExportTarget = {
|
|
2
20
|
readonly default: string;
|
|
3
21
|
readonly import: string;
|
|
@@ -25,7 +43,3 @@ export type PackageJson = {
|
|
|
25
43
|
workspaces?: unknown;
|
|
26
44
|
[key: string]: unknown;
|
|
27
45
|
};
|
|
28
|
-
export type RunPublishCommandOptions = {
|
|
29
|
-
readonly cwd?: string;
|
|
30
|
-
};
|
|
31
|
-
export type RunPublishCommand = (options?: RunPublishCommandOptions) => Promise<number>;
|