@valbuild/init 0.60.23 → 0.60.27
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 +265 -208
- package/main/dist/valbuild-init-main.cjs.prod.js +265 -208
- package/main/dist/valbuild-init-main.esm.js +265 -208
- package/package.json +1 -1
- package/src/init.ts +63 -18
- package/src/templates.ts +3 -3
|
@@ -516,7 +516,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
516
516
|
|
|
517
517
|
var packageJson = {
|
|
518
518
|
name: "@valbuild/init",
|
|
519
|
-
version: "0.60.
|
|
519
|
+
version: "0.60.27",
|
|
520
520
|
description: "Initialize a new val.build project",
|
|
521
521
|
exports: {
|
|
522
522
|
"./main": {
|
|
@@ -588,7 +588,7 @@ var VAL_APP_PAGE = function VAL_APP_PAGE(configImportPath) {
|
|
|
588
588
|
return "import { ValApp } from \"@valbuild/next\";\nimport { config } from \"".concat(configImportPath, "\";\n\nexport default function Val() {\n return <ValApp config={config} />;\n}\n");
|
|
589
589
|
};
|
|
590
590
|
var BASIC_EXAMPLE = function BASIC_EXAMPLE(moduleId, configImportPath, isJavaScript) {
|
|
591
|
-
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 *
|
|
591
|
+
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");
|
|
592
592
|
};
|
|
593
593
|
|
|
594
594
|
function error(message) {
|
|
@@ -676,7 +676,7 @@ function walk(dir) {
|
|
|
676
676
|
}
|
|
677
677
|
var analyze = /*#__PURE__*/function () {
|
|
678
678
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(root, files) {
|
|
679
|
-
var analysis, packageJsonPath, packageJsonText, _packageJson, _semver$minVersion, minNextVersion, _semver$minVersion2, minValVersion, pagesRouterAppPath, appRouterLayoutPath, git, gitStatus, gitRemoteOrigin, parts, owner, repo, gitIgnorePath;
|
|
679
|
+
var analysis, packageJsonPath, packageJsonText, _packageJson, _semver$minVersion, minNextVersion, _semver$minVersion2, minValVersion, _semver$minVersion3, _minValVersion, pagesRouterAppPath, appRouterLayoutPath, git, gitStatus, gitRemoteOrigin, parts, owner, repo, gitIgnorePath;
|
|
680
680
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
681
681
|
while (1) switch (_context.prev = _context.next) {
|
|
682
682
|
case 0:
|
|
@@ -694,38 +694,46 @@ var analyze = /*#__PURE__*/function () {
|
|
|
694
694
|
});
|
|
695
695
|
analysis.packageJsonDir = packageJsonPath && path__default["default"].dirname(packageJsonPath);
|
|
696
696
|
if (!packageJsonPath) {
|
|
697
|
-
_context.next =
|
|
697
|
+
_context.next = 22;
|
|
698
698
|
break;
|
|
699
699
|
}
|
|
700
700
|
packageJsonText = fs__default["default"].readFileSync(packageJsonPath, "utf8");
|
|
701
701
|
if (!packageJsonText) {
|
|
702
|
-
_context.next =
|
|
702
|
+
_context.next = 22;
|
|
703
703
|
break;
|
|
704
704
|
}
|
|
705
705
|
_context.prev = 8;
|
|
706
706
|
_packageJson = JSON.parse(packageJsonText);
|
|
707
|
-
analysis.
|
|
707
|
+
analysis.isValCoreInstalled = !!_packageJson.dependencies["@valbuild/core"];
|
|
708
|
+
analysis.isValNextInstalled = !!_packageJson.dependencies["@valbuild/next"];
|
|
708
709
|
analysis.isNextInstalled = !!_packageJson.dependencies["next"];
|
|
709
710
|
analysis.valEslintVersion = _packageJson.devDependencies["@valbuild/eslint-plugin"] || _packageJson.dependencies["@valbuild/eslint-plugin"];
|
|
710
711
|
analysis.nextVersion = _packageJson.dependencies["next"];
|
|
711
|
-
analysis.
|
|
712
|
-
|
|
712
|
+
analysis.valCoreVersion = _packageJson.dependencies["@valbuild/core"];
|
|
713
|
+
analysis.valNextVersion = _packageJson.dependencies["@valbuild/next"];
|
|
714
|
+
_context.next = 22;
|
|
713
715
|
break;
|
|
714
|
-
case
|
|
715
|
-
_context.prev =
|
|
716
|
+
case 19:
|
|
717
|
+
_context.prev = 19;
|
|
716
718
|
_context.t0 = _context["catch"](8);
|
|
717
719
|
throw new Error("Failed to parse package.json in file: ".concat(packageJsonPath));
|
|
718
|
-
case
|
|
720
|
+
case 22:
|
|
719
721
|
if (analysis.nextVersion) {
|
|
720
722
|
minNextVersion = (_semver$minVersion = semver__default["default"].minVersion(analysis.nextVersion)) === null || _semver$minVersion === void 0 ? void 0 : _semver$minVersion.version;
|
|
721
723
|
if (minNextVersion) {
|
|
722
724
|
analysis.nextVersionIsSatisfied = semver__default["default"].satisfies(minNextVersion, ">=" + MIN_NEXT_VERSION);
|
|
723
725
|
}
|
|
724
726
|
}
|
|
725
|
-
if (analysis.
|
|
726
|
-
minValVersion = (_semver$minVersion2 = semver__default["default"].minVersion(analysis.
|
|
727
|
+
if (analysis.valNextVersion) {
|
|
728
|
+
minValVersion = (_semver$minVersion2 = semver__default["default"].minVersion(analysis.valNextVersion)) === null || _semver$minVersion2 === void 0 ? void 0 : _semver$minVersion2.version;
|
|
727
729
|
if (minValVersion) {
|
|
728
|
-
analysis.
|
|
730
|
+
analysis.valNextVersionIsSatisfied = semver__default["default"].satisfies(minValVersion, ">=" + MIN_VAL_VERSION);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
if (analysis.valCoreVersion) {
|
|
734
|
+
_minValVersion = (_semver$minVersion3 = semver__default["default"].minVersion(analysis.valCoreVersion)) === null || _semver$minVersion3 === void 0 ? void 0 : _semver$minVersion3.version;
|
|
735
|
+
if (_minValVersion) {
|
|
736
|
+
analysis.valCoreVersionIsSatisfied = semver__default["default"].satisfies(_minValVersion, ">=" + MIN_VAL_VERSION);
|
|
729
737
|
}
|
|
730
738
|
}
|
|
731
739
|
analysis.eslintRcJsPath = files.find(function (file) {
|
|
@@ -775,15 +783,15 @@ var analyze = /*#__PURE__*/function () {
|
|
|
775
783
|
analysis.appRouterPath = path__default["default"].dirname(appRouterLayoutPath);
|
|
776
784
|
analysis.srcDir = path__default["default"].dirname(analysis.appRouterPath);
|
|
777
785
|
}
|
|
778
|
-
_context.prev =
|
|
786
|
+
_context.prev = 34;
|
|
779
787
|
git = simpleGit__default["default"](root);
|
|
780
|
-
_context.next =
|
|
788
|
+
_context.next = 38;
|
|
781
789
|
return git.status([]);
|
|
782
|
-
case
|
|
790
|
+
case 38:
|
|
783
791
|
gitStatus = _context.sent;
|
|
784
|
-
_context.next =
|
|
792
|
+
_context.next = 41;
|
|
785
793
|
return git.remote(["-v"]);
|
|
786
|
-
case
|
|
794
|
+
case 41:
|
|
787
795
|
gitRemoteOrigin = _context.sent;
|
|
788
796
|
analysis.hasGit = true;
|
|
789
797
|
analysis.isGitHub = gitRemoteOrigin ? !!gitRemoteOrigin.includes("github.com") : false;
|
|
@@ -799,21 +807,21 @@ var analyze = /*#__PURE__*/function () {
|
|
|
799
807
|
repo: repo
|
|
800
808
|
};
|
|
801
809
|
}
|
|
802
|
-
_context.next =
|
|
810
|
+
_context.next = 50;
|
|
803
811
|
break;
|
|
804
|
-
case
|
|
805
|
-
_context.prev =
|
|
806
|
-
_context.t1 = _context["catch"](
|
|
807
|
-
case
|
|
812
|
+
case 48:
|
|
813
|
+
_context.prev = 48;
|
|
814
|
+
_context.t1 = _context["catch"](34);
|
|
815
|
+
case 50:
|
|
808
816
|
gitIgnorePath = path__default["default"].join(root, ".gitignore");
|
|
809
817
|
analysis.gitIgnorePath = gitIgnorePath;
|
|
810
818
|
analysis.gitIgnoreFile = fs__default["default"].readFileSync(gitIgnorePath, "utf-8");
|
|
811
819
|
return _context.abrupt("return", analysis);
|
|
812
|
-
case
|
|
820
|
+
case 54:
|
|
813
821
|
case "end":
|
|
814
822
|
return _context.stop();
|
|
815
823
|
}
|
|
816
|
-
}, _callee, null, [[8,
|
|
824
|
+
}, _callee, null, [[8, 19], [34, 48]]);
|
|
817
825
|
}));
|
|
818
826
|
return function analyze(_x, _x2) {
|
|
819
827
|
return _ref2.apply(this, arguments);
|
|
@@ -827,10 +835,11 @@ function _plan() {
|
|
|
827
835
|
var defaultAnswers,
|
|
828
836
|
plan,
|
|
829
837
|
answer,
|
|
838
|
+
_answer,
|
|
830
839
|
tsconfigJsonPath,
|
|
831
840
|
jsconfigJsonPath,
|
|
832
|
-
_answer,
|
|
833
841
|
_answer2,
|
|
842
|
+
_answer3,
|
|
834
843
|
valConfigPath,
|
|
835
844
|
valUtilsDir,
|
|
836
845
|
valUtilsImportPath,
|
|
@@ -839,26 +848,26 @@ function _plan() {
|
|
|
839
848
|
valPageImportPath,
|
|
840
849
|
valRouterPath,
|
|
841
850
|
valRouterImportPath,
|
|
842
|
-
_answer3,
|
|
843
851
|
_answer4,
|
|
852
|
+
_answer5,
|
|
844
853
|
NO_PATCH_WARNING,
|
|
845
854
|
res,
|
|
846
855
|
diff$1,
|
|
847
856
|
s,
|
|
848
|
-
_answer5,
|
|
849
857
|
_answer6,
|
|
850
858
|
_answer7,
|
|
859
|
+
_answer8,
|
|
851
860
|
currentEslintRc,
|
|
852
861
|
parsedEslint,
|
|
853
|
-
_answer8,
|
|
854
862
|
_answer9,
|
|
863
|
+
_answer10,
|
|
855
864
|
vscodeDir,
|
|
856
865
|
settingsPath,
|
|
857
866
|
currentSettings,
|
|
858
867
|
currentSettingsFile,
|
|
859
868
|
currentRecommendations,
|
|
860
869
|
valBuildIntelliSense,
|
|
861
|
-
|
|
870
|
+
_answer11,
|
|
862
871
|
exampleDir,
|
|
863
872
|
examplePath,
|
|
864
873
|
exampleImport,
|
|
@@ -919,20 +928,20 @@ function _plan() {
|
|
|
919
928
|
abort: true
|
|
920
929
|
});
|
|
921
930
|
case 20:
|
|
922
|
-
if (analysis.
|
|
931
|
+
if (analysis.isValCoreInstalled) {
|
|
923
932
|
_context3.next = 25;
|
|
924
933
|
break;
|
|
925
934
|
}
|
|
926
|
-
error("Install @valbuild/
|
|
935
|
+
error("Install @valbuild/core first");
|
|
927
936
|
return _context3.abrupt("return", {
|
|
928
937
|
abort: true
|
|
929
938
|
});
|
|
930
939
|
case 25:
|
|
931
|
-
if (analysis.
|
|
940
|
+
if (analysis.valCoreVersionIsSatisfied) {
|
|
932
941
|
_context3.next = 40;
|
|
933
942
|
break;
|
|
934
943
|
}
|
|
935
|
-
warn(" This init script expects @valbuild/
|
|
944
|
+
warn(" This init script expects @valbuild/core >= ".concat(MIN_VAL_VERSION, ". Found: ").concat(analysis.valCoreVersion));
|
|
936
945
|
if (defaultAnswers) {
|
|
937
946
|
_context3.next = 33;
|
|
938
947
|
break;
|
|
@@ -954,7 +963,7 @@ function _plan() {
|
|
|
954
963
|
_context3.next = 38;
|
|
955
964
|
break;
|
|
956
965
|
}
|
|
957
|
-
error("Aborted:
|
|
966
|
+
error("Aborted: @valbuild/core version is not satisfied.\n\nInstall the @valbuild/core@".concat(MIN_VAL_VERSION, " package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/core@").concat(MIN_VAL_VERSION, "\n"));
|
|
958
967
|
return _context3.abrupt("return", {
|
|
959
968
|
abort: true
|
|
960
969
|
});
|
|
@@ -962,23 +971,70 @@ function _plan() {
|
|
|
962
971
|
_context3.next = 41;
|
|
963
972
|
break;
|
|
964
973
|
case 40:
|
|
965
|
-
info(" Val version: found ".concat(analysis.
|
|
974
|
+
info(" Val version: found ".concat(analysis.valCoreVersion, " >= ").concat(MIN_VAL_VERSION), {
|
|
966
975
|
isGood: true
|
|
967
976
|
});
|
|
968
977
|
case 41:
|
|
969
|
-
if (analysis.
|
|
978
|
+
if (analysis.isValNextInstalled) {
|
|
970
979
|
_context3.next = 46;
|
|
971
980
|
break;
|
|
972
981
|
}
|
|
973
|
-
error("
|
|
982
|
+
error("Install @valbuild/next first");
|
|
974
983
|
return _context3.abrupt("return", {
|
|
975
984
|
abort: true
|
|
976
985
|
});
|
|
977
986
|
case 46:
|
|
987
|
+
if (analysis.valNextVersionIsSatisfied) {
|
|
988
|
+
_context3.next = 61;
|
|
989
|
+
break;
|
|
990
|
+
}
|
|
991
|
+
warn(" This init script expects @valbuild/next >= ".concat(MIN_VAL_VERSION, ". Found: ").concat(analysis.valNextVersion));
|
|
992
|
+
if (defaultAnswers) {
|
|
993
|
+
_context3.next = 54;
|
|
994
|
+
break;
|
|
995
|
+
}
|
|
996
|
+
_context3.next = 51;
|
|
997
|
+
return prompts.confirm({
|
|
998
|
+
message: "Continue?",
|
|
999
|
+
"default": false
|
|
1000
|
+
});
|
|
1001
|
+
case 51:
|
|
1002
|
+
_context3.t1 = _context3.sent;
|
|
1003
|
+
_context3.next = 55;
|
|
1004
|
+
break;
|
|
1005
|
+
case 54:
|
|
1006
|
+
_context3.t1 = false;
|
|
1007
|
+
case 55:
|
|
1008
|
+
_answer = _context3.t1;
|
|
1009
|
+
if (_answer) {
|
|
1010
|
+
_context3.next = 59;
|
|
1011
|
+
break;
|
|
1012
|
+
}
|
|
1013
|
+
error("Aborted: @valbuild/next version is not satisfied.\n\nInstall the @valbuild/next@".concat(MIN_VAL_VERSION, " package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/next@").concat(MIN_VAL_VERSION, "\n"));
|
|
1014
|
+
return _context3.abrupt("return", {
|
|
1015
|
+
abort: true
|
|
1016
|
+
});
|
|
1017
|
+
case 59:
|
|
1018
|
+
_context3.next = 62;
|
|
1019
|
+
break;
|
|
1020
|
+
case 61:
|
|
1021
|
+
info(" Val version: found ".concat(analysis.valNextVersion, " >= ").concat(MIN_VAL_VERSION), {
|
|
1022
|
+
isGood: true
|
|
1023
|
+
});
|
|
1024
|
+
case 62:
|
|
1025
|
+
if (analysis.nextVersionIsSatisfied) {
|
|
1026
|
+
_context3.next = 67;
|
|
1027
|
+
break;
|
|
1028
|
+
}
|
|
1029
|
+
error("Val requires Next.js >= ".concat(MIN_NEXT_VERSION, ". Found: ").concat(analysis.nextVersion));
|
|
1030
|
+
return _context3.abrupt("return", {
|
|
1031
|
+
abort: true
|
|
1032
|
+
});
|
|
1033
|
+
case 67:
|
|
978
1034
|
info(" Next.js version: found ".concat(analysis.nextVersion, " >= ").concat(MIN_NEXT_VERSION), {
|
|
979
1035
|
isGood: true
|
|
980
1036
|
});
|
|
981
|
-
case
|
|
1037
|
+
case 68:
|
|
982
1038
|
if (analysis.isTypeScript) {
|
|
983
1039
|
info(" Use: TypeScript", {
|
|
984
1040
|
isGood: true
|
|
@@ -994,81 +1050,81 @@ function _plan() {
|
|
|
994
1050
|
}
|
|
995
1051
|
}
|
|
996
1052
|
if (!analysis.isTypeScript) {
|
|
997
|
-
_context3.next =
|
|
1053
|
+
_context3.next = 80;
|
|
998
1054
|
break;
|
|
999
1055
|
}
|
|
1000
1056
|
tsconfigJsonPath = path__default["default"].join(analysis.root, "tsconfig.json");
|
|
1001
1057
|
if (!fs__default["default"].statSync(tsconfigJsonPath).isFile()) {
|
|
1002
|
-
_context3.next =
|
|
1058
|
+
_context3.next = 76;
|
|
1003
1059
|
break;
|
|
1004
1060
|
}
|
|
1005
1061
|
info(" tsconfig.json: found", {
|
|
1006
1062
|
isGood: true
|
|
1007
1063
|
});
|
|
1008
|
-
_context3.next =
|
|
1064
|
+
_context3.next = 78;
|
|
1009
1065
|
break;
|
|
1010
|
-
case
|
|
1066
|
+
case 76:
|
|
1011
1067
|
error("tsconfig.json: Failed to find tsconfig.json");
|
|
1012
1068
|
return _context3.abrupt("return", {
|
|
1013
1069
|
abort: true
|
|
1014
1070
|
});
|
|
1015
|
-
case
|
|
1016
|
-
_context3.next =
|
|
1071
|
+
case 78:
|
|
1072
|
+
_context3.next = 87;
|
|
1017
1073
|
break;
|
|
1018
|
-
case
|
|
1074
|
+
case 80:
|
|
1019
1075
|
jsconfigJsonPath = path__default["default"].join(analysis.root, "jsconfig.json");
|
|
1020
1076
|
if (!fs__default["default"].statSync(jsconfigJsonPath).isFile()) {
|
|
1021
|
-
_context3.next =
|
|
1077
|
+
_context3.next = 85;
|
|
1022
1078
|
break;
|
|
1023
1079
|
}
|
|
1024
1080
|
info(" jsconfig.json: found", {
|
|
1025
1081
|
isGood: true
|
|
1026
1082
|
});
|
|
1027
|
-
_context3.next =
|
|
1083
|
+
_context3.next = 87;
|
|
1028
1084
|
break;
|
|
1029
|
-
case
|
|
1085
|
+
case 85:
|
|
1030
1086
|
error(" jsconfig.json: failed to find jsconfig.json");
|
|
1031
1087
|
return _context3.abrupt("return", {
|
|
1032
1088
|
abort: true
|
|
1033
1089
|
});
|
|
1034
|
-
case
|
|
1090
|
+
case 87:
|
|
1035
1091
|
if (!(analysis.valEslintVersion === undefined)) {
|
|
1036
|
-
_context3.next =
|
|
1092
|
+
_context3.next = 101;
|
|
1037
1093
|
break;
|
|
1038
1094
|
}
|
|
1039
1095
|
if (defaultAnswers) {
|
|
1040
|
-
_context3.next =
|
|
1096
|
+
_context3.next = 94;
|
|
1041
1097
|
break;
|
|
1042
1098
|
}
|
|
1043
|
-
_context3.next =
|
|
1099
|
+
_context3.next = 91;
|
|
1044
1100
|
return prompts.confirm({
|
|
1045
1101
|
message: "The recommended Val eslint plugin (@valbuild/eslint-plugin) is not installed. Continue?",
|
|
1046
1102
|
"default": false
|
|
1047
1103
|
});
|
|
1048
|
-
case
|
|
1049
|
-
_context3.
|
|
1050
|
-
_context3.next =
|
|
1104
|
+
case 91:
|
|
1105
|
+
_context3.t2 = _context3.sent;
|
|
1106
|
+
_context3.next = 95;
|
|
1051
1107
|
break;
|
|
1052
|
-
case
|
|
1053
|
-
_context3.
|
|
1054
|
-
case
|
|
1055
|
-
|
|
1056
|
-
if (
|
|
1057
|
-
_context3.next =
|
|
1108
|
+
case 94:
|
|
1109
|
+
_context3.t2 = false;
|
|
1110
|
+
case 95:
|
|
1111
|
+
_answer2 = _context3.t2;
|
|
1112
|
+
if (_answer2) {
|
|
1113
|
+
_context3.next = 99;
|
|
1058
1114
|
break;
|
|
1059
1115
|
}
|
|
1060
1116
|
error("Aborted: the Val eslint plugin is not installed.\n\nInstall the @valbuild/eslint-plugin package with your favorite package manager.\n\nExample:\n\n npm install -D @valbuild/eslint-plugin\n");
|
|
1061
1117
|
return _context3.abrupt("return", {
|
|
1062
1118
|
abort: true
|
|
1063
1119
|
});
|
|
1064
|
-
case
|
|
1065
|
-
_context3.next =
|
|
1120
|
+
case 99:
|
|
1121
|
+
_context3.next = 102;
|
|
1066
1122
|
break;
|
|
1067
|
-
case
|
|
1123
|
+
case 101:
|
|
1068
1124
|
info(" @valbuild/eslint-plugin: installed", {
|
|
1069
1125
|
isGood: true
|
|
1070
1126
|
});
|
|
1071
|
-
case
|
|
1127
|
+
case 102:
|
|
1072
1128
|
if (analysis.appRouter) {
|
|
1073
1129
|
info(" Use: App Router", {
|
|
1074
1130
|
isGood: true
|
|
@@ -1094,55 +1150,55 @@ function _plan() {
|
|
|
1094
1150
|
warn(" Git state: dirty");
|
|
1095
1151
|
}
|
|
1096
1152
|
if (analysis.isGitClean) {
|
|
1097
|
-
_context3.next =
|
|
1153
|
+
_context3.next = 122;
|
|
1098
1154
|
break;
|
|
1099
1155
|
}
|
|
1100
|
-
case
|
|
1156
|
+
case 107:
|
|
1101
1157
|
if (!(plan.ignoreGitDirty === undefined)) {
|
|
1102
|
-
_context3.next =
|
|
1158
|
+
_context3.next = 122;
|
|
1103
1159
|
break;
|
|
1104
1160
|
}
|
|
1105
1161
|
if (defaultAnswers) {
|
|
1106
|
-
_context3.next =
|
|
1162
|
+
_context3.next = 114;
|
|
1107
1163
|
break;
|
|
1108
1164
|
}
|
|
1109
|
-
_context3.next =
|
|
1165
|
+
_context3.next = 111;
|
|
1110
1166
|
return prompts.confirm({
|
|
1111
1167
|
message: "You have uncommitted changes. Continue?",
|
|
1112
1168
|
"default": false
|
|
1113
1169
|
});
|
|
1114
|
-
case
|
|
1115
|
-
_context3.
|
|
1116
|
-
_context3.next =
|
|
1170
|
+
case 111:
|
|
1171
|
+
_context3.t3 = _context3.sent;
|
|
1172
|
+
_context3.next = 115;
|
|
1117
1173
|
break;
|
|
1118
|
-
case
|
|
1119
|
-
_context3.
|
|
1120
|
-
case
|
|
1121
|
-
|
|
1122
|
-
plan.ignoreGitDirty =
|
|
1123
|
-
if (
|
|
1124
|
-
_context3.next =
|
|
1174
|
+
case 114:
|
|
1175
|
+
_context3.t3 = false;
|
|
1176
|
+
case 115:
|
|
1177
|
+
_answer3 = _context3.t3;
|
|
1178
|
+
plan.ignoreGitDirty = _answer3;
|
|
1179
|
+
if (_answer3) {
|
|
1180
|
+
_context3.next = 120;
|
|
1125
1181
|
break;
|
|
1126
1182
|
}
|
|
1127
1183
|
error("Aborted: git state dirty");
|
|
1128
1184
|
return _context3.abrupt("return", {
|
|
1129
1185
|
abort: true
|
|
1130
1186
|
});
|
|
1131
|
-
case
|
|
1132
|
-
_context3.next =
|
|
1187
|
+
case 120:
|
|
1188
|
+
_context3.next = 107;
|
|
1133
1189
|
break;
|
|
1134
|
-
case
|
|
1190
|
+
case 122:
|
|
1135
1191
|
// New required files:
|
|
1136
1192
|
valConfigPath = path__default["default"].join(analysis.root, analysis.isTypeScript ? "val.config.ts" : "val.config.js");
|
|
1137
1193
|
if (!fs__default["default"].existsSync(valConfigPath)) {
|
|
1138
|
-
_context3.next =
|
|
1194
|
+
_context3.next = 126;
|
|
1139
1195
|
break;
|
|
1140
1196
|
}
|
|
1141
1197
|
error("Aborted: a Val config file: ".concat(valConfigPath, " already exists."));
|
|
1142
1198
|
return _context3.abrupt("return", {
|
|
1143
1199
|
abort: true
|
|
1144
1200
|
});
|
|
1145
|
-
case
|
|
1201
|
+
case 126:
|
|
1146
1202
|
plan.createConfigFile = {
|
|
1147
1203
|
path: valConfigPath,
|
|
1148
1204
|
source: VAL_CONFIG(!!analysis.isTypeScript, {})
|
|
@@ -1171,29 +1227,29 @@ function _plan() {
|
|
|
1171
1227
|
};
|
|
1172
1228
|
|
|
1173
1229
|
// Util files:
|
|
1174
|
-
case
|
|
1230
|
+
case 138:
|
|
1175
1231
|
if (!(plan.createValClient === undefined)) {
|
|
1176
|
-
_context3.next =
|
|
1232
|
+
_context3.next = 150;
|
|
1177
1233
|
break;
|
|
1178
1234
|
}
|
|
1179
1235
|
if (defaultAnswers) {
|
|
1180
|
-
_context3.next =
|
|
1236
|
+
_context3.next = 145;
|
|
1181
1237
|
break;
|
|
1182
1238
|
}
|
|
1183
|
-
_context3.next =
|
|
1239
|
+
_context3.next = 142;
|
|
1184
1240
|
return prompts.confirm({
|
|
1185
1241
|
message: "Setup useVal for Client Components",
|
|
1186
1242
|
"default": true
|
|
1187
1243
|
});
|
|
1188
|
-
case
|
|
1189
|
-
_context3.
|
|
1190
|
-
_context3.next =
|
|
1244
|
+
case 142:
|
|
1245
|
+
_context3.t4 = _context3.sent;
|
|
1246
|
+
_context3.next = 146;
|
|
1191
1247
|
break;
|
|
1192
|
-
case
|
|
1193
|
-
_context3.
|
|
1194
|
-
case
|
|
1195
|
-
|
|
1196
|
-
if (
|
|
1248
|
+
case 145:
|
|
1249
|
+
_context3.t4 = true;
|
|
1250
|
+
case 146:
|
|
1251
|
+
_answer4 = _context3.t4;
|
|
1252
|
+
if (_answer4) {
|
|
1197
1253
|
plan.createValClient = {
|
|
1198
1254
|
path: path__default["default"].join(valUtilsDir, analysis.isTypeScript ? "val.client.ts" : "val.client.js"),
|
|
1199
1255
|
source: VAL_CLIENT(valUtilsImportPath)
|
|
@@ -1201,31 +1257,31 @@ function _plan() {
|
|
|
1201
1257
|
} else {
|
|
1202
1258
|
plan.createValClient = false;
|
|
1203
1259
|
}
|
|
1204
|
-
_context3.next =
|
|
1260
|
+
_context3.next = 138;
|
|
1205
1261
|
break;
|
|
1206
|
-
case
|
|
1262
|
+
case 150:
|
|
1207
1263
|
if (!(plan.createValRsc === undefined)) {
|
|
1208
|
-
_context3.next =
|
|
1264
|
+
_context3.next = 162;
|
|
1209
1265
|
break;
|
|
1210
1266
|
}
|
|
1211
1267
|
if (defaultAnswers) {
|
|
1212
|
-
_context3.next =
|
|
1268
|
+
_context3.next = 157;
|
|
1213
1269
|
break;
|
|
1214
1270
|
}
|
|
1215
|
-
_context3.next =
|
|
1271
|
+
_context3.next = 154;
|
|
1216
1272
|
return prompts.confirm({
|
|
1217
1273
|
message: "Setup fetchVal for React Server Components",
|
|
1218
1274
|
"default": true
|
|
1219
1275
|
});
|
|
1220
|
-
case
|
|
1221
|
-
_context3.
|
|
1222
|
-
_context3.next =
|
|
1276
|
+
case 154:
|
|
1277
|
+
_context3.t5 = _context3.sent;
|
|
1278
|
+
_context3.next = 158;
|
|
1223
1279
|
break;
|
|
1224
|
-
case
|
|
1225
|
-
_context3.
|
|
1226
|
-
case
|
|
1227
|
-
|
|
1228
|
-
if (
|
|
1280
|
+
case 157:
|
|
1281
|
+
_context3.t5 = true;
|
|
1282
|
+
case 158:
|
|
1283
|
+
_answer5 = _context3.t5;
|
|
1284
|
+
if (_answer5) {
|
|
1229
1285
|
plan.createValRsc = {
|
|
1230
1286
|
path: path__default["default"].join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
|
|
1231
1287
|
source: VAL_RSC(valUtilsImportPath)
|
|
@@ -1233,24 +1289,24 @@ function _plan() {
|
|
|
1233
1289
|
} else {
|
|
1234
1290
|
plan.createValRsc = false;
|
|
1235
1291
|
}
|
|
1236
|
-
_context3.next =
|
|
1292
|
+
_context3.next = 150;
|
|
1237
1293
|
break;
|
|
1238
|
-
case
|
|
1294
|
+
case 162:
|
|
1239
1295
|
// Patches:
|
|
1240
1296
|
NO_PATCH_WARNING = "Remember to add the ValProvider in your root app/layout.tsx or pages/_app.tsx file.\n";
|
|
1241
1297
|
if (!analysis.appRouterLayoutPath) {
|
|
1242
|
-
_context3.next =
|
|
1298
|
+
_context3.next = 192;
|
|
1243
1299
|
break;
|
|
1244
1300
|
}
|
|
1245
1301
|
if (analysis.appRouterLayoutFile) {
|
|
1246
|
-
_context3.next =
|
|
1302
|
+
_context3.next = 167;
|
|
1247
1303
|
break;
|
|
1248
1304
|
}
|
|
1249
1305
|
error("Failed to read app router layout file");
|
|
1250
1306
|
return _context3.abrupt("return", {
|
|
1251
1307
|
abort: true
|
|
1252
1308
|
});
|
|
1253
|
-
case
|
|
1309
|
+
case 167:
|
|
1254
1310
|
res = transformNextAppRouterValProvider({
|
|
1255
1311
|
path: analysis.appRouterLayoutPath,
|
|
1256
1312
|
source: analysis.appRouterLayoutFile
|
|
@@ -1274,44 +1330,44 @@ function _plan() {
|
|
|
1274
1330
|
}
|
|
1275
1331
|
});
|
|
1276
1332
|
if (defaultAnswers) {
|
|
1277
|
-
_context3.next =
|
|
1333
|
+
_context3.next = 177;
|
|
1278
1334
|
break;
|
|
1279
1335
|
}
|
|
1280
|
-
_context3.next =
|
|
1336
|
+
_context3.next = 174;
|
|
1281
1337
|
return prompts.confirm({
|
|
1282
1338
|
message: "Automatically patch ".concat(analysis.appRouterLayoutPath, " file?"),
|
|
1283
1339
|
"default": true
|
|
1284
1340
|
});
|
|
1285
|
-
case
|
|
1286
|
-
_context3.
|
|
1287
|
-
_context3.next =
|
|
1341
|
+
case 174:
|
|
1342
|
+
_context3.t6 = _context3.sent;
|
|
1343
|
+
_context3.next = 178;
|
|
1288
1344
|
break;
|
|
1289
|
-
case
|
|
1290
|
-
_context3.
|
|
1291
|
-
case
|
|
1292
|
-
|
|
1293
|
-
if (!
|
|
1294
|
-
_context3.next =
|
|
1345
|
+
case 177:
|
|
1346
|
+
_context3.t6 = true;
|
|
1347
|
+
case 178:
|
|
1348
|
+
_answer6 = _context3.t6;
|
|
1349
|
+
if (!_answer6) {
|
|
1350
|
+
_context3.next = 191;
|
|
1295
1351
|
break;
|
|
1296
1352
|
}
|
|
1297
1353
|
if (defaultAnswers) {
|
|
1298
|
-
_context3.next =
|
|
1354
|
+
_context3.next = 186;
|
|
1299
1355
|
break;
|
|
1300
1356
|
}
|
|
1301
|
-
_context3.next =
|
|
1357
|
+
_context3.next = 183;
|
|
1302
1358
|
return prompts.confirm({
|
|
1303
1359
|
message: "Do you accept the following patch:\n".concat(s, "\n"),
|
|
1304
1360
|
"default": true
|
|
1305
1361
|
});
|
|
1306
|
-
case
|
|
1307
|
-
_context3.
|
|
1308
|
-
_context3.next =
|
|
1362
|
+
case 183:
|
|
1363
|
+
_context3.t7 = _context3.sent;
|
|
1364
|
+
_context3.next = 187;
|
|
1309
1365
|
break;
|
|
1310
|
-
case
|
|
1311
|
-
_context3.
|
|
1312
|
-
case
|
|
1313
|
-
|
|
1314
|
-
if (!
|
|
1366
|
+
case 186:
|
|
1367
|
+
_context3.t7 = true;
|
|
1368
|
+
case 187:
|
|
1369
|
+
_answer7 = _context3.t7;
|
|
1370
|
+
if (!_answer7) {
|
|
1315
1371
|
warn(NO_PATCH_WARNING);
|
|
1316
1372
|
plan.updateAppLayout = false;
|
|
1317
1373
|
} else {
|
|
@@ -1320,70 +1376,70 @@ function _plan() {
|
|
|
1320
1376
|
source: res
|
|
1321
1377
|
};
|
|
1322
1378
|
}
|
|
1323
|
-
_context3.next =
|
|
1379
|
+
_context3.next = 192;
|
|
1324
1380
|
break;
|
|
1325
|
-
case
|
|
1381
|
+
case 191:
|
|
1326
1382
|
warn(NO_PATCH_WARNING);
|
|
1327
|
-
case
|
|
1383
|
+
case 192:
|
|
1328
1384
|
if (analysis.pagesRouter) {
|
|
1329
1385
|
warn(NO_PATCH_WARNING);
|
|
1330
1386
|
}
|
|
1331
1387
|
if (!analysis.valEslintVersion) {
|
|
1332
|
-
_context3.next =
|
|
1388
|
+
_context3.next = 224;
|
|
1333
1389
|
break;
|
|
1334
1390
|
}
|
|
1335
1391
|
if (!analysis.isValEslintRulesConfigured) {
|
|
1336
|
-
_context3.next =
|
|
1392
|
+
_context3.next = 198;
|
|
1337
1393
|
break;
|
|
1338
1394
|
}
|
|
1339
1395
|
warn(" @valbuild/eslint-plugin rules: already configured");
|
|
1340
|
-
_context3.next =
|
|
1396
|
+
_context3.next = 224;
|
|
1341
1397
|
break;
|
|
1342
|
-
case
|
|
1398
|
+
case 198:
|
|
1343
1399
|
if (!analysis.eslintRcJsPath) {
|
|
1344
|
-
_context3.next =
|
|
1400
|
+
_context3.next = 202;
|
|
1345
1401
|
break;
|
|
1346
1402
|
}
|
|
1347
1403
|
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');
|
|
1348
|
-
_context3.next =
|
|
1404
|
+
_context3.next = 224;
|
|
1349
1405
|
break;
|
|
1350
|
-
case
|
|
1406
|
+
case 202:
|
|
1351
1407
|
if (!analysis.eslintRcJsonPath) {
|
|
1352
|
-
_context3.next =
|
|
1408
|
+
_context3.next = 223;
|
|
1353
1409
|
break;
|
|
1354
1410
|
}
|
|
1355
1411
|
if (defaultAnswers) {
|
|
1356
|
-
_context3.next =
|
|
1412
|
+
_context3.next = 209;
|
|
1357
1413
|
break;
|
|
1358
1414
|
}
|
|
1359
|
-
_context3.next =
|
|
1415
|
+
_context3.next = 206;
|
|
1360
1416
|
return prompts.confirm({
|
|
1361
1417
|
message: "Patch eslintrc.json to use the recommended Val eslint rules?",
|
|
1362
1418
|
"default": true
|
|
1363
1419
|
});
|
|
1364
|
-
case
|
|
1365
|
-
_context3.
|
|
1366
|
-
_context3.next =
|
|
1420
|
+
case 206:
|
|
1421
|
+
_context3.t8 = _context3.sent;
|
|
1422
|
+
_context3.next = 210;
|
|
1367
1423
|
break;
|
|
1368
|
-
case
|
|
1369
|
-
_context3.
|
|
1370
|
-
case
|
|
1371
|
-
|
|
1372
|
-
if (!
|
|
1373
|
-
_context3.next =
|
|
1424
|
+
case 209:
|
|
1425
|
+
_context3.t8 = true;
|
|
1426
|
+
case 210:
|
|
1427
|
+
_answer8 = _context3.t8;
|
|
1428
|
+
if (!_answer8) {
|
|
1429
|
+
_context3.next = 221;
|
|
1374
1430
|
break;
|
|
1375
1431
|
}
|
|
1376
1432
|
currentEslintRc = fs__default["default"].readFileSync(analysis.eslintRcJsonPath, "utf-8");
|
|
1377
1433
|
parsedEslint = JSON.parse(currentEslintRc);
|
|
1378
1434
|
if (!(_typeof(parsedEslint) !== "object")) {
|
|
1379
|
-
_context3.next =
|
|
1435
|
+
_context3.next = 217;
|
|
1380
1436
|
break;
|
|
1381
1437
|
}
|
|
1382
1438
|
error("Could not patch eslint: ".concat(analysis.eslintRcJsonPath, " was not an object"));
|
|
1383
1439
|
return _context3.abrupt("return", {
|
|
1384
1440
|
abort: true
|
|
1385
1441
|
});
|
|
1386
|
-
case
|
|
1442
|
+
case 217:
|
|
1387
1443
|
if (typeof parsedEslint["extends"] === "string") {
|
|
1388
1444
|
parsedEslint["extends"] = [parsedEslint["extends"]];
|
|
1389
1445
|
}
|
|
@@ -1393,24 +1449,24 @@ function _plan() {
|
|
|
1393
1449
|
path: analysis.eslintRcJsonPath,
|
|
1394
1450
|
source: JSON.stringify(parsedEslint, null, 2) + "\n"
|
|
1395
1451
|
};
|
|
1396
|
-
case
|
|
1397
|
-
_context3.next =
|
|
1452
|
+
case 221:
|
|
1453
|
+
_context3.next = 224;
|
|
1398
1454
|
break;
|
|
1399
|
-
case
|
|
1455
|
+
case 223:
|
|
1400
1456
|
warn("Cannot patch eslint: failed to find eslint config file");
|
|
1401
|
-
case
|
|
1457
|
+
case 224:
|
|
1402
1458
|
if (!analysis.gitIgnorePath) {
|
|
1403
|
-
_context3.next =
|
|
1459
|
+
_context3.next = 231;
|
|
1404
1460
|
break;
|
|
1405
1461
|
}
|
|
1406
|
-
_context3.next =
|
|
1462
|
+
_context3.next = 227;
|
|
1407
1463
|
return prompts.confirm({
|
|
1408
1464
|
message: "Append .gitignore entry for Val cache? (recommended)",
|
|
1409
1465
|
"default": true
|
|
1410
1466
|
});
|
|
1411
|
-
case
|
|
1412
|
-
|
|
1413
|
-
if (
|
|
1467
|
+
case 227:
|
|
1468
|
+
_answer9 = _context3.sent;
|
|
1469
|
+
if (_answer9) {
|
|
1414
1470
|
plan.updateGitIgnore = {
|
|
1415
1471
|
path: analysis.gitIgnorePath,
|
|
1416
1472
|
source: (analysis.gitIgnoreFile ? "".concat(analysis.gitIgnoreFile, "\n\n") : "") + "# Val local cache\n.val\n"
|
|
@@ -1418,53 +1474,54 @@ function _plan() {
|
|
|
1418
1474
|
} else {
|
|
1419
1475
|
plan.updateGitIgnore = false;
|
|
1420
1476
|
}
|
|
1421
|
-
_context3.next =
|
|
1477
|
+
_context3.next = 232;
|
|
1422
1478
|
break;
|
|
1423
|
-
case
|
|
1479
|
+
case 231:
|
|
1424
1480
|
plan.updateGitIgnore = false;
|
|
1425
|
-
case
|
|
1426
|
-
_context3.next =
|
|
1481
|
+
case 232:
|
|
1482
|
+
_context3.next = 234;
|
|
1427
1483
|
return prompts.confirm({
|
|
1428
1484
|
message: "Add the Val Build IntelliSense to .vscode/extensions.json?",
|
|
1429
1485
|
"default": true
|
|
1430
1486
|
});
|
|
1431
|
-
case
|
|
1432
|
-
|
|
1433
|
-
if (!
|
|
1434
|
-
_context3.next =
|
|
1487
|
+
case 234:
|
|
1488
|
+
_answer10 = _context3.sent;
|
|
1489
|
+
if (!_answer10) {
|
|
1490
|
+
_context3.next = 260;
|
|
1435
1491
|
break;
|
|
1436
1492
|
}
|
|
1437
1493
|
vscodeDir = path__default["default"].join(analysis.root, ".vscode");
|
|
1438
1494
|
settingsPath = path__default["default"].join(vscodeDir, "extensions.json");
|
|
1439
1495
|
currentSettings = {};
|
|
1440
|
-
_context3.prev =
|
|
1496
|
+
_context3.prev = 239;
|
|
1441
1497
|
currentSettingsFile = fs__default["default"].readFileSync(settingsPath, "utf-8");
|
|
1442
1498
|
if (!currentSettingsFile) {
|
|
1443
|
-
_context3.next =
|
|
1499
|
+
_context3.next = 250;
|
|
1444
1500
|
break;
|
|
1445
1501
|
}
|
|
1446
|
-
_context3.prev =
|
|
1502
|
+
_context3.prev = 242;
|
|
1447
1503
|
currentSettings = JSON.parse(currentSettingsFile);
|
|
1448
|
-
_context3.next =
|
|
1504
|
+
_context3.next = 250;
|
|
1449
1505
|
break;
|
|
1450
|
-
case
|
|
1451
|
-
_context3.prev =
|
|
1452
|
-
_context3.
|
|
1453
|
-
warn("Failed to parse VS Code extensions.json found here: ".concat(settingsPath, ".").concat(_context3.
|
|
1506
|
+
case 246:
|
|
1507
|
+
_context3.prev = 246;
|
|
1508
|
+
_context3.t9 = _context3["catch"](242);
|
|
1509
|
+
warn("Failed to parse VS Code extensions.json found here: ".concat(settingsPath, ".").concat(_context3.t9 instanceof Error ? "Parse error: ".concat(_context3.t9.message) : ""));
|
|
1454
1510
|
return _context3.abrupt("return", {
|
|
1455
1511
|
abort: true
|
|
1456
1512
|
});
|
|
1457
|
-
case
|
|
1458
|
-
_context3.next =
|
|
1513
|
+
case 250:
|
|
1514
|
+
_context3.next = 254;
|
|
1459
1515
|
break;
|
|
1460
|
-
case
|
|
1461
|
-
_context3.prev =
|
|
1462
|
-
_context3.
|
|
1463
|
-
case
|
|
1516
|
+
case 252:
|
|
1517
|
+
_context3.prev = 252;
|
|
1518
|
+
_context3.t10 = _context3["catch"](239);
|
|
1519
|
+
case 254:
|
|
1520
|
+
currentRecommendations =
|
|
1464
1521
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1465
|
-
|
|
1522
|
+
currentSettings.recommendations;
|
|
1466
1523
|
valBuildIntelliSense = "valbuild.vscode-val-build";
|
|
1467
|
-
if (!currentRecommendations.includes(valBuildIntelliSense)) {
|
|
1524
|
+
if (!(currentRecommendations !== null && currentRecommendations !== void 0 && currentRecommendations.includes(valBuildIntelliSense))) {
|
|
1468
1525
|
currentSettings = _objectSpread2(_objectSpread2({}, currentSettings), {}, {
|
|
1469
1526
|
recommendations: (currentRecommendations || []).concat(valBuildIntelliSense)
|
|
1470
1527
|
});
|
|
@@ -1473,43 +1530,43 @@ function _plan() {
|
|
|
1473
1530
|
path: settingsPath,
|
|
1474
1531
|
source: JSON.stringify(currentSettings, null, 2)
|
|
1475
1532
|
};
|
|
1476
|
-
_context3.next =
|
|
1533
|
+
_context3.next = 261;
|
|
1477
1534
|
break;
|
|
1478
|
-
case
|
|
1535
|
+
case 260:
|
|
1479
1536
|
plan.updateVSCodeSettings = false;
|
|
1480
|
-
case
|
|
1481
|
-
_context3.next =
|
|
1537
|
+
case 261:
|
|
1538
|
+
_context3.next = 263;
|
|
1482
1539
|
return prompts.confirm({
|
|
1483
1540
|
message: "Include example Val files?",
|
|
1484
1541
|
"default": true
|
|
1485
1542
|
});
|
|
1486
|
-
case
|
|
1487
|
-
|
|
1488
|
-
if (!
|
|
1489
|
-
_context3.next =
|
|
1543
|
+
case 263:
|
|
1544
|
+
_answer11 = _context3.sent;
|
|
1545
|
+
if (!_answer11) {
|
|
1546
|
+
_context3.next = 272;
|
|
1490
1547
|
break;
|
|
1491
1548
|
}
|
|
1492
1549
|
exampleDir = path__default["default"].join(analysis.srcDir, "examples", "val");
|
|
1493
1550
|
examplePath = path__default["default"].join(exampleDir, "example.val." + (analysis.isJavaScript ? "js" : "ts"));
|
|
1494
1551
|
exampleImport = path__default["default"].relative(exampleDir, valConfigPath).replace(".js", "").replace(".ts", "");
|
|
1495
1552
|
if (analysis.packageJsonDir) {
|
|
1496
|
-
_context3.next =
|
|
1553
|
+
_context3.next = 270;
|
|
1497
1554
|
break;
|
|
1498
1555
|
}
|
|
1499
1556
|
throw Error("Could not detect package.json directory! This is a Val bug.");
|
|
1500
|
-
case
|
|
1557
|
+
case 270:
|
|
1501
1558
|
exampleModuleId = "/".concat(path__default["default"].relative(analysis.packageJsonDir, examplePath).replace(".val", "").replace(".js", "").replace(".ts", ""));
|
|
1502
1559
|
plan.includeExample = {
|
|
1503
1560
|
path: examplePath,
|
|
1504
1561
|
source: BASIC_EXAMPLE(exampleModuleId, exampleImport, !!analysis.isJavaScript)
|
|
1505
1562
|
};
|
|
1506
|
-
case
|
|
1563
|
+
case 272:
|
|
1507
1564
|
return _context3.abrupt("return", plan);
|
|
1508
|
-
case
|
|
1565
|
+
case 273:
|
|
1509
1566
|
case "end":
|
|
1510
1567
|
return _context3.stop();
|
|
1511
1568
|
}
|
|
1512
|
-
}, _callee3, null, [[
|
|
1569
|
+
}, _callee3, null, [[239, 252], [242, 246]]);
|
|
1513
1570
|
}));
|
|
1514
1571
|
return _plan.apply(this, arguments);
|
|
1515
1572
|
}
|