@valbuild/init 0.67.0 → 0.67.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.
|
@@ -504,7 +504,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
504
504
|
|
|
505
505
|
var packageJson = {
|
|
506
506
|
name: "@valbuild/init",
|
|
507
|
-
version: "0.67.
|
|
507
|
+
version: "0.67.1",
|
|
508
508
|
description: "Initialize a new val.build project",
|
|
509
509
|
exports: {
|
|
510
510
|
"./main": {
|
|
@@ -564,7 +564,9 @@ var VAL_SERVER = function VAL_SERVER(configImportPath, valModulesImportPath) {
|
|
|
564
564
|
return "import \"server-only\";\nimport { initValServer } from \"@valbuild/next/server\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { draftMode } from \"next/headers\";\nimport valModules from \"").concat(valModulesImportPath, "\";\n\nconst { valNextAppRouter } = initValServer(\n valModules,\n { ...config },\n {\n draftMode,\n }\n);\n\nexport { valNextAppRouter };\n");
|
|
565
565
|
};
|
|
566
566
|
|
|
567
|
-
// TODO: use
|
|
567
|
+
// TODO: use from @valbuild/core
|
|
568
|
+
|
|
569
|
+
// TODO: use from @valbuild/core
|
|
568
570
|
|
|
569
571
|
var VAL_CONFIG = function VAL_CONFIG(isTypeScript, options) {
|
|
570
572
|
return "import { initVal } from \"@valbuild/next\";\n\nconst { s, c, val, config } = initVal(".concat(JSON.stringify(options, null, 2), ");\n\n").concat(isTypeScript ? 'export type { t } from "@valbuild/next";' : "", ";\nexport { s, c, val, config };\n");
|
|
@@ -579,7 +581,7 @@ var VAL_MODULES = function VAL_MODULES(configImportPath, exampleModuleImport) {
|
|
|
579
581
|
return "import { modules } from \"@valbuild/next\";\nimport { config } from \"./".concat(configImportPath, "\";\n\nexport default modules(config, [\n // Add your modules here").concat(exampleModuleImport ? "\n { def: () => import(\"./".concat(exampleModuleImport, "\") },") : "", "\n]);\n\n");
|
|
580
582
|
};
|
|
581
583
|
var BASIC_EXAMPLE = function BASIC_EXAMPLE(moduleFilePath, configImportPath, isJavaScript) {
|
|
582
|
-
return "".concat(isJavaScript ? "// @ts-check\n" : "", "/**\n * Val example file - generated by @valbuild/init\n **/\n\nimport {\n s /* s = schema */,\n c /* c = content */,").concat(isJavaScript ? "" : "\n type t /* t = type */,", "\n} from \"").concat(configImportPath, "\";\n\n/**\n * This is the schema for the content. It defines the structure of the content and the types of each field.\n *\n * @docs https://val.build/docs/api-reference\n */\nexport const testSchema = s.object({\n /**\n * Basic text field\n */\n text: s.string(),\n\n /**\n * Nullable are optional fields in the UI that can be null or not\n */\n optionals: s.string().nullable(),\n\n arrays: s.array(s.string()),\n /**\n * Records are objects where entries can be added. Useful for array-like structures where you would use a key to uniquely identify each entry.\n */\n records: s.record(s.string()),\n\n /**\n * Rich text can be used for multiline text, but also for more complex text editing capabilities like links, images, lists, etc.\n *\n * @docs https://val.build/docs/api-reference/schema-types/richtext\n *\n * @see ValRichText will render rich text\n */\n richText: s.richtext({\n // styling:\n style: {\n bold: true, // enables bold\n italic: true, // enables italic text\n lineThrough: true, // enables line/strike-through\n },\n // block-level elements:\n block: {\n // tags:\n h1: true, // enables h1\n h2: true,\n h3: true,\n h4: true,\n h5: true,\n h6: true,\n ul: true, // enables unordered lists\n ol: true, // enables ordered lists\n },\n // inline elements:\n inline: {\n a: true,\n img: true,\n },\n }),\n\n /**\n * Images in Val are stored as files in the public folder.\n *\n * @docs https://val.build/docs/api-reference/schema-types/image\n *\n * When defining content use the following syntax:\n * @example c.
|
|
584
|
+
return "".concat(isJavaScript ? "// @ts-check\n" : "", "/**\n * Val example file - generated by @valbuild/init\n **/\n\nimport {\n s /* s = schema */,\n c /* c = content */,").concat(isJavaScript ? "" : "\n type t /* t = type */,", "\n} from \"").concat(configImportPath, "\";\n\n/**\n * This is the schema for the content. It defines the structure of the content and the types of each field.\n *\n * @docs https://val.build/docs/api-reference\n */\nexport const testSchema = s.object({\n /**\n * Basic text field\n */\n text: s.string(),\n\n /**\n * Nullable are optional fields in the UI that can be null or not\n */\n optionals: s.string().nullable(),\n\n arrays: s.array(s.string()),\n /**\n * Records are objects where entries can be added. Useful for array-like structures where you would use a key to uniquely identify each entry.\n */\n records: s.record(s.string()),\n\n /**\n * Rich text can be used for multiline text, but also for more complex text editing capabilities like links, images, lists, etc.\n *\n * @docs https://val.build/docs/api-reference/schema-types/richtext\n *\n * @see ValRichText will render rich text\n */\n richText: s.richtext({\n // styling:\n style: {\n bold: true, // enables bold\n italic: true, // enables italic text\n lineThrough: true, // enables line/strike-through\n },\n // block-level elements:\n block: {\n // tags:\n h1: true, // enables h1\n h2: true,\n h3: true,\n h4: true,\n h5: true,\n h6: true,\n ul: true, // enables unordered lists\n ol: true, // enables ordered lists\n },\n // inline elements:\n inline: {\n a: true,\n img: true,\n },\n }),\n\n /**\n * Images in Val are stored as files in the public folder.\n *\n * @docs https://val.build/docs/api-reference/schema-types/image\n *\n * When defining content use the following syntax:\n * @example c.image('/public/myimage.png') // path to the image file, use the VS Code plugin or the `@valbuild/cli validate --fix` command to add metadata\n *\n * @see ValImage component to see how to render this in your app\n */\n image: s.image().nullable(),\n\n /**\n * String enums: presents as a dropdown in the UI\n */\n stringEnum: s.union(s.literal(\"lit-0\"), s.literal(\"lit-1\")),\n\n /**\n * Raw strings disables the stega (steganography) feature that automatically tags content when using the overlay.\n * It is useful for slugs and other data that might be processed in code (parsed or matching for equality...)\n */\n slug: s.string().raw(),\n\n /**\n * Object unions: presents as a dropdown in the UI and the different fields\n *\n * @docs https://val.build/docs/api-reference/schema-types/union\n */\n objectUnions: s.union(\n \"type\",\n s.object({\n type: s.literal(\"page-type-1\"),\n value: s.number(),\n }),\n s.object({\n type: s.literal(\"page-type-2\"),\n text: s.string(),\n })\n ),\n});\n").concat(isJavaScript ? "" : "\n/**\n * t.inferSchema returns the type of the content.\n * This pattern is useful to type props of components that use this content (partially or whole)\n */\nexport type TestContent = t.inferSchema<typeof testSchema>;\n", "\n\n/**\n * This is the content definition. Add your content below.\n *\n * NOTE: the first argument, module id, must match the path of the file.\n */\nexport default c.define(\"").concat(moduleFilePath, "\", testSchema, {\n text: \"Basic text content\",\n optionals: null,\n arrays: [\"A string\"],\n records: {\n \"unique-key-1\": \"A string\",\n },\n richText: [\n { tag: \"h1\", children: [\"Title 1\"] },\n {\n tag: \"p\",\n children: [\n { tag: \"a\", href: \"https://val.build/docs\", children: [\"Val docs\"] },\n ],\n },\n {\n tag: \"ul\",\n children: [\n { tag: \"li\", children: [{ tag: \"p\", children: [\"List item 1\"] }] },\n { tag: \"li\", children: [{ tag: \"p\", children: [\"List item 2\"] }] },\n ],\n },\n ],\n image: null,\n slug: \"test\",\n objectUnions: {\n type: \"page-type-2\",\n text: \"String value\",\n },\n stringEnum: \"lit-1\",\n});\n");
|
|
583
585
|
};
|
|
584
586
|
|
|
585
587
|
function error(message) {
|
|
@@ -1197,7 +1199,9 @@ function _plan() {
|
|
|
1197
1199
|
case 126:
|
|
1198
1200
|
plan.createConfigFile = {
|
|
1199
1201
|
path: valConfigPath,
|
|
1200
|
-
source: VAL_CONFIG(!!analysis.isTypeScript, {
|
|
1202
|
+
source: VAL_CONFIG(!!analysis.isTypeScript, {
|
|
1203
|
+
defaultTheme: "light"
|
|
1204
|
+
})
|
|
1201
1205
|
};
|
|
1202
1206
|
if (defaultAnswers) {
|
|
1203
1207
|
_context3.next = 133;
|
|
@@ -504,7 +504,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
504
504
|
|
|
505
505
|
var packageJson = {
|
|
506
506
|
name: "@valbuild/init",
|
|
507
|
-
version: "0.67.
|
|
507
|
+
version: "0.67.1",
|
|
508
508
|
description: "Initialize a new val.build project",
|
|
509
509
|
exports: {
|
|
510
510
|
"./main": {
|
|
@@ -564,7 +564,9 @@ var VAL_SERVER = function VAL_SERVER(configImportPath, valModulesImportPath) {
|
|
|
564
564
|
return "import \"server-only\";\nimport { initValServer } from \"@valbuild/next/server\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { draftMode } from \"next/headers\";\nimport valModules from \"").concat(valModulesImportPath, "\";\n\nconst { valNextAppRouter } = initValServer(\n valModules,\n { ...config },\n {\n draftMode,\n }\n);\n\nexport { valNextAppRouter };\n");
|
|
565
565
|
};
|
|
566
566
|
|
|
567
|
-
// TODO: use
|
|
567
|
+
// TODO: use from @valbuild/core
|
|
568
|
+
|
|
569
|
+
// TODO: use from @valbuild/core
|
|
568
570
|
|
|
569
571
|
var VAL_CONFIG = function VAL_CONFIG(isTypeScript, options) {
|
|
570
572
|
return "import { initVal } from \"@valbuild/next\";\n\nconst { s, c, val, config } = initVal(".concat(JSON.stringify(options, null, 2), ");\n\n").concat(isTypeScript ? 'export type { t } from "@valbuild/next";' : "", ";\nexport { s, c, val, config };\n");
|
|
@@ -579,7 +581,7 @@ var VAL_MODULES = function VAL_MODULES(configImportPath, exampleModuleImport) {
|
|
|
579
581
|
return "import { modules } from \"@valbuild/next\";\nimport { config } from \"./".concat(configImportPath, "\";\n\nexport default modules(config, [\n // Add your modules here").concat(exampleModuleImport ? "\n { def: () => import(\"./".concat(exampleModuleImport, "\") },") : "", "\n]);\n\n");
|
|
580
582
|
};
|
|
581
583
|
var BASIC_EXAMPLE = function BASIC_EXAMPLE(moduleFilePath, configImportPath, isJavaScript) {
|
|
582
|
-
return "".concat(isJavaScript ? "// @ts-check\n" : "", "/**\n * Val example file - generated by @valbuild/init\n **/\n\nimport {\n s /* s = schema */,\n c /* c = content */,").concat(isJavaScript ? "" : "\n type t /* t = type */,", "\n} from \"").concat(configImportPath, "\";\n\n/**\n * This is the schema for the content. It defines the structure of the content and the types of each field.\n *\n * @docs https://val.build/docs/api-reference\n */\nexport const testSchema = s.object({\n /**\n * Basic text field\n */\n text: s.string(),\n\n /**\n * Nullable are optional fields in the UI that can be null or not\n */\n optionals: s.string().nullable(),\n\n arrays: s.array(s.string()),\n /**\n * Records are objects where entries can be added. Useful for array-like structures where you would use a key to uniquely identify each entry.\n */\n records: s.record(s.string()),\n\n /**\n * Rich text can be used for multiline text, but also for more complex text editing capabilities like links, images, lists, etc.\n *\n * @docs https://val.build/docs/api-reference/schema-types/richtext\n *\n * @see ValRichText will render rich text\n */\n richText: s.richtext({\n // styling:\n style: {\n bold: true, // enables bold\n italic: true, // enables italic text\n lineThrough: true, // enables line/strike-through\n },\n // block-level elements:\n block: {\n // tags:\n h1: true, // enables h1\n h2: true,\n h3: true,\n h4: true,\n h5: true,\n h6: true,\n ul: true, // enables unordered lists\n ol: true, // enables ordered lists\n },\n // inline elements:\n inline: {\n a: true,\n img: true,\n },\n }),\n\n /**\n * Images in Val are stored as files in the public folder.\n *\n * @docs https://val.build/docs/api-reference/schema-types/image\n *\n * When defining content use the following syntax:\n * @example c.
|
|
584
|
+
return "".concat(isJavaScript ? "// @ts-check\n" : "", "/**\n * Val example file - generated by @valbuild/init\n **/\n\nimport {\n s /* s = schema */,\n c /* c = content */,").concat(isJavaScript ? "" : "\n type t /* t = type */,", "\n} from \"").concat(configImportPath, "\";\n\n/**\n * This is the schema for the content. It defines the structure of the content and the types of each field.\n *\n * @docs https://val.build/docs/api-reference\n */\nexport const testSchema = s.object({\n /**\n * Basic text field\n */\n text: s.string(),\n\n /**\n * Nullable are optional fields in the UI that can be null or not\n */\n optionals: s.string().nullable(),\n\n arrays: s.array(s.string()),\n /**\n * Records are objects where entries can be added. Useful for array-like structures where you would use a key to uniquely identify each entry.\n */\n records: s.record(s.string()),\n\n /**\n * Rich text can be used for multiline text, but also for more complex text editing capabilities like links, images, lists, etc.\n *\n * @docs https://val.build/docs/api-reference/schema-types/richtext\n *\n * @see ValRichText will render rich text\n */\n richText: s.richtext({\n // styling:\n style: {\n bold: true, // enables bold\n italic: true, // enables italic text\n lineThrough: true, // enables line/strike-through\n },\n // block-level elements:\n block: {\n // tags:\n h1: true, // enables h1\n h2: true,\n h3: true,\n h4: true,\n h5: true,\n h6: true,\n ul: true, // enables unordered lists\n ol: true, // enables ordered lists\n },\n // inline elements:\n inline: {\n a: true,\n img: true,\n },\n }),\n\n /**\n * Images in Val are stored as files in the public folder.\n *\n * @docs https://val.build/docs/api-reference/schema-types/image\n *\n * When defining content use the following syntax:\n * @example c.image('/public/myimage.png') // path to the image file, use the VS Code plugin or the `@valbuild/cli validate --fix` command to add metadata\n *\n * @see ValImage component to see how to render this in your app\n */\n image: s.image().nullable(),\n\n /**\n * String enums: presents as a dropdown in the UI\n */\n stringEnum: s.union(s.literal(\"lit-0\"), s.literal(\"lit-1\")),\n\n /**\n * Raw strings disables the stega (steganography) feature that automatically tags content when using the overlay.\n * It is useful for slugs and other data that might be processed in code (parsed or matching for equality...)\n */\n slug: s.string().raw(),\n\n /**\n * Object unions: presents as a dropdown in the UI and the different fields\n *\n * @docs https://val.build/docs/api-reference/schema-types/union\n */\n objectUnions: s.union(\n \"type\",\n s.object({\n type: s.literal(\"page-type-1\"),\n value: s.number(),\n }),\n s.object({\n type: s.literal(\"page-type-2\"),\n text: s.string(),\n })\n ),\n});\n").concat(isJavaScript ? "" : "\n/**\n * t.inferSchema returns the type of the content.\n * This pattern is useful to type props of components that use this content (partially or whole)\n */\nexport type TestContent = t.inferSchema<typeof testSchema>;\n", "\n\n/**\n * This is the content definition. Add your content below.\n *\n * NOTE: the first argument, module id, must match the path of the file.\n */\nexport default c.define(\"").concat(moduleFilePath, "\", testSchema, {\n text: \"Basic text content\",\n optionals: null,\n arrays: [\"A string\"],\n records: {\n \"unique-key-1\": \"A string\",\n },\n richText: [\n { tag: \"h1\", children: [\"Title 1\"] },\n {\n tag: \"p\",\n children: [\n { tag: \"a\", href: \"https://val.build/docs\", children: [\"Val docs\"] },\n ],\n },\n {\n tag: \"ul\",\n children: [\n { tag: \"li\", children: [{ tag: \"p\", children: [\"List item 1\"] }] },\n { tag: \"li\", children: [{ tag: \"p\", children: [\"List item 2\"] }] },\n ],\n },\n ],\n image: null,\n slug: \"test\",\n objectUnions: {\n type: \"page-type-2\",\n text: \"String value\",\n },\n stringEnum: \"lit-1\",\n});\n");
|
|
583
585
|
};
|
|
584
586
|
|
|
585
587
|
function error(message) {
|
|
@@ -1197,7 +1199,9 @@ function _plan() {
|
|
|
1197
1199
|
case 126:
|
|
1198
1200
|
plan.createConfigFile = {
|
|
1199
1201
|
path: valConfigPath,
|
|
1200
|
-
source: VAL_CONFIG(!!analysis.isTypeScript, {
|
|
1202
|
+
source: VAL_CONFIG(!!analysis.isTypeScript, {
|
|
1203
|
+
defaultTheme: "light"
|
|
1204
|
+
})
|
|
1201
1205
|
};
|
|
1202
1206
|
if (defaultAnswers) {
|
|
1203
1207
|
_context3.next = 133;
|
|
@@ -492,7 +492,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
492
492
|
|
|
493
493
|
var packageJson = {
|
|
494
494
|
name: "@valbuild/init",
|
|
495
|
-
version: "0.67.
|
|
495
|
+
version: "0.67.1",
|
|
496
496
|
description: "Initialize a new val.build project",
|
|
497
497
|
exports: {
|
|
498
498
|
"./main": {
|
|
@@ -552,7 +552,9 @@ var VAL_SERVER = function VAL_SERVER(configImportPath, valModulesImportPath) {
|
|
|
552
552
|
return "import \"server-only\";\nimport { initValServer } from \"@valbuild/next/server\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { draftMode } from \"next/headers\";\nimport valModules from \"").concat(valModulesImportPath, "\";\n\nconst { valNextAppRouter } = initValServer(\n valModules,\n { ...config },\n {\n draftMode,\n }\n);\n\nexport { valNextAppRouter };\n");
|
|
553
553
|
};
|
|
554
554
|
|
|
555
|
-
// TODO: use
|
|
555
|
+
// TODO: use from @valbuild/core
|
|
556
|
+
|
|
557
|
+
// TODO: use from @valbuild/core
|
|
556
558
|
|
|
557
559
|
var VAL_CONFIG = function VAL_CONFIG(isTypeScript, options) {
|
|
558
560
|
return "import { initVal } from \"@valbuild/next\";\n\nconst { s, c, val, config } = initVal(".concat(JSON.stringify(options, null, 2), ");\n\n").concat(isTypeScript ? 'export type { t } from "@valbuild/next";' : "", ";\nexport { s, c, val, config };\n");
|
|
@@ -567,7 +569,7 @@ var VAL_MODULES = function VAL_MODULES(configImportPath, exampleModuleImport) {
|
|
|
567
569
|
return "import { modules } from \"@valbuild/next\";\nimport { config } from \"./".concat(configImportPath, "\";\n\nexport default modules(config, [\n // Add your modules here").concat(exampleModuleImport ? "\n { def: () => import(\"./".concat(exampleModuleImport, "\") },") : "", "\n]);\n\n");
|
|
568
570
|
};
|
|
569
571
|
var BASIC_EXAMPLE = function BASIC_EXAMPLE(moduleFilePath, configImportPath, isJavaScript) {
|
|
570
|
-
return "".concat(isJavaScript ? "// @ts-check\n" : "", "/**\n * Val example file - generated by @valbuild/init\n **/\n\nimport {\n s /* s = schema */,\n c /* c = content */,").concat(isJavaScript ? "" : "\n type t /* t = type */,", "\n} from \"").concat(configImportPath, "\";\n\n/**\n * This is the schema for the content. It defines the structure of the content and the types of each field.\n *\n * @docs https://val.build/docs/api-reference\n */\nexport const testSchema = s.object({\n /**\n * Basic text field\n */\n text: s.string(),\n\n /**\n * Nullable are optional fields in the UI that can be null or not\n */\n optionals: s.string().nullable(),\n\n arrays: s.array(s.string()),\n /**\n * Records are objects where entries can be added. Useful for array-like structures where you would use a key to uniquely identify each entry.\n */\n records: s.record(s.string()),\n\n /**\n * Rich text can be used for multiline text, but also for more complex text editing capabilities like links, images, lists, etc.\n *\n * @docs https://val.build/docs/api-reference/schema-types/richtext\n *\n * @see ValRichText will render rich text\n */\n richText: s.richtext({\n // styling:\n style: {\n bold: true, // enables bold\n italic: true, // enables italic text\n lineThrough: true, // enables line/strike-through\n },\n // block-level elements:\n block: {\n // tags:\n h1: true, // enables h1\n h2: true,\n h3: true,\n h4: true,\n h5: true,\n h6: true,\n ul: true, // enables unordered lists\n ol: true, // enables ordered lists\n },\n // inline elements:\n inline: {\n a: true,\n img: true,\n },\n }),\n\n /**\n * Images in Val are stored as files in the public folder.\n *\n * @docs https://val.build/docs/api-reference/schema-types/image\n *\n * When defining content use the following syntax:\n * @example c.
|
|
572
|
+
return "".concat(isJavaScript ? "// @ts-check\n" : "", "/**\n * Val example file - generated by @valbuild/init\n **/\n\nimport {\n s /* s = schema */,\n c /* c = content */,").concat(isJavaScript ? "" : "\n type t /* t = type */,", "\n} from \"").concat(configImportPath, "\";\n\n/**\n * This is the schema for the content. It defines the structure of the content and the types of each field.\n *\n * @docs https://val.build/docs/api-reference\n */\nexport const testSchema = s.object({\n /**\n * Basic text field\n */\n text: s.string(),\n\n /**\n * Nullable are optional fields in the UI that can be null or not\n */\n optionals: s.string().nullable(),\n\n arrays: s.array(s.string()),\n /**\n * Records are objects where entries can be added. Useful for array-like structures where you would use a key to uniquely identify each entry.\n */\n records: s.record(s.string()),\n\n /**\n * Rich text can be used for multiline text, but also for more complex text editing capabilities like links, images, lists, etc.\n *\n * @docs https://val.build/docs/api-reference/schema-types/richtext\n *\n * @see ValRichText will render rich text\n */\n richText: s.richtext({\n // styling:\n style: {\n bold: true, // enables bold\n italic: true, // enables italic text\n lineThrough: true, // enables line/strike-through\n },\n // block-level elements:\n block: {\n // tags:\n h1: true, // enables h1\n h2: true,\n h3: true,\n h4: true,\n h5: true,\n h6: true,\n ul: true, // enables unordered lists\n ol: true, // enables ordered lists\n },\n // inline elements:\n inline: {\n a: true,\n img: true,\n },\n }),\n\n /**\n * Images in Val are stored as files in the public folder.\n *\n * @docs https://val.build/docs/api-reference/schema-types/image\n *\n * When defining content use the following syntax:\n * @example c.image('/public/myimage.png') // path to the image file, use the VS Code plugin or the `@valbuild/cli validate --fix` command to add metadata\n *\n * @see ValImage component to see how to render this in your app\n */\n image: s.image().nullable(),\n\n /**\n * String enums: presents as a dropdown in the UI\n */\n stringEnum: s.union(s.literal(\"lit-0\"), s.literal(\"lit-1\")),\n\n /**\n * Raw strings disables the stega (steganography) feature that automatically tags content when using the overlay.\n * It is useful for slugs and other data that might be processed in code (parsed or matching for equality...)\n */\n slug: s.string().raw(),\n\n /**\n * Object unions: presents as a dropdown in the UI and the different fields\n *\n * @docs https://val.build/docs/api-reference/schema-types/union\n */\n objectUnions: s.union(\n \"type\",\n s.object({\n type: s.literal(\"page-type-1\"),\n value: s.number(),\n }),\n s.object({\n type: s.literal(\"page-type-2\"),\n text: s.string(),\n })\n ),\n});\n").concat(isJavaScript ? "" : "\n/**\n * t.inferSchema returns the type of the content.\n * This pattern is useful to type props of components that use this content (partially or whole)\n */\nexport type TestContent = t.inferSchema<typeof testSchema>;\n", "\n\n/**\n * This is the content definition. Add your content below.\n *\n * NOTE: the first argument, module id, must match the path of the file.\n */\nexport default c.define(\"").concat(moduleFilePath, "\", testSchema, {\n text: \"Basic text content\",\n optionals: null,\n arrays: [\"A string\"],\n records: {\n \"unique-key-1\": \"A string\",\n },\n richText: [\n { tag: \"h1\", children: [\"Title 1\"] },\n {\n tag: \"p\",\n children: [\n { tag: \"a\", href: \"https://val.build/docs\", children: [\"Val docs\"] },\n ],\n },\n {\n tag: \"ul\",\n children: [\n { tag: \"li\", children: [{ tag: \"p\", children: [\"List item 1\"] }] },\n { tag: \"li\", children: [{ tag: \"p\", children: [\"List item 2\"] }] },\n ],\n },\n ],\n image: null,\n slug: \"test\",\n objectUnions: {\n type: \"page-type-2\",\n text: \"String value\",\n },\n stringEnum: \"lit-1\",\n});\n");
|
|
571
573
|
};
|
|
572
574
|
|
|
573
575
|
function error(message) {
|
|
@@ -1185,7 +1187,9 @@ function _plan() {
|
|
|
1185
1187
|
case 126:
|
|
1186
1188
|
plan.createConfigFile = {
|
|
1187
1189
|
path: valConfigPath,
|
|
1188
|
-
source: VAL_CONFIG(!!analysis.isTypeScript, {
|
|
1190
|
+
source: VAL_CONFIG(!!analysis.isTypeScript, {
|
|
1191
|
+
defaultTheme: "light"
|
|
1192
|
+
})
|
|
1189
1193
|
};
|
|
1190
1194
|
if (defaultAnswers) {
|
|
1191
1195
|
_context3.next = 133;
|
package/package.json
CHANGED
package/src/init.ts
CHANGED
package/src/templates.ts
CHANGED
|
@@ -45,13 +45,21 @@ const { valNextAppRouter } = initValServer(
|
|
|
45
45
|
export { valNextAppRouter };
|
|
46
46
|
`;
|
|
47
47
|
|
|
48
|
-
// TODO: use
|
|
48
|
+
// TODO: use from @valbuild/core
|
|
49
|
+
type ConfigDirectory = `/public/${string}`;
|
|
50
|
+
|
|
51
|
+
// TODO: use from @valbuild/core
|
|
49
52
|
type ValConfig = {
|
|
50
|
-
|
|
53
|
+
project?: string;
|
|
54
|
+
root?: string;
|
|
55
|
+
files?: {
|
|
56
|
+
directory: ConfigDirectory;
|
|
57
|
+
};
|
|
51
58
|
gitCommit?: string;
|
|
52
59
|
gitBranch?: string;
|
|
53
|
-
|
|
60
|
+
defaultTheme?: "dark" | "light";
|
|
54
61
|
};
|
|
62
|
+
|
|
55
63
|
export const VAL_CONFIG = (
|
|
56
64
|
isTypeScript: boolean,
|
|
57
65
|
options: ValConfig,
|
|
@@ -176,7 +184,7 @@ export const testSchema = s.object({
|
|
|
176
184
|
* @docs https://val.build/docs/api-reference/schema-types/image
|
|
177
185
|
*
|
|
178
186
|
* When defining content use the following syntax:
|
|
179
|
-
* @example c.
|
|
187
|
+
* @example c.image('/public/myimage.png') // path to the image file, use the VS Code plugin or the \`@valbuild/cli validate --fix\` command to add metadata
|
|
180
188
|
*
|
|
181
189
|
* @see ValImage component to see how to render this in your app
|
|
182
190
|
*/
|