@valbuild/init 0.55.2 → 0.57.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.57.0",
|
|
467
467
|
description: "Initialize a new val.build project",
|
|
468
468
|
exports: {
|
|
469
469
|
"./main": {
|
|
@@ -719,7 +719,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
719
719
|
_context.prev = 31;
|
|
720
720
|
git = simpleGit__default["default"](root);
|
|
721
721
|
_context.next = 35;
|
|
722
|
-
return git.status();
|
|
722
|
+
return git.status([]);
|
|
723
723
|
case 35:
|
|
724
724
|
gitStatus = _context.sent;
|
|
725
725
|
_context.next = 38;
|
|
@@ -728,7 +728,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
728
728
|
gitRemoteOrigin = _context.sent;
|
|
729
729
|
analysis.hasGit = true;
|
|
730
730
|
analysis.isGitHub = gitRemoteOrigin ? !!gitRemoteOrigin.includes("github.com") : false;
|
|
731
|
-
analysis.isGitClean = gitStatus
|
|
731
|
+
analysis.isGitClean = getGitStatusIsClean(gitStatus);
|
|
732
732
|
_context.next = 46;
|
|
733
733
|
break;
|
|
734
734
|
case 44:
|
|
@@ -994,9 +994,15 @@ function _plan() {
|
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
996
|
if (analysis.isGitClean) {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
997
|
+
if (analysis.isGitClean === "packages") {
|
|
998
|
+
info(" Git state: clean (only package.json / lock files modified)", {
|
|
999
|
+
isGood: true
|
|
1000
|
+
});
|
|
1001
|
+
} else {
|
|
1002
|
+
info(" Git state: clean", {
|
|
1003
|
+
isGood: true
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1000
1006
|
}
|
|
1001
1007
|
if (!analysis.isGitClean) {
|
|
1002
1008
|
warn(" Git state: dirty");
|
|
@@ -1071,7 +1077,7 @@ function _plan() {
|
|
|
1071
1077
|
path: valAppPagePath,
|
|
1072
1078
|
source: VAL_APP_PAGE(valPageImportPath)
|
|
1073
1079
|
};
|
|
1074
|
-
valRouterPath = path__default["default"].join(analysis.appRouterPath || path__default["default"].join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "
|
|
1080
|
+
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
1081
|
valRouterImportPath = path__default["default"].relative(path__default["default"].dirname(valRouterPath), valServerPath).replace(".js", "").replace(".ts", "");
|
|
1076
1082
|
plan.createValRouter = {
|
|
1077
1083
|
path: valRouterPath,
|
|
@@ -1361,6 +1367,26 @@ function writeFile(fileOp, rootDir, isUpdate) {
|
|
|
1361
1367
|
});
|
|
1362
1368
|
}
|
|
1363
1369
|
}
|
|
1370
|
+
function getGitStatusIsClean(gitStatus) {
|
|
1371
|
+
var filteredFiles = gitStatus.files.filter(function (_ref3) {
|
|
1372
|
+
var path = _ref3.path;
|
|
1373
|
+
return !(
|
|
1374
|
+
// ignore updates to package.json and lock files
|
|
1375
|
+
// since user might have just installed val
|
|
1376
|
+
// TODO: check if package.json only includes val related things
|
|
1377
|
+
|
|
1378
|
+
path === "package.json" ||
|
|
1379
|
+
// lock files:
|
|
1380
|
+
path === "package-lock.json" || path === "yarn.lock" || path === "pnpm-lock.yaml");
|
|
1381
|
+
});
|
|
1382
|
+
if (filteredFiles.length === 0) {
|
|
1383
|
+
if (gitStatus.files.length !== 0) {
|
|
1384
|
+
return "packages";
|
|
1385
|
+
}
|
|
1386
|
+
return true;
|
|
1387
|
+
}
|
|
1388
|
+
return false;
|
|
1389
|
+
}
|
|
1364
1390
|
|
|
1365
1391
|
function main() {
|
|
1366
1392
|
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.57.0",
|
|
467
467
|
description: "Initialize a new val.build project",
|
|
468
468
|
exports: {
|
|
469
469
|
"./main": {
|
|
@@ -719,7 +719,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
719
719
|
_context.prev = 31;
|
|
720
720
|
git = simpleGit__default["default"](root);
|
|
721
721
|
_context.next = 35;
|
|
722
|
-
return git.status();
|
|
722
|
+
return git.status([]);
|
|
723
723
|
case 35:
|
|
724
724
|
gitStatus = _context.sent;
|
|
725
725
|
_context.next = 38;
|
|
@@ -728,7 +728,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
728
728
|
gitRemoteOrigin = _context.sent;
|
|
729
729
|
analysis.hasGit = true;
|
|
730
730
|
analysis.isGitHub = gitRemoteOrigin ? !!gitRemoteOrigin.includes("github.com") : false;
|
|
731
|
-
analysis.isGitClean = gitStatus
|
|
731
|
+
analysis.isGitClean = getGitStatusIsClean(gitStatus);
|
|
732
732
|
_context.next = 46;
|
|
733
733
|
break;
|
|
734
734
|
case 44:
|
|
@@ -994,9 +994,15 @@ function _plan() {
|
|
|
994
994
|
});
|
|
995
995
|
}
|
|
996
996
|
if (analysis.isGitClean) {
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
997
|
+
if (analysis.isGitClean === "packages") {
|
|
998
|
+
info(" Git state: clean (only package.json / lock files modified)", {
|
|
999
|
+
isGood: true
|
|
1000
|
+
});
|
|
1001
|
+
} else {
|
|
1002
|
+
info(" Git state: clean", {
|
|
1003
|
+
isGood: true
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
1000
1006
|
}
|
|
1001
1007
|
if (!analysis.isGitClean) {
|
|
1002
1008
|
warn(" Git state: dirty");
|
|
@@ -1071,7 +1077,7 @@ function _plan() {
|
|
|
1071
1077
|
path: valAppPagePath,
|
|
1072
1078
|
source: VAL_APP_PAGE(valPageImportPath)
|
|
1073
1079
|
};
|
|
1074
|
-
valRouterPath = path__default["default"].join(analysis.appRouterPath || path__default["default"].join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "
|
|
1080
|
+
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
1081
|
valRouterImportPath = path__default["default"].relative(path__default["default"].dirname(valRouterPath), valServerPath).replace(".js", "").replace(".ts", "");
|
|
1076
1082
|
plan.createValRouter = {
|
|
1077
1083
|
path: valRouterPath,
|
|
@@ -1361,6 +1367,26 @@ function writeFile(fileOp, rootDir, isUpdate) {
|
|
|
1361
1367
|
});
|
|
1362
1368
|
}
|
|
1363
1369
|
}
|
|
1370
|
+
function getGitStatusIsClean(gitStatus) {
|
|
1371
|
+
var filteredFiles = gitStatus.files.filter(function (_ref3) {
|
|
1372
|
+
var path = _ref3.path;
|
|
1373
|
+
return !(
|
|
1374
|
+
// ignore updates to package.json and lock files
|
|
1375
|
+
// since user might have just installed val
|
|
1376
|
+
// TODO: check if package.json only includes val related things
|
|
1377
|
+
|
|
1378
|
+
path === "package.json" ||
|
|
1379
|
+
// lock files:
|
|
1380
|
+
path === "package-lock.json" || path === "yarn.lock" || path === "pnpm-lock.yaml");
|
|
1381
|
+
});
|
|
1382
|
+
if (filteredFiles.length === 0) {
|
|
1383
|
+
if (gitStatus.files.length !== 0) {
|
|
1384
|
+
return "packages";
|
|
1385
|
+
}
|
|
1386
|
+
return true;
|
|
1387
|
+
}
|
|
1388
|
+
return false;
|
|
1389
|
+
}
|
|
1364
1390
|
|
|
1365
1391
|
function main() {
|
|
1366
1392
|
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.57.0",
|
|
455
455
|
description: "Initialize a new val.build project",
|
|
456
456
|
exports: {
|
|
457
457
|
"./main": {
|
|
@@ -707,7 +707,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
707
707
|
_context.prev = 31;
|
|
708
708
|
git = simpleGit(root);
|
|
709
709
|
_context.next = 35;
|
|
710
|
-
return git.status();
|
|
710
|
+
return git.status([]);
|
|
711
711
|
case 35:
|
|
712
712
|
gitStatus = _context.sent;
|
|
713
713
|
_context.next = 38;
|
|
@@ -716,7 +716,7 @@ var analyze = /*#__PURE__*/function () {
|
|
|
716
716
|
gitRemoteOrigin = _context.sent;
|
|
717
717
|
analysis.hasGit = true;
|
|
718
718
|
analysis.isGitHub = gitRemoteOrigin ? !!gitRemoteOrigin.includes("github.com") : false;
|
|
719
|
-
analysis.isGitClean = gitStatus
|
|
719
|
+
analysis.isGitClean = getGitStatusIsClean(gitStatus);
|
|
720
720
|
_context.next = 46;
|
|
721
721
|
break;
|
|
722
722
|
case 44:
|
|
@@ -982,9 +982,15 @@ function _plan() {
|
|
|
982
982
|
});
|
|
983
983
|
}
|
|
984
984
|
if (analysis.isGitClean) {
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
985
|
+
if (analysis.isGitClean === "packages") {
|
|
986
|
+
info(" Git state: clean (only package.json / lock files modified)", {
|
|
987
|
+
isGood: true
|
|
988
|
+
});
|
|
989
|
+
} else {
|
|
990
|
+
info(" Git state: clean", {
|
|
991
|
+
isGood: true
|
|
992
|
+
});
|
|
993
|
+
}
|
|
988
994
|
}
|
|
989
995
|
if (!analysis.isGitClean) {
|
|
990
996
|
warn(" Git state: dirty");
|
|
@@ -1059,7 +1065,7 @@ function _plan() {
|
|
|
1059
1065
|
path: valAppPagePath,
|
|
1060
1066
|
source: VAL_APP_PAGE(valPageImportPath)
|
|
1061
1067
|
};
|
|
1062
|
-
valRouterPath = path.join(analysis.appRouterPath || path.join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "
|
|
1068
|
+
valRouterPath = path.join(analysis.appRouterPath || path.join(analysis.srcDir, "app"), "(val)", "api", "val", "[[...val]]", analysis.isTypeScript ? "route.ts" : "route.js");
|
|
1063
1069
|
valRouterImportPath = path.relative(path.dirname(valRouterPath), valServerPath).replace(".js", "").replace(".ts", "");
|
|
1064
1070
|
plan.createValRouter = {
|
|
1065
1071
|
path: valRouterPath,
|
|
@@ -1349,6 +1355,26 @@ function writeFile(fileOp, rootDir, isUpdate) {
|
|
|
1349
1355
|
});
|
|
1350
1356
|
}
|
|
1351
1357
|
}
|
|
1358
|
+
function getGitStatusIsClean(gitStatus) {
|
|
1359
|
+
var filteredFiles = gitStatus.files.filter(function (_ref3) {
|
|
1360
|
+
var path = _ref3.path;
|
|
1361
|
+
return !(
|
|
1362
|
+
// ignore updates to package.json and lock files
|
|
1363
|
+
// since user might have just installed val
|
|
1364
|
+
// TODO: check if package.json only includes val related things
|
|
1365
|
+
|
|
1366
|
+
path === "package.json" ||
|
|
1367
|
+
// lock files:
|
|
1368
|
+
path === "package-lock.json" || path === "yarn.lock" || path === "pnpm-lock.yaml");
|
|
1369
|
+
});
|
|
1370
|
+
if (filteredFiles.length === 0) {
|
|
1371
|
+
if (gitStatus.files.length !== 0) {
|
|
1372
|
+
return "packages";
|
|
1373
|
+
}
|
|
1374
|
+
return true;
|
|
1375
|
+
}
|
|
1376
|
+
return false;
|
|
1377
|
+
}
|
|
1352
1378
|
|
|
1353
1379
|
function main() {
|
|
1354
1380
|
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";
|
|
@@ -94,7 +94,7 @@ type Analysis = Partial<{
|
|
|
94
94
|
// git:
|
|
95
95
|
hasGit: boolean;
|
|
96
96
|
isGitHub: boolean;
|
|
97
|
-
isGitClean: boolean;
|
|
97
|
+
isGitClean: boolean | "packages";
|
|
98
98
|
|
|
99
99
|
// TODO:
|
|
100
100
|
// check if modules are used
|
|
@@ -200,13 +200,13 @@ const analyze = async (root: string, files: string[]): Promise<Analysis> => {
|
|
|
200
200
|
|
|
201
201
|
try {
|
|
202
202
|
const git = simpleGit(root);
|
|
203
|
-
const gitStatus = await git.status();
|
|
203
|
+
const gitStatus = await git.status([]);
|
|
204
204
|
const gitRemoteOrigin = await git.remote(["-v"]);
|
|
205
205
|
analysis.hasGit = true;
|
|
206
206
|
analysis.isGitHub = gitRemoteOrigin
|
|
207
207
|
? !!gitRemoteOrigin.includes("github.com")
|
|
208
208
|
: false;
|
|
209
|
-
analysis.isGitClean = gitStatus
|
|
209
|
+
analysis.isGitClean = getGitStatusIsClean(gitStatus);
|
|
210
210
|
} catch (err) {
|
|
211
211
|
// console.error(err);
|
|
212
212
|
}
|
|
@@ -353,7 +353,16 @@ async function plan(
|
|
|
353
353
|
logger.info(" Use: Pages Router", { isGood: true });
|
|
354
354
|
}
|
|
355
355
|
if (analysis.isGitClean) {
|
|
356
|
-
|
|
356
|
+
if (analysis.isGitClean === "packages") {
|
|
357
|
+
logger.info(
|
|
358
|
+
" Git state: clean (only package.json / lock files modified)",
|
|
359
|
+
{
|
|
360
|
+
isGood: true,
|
|
361
|
+
}
|
|
362
|
+
);
|
|
363
|
+
} else {
|
|
364
|
+
logger.info(" Git state: clean", { isGood: true });
|
|
365
|
+
}
|
|
357
366
|
}
|
|
358
367
|
if (!analysis.isGitClean) {
|
|
359
368
|
logger.warn(" Git state: dirty");
|
|
@@ -433,7 +442,7 @@ async function plan(
|
|
|
433
442
|
"api",
|
|
434
443
|
"val",
|
|
435
444
|
"[[...val]]",
|
|
436
|
-
analysis.isTypeScript ? "
|
|
445
|
+
analysis.isTypeScript ? "route.ts" : "route.js"
|
|
437
446
|
);
|
|
438
447
|
const valRouterImportPath = path
|
|
439
448
|
.relative(path.dirname(valRouterPath), valServerPath)
|
|
@@ -633,3 +642,27 @@ function writeFile(
|
|
|
633
642
|
);
|
|
634
643
|
}
|
|
635
644
|
}
|
|
645
|
+
function getGitStatusIsClean(gitStatus: StatusResult): Analysis["isGitClean"] {
|
|
646
|
+
const filteredFiles = gitStatus.files.filter(
|
|
647
|
+
({ path }) =>
|
|
648
|
+
!(
|
|
649
|
+
// ignore updates to package.json and lock files
|
|
650
|
+
// since user might have just installed val
|
|
651
|
+
// TODO: check if package.json only includes val related things
|
|
652
|
+
(
|
|
653
|
+
path === "package.json" ||
|
|
654
|
+
// lock files:
|
|
655
|
+
path === "package-lock.json" ||
|
|
656
|
+
path === "yarn.lock" ||
|
|
657
|
+
path === "pnpm-lock.yaml"
|
|
658
|
+
)
|
|
659
|
+
)
|
|
660
|
+
);
|
|
661
|
+
if (filteredFiles.length === 0) {
|
|
662
|
+
if (gitStatus.files.length !== 0) {
|
|
663
|
+
return "packages";
|
|
664
|
+
}
|
|
665
|
+
return true;
|
|
666
|
+
}
|
|
667
|
+
return false;
|
|
668
|
+
}
|