@conloca/content-api 0.1.7 → 0.1.9
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/dist/node.mjs +8 -8
- package/dist/node.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node.mjs
CHANGED
|
@@ -4995,13 +4995,13 @@ function createContentAPIRouter(api, options) {
|
|
|
4995
4995
|
}
|
|
4996
4996
|
});
|
|
4997
4997
|
/**
|
|
4998
|
-
* Get git config from environment variables.
|
|
4999
|
-
*
|
|
4998
|
+
* Get git config from router options or environment variables.
|
|
4999
|
+
* contentRoot from router options takes priority over CONTENT_PATH env var.
|
|
5000
5000
|
* Optional: GIT_BRANCH (defaults to current checked-out branch)
|
|
5001
5001
|
*/
|
|
5002
5002
|
function getGitConfig() {
|
|
5003
|
-
const contentPath = process.env.CONTENT_PATH;
|
|
5004
|
-
if (!contentPath) throw new Error("CONTENT_PATH environment variable is required for git operations");
|
|
5003
|
+
const contentPath = options?.contentRoot || process.env.CONTENT_PATH;
|
|
5004
|
+
if (!contentPath) throw new Error("contentRoot option or CONTENT_PATH environment variable is required for git operations");
|
|
5005
5005
|
return {
|
|
5006
5006
|
contentPath,
|
|
5007
5007
|
branch: process.env.GIT_BRANCH
|
|
@@ -5013,7 +5013,7 @@ function createContentAPIRouter(api, options) {
|
|
|
5013
5013
|
if (!status.isRepo) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, "Repository not accessible"), 400);
|
|
5014
5014
|
return c.json(status);
|
|
5015
5015
|
} catch (error) {
|
|
5016
|
-
if (error instanceof Error && error.message.includes("CONTENT_PATH")) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5016
|
+
if (error instanceof Error && (error.message.includes("contentRoot") || error.message.includes("CONTENT_PATH"))) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5017
5017
|
return c.json(logAndCreateErrorResponse(error, ErrorCodes.GIT_STATUS_FAILED, "Failed to get git status"), 500);
|
|
5018
5018
|
}
|
|
5019
5019
|
});
|
|
@@ -5045,7 +5045,7 @@ function createContentAPIRouter(api, options) {
|
|
|
5045
5045
|
if (!result.success) return c.json(errorResponse(ErrorCodes.GIT_COMMIT_FAILED, result.error || "Commit failed"), 500);
|
|
5046
5046
|
return c.json(result);
|
|
5047
5047
|
} catch (error) {
|
|
5048
|
-
if (error instanceof Error && error.message.includes("CONTENT_PATH")) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5048
|
+
if (error instanceof Error && (error.message.includes("contentRoot") || error.message.includes("CONTENT_PATH"))) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5049
5049
|
return c.json(logAndCreateErrorResponse(error, ErrorCodes.GIT_COMMIT_FAILED, "Failed to commit changes"), 500);
|
|
5050
5050
|
}
|
|
5051
5051
|
});
|
|
@@ -5055,7 +5055,7 @@ function createContentAPIRouter(api, options) {
|
|
|
5055
5055
|
if (!result.success) return c.json(errorResponse(ErrorCodes.GIT_PUSH_FAILED, result.error || "Push failed"), 500);
|
|
5056
5056
|
return c.json(result);
|
|
5057
5057
|
} catch (error) {
|
|
5058
|
-
if (error instanceof Error && error.message.includes("CONTENT_PATH")) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5058
|
+
if (error instanceof Error && (error.message.includes("contentRoot") || error.message.includes("CONTENT_PATH"))) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5059
5059
|
return c.json(logAndCreateErrorResponse(error, ErrorCodes.GIT_PUSH_FAILED, "Failed to push to origin"), 500);
|
|
5060
5060
|
}
|
|
5061
5061
|
});
|
|
@@ -5065,7 +5065,7 @@ function createContentAPIRouter(api, options) {
|
|
|
5065
5065
|
if (!result.success) return c.json(errorResponse(ErrorCodes.GIT_PULL_FAILED, result.error || "Pull failed"), 500);
|
|
5066
5066
|
return c.json(result);
|
|
5067
5067
|
} catch (error) {
|
|
5068
|
-
if (error instanceof Error && error.message.includes("CONTENT_PATH")) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5068
|
+
if (error instanceof Error && (error.message.includes("contentRoot") || error.message.includes("CONTENT_PATH"))) return c.json(errorResponse(ErrorCodes.GIT_NOT_REPO, error.message), 400);
|
|
5069
5069
|
return c.json(logAndCreateErrorResponse(error, ErrorCodes.GIT_PULL_FAILED, "Failed to pull from origin"), 500);
|
|
5070
5070
|
}
|
|
5071
5071
|
});
|