@valbuild/init 0.63.1 → 0.63.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.
- package/main/dist/valbuild-init-main.cjs.dev.js +143 -113
- package/main/dist/valbuild-init-main.cjs.prod.js +143 -113
- package/main/dist/valbuild-init-main.esm.js +143 -113
- package/package.json +1 -1
- package/src/init.ts +18 -12
- package/src/templates.ts +39 -16
|
@@ -516,7 +516,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
516
516
|
|
|
517
517
|
var packageJson = {
|
|
518
518
|
name: "@valbuild/init",
|
|
519
|
-
version: "0.63.
|
|
519
|
+
version: "0.63.4",
|
|
520
520
|
description: "Initialize a new val.build project",
|
|
521
521
|
exports: {
|
|
522
522
|
"./main": {
|
|
@@ -591,7 +591,7 @@ var VAL_MODULES = function VAL_MODULES(configImportPath, exampleModuleImport) {
|
|
|
591
591
|
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");
|
|
592
592
|
};
|
|
593
593
|
var BASIC_EXAMPLE = function BASIC_EXAMPLE(moduleFilePath, configImportPath, isJavaScript) {
|
|
594
|
-
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 //
|
|
594
|
+
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.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: [\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");
|
|
595
595
|
};
|
|
596
596
|
|
|
597
597
|
function error(message) {
|
|
@@ -1211,32 +1211,42 @@ function _plan() {
|
|
|
1211
1211
|
path: valConfigPath,
|
|
1212
1212
|
source: VAL_CONFIG(!!analysis.isTypeScript, {})
|
|
1213
1213
|
};
|
|
1214
|
-
|
|
1214
|
+
if (defaultAnswers) {
|
|
1215
|
+
_context3.next = 133;
|
|
1216
|
+
break;
|
|
1217
|
+
}
|
|
1218
|
+
_context3.next = 130;
|
|
1215
1219
|
return prompts.confirm({
|
|
1216
1220
|
message: "Include example Val files?",
|
|
1217
1221
|
"default": true
|
|
1218
1222
|
});
|
|
1219
|
-
case
|
|
1220
|
-
|
|
1223
|
+
case 130:
|
|
1224
|
+
_context3.t4 = _context3.sent;
|
|
1225
|
+
_context3.next = 134;
|
|
1226
|
+
break;
|
|
1227
|
+
case 133:
|
|
1228
|
+
_context3.t4 = true;
|
|
1229
|
+
case 134:
|
|
1230
|
+
_answer4 = _context3.t4;
|
|
1221
1231
|
if (!_answer4) {
|
|
1222
|
-
_context3.next =
|
|
1232
|
+
_context3.next = 143;
|
|
1223
1233
|
break;
|
|
1224
1234
|
}
|
|
1225
1235
|
exampleDir = path__default["default"].join(analysis.srcDir, "examples", "val");
|
|
1226
1236
|
examplePath = path__default["default"].join(exampleDir, "example.val." + (analysis.isJavaScript ? "js" : "ts"));
|
|
1227
1237
|
exampleImport = path__default["default"].relative(exampleDir, valConfigPath).replace(".js", "").replace(".ts", "");
|
|
1228
1238
|
if (analysis.packageJsonDir) {
|
|
1229
|
-
_context3.next =
|
|
1239
|
+
_context3.next = 141;
|
|
1230
1240
|
break;
|
|
1231
1241
|
}
|
|
1232
1242
|
throw Error("Could not detect package.json directory! This is a Val bug.");
|
|
1233
|
-
case
|
|
1243
|
+
case 141:
|
|
1234
1244
|
_exampleModuleFilePath = "/".concat(path__default["default"].relative(analysis.packageJsonDir, examplePath));
|
|
1235
1245
|
plan.includeExample = {
|
|
1236
1246
|
path: examplePath,
|
|
1237
1247
|
source: BASIC_EXAMPLE(_exampleModuleFilePath, exampleImport, !!analysis.isJavaScript)
|
|
1238
1248
|
};
|
|
1239
|
-
case
|
|
1249
|
+
case 143:
|
|
1240
1250
|
valModulesDir = analysis.root;
|
|
1241
1251
|
valModulesImport = path__default["default"].relative(valModulesDir, valConfigPath).replace(".js", "").replace(".ts", "");
|
|
1242
1252
|
exampleModuleFilePath = plan.includeExample ? plan.includeExample.path : undefined;
|
|
@@ -1270,28 +1280,28 @@ function _plan() {
|
|
|
1270
1280
|
};
|
|
1271
1281
|
|
|
1272
1282
|
// Util files:
|
|
1273
|
-
case
|
|
1283
|
+
case 160:
|
|
1274
1284
|
if (!(plan.createValClient === undefined)) {
|
|
1275
|
-
_context3.next =
|
|
1285
|
+
_context3.next = 172;
|
|
1276
1286
|
break;
|
|
1277
1287
|
}
|
|
1278
1288
|
if (defaultAnswers) {
|
|
1279
|
-
_context3.next =
|
|
1289
|
+
_context3.next = 167;
|
|
1280
1290
|
break;
|
|
1281
1291
|
}
|
|
1282
|
-
_context3.next =
|
|
1292
|
+
_context3.next = 164;
|
|
1283
1293
|
return prompts.confirm({
|
|
1284
1294
|
message: "Setup useVal for Client Components",
|
|
1285
1295
|
"default": true
|
|
1286
1296
|
});
|
|
1287
|
-
case
|
|
1288
|
-
_context3.
|
|
1289
|
-
_context3.next =
|
|
1297
|
+
case 164:
|
|
1298
|
+
_context3.t5 = _context3.sent;
|
|
1299
|
+
_context3.next = 168;
|
|
1290
1300
|
break;
|
|
1291
|
-
case
|
|
1292
|
-
_context3.
|
|
1293
|
-
case
|
|
1294
|
-
_answer5 = _context3.
|
|
1301
|
+
case 167:
|
|
1302
|
+
_context3.t5 = true;
|
|
1303
|
+
case 168:
|
|
1304
|
+
_answer5 = _context3.t5;
|
|
1295
1305
|
if (_answer5) {
|
|
1296
1306
|
plan.createValClient = {
|
|
1297
1307
|
path: path__default["default"].join(valUtilsDir, analysis.isTypeScript ? "val.client.ts" : "val.client.js"),
|
|
@@ -1300,30 +1310,30 @@ function _plan() {
|
|
|
1300
1310
|
} else {
|
|
1301
1311
|
plan.createValClient = false;
|
|
1302
1312
|
}
|
|
1303
|
-
_context3.next =
|
|
1313
|
+
_context3.next = 160;
|
|
1304
1314
|
break;
|
|
1305
|
-
case
|
|
1315
|
+
case 172:
|
|
1306
1316
|
if (!(plan.createValRsc === undefined)) {
|
|
1307
|
-
_context3.next =
|
|
1317
|
+
_context3.next = 184;
|
|
1308
1318
|
break;
|
|
1309
1319
|
}
|
|
1310
1320
|
if (defaultAnswers) {
|
|
1311
|
-
_context3.next =
|
|
1321
|
+
_context3.next = 179;
|
|
1312
1322
|
break;
|
|
1313
1323
|
}
|
|
1314
|
-
_context3.next =
|
|
1324
|
+
_context3.next = 176;
|
|
1315
1325
|
return prompts.confirm({
|
|
1316
1326
|
message: "Setup fetchVal for React Server Components",
|
|
1317
1327
|
"default": true
|
|
1318
1328
|
});
|
|
1319
|
-
case
|
|
1320
|
-
_context3.
|
|
1321
|
-
_context3.next =
|
|
1329
|
+
case 176:
|
|
1330
|
+
_context3.t6 = _context3.sent;
|
|
1331
|
+
_context3.next = 180;
|
|
1322
1332
|
break;
|
|
1323
|
-
case
|
|
1324
|
-
_context3.
|
|
1325
|
-
case
|
|
1326
|
-
_answer6 = _context3.
|
|
1333
|
+
case 179:
|
|
1334
|
+
_context3.t6 = true;
|
|
1335
|
+
case 180:
|
|
1336
|
+
_answer6 = _context3.t6;
|
|
1327
1337
|
if (_answer6) {
|
|
1328
1338
|
plan.createValRsc = {
|
|
1329
1339
|
path: path__default["default"].join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
|
|
@@ -1332,24 +1342,24 @@ function _plan() {
|
|
|
1332
1342
|
} else {
|
|
1333
1343
|
plan.createValRsc = false;
|
|
1334
1344
|
}
|
|
1335
|
-
_context3.next =
|
|
1345
|
+
_context3.next = 172;
|
|
1336
1346
|
break;
|
|
1337
|
-
case
|
|
1347
|
+
case 184:
|
|
1338
1348
|
// Patches:
|
|
1339
1349
|
NO_PATCH_WARNING = "Remember to add the ValProvider in your root app/layout.tsx or pages/_app.tsx file.\n";
|
|
1340
1350
|
if (!analysis.appRouterLayoutPath) {
|
|
1341
|
-
_context3.next =
|
|
1351
|
+
_context3.next = 214;
|
|
1342
1352
|
break;
|
|
1343
1353
|
}
|
|
1344
1354
|
if (analysis.appRouterLayoutFile) {
|
|
1345
|
-
_context3.next =
|
|
1355
|
+
_context3.next = 189;
|
|
1346
1356
|
break;
|
|
1347
1357
|
}
|
|
1348
1358
|
error("Failed to read app router layout file");
|
|
1349
1359
|
return _context3.abrupt("return", {
|
|
1350
1360
|
abort: true
|
|
1351
1361
|
});
|
|
1352
|
-
case
|
|
1362
|
+
case 189:
|
|
1353
1363
|
res = transformNextAppRouterValProvider({
|
|
1354
1364
|
path: analysis.appRouterLayoutPath,
|
|
1355
1365
|
source: analysis.appRouterLayoutFile
|
|
@@ -1373,43 +1383,43 @@ function _plan() {
|
|
|
1373
1383
|
}
|
|
1374
1384
|
});
|
|
1375
1385
|
if (defaultAnswers) {
|
|
1376
|
-
_context3.next =
|
|
1386
|
+
_context3.next = 199;
|
|
1377
1387
|
break;
|
|
1378
1388
|
}
|
|
1379
|
-
_context3.next =
|
|
1389
|
+
_context3.next = 196;
|
|
1380
1390
|
return prompts.confirm({
|
|
1381
1391
|
message: "Automatically patch ".concat(analysis.appRouterLayoutPath, " file?"),
|
|
1382
1392
|
"default": true
|
|
1383
1393
|
});
|
|
1384
|
-
case
|
|
1385
|
-
_context3.
|
|
1386
|
-
_context3.next =
|
|
1394
|
+
case 196:
|
|
1395
|
+
_context3.t7 = _context3.sent;
|
|
1396
|
+
_context3.next = 200;
|
|
1387
1397
|
break;
|
|
1388
|
-
case
|
|
1389
|
-
_context3.
|
|
1390
|
-
case
|
|
1391
|
-
_answer7 = _context3.
|
|
1398
|
+
case 199:
|
|
1399
|
+
_context3.t7 = true;
|
|
1400
|
+
case 200:
|
|
1401
|
+
_answer7 = _context3.t7;
|
|
1392
1402
|
if (!_answer7) {
|
|
1393
|
-
_context3.next =
|
|
1403
|
+
_context3.next = 213;
|
|
1394
1404
|
break;
|
|
1395
1405
|
}
|
|
1396
1406
|
if (defaultAnswers) {
|
|
1397
|
-
_context3.next =
|
|
1407
|
+
_context3.next = 208;
|
|
1398
1408
|
break;
|
|
1399
1409
|
}
|
|
1400
|
-
_context3.next =
|
|
1410
|
+
_context3.next = 205;
|
|
1401
1411
|
return prompts.confirm({
|
|
1402
1412
|
message: "Do you accept the following patch:\n".concat(s, "\n"),
|
|
1403
1413
|
"default": true
|
|
1404
1414
|
});
|
|
1405
|
-
case
|
|
1406
|
-
_context3.
|
|
1407
|
-
_context3.next =
|
|
1415
|
+
case 205:
|
|
1416
|
+
_context3.t8 = _context3.sent;
|
|
1417
|
+
_context3.next = 209;
|
|
1408
1418
|
break;
|
|
1409
|
-
case
|
|
1410
|
-
_context3.
|
|
1411
|
-
case
|
|
1412
|
-
_answer8 = _context3.
|
|
1419
|
+
case 208:
|
|
1420
|
+
_context3.t8 = true;
|
|
1421
|
+
case 209:
|
|
1422
|
+
_answer8 = _context3.t8;
|
|
1413
1423
|
if (!_answer8) {
|
|
1414
1424
|
warn(NO_PATCH_WARNING);
|
|
1415
1425
|
plan.updateAppLayout = false;
|
|
@@ -1419,70 +1429,70 @@ function _plan() {
|
|
|
1419
1429
|
source: res
|
|
1420
1430
|
};
|
|
1421
1431
|
}
|
|
1422
|
-
_context3.next =
|
|
1432
|
+
_context3.next = 214;
|
|
1423
1433
|
break;
|
|
1424
|
-
case
|
|
1434
|
+
case 213:
|
|
1425
1435
|
warn(NO_PATCH_WARNING);
|
|
1426
|
-
case
|
|
1436
|
+
case 214:
|
|
1427
1437
|
if (analysis.pagesRouter) {
|
|
1428
1438
|
warn(NO_PATCH_WARNING);
|
|
1429
1439
|
}
|
|
1430
1440
|
if (!analysis.valEslintVersion) {
|
|
1431
|
-
_context3.next =
|
|
1441
|
+
_context3.next = 246;
|
|
1432
1442
|
break;
|
|
1433
1443
|
}
|
|
1434
1444
|
if (!analysis.isValEslintRulesConfigured) {
|
|
1435
|
-
_context3.next =
|
|
1445
|
+
_context3.next = 220;
|
|
1436
1446
|
break;
|
|
1437
1447
|
}
|
|
1438
1448
|
warn(" @valbuild/eslint-plugin rules: already configured");
|
|
1439
|
-
_context3.next =
|
|
1449
|
+
_context3.next = 246;
|
|
1440
1450
|
break;
|
|
1441
|
-
case
|
|
1451
|
+
case 220:
|
|
1442
1452
|
if (!analysis.eslintRcJsPath) {
|
|
1443
|
-
_context3.next =
|
|
1453
|
+
_context3.next = 224;
|
|
1444
1454
|
break;
|
|
1445
1455
|
}
|
|
1446
1456
|
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');
|
|
1447
|
-
_context3.next =
|
|
1457
|
+
_context3.next = 246;
|
|
1448
1458
|
break;
|
|
1449
|
-
case
|
|
1459
|
+
case 224:
|
|
1450
1460
|
if (!analysis.eslintRcJsonPath) {
|
|
1451
|
-
_context3.next =
|
|
1461
|
+
_context3.next = 245;
|
|
1452
1462
|
break;
|
|
1453
1463
|
}
|
|
1454
1464
|
if (defaultAnswers) {
|
|
1455
|
-
_context3.next =
|
|
1465
|
+
_context3.next = 231;
|
|
1456
1466
|
break;
|
|
1457
1467
|
}
|
|
1458
|
-
_context3.next =
|
|
1468
|
+
_context3.next = 228;
|
|
1459
1469
|
return prompts.confirm({
|
|
1460
1470
|
message: "Patch eslintrc.json to use the recommended Val eslint rules?",
|
|
1461
1471
|
"default": true
|
|
1462
1472
|
});
|
|
1463
|
-
case
|
|
1464
|
-
_context3.
|
|
1465
|
-
_context3.next =
|
|
1473
|
+
case 228:
|
|
1474
|
+
_context3.t9 = _context3.sent;
|
|
1475
|
+
_context3.next = 232;
|
|
1466
1476
|
break;
|
|
1467
|
-
case
|
|
1468
|
-
_context3.
|
|
1469
|
-
case
|
|
1470
|
-
_answer9 = _context3.
|
|
1477
|
+
case 231:
|
|
1478
|
+
_context3.t9 = true;
|
|
1479
|
+
case 232:
|
|
1480
|
+
_answer9 = _context3.t9;
|
|
1471
1481
|
if (!_answer9) {
|
|
1472
|
-
_context3.next =
|
|
1482
|
+
_context3.next = 243;
|
|
1473
1483
|
break;
|
|
1474
1484
|
}
|
|
1475
1485
|
currentEslintRc = fs__default["default"].readFileSync(analysis.eslintRcJsonPath, "utf-8");
|
|
1476
1486
|
parsedEslint = JSON.parse(currentEslintRc);
|
|
1477
1487
|
if (!(_typeof(parsedEslint) !== "object")) {
|
|
1478
|
-
_context3.next =
|
|
1488
|
+
_context3.next = 239;
|
|
1479
1489
|
break;
|
|
1480
1490
|
}
|
|
1481
1491
|
error("Could not patch eslint: ".concat(analysis.eslintRcJsonPath, " was not an object"));
|
|
1482
1492
|
return _context3.abrupt("return", {
|
|
1483
1493
|
abort: true
|
|
1484
1494
|
});
|
|
1485
|
-
case
|
|
1495
|
+
case 239:
|
|
1486
1496
|
if (typeof parsedEslint["extends"] === "string") {
|
|
1487
1497
|
parsedEslint["extends"] = [parsedEslint["extends"]];
|
|
1488
1498
|
}
|
|
@@ -1492,23 +1502,33 @@ function _plan() {
|
|
|
1492
1502
|
path: analysis.eslintRcJsonPath,
|
|
1493
1503
|
source: JSON.stringify(parsedEslint, null, 2) + "\n"
|
|
1494
1504
|
};
|
|
1495
|
-
case
|
|
1496
|
-
_context3.next =
|
|
1505
|
+
case 243:
|
|
1506
|
+
_context3.next = 246;
|
|
1497
1507
|
break;
|
|
1498
|
-
case
|
|
1508
|
+
case 245:
|
|
1499
1509
|
warn("Cannot patch eslint: failed to find eslint config file");
|
|
1500
|
-
case
|
|
1510
|
+
case 246:
|
|
1501
1511
|
if (!analysis.gitIgnorePath) {
|
|
1502
|
-
_context3.next =
|
|
1512
|
+
_context3.next = 258;
|
|
1513
|
+
break;
|
|
1514
|
+
}
|
|
1515
|
+
if (defaultAnswers) {
|
|
1516
|
+
_context3.next = 253;
|
|
1503
1517
|
break;
|
|
1504
1518
|
}
|
|
1505
|
-
_context3.next =
|
|
1519
|
+
_context3.next = 250;
|
|
1506
1520
|
return prompts.confirm({
|
|
1507
1521
|
message: "Append .gitignore entry for Val cache? (recommended)",
|
|
1508
1522
|
"default": true
|
|
1509
1523
|
});
|
|
1510
|
-
case
|
|
1511
|
-
|
|
1524
|
+
case 250:
|
|
1525
|
+
_context3.t10 = _context3.sent;
|
|
1526
|
+
_context3.next = 254;
|
|
1527
|
+
break;
|
|
1528
|
+
case 253:
|
|
1529
|
+
_context3.t10 = true;
|
|
1530
|
+
case 254:
|
|
1531
|
+
_answer10 = _context3.t10;
|
|
1512
1532
|
if (_answer10) {
|
|
1513
1533
|
plan.updateGitIgnore = {
|
|
1514
1534
|
path: analysis.gitIgnorePath,
|
|
@@ -1517,49 +1537,59 @@ function _plan() {
|
|
|
1517
1537
|
} else {
|
|
1518
1538
|
plan.updateGitIgnore = false;
|
|
1519
1539
|
}
|
|
1520
|
-
_context3.next =
|
|
1540
|
+
_context3.next = 259;
|
|
1521
1541
|
break;
|
|
1522
|
-
case
|
|
1542
|
+
case 258:
|
|
1523
1543
|
plan.updateGitIgnore = false;
|
|
1524
|
-
case
|
|
1525
|
-
|
|
1544
|
+
case 259:
|
|
1545
|
+
if (defaultAnswers) {
|
|
1546
|
+
_context3.next = 265;
|
|
1547
|
+
break;
|
|
1548
|
+
}
|
|
1549
|
+
_context3.next = 262;
|
|
1526
1550
|
return prompts.confirm({
|
|
1527
1551
|
message: "Add the Val Build IntelliSense to .vscode/extensions.json?",
|
|
1528
1552
|
"default": true
|
|
1529
1553
|
});
|
|
1530
|
-
case
|
|
1531
|
-
|
|
1554
|
+
case 262:
|
|
1555
|
+
_context3.t11 = _context3.sent;
|
|
1556
|
+
_context3.next = 266;
|
|
1557
|
+
break;
|
|
1558
|
+
case 265:
|
|
1559
|
+
_context3.t11 = true;
|
|
1560
|
+
case 266:
|
|
1561
|
+
_answer11 = _context3.t11;
|
|
1532
1562
|
if (!_answer11) {
|
|
1533
|
-
_context3.next =
|
|
1563
|
+
_context3.next = 292;
|
|
1534
1564
|
break;
|
|
1535
1565
|
}
|
|
1536
1566
|
vscodeDir = path__default["default"].join(analysis.root, ".vscode");
|
|
1537
1567
|
settingsPath = path__default["default"].join(vscodeDir, "extensions.json");
|
|
1538
1568
|
currentSettings = {};
|
|
1539
|
-
_context3.prev =
|
|
1569
|
+
_context3.prev = 271;
|
|
1540
1570
|
currentSettingsFile = fs__default["default"].readFileSync(settingsPath, "utf-8");
|
|
1541
1571
|
if (!currentSettingsFile) {
|
|
1542
|
-
_context3.next =
|
|
1572
|
+
_context3.next = 282;
|
|
1543
1573
|
break;
|
|
1544
1574
|
}
|
|
1545
|
-
_context3.prev =
|
|
1575
|
+
_context3.prev = 274;
|
|
1546
1576
|
currentSettings = JSON.parse(currentSettingsFile);
|
|
1547
|
-
_context3.next =
|
|
1577
|
+
_context3.next = 282;
|
|
1548
1578
|
break;
|
|
1549
|
-
case
|
|
1550
|
-
_context3.prev =
|
|
1551
|
-
_context3.
|
|
1552
|
-
warn("Failed to parse VS Code extensions.json found here: ".concat(settingsPath, ".").concat(_context3.
|
|
1579
|
+
case 278:
|
|
1580
|
+
_context3.prev = 278;
|
|
1581
|
+
_context3.t12 = _context3["catch"](274);
|
|
1582
|
+
warn("Failed to parse VS Code extensions.json found here: ".concat(settingsPath, ".").concat(_context3.t12 instanceof Error ? "Parse error: ".concat(_context3.t12.message) : ""));
|
|
1553
1583
|
return _context3.abrupt("return", {
|
|
1554
1584
|
abort: true
|
|
1555
1585
|
});
|
|
1556
|
-
case
|
|
1557
|
-
_context3.next =
|
|
1586
|
+
case 282:
|
|
1587
|
+
_context3.next = 286;
|
|
1558
1588
|
break;
|
|
1559
|
-
case
|
|
1560
|
-
_context3.prev =
|
|
1561
|
-
_context3.
|
|
1562
|
-
case
|
|
1589
|
+
case 284:
|
|
1590
|
+
_context3.prev = 284;
|
|
1591
|
+
_context3.t13 = _context3["catch"](271);
|
|
1592
|
+
case 286:
|
|
1563
1593
|
currentRecommendations =
|
|
1564
1594
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1565
1595
|
currentSettings.recommendations;
|
|
@@ -1573,17 +1603,17 @@ function _plan() {
|
|
|
1573
1603
|
path: settingsPath,
|
|
1574
1604
|
source: JSON.stringify(currentSettings, null, 2)
|
|
1575
1605
|
};
|
|
1576
|
-
_context3.next =
|
|
1606
|
+
_context3.next = 293;
|
|
1577
1607
|
break;
|
|
1578
|
-
case
|
|
1608
|
+
case 292:
|
|
1579
1609
|
plan.updateVSCodeSettings = false;
|
|
1580
|
-
case
|
|
1610
|
+
case 293:
|
|
1581
1611
|
return _context3.abrupt("return", plan);
|
|
1582
|
-
case
|
|
1612
|
+
case 294:
|
|
1583
1613
|
case "end":
|
|
1584
1614
|
return _context3.stop();
|
|
1585
1615
|
}
|
|
1586
|
-
}, _callee3, null, [[
|
|
1616
|
+
}, _callee3, null, [[271, 284], [274, 278]]);
|
|
1587
1617
|
}));
|
|
1588
1618
|
return _plan.apply(this, arguments);
|
|
1589
1619
|
}
|