@reliverse/config 1.5.0 → 1.5.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/bin/main.d.ts +102 -0
- package/bin/main.js +313 -0
- package/package.json +9 -6
package/bin/main.d.ts
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { type Static } from "@sinclair/typebox";
|
|
2
|
+
export declare const reliverseConfigSchema: import("@sinclair/typebox").TObject<{
|
|
3
|
+
$schema: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"https://reliverse.org/schema.json">, import("@sinclair/typebox").TLiteral<"./schema.json">]>;
|
|
4
|
+
projectName: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"unknown">, import("@sinclair/typebox").TString]>;
|
|
5
|
+
projectAuthor: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"unknown">, import("@sinclair/typebox").TString]>;
|
|
6
|
+
projectDescription: import("@sinclair/typebox").TString;
|
|
7
|
+
version: import("@sinclair/typebox").TString;
|
|
8
|
+
projectLicense: import("@sinclair/typebox").TString;
|
|
9
|
+
projectRepository: import("@sinclair/typebox").TString;
|
|
10
|
+
projectDomain: import("@sinclair/typebox").TString;
|
|
11
|
+
projectGitService: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"github">, import("@sinclair/typebox").TLiteral<"gitlab">, import("@sinclair/typebox").TLiteral<"bitbucket">, import("@sinclair/typebox").TLiteral<"none">]>;
|
|
12
|
+
projectDeployService: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"vercel">, import("@sinclair/typebox").TLiteral<"netlify">, import("@sinclair/typebox").TLiteral<"railway">, import("@sinclair/typebox").TLiteral<"deno">, import("@sinclair/typebox").TLiteral<"none">]>;
|
|
13
|
+
projectPackageManager: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"npm">, import("@sinclair/typebox").TLiteral<"pnpm">, import("@sinclair/typebox").TLiteral<"yarn">, import("@sinclair/typebox").TLiteral<"bun">]>;
|
|
14
|
+
projectState: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"creating">, import("@sinclair/typebox").TLiteral<"created">]>;
|
|
15
|
+
projectCategory: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"unknown">, import("@sinclair/typebox").TLiteral<"website">, import("@sinclair/typebox").TLiteral<"vscode">, import("@sinclair/typebox").TLiteral<"browser">, import("@sinclair/typebox").TLiteral<"cli">, import("@sinclair/typebox").TLiteral<"library">]>;
|
|
16
|
+
projectSubcategory: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"unknown">, import("@sinclair/typebox").TLiteral<"e-commerce">, import("@sinclair/typebox").TLiteral<"tool">]>;
|
|
17
|
+
projectFramework: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"unknown">, import("@sinclair/typebox").TLiteral<"nextjs">, import("@sinclair/typebox").TLiteral<"vite">, import("@sinclair/typebox").TLiteral<"svelte">, import("@sinclair/typebox").TLiteral<"vue">, import("@sinclair/typebox").TLiteral<"astro">, import("@sinclair/typebox").TLiteral<"npm-jsr">, import("@sinclair/typebox").TLiteral<"wxt">, import("@sinclair/typebox").TLiteral<"vscode">]>;
|
|
18
|
+
projectTemplate: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"unknown">, import("@sinclair/typebox").TLiteral<"blefnk/relivator">, import("@sinclair/typebox").TLiteral<"blefnk/relivator-docker-template">, import("@sinclair/typebox").TLiteral<"blefnk/next-react-ts-src-minimal">, import("@sinclair/typebox").TLiteral<"blefnk/all-in-one-nextjs-template">, import("@sinclair/typebox").TLiteral<"blefnk/create-t3-app">, import("@sinclair/typebox").TLiteral<"blefnk/create-next-app">, import("@sinclair/typebox").TLiteral<"blefnk/astro-starlight-template">, import("@sinclair/typebox").TLiteral<"blefnk/versator">, import("@sinclair/typebox").TLiteral<"reliverse/template-browser-extension">, import("@sinclair/typebox").TLiteral<"microsoft/vscode-extension-samples">, import("@sinclair/typebox").TLiteral<"microsoft/vscode-extension-template">, import("@sinclair/typebox").TLiteral<"reliverse/cli-starter-template">, import("@sinclair/typebox").TLiteral<"blefnk/deno-cli-tutorial">]>;
|
|
19
|
+
features: import("@sinclair/typebox").TObject<{
|
|
20
|
+
i18n: import("@sinclair/typebox").TBoolean;
|
|
21
|
+
analytics: import("@sinclair/typebox").TBoolean;
|
|
22
|
+
themeMode: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"light">, import("@sinclair/typebox").TLiteral<"dark">, import("@sinclair/typebox").TLiteral<"dark-light">]>;
|
|
23
|
+
authentication: import("@sinclair/typebox").TBoolean;
|
|
24
|
+
api: import("@sinclair/typebox").TBoolean;
|
|
25
|
+
database: import("@sinclair/typebox").TBoolean;
|
|
26
|
+
testing: import("@sinclair/typebox").TBoolean;
|
|
27
|
+
docker: import("@sinclair/typebox").TBoolean;
|
|
28
|
+
ci: import("@sinclair/typebox").TBoolean;
|
|
29
|
+
commands: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
30
|
+
webview: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
31
|
+
language: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
32
|
+
themes: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
33
|
+
}>;
|
|
34
|
+
preferredLibraries: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TString>;
|
|
35
|
+
codeStyle: import("@sinclair/typebox").TObject<{
|
|
36
|
+
lineWidth: import("@sinclair/typebox").TNumber;
|
|
37
|
+
indentSize: import("@sinclair/typebox").TNumber;
|
|
38
|
+
indentStyle: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"space">, import("@sinclair/typebox").TLiteral<"tab">]>;
|
|
39
|
+
quoteMark: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"single">, import("@sinclair/typebox").TLiteral<"double">]>;
|
|
40
|
+
semicolons: import("@sinclair/typebox").TBoolean;
|
|
41
|
+
trailingComma: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"none">, import("@sinclair/typebox").TLiteral<"es5">, import("@sinclair/typebox").TLiteral<"all">]>;
|
|
42
|
+
bracketSpacing: import("@sinclair/typebox").TBoolean;
|
|
43
|
+
arrowParens: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"always">, import("@sinclair/typebox").TLiteral<"avoid">]>;
|
|
44
|
+
tabWidth: import("@sinclair/typebox").TNumber;
|
|
45
|
+
jsToTs: import("@sinclair/typebox").TBoolean;
|
|
46
|
+
dontRemoveComments: import("@sinclair/typebox").TBoolean;
|
|
47
|
+
shouldAddComments: import("@sinclair/typebox").TBoolean;
|
|
48
|
+
typeOrInterface: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"type">, import("@sinclair/typebox").TLiteral<"interface">, import("@sinclair/typebox").TLiteral<"mixed">]>;
|
|
49
|
+
importOrRequire: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"import">, import("@sinclair/typebox").TLiteral<"require">, import("@sinclair/typebox").TLiteral<"mixed">]>;
|
|
50
|
+
cjsToEsm: import("@sinclair/typebox").TBoolean;
|
|
51
|
+
modernize: import("@sinclair/typebox").TObject<{
|
|
52
|
+
replaceFs: import("@sinclair/typebox").TBoolean;
|
|
53
|
+
replacePath: import("@sinclair/typebox").TBoolean;
|
|
54
|
+
replaceHttp: import("@sinclair/typebox").TBoolean;
|
|
55
|
+
replaceProcess: import("@sinclair/typebox").TBoolean;
|
|
56
|
+
replaceConsole: import("@sinclair/typebox").TBoolean;
|
|
57
|
+
replaceEvents: import("@sinclair/typebox").TBoolean;
|
|
58
|
+
}>;
|
|
59
|
+
importSymbol: import("@sinclair/typebox").TString;
|
|
60
|
+
}>;
|
|
61
|
+
monorepo: import("@sinclair/typebox").TObject<{
|
|
62
|
+
type: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"none">, import("@sinclair/typebox").TLiteral<"turborepo">, import("@sinclair/typebox").TLiteral<"nx">, import("@sinclair/typebox").TLiteral<"pnpm">, import("@sinclair/typebox").TLiteral<"bun">]>;
|
|
63
|
+
packages: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
64
|
+
sharedPackages: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
65
|
+
}>;
|
|
66
|
+
ignoreDependencies: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>;
|
|
67
|
+
customRules: import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnknown>;
|
|
68
|
+
multipleRepoCloneMode: import("@sinclair/typebox").TBoolean;
|
|
69
|
+
customUserFocusedRepos: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
70
|
+
customDevsFocusedRepos: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
71
|
+
hideRepoSuggestions: import("@sinclair/typebox").TBoolean;
|
|
72
|
+
customReposOnNewProject: import("@sinclair/typebox").TBoolean;
|
|
73
|
+
envComposerOpenBrowser: import("@sinclair/typebox").TBoolean;
|
|
74
|
+
repoBranch: import("@sinclair/typebox").TString;
|
|
75
|
+
repoPrivacy: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"unknown">, import("@sinclair/typebox").TLiteral<"public">, import("@sinclair/typebox").TLiteral<"private">]>;
|
|
76
|
+
projectArchitecture: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"unknown">, import("@sinclair/typebox").TLiteral<"fullstack">, import("@sinclair/typebox").TLiteral<"separated">]>;
|
|
77
|
+
projectRuntime: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"bun">, import("@sinclair/typebox").TLiteral<"deno">, import("@sinclair/typebox").TLiteral<"edge-light">, import("@sinclair/typebox").TLiteral<"fastly">, import("@sinclair/typebox").TLiteral<"netlify">, import("@sinclair/typebox").TLiteral<"node">, import("@sinclair/typebox").TLiteral<"workerd">]>;
|
|
78
|
+
skipPromptsUseAutoBehavior: import("@sinclair/typebox").TBoolean;
|
|
79
|
+
deployBehavior: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"prompt">, import("@sinclair/typebox").TLiteral<"autoYes">, import("@sinclair/typebox").TLiteral<"autoNo">]>;
|
|
80
|
+
depsBehavior: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"prompt">, import("@sinclair/typebox").TLiteral<"autoYes">, import("@sinclair/typebox").TLiteral<"autoNo">]>;
|
|
81
|
+
gitBehavior: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"prompt">, import("@sinclair/typebox").TLiteral<"autoYes">, import("@sinclair/typebox").TLiteral<"autoNo">]>;
|
|
82
|
+
i18nBehavior: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"prompt">, import("@sinclair/typebox").TLiteral<"autoYes">, import("@sinclair/typebox").TLiteral<"autoNo">]>;
|
|
83
|
+
scriptsBehavior: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"prompt">, import("@sinclair/typebox").TLiteral<"autoYes">, import("@sinclair/typebox").TLiteral<"autoNo">]>;
|
|
84
|
+
existingRepoBehavior: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<"prompt">, import("@sinclair/typebox").TLiteral<"autoYes">, import("@sinclair/typebox").TLiteral<"autoYesSkipCommit">, import("@sinclair/typebox").TLiteral<"autoNo">]>;
|
|
85
|
+
}>;
|
|
86
|
+
export type ReliverseConfig = Static<typeof reliverseConfigSchema>;
|
|
87
|
+
export type ProjectCategory = Exclude<ReliverseConfig["projectCategory"], undefined>;
|
|
88
|
+
export type ProjectSubcategory = Exclude<ReliverseConfig["projectSubcategory"], undefined>;
|
|
89
|
+
export type ProjectFramework = Exclude<ReliverseConfig["projectFramework"], undefined>;
|
|
90
|
+
export type ProjectArchitecture = Exclude<ReliverseConfig["projectArchitecture"], undefined>;
|
|
91
|
+
/**
|
|
92
|
+
* A helper to define a Reliverse configuration in the reliverse.ts file
|
|
93
|
+
*/
|
|
94
|
+
export declare function defineConfig<T extends ReliverseConfig>(config: T): T;
|
|
95
|
+
/**
|
|
96
|
+
* Generates a JSON schema file from the TypeBox schema
|
|
97
|
+
*/
|
|
98
|
+
export declare function generateJsonSchema(outputPath: string): Promise<void>;
|
|
99
|
+
/**
|
|
100
|
+
* Generates the schema.json in the project root
|
|
101
|
+
*/
|
|
102
|
+
export declare function generateSchemaFile(): Promise<void>;
|
package/bin/main.js
ADDED
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
import { Type } from "@sinclair/typebox";
|
|
2
|
+
import fs from "fs-extra";
|
|
3
|
+
import path from "pathe";
|
|
4
|
+
const UNKNOWN_VALUE = "unknown";
|
|
5
|
+
const reliverseOrgBase = "reliverse.org";
|
|
6
|
+
const reliverseOrgRoot = `https://${reliverseOrgBase}`;
|
|
7
|
+
const cliDomainRoot = `https://docs.${reliverseOrgBase}`;
|
|
8
|
+
const cliDomainDocs = `${cliDomainRoot}/cli`;
|
|
9
|
+
const RELIVERSE_SCHEMA_DEV = "./schema.json";
|
|
10
|
+
const RELIVERSE_SCHEMA_URL = `${reliverseOrgRoot}/schema.json`;
|
|
11
|
+
const featuresSchema = Type.Object({
|
|
12
|
+
i18n: Type.Boolean(),
|
|
13
|
+
analytics: Type.Boolean(),
|
|
14
|
+
themeMode: Type.Union([
|
|
15
|
+
Type.Literal("light"),
|
|
16
|
+
Type.Literal("dark"),
|
|
17
|
+
Type.Literal("dark-light")
|
|
18
|
+
]),
|
|
19
|
+
authentication: Type.Boolean(),
|
|
20
|
+
api: Type.Boolean(),
|
|
21
|
+
database: Type.Boolean(),
|
|
22
|
+
testing: Type.Boolean(),
|
|
23
|
+
docker: Type.Boolean(),
|
|
24
|
+
ci: Type.Boolean(),
|
|
25
|
+
commands: Type.Array(Type.String()),
|
|
26
|
+
webview: Type.Array(Type.String()),
|
|
27
|
+
language: Type.Array(Type.String()),
|
|
28
|
+
themes: Type.Array(Type.String())
|
|
29
|
+
});
|
|
30
|
+
const codeStyleSchema = Type.Object({
|
|
31
|
+
lineWidth: Type.Number(),
|
|
32
|
+
indentSize: Type.Number(),
|
|
33
|
+
indentStyle: Type.Union([Type.Literal("space"), Type.Literal("tab")]),
|
|
34
|
+
quoteMark: Type.Union([Type.Literal("single"), Type.Literal("double")]),
|
|
35
|
+
semicolons: Type.Boolean(),
|
|
36
|
+
trailingComma: Type.Union([
|
|
37
|
+
Type.Literal("none"),
|
|
38
|
+
Type.Literal("es5"),
|
|
39
|
+
Type.Literal("all")
|
|
40
|
+
]),
|
|
41
|
+
bracketSpacing: Type.Boolean(),
|
|
42
|
+
arrowParens: Type.Union([Type.Literal("always"), Type.Literal("avoid")]),
|
|
43
|
+
tabWidth: Type.Number(),
|
|
44
|
+
jsToTs: Type.Boolean(),
|
|
45
|
+
dontRemoveComments: Type.Boolean(),
|
|
46
|
+
shouldAddComments: Type.Boolean(),
|
|
47
|
+
typeOrInterface: Type.Union([
|
|
48
|
+
Type.Literal("type"),
|
|
49
|
+
Type.Literal("interface"),
|
|
50
|
+
Type.Literal("mixed")
|
|
51
|
+
]),
|
|
52
|
+
importOrRequire: Type.Union([
|
|
53
|
+
Type.Literal("import"),
|
|
54
|
+
Type.Literal("require"),
|
|
55
|
+
Type.Literal("mixed")
|
|
56
|
+
]),
|
|
57
|
+
cjsToEsm: Type.Boolean(),
|
|
58
|
+
modernize: Type.Object({
|
|
59
|
+
replaceFs: Type.Boolean(),
|
|
60
|
+
replacePath: Type.Boolean(),
|
|
61
|
+
replaceHttp: Type.Boolean(),
|
|
62
|
+
replaceProcess: Type.Boolean(),
|
|
63
|
+
replaceConsole: Type.Boolean(),
|
|
64
|
+
replaceEvents: Type.Boolean()
|
|
65
|
+
}),
|
|
66
|
+
importSymbol: Type.String()
|
|
67
|
+
});
|
|
68
|
+
const monorepoSchema = Type.Object({
|
|
69
|
+
type: Type.Union([
|
|
70
|
+
Type.Literal("none"),
|
|
71
|
+
Type.Literal("turborepo"),
|
|
72
|
+
Type.Literal("nx"),
|
|
73
|
+
Type.Literal("pnpm"),
|
|
74
|
+
Type.Literal("bun")
|
|
75
|
+
]),
|
|
76
|
+
packages: Type.Array(Type.String()),
|
|
77
|
+
sharedPackages: Type.Array(Type.String())
|
|
78
|
+
});
|
|
79
|
+
export const reliverseConfigSchema = Type.Object({
|
|
80
|
+
// Reliverse config schema
|
|
81
|
+
$schema: Type.Union([
|
|
82
|
+
Type.Literal(RELIVERSE_SCHEMA_URL),
|
|
83
|
+
Type.Literal(RELIVERSE_SCHEMA_DEV)
|
|
84
|
+
]),
|
|
85
|
+
// General project information
|
|
86
|
+
projectName: Type.Union([
|
|
87
|
+
Type.Literal(UNKNOWN_VALUE),
|
|
88
|
+
Type.String({ minLength: 1 })
|
|
89
|
+
]),
|
|
90
|
+
projectAuthor: Type.Union([
|
|
91
|
+
Type.Literal(UNKNOWN_VALUE),
|
|
92
|
+
Type.String({ minLength: 1 })
|
|
93
|
+
]),
|
|
94
|
+
projectDescription: Type.String(),
|
|
95
|
+
version: Type.String(),
|
|
96
|
+
projectLicense: Type.String(),
|
|
97
|
+
projectRepository: Type.String(),
|
|
98
|
+
projectDomain: Type.String(),
|
|
99
|
+
projectGitService: Type.Union([
|
|
100
|
+
Type.Literal("github"),
|
|
101
|
+
Type.Literal("gitlab"),
|
|
102
|
+
Type.Literal("bitbucket"),
|
|
103
|
+
Type.Literal("none")
|
|
104
|
+
]),
|
|
105
|
+
projectDeployService: Type.Union([
|
|
106
|
+
Type.Literal("vercel"),
|
|
107
|
+
Type.Literal("netlify"),
|
|
108
|
+
Type.Literal("railway"),
|
|
109
|
+
Type.Literal("deno"),
|
|
110
|
+
Type.Literal("none")
|
|
111
|
+
]),
|
|
112
|
+
projectPackageManager: Type.Union([
|
|
113
|
+
Type.Literal("npm"),
|
|
114
|
+
Type.Literal("pnpm"),
|
|
115
|
+
Type.Literal("yarn"),
|
|
116
|
+
Type.Literal("bun")
|
|
117
|
+
]),
|
|
118
|
+
projectState: Type.Union([Type.Literal("creating"), Type.Literal("created")]),
|
|
119
|
+
projectCategory: Type.Union([
|
|
120
|
+
Type.Literal(UNKNOWN_VALUE),
|
|
121
|
+
Type.Literal("website"),
|
|
122
|
+
Type.Literal("vscode"),
|
|
123
|
+
Type.Literal("browser"),
|
|
124
|
+
Type.Literal("cli"),
|
|
125
|
+
Type.Literal("library")
|
|
126
|
+
]),
|
|
127
|
+
projectSubcategory: Type.Union([
|
|
128
|
+
Type.Literal(UNKNOWN_VALUE),
|
|
129
|
+
Type.Literal("e-commerce"),
|
|
130
|
+
Type.Literal("tool")
|
|
131
|
+
]),
|
|
132
|
+
projectFramework: Type.Union([
|
|
133
|
+
Type.Literal(UNKNOWN_VALUE),
|
|
134
|
+
// web app frameworks
|
|
135
|
+
Type.Literal("nextjs"),
|
|
136
|
+
Type.Literal("vite"),
|
|
137
|
+
Type.Literal("svelte"),
|
|
138
|
+
Type.Literal("vue"),
|
|
139
|
+
Type.Literal("astro"),
|
|
140
|
+
// library frameworks
|
|
141
|
+
Type.Literal("npm-jsr"),
|
|
142
|
+
// browser extension frameworks
|
|
143
|
+
Type.Literal("wxt"),
|
|
144
|
+
// vscode extension frameworks
|
|
145
|
+
Type.Literal("vscode")
|
|
146
|
+
]),
|
|
147
|
+
projectTemplate: Type.Union([
|
|
148
|
+
Type.Literal(UNKNOWN_VALUE),
|
|
149
|
+
Type.Literal("blefnk/relivator"),
|
|
150
|
+
Type.Literal("blefnk/relivator-docker-template"),
|
|
151
|
+
Type.Literal("blefnk/next-react-ts-src-minimal"),
|
|
152
|
+
Type.Literal("blefnk/all-in-one-nextjs-template"),
|
|
153
|
+
Type.Literal("blefnk/create-t3-app"),
|
|
154
|
+
Type.Literal("blefnk/create-next-app"),
|
|
155
|
+
Type.Literal("blefnk/astro-starlight-template"),
|
|
156
|
+
Type.Literal("blefnk/versator"),
|
|
157
|
+
Type.Literal("reliverse/template-browser-extension"),
|
|
158
|
+
Type.Literal("microsoft/vscode-extension-samples"),
|
|
159
|
+
Type.Literal("microsoft/vscode-extension-template"),
|
|
160
|
+
Type.Literal("reliverse/cli-starter-template"),
|
|
161
|
+
Type.Literal("blefnk/deno-cli-tutorial")
|
|
162
|
+
]),
|
|
163
|
+
features: featuresSchema,
|
|
164
|
+
preferredLibraries: Type.Record(Type.String(), Type.String()),
|
|
165
|
+
codeStyle: codeStyleSchema,
|
|
166
|
+
monorepo: monorepoSchema,
|
|
167
|
+
ignoreDependencies: Type.Array(Type.String()),
|
|
168
|
+
customRules: Type.Record(Type.String(), Type.Unknown()),
|
|
169
|
+
// Custom repos configuration
|
|
170
|
+
multipleRepoCloneMode: Type.Boolean(),
|
|
171
|
+
customUserFocusedRepos: Type.Optional(Type.Array(Type.String())),
|
|
172
|
+
customDevsFocusedRepos: Type.Optional(Type.Array(Type.String())),
|
|
173
|
+
hideRepoSuggestions: Type.Boolean(),
|
|
174
|
+
customReposOnNewProject: Type.Boolean(),
|
|
175
|
+
envComposerOpenBrowser: Type.Boolean(),
|
|
176
|
+
repoBranch: Type.String(),
|
|
177
|
+
repoPrivacy: Type.Union([
|
|
178
|
+
Type.Literal("unknown"),
|
|
179
|
+
Type.Literal("public"),
|
|
180
|
+
Type.Literal("private")
|
|
181
|
+
]),
|
|
182
|
+
projectArchitecture: Type.Union([
|
|
183
|
+
Type.Literal("unknown"),
|
|
184
|
+
Type.Literal("fullstack"),
|
|
185
|
+
Type.Literal("separated")
|
|
186
|
+
]),
|
|
187
|
+
projectRuntime: Type.Union([
|
|
188
|
+
Type.Literal("bun"),
|
|
189
|
+
Type.Literal("deno"),
|
|
190
|
+
Type.Literal("edge-light"),
|
|
191
|
+
Type.Literal("fastly"),
|
|
192
|
+
Type.Literal("netlify"),
|
|
193
|
+
Type.Literal("node"),
|
|
194
|
+
Type.Literal("workerd")
|
|
195
|
+
]),
|
|
196
|
+
skipPromptsUseAutoBehavior: Type.Boolean(),
|
|
197
|
+
deployBehavior: Type.Union([
|
|
198
|
+
Type.Literal("prompt"),
|
|
199
|
+
Type.Literal("autoYes"),
|
|
200
|
+
Type.Literal("autoNo")
|
|
201
|
+
]),
|
|
202
|
+
depsBehavior: Type.Union([
|
|
203
|
+
Type.Literal("prompt"),
|
|
204
|
+
Type.Literal("autoYes"),
|
|
205
|
+
Type.Literal("autoNo")
|
|
206
|
+
]),
|
|
207
|
+
gitBehavior: Type.Union([
|
|
208
|
+
Type.Literal("prompt"),
|
|
209
|
+
Type.Literal("autoYes"),
|
|
210
|
+
Type.Literal("autoNo")
|
|
211
|
+
]),
|
|
212
|
+
i18nBehavior: Type.Union([
|
|
213
|
+
Type.Literal("prompt"),
|
|
214
|
+
Type.Literal("autoYes"),
|
|
215
|
+
Type.Literal("autoNo")
|
|
216
|
+
]),
|
|
217
|
+
scriptsBehavior: Type.Union([
|
|
218
|
+
Type.Literal("prompt"),
|
|
219
|
+
Type.Literal("autoYes"),
|
|
220
|
+
Type.Literal("autoNo")
|
|
221
|
+
]),
|
|
222
|
+
existingRepoBehavior: Type.Union([
|
|
223
|
+
Type.Literal("prompt"),
|
|
224
|
+
Type.Literal("autoYes"),
|
|
225
|
+
Type.Literal("autoYesSkipCommit"),
|
|
226
|
+
Type.Literal("autoNo")
|
|
227
|
+
])
|
|
228
|
+
});
|
|
229
|
+
export function defineConfig(config) {
|
|
230
|
+
return config;
|
|
231
|
+
}
|
|
232
|
+
function convertTypeBoxToJsonSchema(schema) {
|
|
233
|
+
if (!schema || typeof schema !== "object") return schema;
|
|
234
|
+
if (schema.type === "string" && schema.enum) {
|
|
235
|
+
return {
|
|
236
|
+
type: "string",
|
|
237
|
+
enum: schema.enum
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
if (schema.anyOf || schema.allOf || schema.oneOf) {
|
|
241
|
+
const variants = schema.anyOf || schema.allOf || schema.oneOf;
|
|
242
|
+
const allLiterals = variants.every((v) => v.const !== void 0);
|
|
243
|
+
if (allLiterals) {
|
|
244
|
+
return {
|
|
245
|
+
type: "string",
|
|
246
|
+
enum: variants.map((v) => v.const)
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (schema.type === "object") {
|
|
251
|
+
const result = {
|
|
252
|
+
type: "object",
|
|
253
|
+
properties: {}
|
|
254
|
+
};
|
|
255
|
+
if (schema.required) {
|
|
256
|
+
result.required = schema.required;
|
|
257
|
+
}
|
|
258
|
+
if (schema.properties) {
|
|
259
|
+
for (const [key, value] of Object.entries(schema.properties)) {
|
|
260
|
+
result.properties[key] = convertTypeBoxToJsonSchema(value);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (schema.additionalProperties) {
|
|
264
|
+
result.additionalProperties = convertTypeBoxToJsonSchema(
|
|
265
|
+
schema.additionalProperties
|
|
266
|
+
);
|
|
267
|
+
}
|
|
268
|
+
if (schema.patternProperties) {
|
|
269
|
+
result.patternProperties = {};
|
|
270
|
+
for (const [pattern, value] of Object.entries(schema.patternProperties)) {
|
|
271
|
+
result.patternProperties[pattern] = convertTypeBoxToJsonSchema(value);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
return result;
|
|
275
|
+
}
|
|
276
|
+
if (schema.type === "array") {
|
|
277
|
+
return {
|
|
278
|
+
type: "array",
|
|
279
|
+
items: convertTypeBoxToJsonSchema(schema.items)
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
if (schema.type) {
|
|
283
|
+
const result = { type: schema.type };
|
|
284
|
+
if (schema.minimum !== void 0) result.minimum = schema.minimum;
|
|
285
|
+
if (schema.maximum !== void 0) result.maximum = schema.maximum;
|
|
286
|
+
if (schema.minLength !== void 0) result.minLength = schema.minLength;
|
|
287
|
+
if (schema.maxLength !== void 0) result.maxLength = schema.maxLength;
|
|
288
|
+
if (schema.pattern !== void 0) result.pattern = schema.pattern;
|
|
289
|
+
if (schema.format !== void 0) result.format = schema.format;
|
|
290
|
+
if (schema.default !== void 0) result.default = schema.default;
|
|
291
|
+
return result;
|
|
292
|
+
}
|
|
293
|
+
return schema;
|
|
294
|
+
}
|
|
295
|
+
export async function generateJsonSchema(outputPath) {
|
|
296
|
+
const converted = convertTypeBoxToJsonSchema(reliverseConfigSchema);
|
|
297
|
+
const schema = {
|
|
298
|
+
$schema: "http://json-schema.org/draft-07/schema#",
|
|
299
|
+
title: "Reliverse Configuration Schema",
|
|
300
|
+
description: cliDomainDocs,
|
|
301
|
+
type: "object",
|
|
302
|
+
properties: converted.properties,
|
|
303
|
+
required: converted.required
|
|
304
|
+
};
|
|
305
|
+
await fs.writeFile(outputPath, JSON.stringify(schema, null, 2));
|
|
306
|
+
}
|
|
307
|
+
export async function generateSchemaFile() {
|
|
308
|
+
const schemaPath = path.join(process.cwd(), "schema.json");
|
|
309
|
+
if (fs.existsSync(schemaPath)) {
|
|
310
|
+
await fs.remove(schemaPath);
|
|
311
|
+
}
|
|
312
|
+
await generateJsonSchema(schemaPath);
|
|
313
|
+
}
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reliverse/config",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
|
-
"description": "
|
|
5
|
+
"description": "A helper library for the Reliverse CLI",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"author": "reliverse",
|
|
8
8
|
"repository": {
|
|
@@ -22,9 +22,6 @@
|
|
|
22
22
|
"exports": {
|
|
23
23
|
".": "./bin/main.js"
|
|
24
24
|
},
|
|
25
|
-
"bin": {
|
|
26
|
-
"config": "bin/main.js"
|
|
27
|
-
},
|
|
28
25
|
"files": [
|
|
29
26
|
"bin",
|
|
30
27
|
"package.json",
|
|
@@ -33,5 +30,11 @@
|
|
|
33
30
|
],
|
|
34
31
|
"publishConfig": {
|
|
35
32
|
"access": "public"
|
|
36
|
-
}
|
|
33
|
+
},
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@sinclair/typebox": "^0.34.21",
|
|
36
|
+
"fs-extra": "^11.3.0",
|
|
37
|
+
"pathe": "^2.0.3"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {}
|
|
37
40
|
}
|