@valbuild/init 0.56.0 → 0.58.0
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.
|
@@ -463,7 +463,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
463
463
|
|
|
464
464
|
var packageJson = {
|
|
465
465
|
name: "@valbuild/init",
|
|
466
|
-
version: "0.
|
|
466
|
+
version: "0.58.0",
|
|
467
467
|
description: "Initialize a new val.build project",
|
|
468
468
|
exports: {
|
|
469
469
|
"./main": {
|
|
@@ -516,6 +516,9 @@ var packageJson = {
|
|
|
516
516
|
var VAL_CLIENT = function VAL_CLIENT(configImportPath) {
|
|
517
517
|
return "import \"client-only\";\nimport { initValClient } from \"@valbuild/next/client\";\nimport { config } from \"".concat(configImportPath, "\";\n\nconst { useValStega: useVal } = initValClient(config);\n\nexport { useVal };\n");
|
|
518
518
|
};
|
|
519
|
+
var VAL_RSC = function VAL_RSC(configImportPath) {
|
|
520
|
+
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");
|
|
521
|
+
};
|
|
519
522
|
var VAL_SERVER = function VAL_SERVER(configImportPath) {
|
|
520
523
|
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");
|
|
521
524
|
};
|
|
@@ -719,7 +722,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
719
722
|
_context.prev = 31;
|
|
720
723
|
git = simpleGit__default["default"](root);
|
|
721
724
|
_context.next = 35;
|
|
722
|
-
return git.status();
|
|
725
|
+
return git.status([]);
|
|
723
726
|
case 35:
|
|
724
727
|
gitStatus = _context.sent;
|
|
725
728
|
_context.next = 38;
|
|
@@ -728,7 +731,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
728
731
|
gitRemoteOrigin = _context.sent;
|
|
729
732
|
analysis.hasGit = true;
|
|
730
733
|
analysis.isGitHub = gitRemoteOrigin ? !!gitRemoteOrigin.includes("github.com") : false;
|
|
731
|
-
analysis.isGitClean = gitStatus
|
|
734
|
+
analysis.isGitClean = getGitStatusIsClean(gitStatus);
|
|
732
735
|
_context.next = 46;
|
|
733
736
|
break;
|
|
734
737
|
case 44:
|
|
@@ -994,9 +997,15 @@ function _plan() {
|
|
|
994
997
|
});
|
|
995
998
|
}
|
|
996
999
|
if (analysis.isGitClean) {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
+
if (analysis.isGitClean === "packages") {
|
|
1001
|
+
info(" Git state: clean (only package.json / lock files modified)", {
|
|
1002
|
+
isGood: true
|
|
1003
|
+
});
|
|
1004
|
+
} else {
|
|
1005
|
+
info(" Git state: clean", {
|
|
1006
|
+
isGood: true
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1000
1009
|
}
|
|
1001
1010
|
if (!analysis.isGitClean) {
|
|
1002
1011
|
warn(" Git state: dirty");
|
|
@@ -1071,7 +1080,7 @@ function _plan() {
|
|
|
1071
1080
|
path: valAppPagePath,
|
|
1072
1081
|
source: VAL_APP_PAGE(valPageImportPath)
|
|
1073
1082
|
};
|
|
1074
|
-
valRouterPath = path__default["default"].join(analysis.appRouterPath || path__default["default"].join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "
|
|
1083
|
+
valRouterPath = path__default["default"].join(analysis.appRouterPath || path__default["default"].join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "route.ts" : "route.js");
|
|
1075
1084
|
valRouterImportPath = path__default["default"].relative(path__default["default"].dirname(valRouterPath), valServerPath).replace(".js", "").replace(".ts", "");
|
|
1076
1085
|
plan.createValRouter = {
|
|
1077
1086
|
path: valRouterPath,
|
|
@@ -1136,7 +1145,7 @@ function _plan() {
|
|
|
1136
1145
|
if (_answer4) {
|
|
1137
1146
|
plan.createValRsc = {
|
|
1138
1147
|
path: path__default["default"].join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
|
|
1139
|
-
source:
|
|
1148
|
+
source: VAL_RSC(valUtilsImportPath)
|
|
1140
1149
|
};
|
|
1141
1150
|
} else {
|
|
1142
1151
|
plan.createValRsc = false;
|
|
@@ -1361,6 +1370,26 @@ function writeFile(fileOp, rootDir, isUpdate) {
|
|
|
1361
1370
|
});
|
|
1362
1371
|
}
|
|
1363
1372
|
}
|
|
1373
|
+
function getGitStatusIsClean(gitStatus) {
|
|
1374
|
+
var filteredFiles = gitStatus.files.filter(function (_ref3) {
|
|
1375
|
+
var path = _ref3.path;
|
|
1376
|
+
return !(
|
|
1377
|
+
// ignore updates to package.json and lock files
|
|
1378
|
+
// since user might have just installed val
|
|
1379
|
+
// TODO: check if package.json only includes val related things
|
|
1380
|
+
|
|
1381
|
+
path === "package.json" ||
|
|
1382
|
+
// lock files:
|
|
1383
|
+
path === "package-lock.json" || path === "yarn.lock" || path === "pnpm-lock.yaml");
|
|
1384
|
+
});
|
|
1385
|
+
if (filteredFiles.length === 0) {
|
|
1386
|
+
if (gitStatus.files.length !== 0) {
|
|
1387
|
+
return "packages";
|
|
1388
|
+
}
|
|
1389
|
+
return true;
|
|
1390
|
+
}
|
|
1391
|
+
return false;
|
|
1392
|
+
}
|
|
1364
1393
|
|
|
1365
1394
|
function main() {
|
|
1366
1395
|
return _main.apply(this, arguments);
|
|
@@ -463,7 +463,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
463
463
|
|
|
464
464
|
var packageJson = {
|
|
465
465
|
name: "@valbuild/init",
|
|
466
|
-
version: "0.
|
|
466
|
+
version: "0.58.0",
|
|
467
467
|
description: "Initialize a new val.build project",
|
|
468
468
|
exports: {
|
|
469
469
|
"./main": {
|
|
@@ -516,6 +516,9 @@ var packageJson = {
|
|
|
516
516
|
var VAL_CLIENT = function VAL_CLIENT(configImportPath) {
|
|
517
517
|
return "import \"client-only\";\nimport { initValClient } from \"@valbuild/next/client\";\nimport { config } from \"".concat(configImportPath, "\";\n\nconst { useValStega: useVal } = initValClient(config);\n\nexport { useVal };\n");
|
|
518
518
|
};
|
|
519
|
+
var VAL_RSC = function VAL_RSC(configImportPath) {
|
|
520
|
+
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");
|
|
521
|
+
};
|
|
519
522
|
var VAL_SERVER = function VAL_SERVER(configImportPath) {
|
|
520
523
|
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");
|
|
521
524
|
};
|
|
@@ -719,7 +722,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
719
722
|
_context.prev = 31;
|
|
720
723
|
git = simpleGit__default["default"](root);
|
|
721
724
|
_context.next = 35;
|
|
722
|
-
return git.status();
|
|
725
|
+
return git.status([]);
|
|
723
726
|
case 35:
|
|
724
727
|
gitStatus = _context.sent;
|
|
725
728
|
_context.next = 38;
|
|
@@ -728,7 +731,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
728
731
|
gitRemoteOrigin = _context.sent;
|
|
729
732
|
analysis.hasGit = true;
|
|
730
733
|
analysis.isGitHub = gitRemoteOrigin ? !!gitRemoteOrigin.includes("github.com") : false;
|
|
731
|
-
analysis.isGitClean = gitStatus
|
|
734
|
+
analysis.isGitClean = getGitStatusIsClean(gitStatus);
|
|
732
735
|
_context.next = 46;
|
|
733
736
|
break;
|
|
734
737
|
case 44:
|
|
@@ -994,9 +997,15 @@ function _plan() {
|
|
|
994
997
|
});
|
|
995
998
|
}
|
|
996
999
|
if (analysis.isGitClean) {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
+
if (analysis.isGitClean === "packages") {
|
|
1001
|
+
info(" Git state: clean (only package.json / lock files modified)", {
|
|
1002
|
+
isGood: true
|
|
1003
|
+
});
|
|
1004
|
+
} else {
|
|
1005
|
+
info(" Git state: clean", {
|
|
1006
|
+
isGood: true
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1000
1009
|
}
|
|
1001
1010
|
if (!analysis.isGitClean) {
|
|
1002
1011
|
warn(" Git state: dirty");
|
|
@@ -1071,7 +1080,7 @@ function _plan() {
|
|
|
1071
1080
|
path: valAppPagePath,
|
|
1072
1081
|
source: VAL_APP_PAGE(valPageImportPath)
|
|
1073
1082
|
};
|
|
1074
|
-
valRouterPath = path__default["default"].join(analysis.appRouterPath || path__default["default"].join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "
|
|
1083
|
+
valRouterPath = path__default["default"].join(analysis.appRouterPath || path__default["default"].join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "route.ts" : "route.js");
|
|
1075
1084
|
valRouterImportPath = path__default["default"].relative(path__default["default"].dirname(valRouterPath), valServerPath).replace(".js", "").replace(".ts", "");
|
|
1076
1085
|
plan.createValRouter = {
|
|
1077
1086
|
path: valRouterPath,
|
|
@@ -1136,7 +1145,7 @@ function _plan() {
|
|
|
1136
1145
|
if (_answer4) {
|
|
1137
1146
|
plan.createValRsc = {
|
|
1138
1147
|
path: path__default["default"].join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
|
|
1139
|
-
source:
|
|
1148
|
+
source: VAL_RSC(valUtilsImportPath)
|
|
1140
1149
|
};
|
|
1141
1150
|
} else {
|
|
1142
1151
|
plan.createValRsc = false;
|
|
@@ -1361,6 +1370,26 @@ function writeFile(fileOp, rootDir, isUpdate) {
|
|
|
1361
1370
|
});
|
|
1362
1371
|
}
|
|
1363
1372
|
}
|
|
1373
|
+
function getGitStatusIsClean(gitStatus) {
|
|
1374
|
+
var filteredFiles = gitStatus.files.filter(function (_ref3) {
|
|
1375
|
+
var path = _ref3.path;
|
|
1376
|
+
return !(
|
|
1377
|
+
// ignore updates to package.json and lock files
|
|
1378
|
+
// since user might have just installed val
|
|
1379
|
+
// TODO: check if package.json only includes val related things
|
|
1380
|
+
|
|
1381
|
+
path === "package.json" ||
|
|
1382
|
+
// lock files:
|
|
1383
|
+
path === "package-lock.json" || path === "yarn.lock" || path === "pnpm-lock.yaml");
|
|
1384
|
+
});
|
|
1385
|
+
if (filteredFiles.length === 0) {
|
|
1386
|
+
if (gitStatus.files.length !== 0) {
|
|
1387
|
+
return "packages";
|
|
1388
|
+
}
|
|
1389
|
+
return true;
|
|
1390
|
+
}
|
|
1391
|
+
return false;
|
|
1392
|
+
}
|
|
1364
1393
|
|
|
1365
1394
|
function main() {
|
|
1366
1395
|
return _main.apply(this, arguments);
|
|
@@ -451,7 +451,7 @@ function transformNextAppRouterValProvider(fileInfo, api, options) {
|
|
|
451
451
|
|
|
452
452
|
var packageJson = {
|
|
453
453
|
name: "@valbuild/init",
|
|
454
|
-
version: "0.
|
|
454
|
+
version: "0.58.0",
|
|
455
455
|
description: "Initialize a new val.build project",
|
|
456
456
|
exports: {
|
|
457
457
|
"./main": {
|
|
@@ -504,6 +504,9 @@ var packageJson = {
|
|
|
504
504
|
var VAL_CLIENT = function VAL_CLIENT(configImportPath) {
|
|
505
505
|
return "import \"client-only\";\nimport { initValClient } from \"@valbuild/next/client\";\nimport { config } from \"".concat(configImportPath, "\";\n\nconst { useValStega: useVal } = initValClient(config);\n\nexport { useVal };\n");
|
|
506
506
|
};
|
|
507
|
+
var VAL_RSC = function VAL_RSC(configImportPath) {
|
|
508
|
+
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");
|
|
509
|
+
};
|
|
507
510
|
var VAL_SERVER = function VAL_SERVER(configImportPath) {
|
|
508
511
|
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");
|
|
509
512
|
};
|
|
@@ -707,7 +710,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
707
710
|
_context.prev = 31;
|
|
708
711
|
git = simpleGit(root);
|
|
709
712
|
_context.next = 35;
|
|
710
|
-
return git.status();
|
|
713
|
+
return git.status([]);
|
|
711
714
|
case 35:
|
|
712
715
|
gitStatus = _context.sent;
|
|
713
716
|
_context.next = 38;
|
|
@@ -716,7 +719,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
716
719
|
gitRemoteOrigin = _context.sent;
|
|
717
720
|
analysis.hasGit = true;
|
|
718
721
|
analysis.isGitHub = gitRemoteOrigin ? !!gitRemoteOrigin.includes("github.com") : false;
|
|
719
|
-
analysis.isGitClean = gitStatus
|
|
722
|
+
analysis.isGitClean = getGitStatusIsClean(gitStatus);
|
|
720
723
|
_context.next = 46;
|
|
721
724
|
break;
|
|
722
725
|
case 44:
|
|
@@ -982,9 +985,15 @@ function _plan() {
|
|
|
982
985
|
});
|
|
983
986
|
}
|
|
984
987
|
if (analysis.isGitClean) {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
+
if (analysis.isGitClean === "packages") {
|
|
989
|
+
info(" Git state: clean (only package.json / lock files modified)", {
|
|
990
|
+
isGood: true
|
|
991
|
+
});
|
|
992
|
+
} else {
|
|
993
|
+
info(" Git state: clean", {
|
|
994
|
+
isGood: true
|
|
995
|
+
});
|
|
996
|
+
}
|
|
988
997
|
}
|
|
989
998
|
if (!analysis.isGitClean) {
|
|
990
999
|
warn(" Git state: dirty");
|
|
@@ -1059,7 +1068,7 @@ function _plan() {
|
|
|
1059
1068
|
path: valAppPagePath,
|
|
1060
1069
|
source: VAL_APP_PAGE(valPageImportPath)
|
|
1061
1070
|
};
|
|
1062
|
-
valRouterPath = path.join(analysis.appRouterPath || path.join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "
|
|
1071
|
+
valRouterPath = path.join(analysis.appRouterPath || path.join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "route.ts" : "route.js");
|
|
1063
1072
|
valRouterImportPath = path.relative(path.dirname(valRouterPath), valServerPath).replace(".js", "").replace(".ts", "");
|
|
1064
1073
|
plan.createValRouter = {
|
|
1065
1074
|
path: valRouterPath,
|
|
@@ -1124,7 +1133,7 @@ function _plan() {
|
|
|
1124
1133
|
if (_answer4) {
|
|
1125
1134
|
plan.createValRsc = {
|
|
1126
1135
|
path: path.join(valUtilsDir, analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"),
|
|
1127
|
-
source:
|
|
1136
|
+
source: VAL_RSC(valUtilsImportPath)
|
|
1128
1137
|
};
|
|
1129
1138
|
} else {
|
|
1130
1139
|
plan.createValRsc = false;
|
|
@@ -1349,6 +1358,26 @@ function writeFile(fileOp, rootDir, isUpdate) {
|
|
|
1349
1358
|
});
|
|
1350
1359
|
}
|
|
1351
1360
|
}
|
|
1361
|
+
function getGitStatusIsClean(gitStatus) {
|
|
1362
|
+
var filteredFiles = gitStatus.files.filter(function (_ref3) {
|
|
1363
|
+
var path = _ref3.path;
|
|
1364
|
+
return !(
|
|
1365
|
+
// ignore updates to package.json and lock files
|
|
1366
|
+
// since user might have just installed val
|
|
1367
|
+
// TODO: check if package.json only includes val related things
|
|
1368
|
+
|
|
1369
|
+
path === "package.json" ||
|
|
1370
|
+
// lock files:
|
|
1371
|
+
path === "package-lock.json" || path === "yarn.lock" || path === "pnpm-lock.yaml");
|
|
1372
|
+
});
|
|
1373
|
+
if (filteredFiles.length === 0) {
|
|
1374
|
+
if (gitStatus.files.length !== 0) {
|
|
1375
|
+
return "packages";
|
|
1376
|
+
}
|
|
1377
|
+
return true;
|
|
1378
|
+
}
|
|
1379
|
+
return false;
|
|
1380
|
+
}
|
|
1352
1381
|
|
|
1353
1382
|
function main() {
|
|
1354
1383
|
return _main.apply(this, arguments);
|
package/package.json
CHANGED
package/src/init.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import fs from "fs";
|
|
3
3
|
import path from "path";
|
|
4
|
-
import simpleGit from "simple-git";
|
|
4
|
+
import simpleGit, { StatusResult } from "simple-git";
|
|
5
5
|
import { confirm } from "@inquirer/prompts";
|
|
6
6
|
import { transformNextAppRouterValProvider } from "./codemods/transformNextAppRouterValProvider";
|
|
7
7
|
import { diffLines } from "diff";
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
VAL_APP_PAGE,
|
|
14
14
|
VAL_CLIENT,
|
|
15
15
|
VAL_CONFIG,
|
|
16
|
+
VAL_RSC,
|
|
16
17
|
VAL_SERVER,
|
|
17
18
|
} from "./templates";
|
|
18
19
|
import * as logger from "./logger";
|
|
@@ -94,7 +95,7 @@ type Analysis = Partial<{
|
|
|
94
95
|
// git:
|
|
95
96
|
hasGit: boolean;
|
|
96
97
|
isGitHub: boolean;
|
|
97
|
-
isGitClean: boolean;
|
|
98
|
+
isGitClean: boolean | "packages";
|
|
98
99
|
|
|
99
100
|
// TODO:
|
|
100
101
|
// check if modules are used
|
|
@@ -200,13 +201,13 @@ const analyze = async (root: string, files: string[]): Promise<Analysis> => {
|
|
|
200
201
|
|
|
201
202
|
try {
|
|
202
203
|
const git = simpleGit(root);
|
|
203
|
-
const gitStatus = await git.status();
|
|
204
|
+
const gitStatus = await git.status([]);
|
|
204
205
|
const gitRemoteOrigin = await git.remote(["-v"]);
|
|
205
206
|
analysis.hasGit = true;
|
|
206
207
|
analysis.isGitHub = gitRemoteOrigin
|
|
207
208
|
? !!gitRemoteOrigin.includes("github.com")
|
|
208
209
|
: false;
|
|
209
|
-
analysis.isGitClean = gitStatus
|
|
210
|
+
analysis.isGitClean = getGitStatusIsClean(gitStatus);
|
|
210
211
|
} catch (err) {
|
|
211
212
|
// console.error(err);
|
|
212
213
|
}
|
|
@@ -353,7 +354,16 @@ async function plan(
|
|
|
353
354
|
logger.info(" Use: Pages Router", { isGood: true });
|
|
354
355
|
}
|
|
355
356
|
if (analysis.isGitClean) {
|
|
356
|
-
|
|
357
|
+
if (analysis.isGitClean === "packages") {
|
|
358
|
+
logger.info(
|
|
359
|
+
" Git state: clean (only package.json / lock files modified)",
|
|
360
|
+
{
|
|
361
|
+
isGood: true,
|
|
362
|
+
}
|
|
363
|
+
);
|
|
364
|
+
} else {
|
|
365
|
+
logger.info(" Git state: clean", { isGood: true });
|
|
366
|
+
}
|
|
357
367
|
}
|
|
358
368
|
if (!analysis.isGitClean) {
|
|
359
369
|
logger.warn(" Git state: dirty");
|
|
@@ -433,7 +443,7 @@ async function plan(
|
|
|
433
443
|
"api",
|
|
434
444
|
"val",
|
|
435
445
|
"[[...val]]",
|
|
436
|
-
analysis.isTypeScript ? "
|
|
446
|
+
analysis.isTypeScript ? "route.ts" : "route.js"
|
|
437
447
|
);
|
|
438
448
|
const valRouterImportPath = path
|
|
439
449
|
.relative(path.dirname(valRouterPath), valServerPath)
|
|
@@ -478,7 +488,7 @@ async function plan(
|
|
|
478
488
|
valUtilsDir,
|
|
479
489
|
analysis.isTypeScript ? "val.rsc.ts" : "val.rsc.js"
|
|
480
490
|
),
|
|
481
|
-
source:
|
|
491
|
+
source: VAL_RSC(valUtilsImportPath),
|
|
482
492
|
};
|
|
483
493
|
} else {
|
|
484
494
|
plan.createValRsc = false;
|
|
@@ -633,3 +643,27 @@ function writeFile(
|
|
|
633
643
|
);
|
|
634
644
|
}
|
|
635
645
|
}
|
|
646
|
+
function getGitStatusIsClean(gitStatus: StatusResult): Analysis["isGitClean"] {
|
|
647
|
+
const filteredFiles = gitStatus.files.filter(
|
|
648
|
+
({ path }) =>
|
|
649
|
+
!(
|
|
650
|
+
// ignore updates to package.json and lock files
|
|
651
|
+
// since user might have just installed val
|
|
652
|
+
// TODO: check if package.json only includes val related things
|
|
653
|
+
(
|
|
654
|
+
path === "package.json" ||
|
|
655
|
+
// lock files:
|
|
656
|
+
path === "package-lock.json" ||
|
|
657
|
+
path === "yarn.lock" ||
|
|
658
|
+
path === "pnpm-lock.yaml"
|
|
659
|
+
)
|
|
660
|
+
)
|
|
661
|
+
);
|
|
662
|
+
if (filteredFiles.length === 0) {
|
|
663
|
+
if (gitStatus.files.length !== 0) {
|
|
664
|
+
return "packages";
|
|
665
|
+
}
|
|
666
|
+
return true;
|
|
667
|
+
}
|
|
668
|
+
return false;
|
|
669
|
+
}
|