@dafish/gogo-meta 1.6.0 → 1.7.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.
- package/README.md +19 -0
- package/dist/cli.js +29 -2
- package/dist/cli.js.map +1 -1
- package/dist/index.js +29 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1488,6 +1488,7 @@ function registerNpmCommands(program) {
|
|
|
1488
1488
|
await runCommand2(script, options);
|
|
1489
1489
|
});
|
|
1490
1490
|
}
|
|
1491
|
+
var MISSING_DIRECTORY_HINT = "directory missing \u2014 run 'gogo migrate' if it moved, or 'gogo git update' to clone";
|
|
1491
1492
|
function isGogoConfigFile(filename) {
|
|
1492
1493
|
return filename === ".gogo" || filename.startsWith(".gogo.");
|
|
1493
1494
|
}
|
|
@@ -1528,10 +1529,36 @@ async function validateCommand() {
|
|
|
1528
1529
|
projectStatus(result.file, "error", result.error);
|
|
1529
1530
|
}
|
|
1530
1531
|
}
|
|
1531
|
-
|
|
1532
|
+
const workingCopyHasErrors = await validateWorkingCopy(cwd);
|
|
1533
|
+
if (hasErrors || workingCopyHasErrors) {
|
|
1532
1534
|
throw new Error("Validation failed");
|
|
1533
1535
|
}
|
|
1534
1536
|
}
|
|
1537
|
+
async function validateWorkingCopy(cwd) {
|
|
1538
|
+
let config;
|
|
1539
|
+
let metaDir;
|
|
1540
|
+
try {
|
|
1541
|
+
({ config, metaDir } = await readMetaConfig(cwd));
|
|
1542
|
+
} catch {
|
|
1543
|
+
return false;
|
|
1544
|
+
}
|
|
1545
|
+
const projectPaths = Object.keys(config.projects);
|
|
1546
|
+
if (projectPaths.length === 0) {
|
|
1547
|
+
return false;
|
|
1548
|
+
}
|
|
1549
|
+
let hasErrors = false;
|
|
1550
|
+
for (const projectPath of projectPaths) {
|
|
1551
|
+
const projectDir = join(metaDir, projectPath);
|
|
1552
|
+
if (!await fileExists(projectDir)) {
|
|
1553
|
+
projectStatus(projectPath, "error", MISSING_DIRECTORY_HINT);
|
|
1554
|
+
hasErrors = true;
|
|
1555
|
+
}
|
|
1556
|
+
}
|
|
1557
|
+
if (!hasErrors) {
|
|
1558
|
+
success(`All ${projectPaths.length} project directories present`);
|
|
1559
|
+
}
|
|
1560
|
+
return hasErrors;
|
|
1561
|
+
}
|
|
1535
1562
|
async function validateConfigFile(filePath, filename) {
|
|
1536
1563
|
const format = detectFormat(filePath);
|
|
1537
1564
|
try {
|
|
@@ -1569,7 +1596,7 @@ async function validateLoopRcFile(filePath) {
|
|
|
1569
1596
|
}
|
|
1570
1597
|
}
|
|
1571
1598
|
function registerValidateCommand(program) {
|
|
1572
|
-
program.command("validate").description("Validate
|
|
1599
|
+
program.command("validate").description("Validate config files and check that configured projects exist in the working copy").action(async () => {
|
|
1573
1600
|
await validateCommand();
|
|
1574
1601
|
});
|
|
1575
1602
|
}
|