@valbuild/init 0.62.3 → 0.62.4

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.62.3",
507
+ version: "0.62.4",
508
508
  description: "Initialize a new val.build project",
509
509
  exports: {
510
510
  "./main": {
@@ -560,8 +560,8 @@ var VAL_CLIENT = function VAL_CLIENT(configImportPath) {
560
560
  var VAL_RSC = function VAL_RSC(configImportPath) {
561
561
  return "import \"server-only\";\nimport { initValRsc } from \"@valbuild/next/rsc\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { cookies, draftMode, headers } from \"next/headers\";\n\nconst { fetchValStega: fetchVal } = initValRsc(config, {\n draftMode,\n headers,\n cookies,\n});\n\nexport { fetchVal };\n");
562
562
  };
563
- var VAL_SERVER = function VAL_SERVER(configImportPath) {
564
- return "import \"server-only\";\nimport { initValServer } from \"@valbuild/next/server\";\nimport { config } from \"".concat(configImportPath, "\";\nimport { draftMode } from \"next/headers\";\n\nconst { valNextAppRouter } = initValServer(\n { ...config },\n {\n draftMode,\n }\n);\n\nexport { valNextAppRouter };\n");
563
+ var VAL_SERVER = function VAL_SERVER(configImportPath, valModulesImportPath) {
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
567
  // TODO: use Val config
@@ -575,8 +575,11 @@ var VAL_API_ROUTER = function VAL_API_ROUTER(valServerPath) {
575
575
  var VAL_APP_PAGE = function VAL_APP_PAGE(configImportPath) {
576
576
  return "import { ValApp } from \"@valbuild/next\";\nimport { config } from \"".concat(configImportPath, "\";\n\nexport default function Val() {\n return <ValApp config={config} />;\n}\n");
577
577
  };
578
- var BASIC_EXAMPLE = function BASIC_EXAMPLE(moduleId, configImportPath, isJavaScript) {
579
- 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 // All features enabled:\n bold: true,\n italic: true,\n lineThrough: true,\n headings: [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"],\n a: true,\n img: true,\n ul: true,\n ol: true,\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.file('/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(moduleId, "\", testSchema, {\n text: \"Basic text content\",\n optionals: null,\n arrays: [\"A string\"],\n records: {\n \"unique-key-1\": \"A string\",\n },\n richText: c.richtext`# Title 1\n\n${c.rt.link(\"Val docs\", { href: \"https://val.build/docs\" })}\n\n- List item 1\n- List item 2\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");
578
+ var VAL_MODULES = function VAL_MODULES(configImportPath, exampleModuleImport) {
579
+ 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
+ };
581
+ 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 // All features enabled:\n bold: true,\n italic: true,\n lineThrough: true,\n headings: [\"h1\", \"h2\", \"h3\", \"h4\", \"h5\", \"h6\"],\n a: true,\n img: true,\n ul: true,\n ol: true,\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.file('/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: c.richtext`# Title 1\n\n${c.rt.link(\"Val docs\", { href: \"https://val.build/docs\" })}\n\n- List item 1\n- List item 2\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");
580
583
  };
581
584
 
582
585
  function error(message) {
@@ -829,37 +832,42 @@ function _plan() {
829
832
  _answer2,
830
833
  _answer3,
831
834
  valConfigPath,
835
+ _answer4,
836
+ exampleDir,
837
+ examplePath,
838
+ exampleImport,
839
+ _exampleModuleFilePath,
840
+ valModulesDir,
841
+ valModulesImport,
842
+ exampleModuleFilePath,
843
+ exampleModuleImport,
832
844
  valUtilsDir,
845
+ valModulesServerImport,
833
846
  valUtilsImportPath,
834
847
  valServerPath,
835
848
  valAppPagePath,
836
849
  valPageImportPath,
837
850
  valRouterPath,
838
851
  valRouterImportPath,
839
- _answer4,
840
852
  _answer5,
853
+ _answer6,
841
854
  NO_PATCH_WARNING,
842
855
  res,
843
856
  diff,
844
857
  s,
845
- _answer6,
846
858
  _answer7,
847
859
  _answer8,
860
+ _answer9,
848
861
  currentEslintRc,
849
862
  parsedEslint,
850
- _answer9,
851
863
  _answer10,
864
+ _answer11,
852
865
  vscodeDir,
853
866
  settingsPath,
854
867
  currentSettings,
855
868
  currentSettingsFile,
856
869
  currentRecommendations,
857
870
  valBuildIntelliSense,
858
- _answer11,
859
- exampleDir,
860
- examplePath,
861
- exampleImport,
862
- exampleModuleId,
863
871
  _args3 = arguments;
864
872
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
865
873
  while (1) switch (_context3.prev = _context3.next) {
@@ -1191,12 +1199,47 @@ function _plan() {
1191
1199
  path: valConfigPath,
1192
1200
  source: VAL_CONFIG(!!analysis.isTypeScript, {})
1193
1201
  };
1202
+ _context3.next = 129;
1203
+ return confirm({
1204
+ message: "Include example Val files?",
1205
+ "default": true
1206
+ });
1207
+ case 129:
1208
+ _answer4 = _context3.sent;
1209
+ if (!_answer4) {
1210
+ _context3.next = 138;
1211
+ break;
1212
+ }
1213
+ exampleDir = path.join(analysis.srcDir, "examples", "val");
1214
+ examplePath = path.join(exampleDir, "example.val." + (analysis.isJavaScript ? "js" : "ts"));
1215
+ exampleImport = path.relative(exampleDir, valConfigPath).replace(".js", "").replace(".ts", "");
1216
+ if (analysis.packageJsonDir) {
1217
+ _context3.next = 136;
1218
+ break;
1219
+ }
1220
+ throw Error("Could not detect package.json directory! This is a Val bug.");
1221
+ case 136:
1222
+ _exampleModuleFilePath = "/".concat(path.relative(analysis.packageJsonDir, examplePath));
1223
+ plan.includeExample = {
1224
+ path: examplePath,
1225
+ source: BASIC_EXAMPLE(_exampleModuleFilePath, exampleImport, !!analysis.isJavaScript)
1226
+ };
1227
+ case 138:
1228
+ valModulesDir = analysis.root;
1229
+ valModulesImport = path.relative(valModulesDir, valConfigPath).replace(".js", "").replace(".ts", "");
1230
+ exampleModuleFilePath = plan.includeExample ? plan.includeExample.path : undefined;
1231
+ exampleModuleImport = exampleModuleFilePath && path.relative(valModulesDir, exampleModuleFilePath).replace(".js", "").replace(".ts", "");
1232
+ plan.includeModules = {
1233
+ path: path.join(valModulesDir, "val.modules.ts"),
1234
+ source: VAL_MODULES(valModulesImport, exampleModuleImport)
1235
+ };
1194
1236
  valUtilsDir = path.join(analysis.srcDir, "val");
1237
+ valModulesServerImport = path.relative(valUtilsDir, plan.includeModules.path).replace(".js", "").replace(".ts", "");
1195
1238
  valUtilsImportPath = path.relative(valUtilsDir, valConfigPath).replace(".js", "").replace(".ts", "");
1196
1239
  valServerPath = path.join(valUtilsDir, analysis.isTypeScript ? "val.server.ts" : "val.server.js");
1197
1240
  plan.createValServer = {
1198
1241
  path: valServerPath,
1199
- source: VAL_SERVER(valUtilsImportPath)
1242
+ source: VAL_SERVER(valUtilsImportPath, valModulesServerImport)
1200
1243
  };
1201
1244
  if (!analysis.appRouterPath) {
1202
1245
  warn('Creating a new "app" router');
@@ -1215,29 +1258,29 @@ function _plan() {
1215
1258
  };
1216
1259
 
1217
1260
  // Util files:
1218
- case 138:
1261
+ case 155:
1219
1262
  if (!(plan.createValClient === undefined)) {
1220
- _context3.next = 150;
1263
+ _context3.next = 167;
1221
1264
  break;
1222
1265
  }
1223
1266
  if (defaultAnswers) {
1224
- _context3.next = 145;
1267
+ _context3.next = 162;
1225
1268
  break;
1226
1269
  }
1227
- _context3.next = 142;
1270
+ _context3.next = 159;
1228
1271
  return confirm({
1229
1272
  message: "Setup useVal for Client Components",
1230
1273
  "default": true
1231
1274
  });
1232
- case 142:
1275
+ case 159:
1233
1276
  _context3.t4 = _context3.sent;
1234
- _context3.next = 146;
1277
+ _context3.next = 163;
1235
1278
  break;
1236
- case 145:
1279
+ case 162:
1237
1280
  _context3.t4 = true;
1238
- case 146:
1239
- _answer4 = _context3.t4;
1240
- if (_answer4) {
1281
+ case 163:
1282
+ _answer5 = _context3.t4;
1283
+ if (_answer5) {
1241
1284
  plan.createValClient = {
1242
1285
  path: path.join(valUtilsDir, analysis.isTypeScript ? "val.client.ts" : "val.client.js"),
1243
1286
  source: VAL_CLIENT(valUtilsImportPath)
@@ -1245,31 +1288,31 @@ function _plan() {
1245
1288
  } else {
1246
1289
  plan.createValClient = false;
1247
1290
  }
1248
- _context3.next = 138;
1291
+ _context3.next = 155;
1249
1292
  break;
1250
- case 150:
1293
+ case 167:
1251
1294
  if (!(plan.createValRsc === undefined)) {
1252
- _context3.next = 162;
1295
+ _context3.next = 179;
1253
1296
  break;
1254
1297
  }
1255
1298
  if (defaultAnswers) {
1256
- _context3.next = 157;
1299
+ _context3.next = 174;
1257
1300
  break;
1258
1301
  }
1259
- _context3.next = 154;
1302
+ _context3.next = 171;
1260
1303
  return confirm({
1261
1304
  message: "Setup fetchVal for React Server Components",
1262
1305
  "default": true
1263
1306
  });
1264
- case 154:
1307
+ case 171:
1265
1308
  _context3.t5 = _context3.sent;
1266
- _context3.next = 158;
1309
+ _context3.next = 175;
1267
1310
  break;
1268
- case 157:
1311
+ case 174:
1269
1312
  _context3.t5 = true;
1270
- case 158:
1271
- _answer5 = _context3.t5;
1272
- if (_answer5) {
1313
+ case 175:
1314
+ _answer6 = _context3.t5;
1315
+ if (_answer6) {
1273
1316
  plan.createValRsc = {
1274
1317
  path: path.join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
1275
1318
  source: VAL_RSC(valUtilsImportPath)
@@ -1277,24 +1320,24 @@ function _plan() {
1277
1320
  } else {
1278
1321
  plan.createValRsc = false;
1279
1322
  }
1280
- _context3.next = 150;
1323
+ _context3.next = 167;
1281
1324
  break;
1282
- case 162:
1325
+ case 179:
1283
1326
  // Patches:
1284
1327
  NO_PATCH_WARNING = "Remember to add the ValProvider in your root app/layout.tsx or pages/_app.tsx file.\n";
1285
1328
  if (!analysis.appRouterLayoutPath) {
1286
- _context3.next = 192;
1329
+ _context3.next = 209;
1287
1330
  break;
1288
1331
  }
1289
1332
  if (analysis.appRouterLayoutFile) {
1290
- _context3.next = 167;
1333
+ _context3.next = 184;
1291
1334
  break;
1292
1335
  }
1293
1336
  error("Failed to read app router layout file");
1294
1337
  return _context3.abrupt("return", {
1295
1338
  abort: true
1296
1339
  });
1297
- case 167:
1340
+ case 184:
1298
1341
  res = transformNextAppRouterValProvider({
1299
1342
  path: analysis.appRouterLayoutPath,
1300
1343
  source: analysis.appRouterLayoutFile
@@ -1318,44 +1361,44 @@ function _plan() {
1318
1361
  }
1319
1362
  });
1320
1363
  if (defaultAnswers) {
1321
- _context3.next = 177;
1364
+ _context3.next = 194;
1322
1365
  break;
1323
1366
  }
1324
- _context3.next = 174;
1367
+ _context3.next = 191;
1325
1368
  return confirm({
1326
1369
  message: "Automatically patch ".concat(analysis.appRouterLayoutPath, " file?"),
1327
1370
  "default": true
1328
1371
  });
1329
- case 174:
1372
+ case 191:
1330
1373
  _context3.t6 = _context3.sent;
1331
- _context3.next = 178;
1374
+ _context3.next = 195;
1332
1375
  break;
1333
- case 177:
1376
+ case 194:
1334
1377
  _context3.t6 = true;
1335
- case 178:
1336
- _answer6 = _context3.t6;
1337
- if (!_answer6) {
1338
- _context3.next = 191;
1378
+ case 195:
1379
+ _answer7 = _context3.t6;
1380
+ if (!_answer7) {
1381
+ _context3.next = 208;
1339
1382
  break;
1340
1383
  }
1341
1384
  if (defaultAnswers) {
1342
- _context3.next = 186;
1385
+ _context3.next = 203;
1343
1386
  break;
1344
1387
  }
1345
- _context3.next = 183;
1388
+ _context3.next = 200;
1346
1389
  return confirm({
1347
1390
  message: "Do you accept the following patch:\n".concat(s, "\n"),
1348
1391
  "default": true
1349
1392
  });
1350
- case 183:
1393
+ case 200:
1351
1394
  _context3.t7 = _context3.sent;
1352
- _context3.next = 187;
1395
+ _context3.next = 204;
1353
1396
  break;
1354
- case 186:
1397
+ case 203:
1355
1398
  _context3.t7 = true;
1356
- case 187:
1357
- _answer7 = _context3.t7;
1358
- if (!_answer7) {
1399
+ case 204:
1400
+ _answer8 = _context3.t7;
1401
+ if (!_answer8) {
1359
1402
  warn(NO_PATCH_WARNING);
1360
1403
  plan.updateAppLayout = false;
1361
1404
  } else {
@@ -1364,70 +1407,70 @@ function _plan() {
1364
1407
  source: res
1365
1408
  };
1366
1409
  }
1367
- _context3.next = 192;
1410
+ _context3.next = 209;
1368
1411
  break;
1369
- case 191:
1412
+ case 208:
1370
1413
  warn(NO_PATCH_WARNING);
1371
- case 192:
1414
+ case 209:
1372
1415
  if (analysis.pagesRouter) {
1373
1416
  warn(NO_PATCH_WARNING);
1374
1417
  }
1375
1418
  if (!analysis.valEslintVersion) {
1376
- _context3.next = 224;
1419
+ _context3.next = 241;
1377
1420
  break;
1378
1421
  }
1379
1422
  if (!analysis.isValEslintRulesConfigured) {
1380
- _context3.next = 198;
1423
+ _context3.next = 215;
1381
1424
  break;
1382
1425
  }
1383
1426
  warn(" @valbuild/eslint-plugin rules: already configured");
1384
- _context3.next = 224;
1427
+ _context3.next = 241;
1385
1428
  break;
1386
- case 198:
1429
+ case 215:
1387
1430
  if (!analysis.eslintRcJsPath) {
1388
- _context3.next = 202;
1431
+ _context3.next = 219;
1389
1432
  break;
1390
1433
  }
1391
1434
  warn('Cannot patch eslint: found .eslintrc.js but can only patch JSON files (at the moment).\nAdd the following to your eslint config:\n\n "extends": ["plugin:@valbuild/recommended"]\n');
1392
- _context3.next = 224;
1435
+ _context3.next = 241;
1393
1436
  break;
1394
- case 202:
1437
+ case 219:
1395
1438
  if (!analysis.eslintRcJsonPath) {
1396
- _context3.next = 223;
1439
+ _context3.next = 240;
1397
1440
  break;
1398
1441
  }
1399
1442
  if (defaultAnswers) {
1400
- _context3.next = 209;
1443
+ _context3.next = 226;
1401
1444
  break;
1402
1445
  }
1403
- _context3.next = 206;
1446
+ _context3.next = 223;
1404
1447
  return confirm({
1405
1448
  message: "Patch eslintrc.json to use the recommended Val eslint rules?",
1406
1449
  "default": true
1407
1450
  });
1408
- case 206:
1451
+ case 223:
1409
1452
  _context3.t8 = _context3.sent;
1410
- _context3.next = 210;
1453
+ _context3.next = 227;
1411
1454
  break;
1412
- case 209:
1455
+ case 226:
1413
1456
  _context3.t8 = true;
1414
- case 210:
1415
- _answer8 = _context3.t8;
1416
- if (!_answer8) {
1417
- _context3.next = 221;
1457
+ case 227:
1458
+ _answer9 = _context3.t8;
1459
+ if (!_answer9) {
1460
+ _context3.next = 238;
1418
1461
  break;
1419
1462
  }
1420
1463
  currentEslintRc = fs.readFileSync(analysis.eslintRcJsonPath, "utf-8");
1421
1464
  parsedEslint = JSON.parse(currentEslintRc);
1422
1465
  if (!(_typeof(parsedEslint) !== "object")) {
1423
- _context3.next = 217;
1466
+ _context3.next = 234;
1424
1467
  break;
1425
1468
  }
1426
1469
  error("Could not patch eslint: ".concat(analysis.eslintRcJsonPath, " was not an object"));
1427
1470
  return _context3.abrupt("return", {
1428
1471
  abort: true
1429
1472
  });
1430
- case 217:
1473
+ case 234:
1431
1474
  if (typeof parsedEslint["extends"] === "string") {
1432
1475
  parsedEslint["extends"] = [parsedEslint["extends"]];
1433
1476
  }
@@ -1437,24 +1480,24 @@ function _plan() {
1437
1480
  path: analysis.eslintRcJsonPath,
1438
1481
  source: JSON.stringify(parsedEslint, null, 2) + "\n"
1439
1482
  };
1440
- case 221:
1441
- _context3.next = 224;
1483
+ case 238:
1484
+ _context3.next = 241;
1442
1485
  break;
1443
- case 223:
1486
+ case 240:
1444
1487
  warn("Cannot patch eslint: failed to find eslint config file");
1445
- case 224:
1488
+ case 241:
1446
1489
  if (!analysis.gitIgnorePath) {
1447
- _context3.next = 231;
1490
+ _context3.next = 248;
1448
1491
  break;
1449
1492
  }
1450
- _context3.next = 227;
1493
+ _context3.next = 244;
1451
1494
  return confirm({
1452
1495
  message: "Append .gitignore entry for Val cache? (recommended)",
1453
1496
  "default": true
1454
1497
  });
1455
- case 227:
1456
- _answer9 = _context3.sent;
1457
- if (_answer9) {
1498
+ case 244:
1499
+ _answer10 = _context3.sent;
1500
+ if (_answer10) {
1458
1501
  plan.updateGitIgnore = {
1459
1502
  path: analysis.gitIgnorePath,
1460
1503
  source: (analysis.gitIgnoreFile ? "".concat(analysis.gitIgnoreFile, "\n\n") : "") + "# Val local cache\n.val\n"
@@ -1462,49 +1505,49 @@ function _plan() {
1462
1505
  } else {
1463
1506
  plan.updateGitIgnore = false;
1464
1507
  }
1465
- _context3.next = 232;
1508
+ _context3.next = 249;
1466
1509
  break;
1467
- case 231:
1510
+ case 248:
1468
1511
  plan.updateGitIgnore = false;
1469
- case 232:
1470
- _context3.next = 234;
1512
+ case 249:
1513
+ _context3.next = 251;
1471
1514
  return confirm({
1472
1515
  message: "Add the Val Build IntelliSense to .vscode/extensions.json?",
1473
1516
  "default": true
1474
1517
  });
1475
- case 234:
1476
- _answer10 = _context3.sent;
1477
- if (!_answer10) {
1478
- _context3.next = 260;
1518
+ case 251:
1519
+ _answer11 = _context3.sent;
1520
+ if (!_answer11) {
1521
+ _context3.next = 277;
1479
1522
  break;
1480
1523
  }
1481
1524
  vscodeDir = path.join(analysis.root, ".vscode");
1482
1525
  settingsPath = path.join(vscodeDir, "extensions.json");
1483
1526
  currentSettings = {};
1484
- _context3.prev = 239;
1527
+ _context3.prev = 256;
1485
1528
  currentSettingsFile = fs.readFileSync(settingsPath, "utf-8");
1486
1529
  if (!currentSettingsFile) {
1487
- _context3.next = 250;
1530
+ _context3.next = 267;
1488
1531
  break;
1489
1532
  }
1490
- _context3.prev = 242;
1533
+ _context3.prev = 259;
1491
1534
  currentSettings = JSON.parse(currentSettingsFile);
1492
- _context3.next = 250;
1535
+ _context3.next = 267;
1493
1536
  break;
1494
- case 246:
1495
- _context3.prev = 246;
1496
- _context3.t9 = _context3["catch"](242);
1537
+ case 263:
1538
+ _context3.prev = 263;
1539
+ _context3.t9 = _context3["catch"](259);
1497
1540
  warn("Failed to parse VS Code extensions.json found here: ".concat(settingsPath, ".").concat(_context3.t9 instanceof Error ? "Parse error: ".concat(_context3.t9.message) : ""));
1498
1541
  return _context3.abrupt("return", {
1499
1542
  abort: true
1500
1543
  });
1501
- case 250:
1502
- _context3.next = 254;
1544
+ case 267:
1545
+ _context3.next = 271;
1503
1546
  break;
1504
- case 252:
1505
- _context3.prev = 252;
1506
- _context3.t10 = _context3["catch"](239);
1507
- case 254:
1547
+ case 269:
1548
+ _context3.prev = 269;
1549
+ _context3.t10 = _context3["catch"](256);
1550
+ case 271:
1508
1551
  currentRecommendations =
1509
1552
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
1510
1553
  currentSettings.recommendations;
@@ -1518,43 +1561,17 @@ function _plan() {
1518
1561
  path: settingsPath,
1519
1562
  source: JSON.stringify(currentSettings, null, 2)
1520
1563
  };
1521
- _context3.next = 261;
1564
+ _context3.next = 278;
1522
1565
  break;
1523
- case 260:
1566
+ case 277:
1524
1567
  plan.updateVSCodeSettings = false;
1525
- case 261:
1526
- _context3.next = 263;
1527
- return confirm({
1528
- message: "Include example Val files?",
1529
- "default": true
1530
- });
1531
- case 263:
1532
- _answer11 = _context3.sent;
1533
- if (!_answer11) {
1534
- _context3.next = 272;
1535
- break;
1536
- }
1537
- exampleDir = path.join(analysis.srcDir, "examples", "val");
1538
- examplePath = path.join(exampleDir, "example.val." + (analysis.isJavaScript ? "js" : "ts"));
1539
- exampleImport = path.relative(exampleDir, valConfigPath).replace(".js", "").replace(".ts", "");
1540
- if (analysis.packageJsonDir) {
1541
- _context3.next = 270;
1542
- break;
1543
- }
1544
- throw Error("Could not detect package.json directory! This is a Val bug.");
1545
- case 270:
1546
- exampleModuleId = "/".concat(path.relative(analysis.packageJsonDir, examplePath).replace(".val", "").replace(".js", "").replace(".ts", ""));
1547
- plan.includeExample = {
1548
- path: examplePath,
1549
- source: BASIC_EXAMPLE(exampleModuleId, exampleImport, !!analysis.isJavaScript)
1550
- };
1551
- case 272:
1568
+ case 278:
1552
1569
  return _context3.abrupt("return", plan);
1553
- case 273:
1570
+ case 279:
1554
1571
  case "end":
1555
1572
  return _context3.stop();
1556
1573
  }
1557
- }, _callee3, null, [[239, 252], [242, 246]]);
1574
+ }, _callee3, null, [[256, 269], [259, 263]]);
1558
1575
  }));
1559
1576
  return _plan.apply(this, arguments);
1560
1577
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@valbuild/init",
3
- "version": "0.62.3",
3
+ "version": "0.62.4",
4
4
  "description": "Initialize a new val.build project",
5
5
  "exports": {
6
6
  "./main": {