fix(cli): improve lockfile support on cli

This commit is contained in:
Ruben Fiszel
2024-04-30 00:59:12 +02:00
parent 196de08775
commit 05e70a849e
2 changed files with 12 additions and 2 deletions
+7 -1
View File
@@ -83,7 +83,11 @@ export async function handleScriptMetadata(
message: string | undefined,
globalDeps: GlobalDeps
): Promise<boolean> {
if (path.endsWith(".script.json") || path.endsWith(".script.yaml")) {
if (
path.endsWith(".script.json") ||
path.endsWith(".script.yaml") ||
path.endsWith(".script.lock")
) {
const contentPath = await findContentFile(path);
return handleFile(
contentPath,
@@ -242,6 +246,8 @@ export async function handleFile(
export async function findContentFile(filePath: string) {
const candidates = filePath.endsWith("script.json")
? exts.map((x) => filePath.replace(".script.json", x))
: filePath.endsWith("script.lock")
? exts.map((x) => filePath.replace(".script.lock", x))
: exts.map((x) => filePath.replace(".script.yaml", x));
const validCandidates = (
+5 -1
View File
@@ -1056,7 +1056,8 @@ async function push(opts: GlobalOptions & SyncOptions) {
} else if (change.name === "added") {
if (
change.path.endsWith(".script.json") ||
change.path.endsWith(".script.yaml")
change.path.endsWith(".script.yaml") ||
change.path.endsWith(".lock")
) {
continue;
} else if (
@@ -1089,6 +1090,9 @@ async function push(opts: GlobalOptions & SyncOptions) {
await Deno.writeTextFile(stateTarget, change.content);
}
} else if (change.name === "deleted") {
if (change.name.endsWith(".lock")) {
continue;
}
const typ = getTypeStrFromPath(change.path);
if (typ == "script") {