mktcms 0.2.7 → 0.2.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.
Files changed (37) hide show
  1. package/README.md +2 -8
  2. package/dist/module.json +1 -1
  3. package/dist/module.mjs +19 -1
  4. package/dist/runtime/app/components/content/editor/frontmatter/form.d.vue.ts +14 -6
  5. package/dist/runtime/app/components/content/editor/frontmatter/form.vue +285 -17
  6. package/dist/runtime/app/components/content/editor/frontmatter/form.vue.d.ts +14 -6
  7. package/dist/runtime/app/components/content/editor/frontmatter/input.d.vue.ts +7 -5
  8. package/dist/runtime/app/components/content/editor/frontmatter/input.vue +27 -8
  9. package/dist/runtime/app/components/content/editor/frontmatter/input.vue.d.ts +7 -5
  10. package/dist/runtime/app/components/content/editor/frontmatter/{toggle.d.vue.ts → modal.d.vue.ts} +7 -4
  11. package/dist/runtime/app/components/content/editor/frontmatter/modal.vue +113 -0
  12. package/dist/runtime/app/components/content/editor/frontmatter/{toggle.vue.d.ts → modal.vue.d.ts} +7 -4
  13. package/dist/runtime/app/components/content/editor/markdown.vue +14 -3
  14. package/dist/runtime/app/components/content/versioning.d.vue.ts +3 -0
  15. package/dist/runtime/app/components/content/versioning.vue +359 -0
  16. package/dist/runtime/app/components/content/versioning.vue.d.ts +3 -0
  17. package/dist/runtime/app/composables/useFileType.js +6 -5
  18. package/dist/runtime/app/pages/admin/delete/[path].vue +4 -2
  19. package/dist/runtime/app/pages/admin/edit/file/[path].vue +9 -7
  20. package/dist/runtime/app/pages/admin/edit/markdown/[path].vue +7 -5
  21. package/dist/runtime/app/pages/admin/index.vue +14 -5
  22. package/dist/runtime/app/pages/admin/new.vue +4 -2
  23. package/dist/runtime/app/styles/admin.css +1 -1
  24. package/dist/runtime/app/styles/admin.min.css +1 -1
  25. package/dist/runtime/server/api/admin/git-branch.d.ts +18 -0
  26. package/dist/runtime/server/api/admin/git-branch.js +44 -0
  27. package/dist/runtime/server/api/admin/git-history.d.ts +2 -0
  28. package/dist/runtime/server/api/admin/git-history.js +27 -0
  29. package/dist/runtime/server/api/admin/git-update-status.d.ts +2 -0
  30. package/dist/runtime/server/api/admin/git-update-status.js +21 -0
  31. package/dist/runtime/server/api/admin/git-update.post.d.ts +6 -0
  32. package/dist/runtime/server/api/admin/git-update.post.js +45 -0
  33. package/dist/runtime/server/utils/gitVersioning.d.ts +54 -0
  34. package/dist/runtime/server/utils/gitVersioning.js +205 -0
  35. package/dist/runtime/server/utils/syncGitContent.js +20 -10
  36. package/package.json +18 -15
  37. package/dist/runtime/app/components/content/editor/frontmatter/toggle.vue +0 -22
@@ -1,5 +1,4 @@
1
- import { useRuntimeConfig } from "nitropack/runtime";
2
- import { simpleGit } from "simple-git";
1
+ import { createAuthenticatedGitClient, gitBotIdentityArgs, toGitErrorMessage } from "./gitVersioning.js";
3
2
  function toStorageFilePath(file) {
4
3
  const normalized = file.replace(/\\/g, "/").replace(/:/g, "/").replace(/^\/+/, "").replace(/^\.\/+/, "");
5
4
  const withoutBase = normalized.startsWith(".storage/") ? normalized.slice(".storage/".length) : normalized;
@@ -10,15 +9,26 @@ function toStorageFilePath(file) {
10
9
  return `.storage/${safePath}`;
11
10
  }
12
11
  export default async function syncGitContent(commitMessage, files) {
13
- const { mktcms: { gitToken, gitUser, gitRepo } } = useRuntimeConfig();
14
- if (!gitToken || !gitUser || !gitRepo) {
15
- throw new Error("Missing Git auth config: NUXT_MKTCMS_GIT_USER, NUXT_MKTCMS_GIT_REPO, NUXT_MKTCMS_GIT_TOKEN");
12
+ const { git, authUrl } = createAuthenticatedGitClient();
13
+ try {
14
+ await git.raw(["pull", "--rebase", "--autostash", authUrl]);
15
+ } catch (error) {
16
+ throw new Error(toGitErrorMessage(error, "Git pull failed"));
16
17
  }
17
- const git = simpleGit();
18
- git.addConfig("user.name", "Kunde").addConfig("user.email", "admin@mktcode.de");
19
18
  const filesToAdd = [...new Set(files.map(toStorageFilePath))];
20
19
  await git.add(filesToAdd);
21
- await git.commit(commitMessage);
22
- const authUrl = `https://${encodeURIComponent(gitUser)}:${encodeURIComponent(gitToken)}@github.com/${gitRepo}`;
23
- await git.push([authUrl]);
20
+ const status = await git.status();
21
+ if (status.staged.length === 0) {
22
+ return;
23
+ }
24
+ try {
25
+ await git.raw([...gitBotIdentityArgs(), "commit", "-m", commitMessage]);
26
+ } catch (error) {
27
+ throw new Error(toGitErrorMessage(error, "Git commit failed"));
28
+ }
29
+ try {
30
+ await git.push([authUrl]);
31
+ } catch (error) {
32
+ throw new Error(toGitErrorMessage(error, "Git push failed"));
33
+ }
24
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mktcms",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Simple CMS module for Nuxt",
5
5
  "repository": "mktcode/mktcms",
6
6
  "license": "MIT",
@@ -28,9 +28,12 @@
28
28
  "dev:build": "nuxi build playground",
29
29
  "dev:prepare": "nuxt-module-build build --stub && nuxt-module-build prepare && nuxi prepare playground",
30
30
  "release": "npm run lint && npm run test && npm run prepack && changelogen --release && npm publish && git push --follow-tags",
31
+ "release:minor": "npm run lint && npm run test && npm run prepack && changelogen --release --minor && npm publish && git push --follow-tags",
32
+ "release:major": "npm run lint && npm run test && npm run prepack && changelogen --release --major && npm publish && git push --follow-tags",
31
33
  "lint": "eslint .",
32
34
  "lint:fix": "eslint . --fix",
33
35
  "test": "vitest run",
36
+ "test:unit": "vitest run test/unit",
34
37
  "test:watch": "vitest watch",
35
38
  "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
36
39
  "css": "tailwindcss -i ./src/runtime/app/styles/admin.css -o ./src/runtime/app/styles/admin.min.css --minify",
@@ -38,39 +41,39 @@
38
41
  },
39
42
  "dependencies": {
40
43
  "@nuxt/kit": "^4.2.2",
41
- "@nuxtjs/mdc": "^0.20.0",
44
+ "@nuxtjs/mdc": "^0.20.1",
42
45
  "@types/ejs": "^3.1.5",
43
- "@vueuse/core": "^14.1.0",
46
+ "@vueuse/core": "^14.2.1",
44
47
  "csv-parse": "^6.1.0",
45
48
  "csv-stringify": "^6.6.0",
46
49
  "defu": "^6.1.4",
47
50
  "ejs": "^4.0.1",
48
- "marked": "^17.0.1",
51
+ "marked": "^17.0.3",
49
52
  "monaco-editor": "^0.55.1",
50
- "nodemailer": "^7.0.12",
53
+ "nodemailer": "^7.0.13",
51
54
  "sharp": "^0.34.5",
52
- "simple-git": "^3.30.0",
55
+ "simple-git": "^3.32.2",
53
56
  "unzipper": "^0.12.3",
54
57
  "yaml": "^2.8.2",
55
- "zod": "^4.3.5"
58
+ "zod": "^4.3.6"
56
59
  },
57
60
  "devDependencies": {
58
- "@nuxt/devtools": "^3.1.1",
59
- "@nuxt/eslint-config": "^1.12.1",
61
+ "@nuxt/devtools": "^3.2.1",
62
+ "@nuxt/eslint-config": "^1.15.1",
60
63
  "@nuxt/module-builder": "^1.0.2",
61
64
  "@nuxt/schema": "^4.2.2",
62
- "@nuxt/test-utils": "^3.22.0",
63
- "@tailwindcss/cli": "^4.1.18",
65
+ "@nuxt/test-utils": "^3.23.0",
66
+ "@tailwindcss/cli": "^4.2.0",
64
67
  "@tailwindcss/typography": "^0.5.19",
65
- "@types/node": "latest",
66
- "@types/nodemailer": "^7.0.5",
68
+ "@types/node": "^25.3.0",
69
+ "@types/nodemailer": "^7.0.11",
67
70
  "@types/unzipper": "^0.10.11",
68
71
  "changelogen": "^0.6.2",
69
- "eslint": "^9.39.2",
72
+ "eslint": "^9.39.3",
70
73
  "nuxt": "^4.2.2",
71
74
  "tailwindcss": "^4.1.18",
72
75
  "typescript": "~5.9.3",
73
76
  "vitest": "^3.2.4",
74
- "vue-tsc": "^3.2.2"
77
+ "vue-tsc": "^3.2.5"
75
78
  }
76
79
  }
@@ -1,22 +0,0 @@
1
- <script setup>
2
- defineProps({
3
- label: { type: String, required: true }
4
- });
5
- const value = defineModel("value", { type: Boolean, ...{
6
- required: true
7
- } });
8
- </script>
9
-
10
- <template>
11
- <div class="flex flex-col gap-2 w-full">
12
- <label class="font-bold">
13
- <input
14
- v-model="value"
15
- type="checkbox"
16
- class="mr-2"
17
- >
18
- {{ label }}
19
- </label>
20
- <div class="relative" />
21
- </div>
22
- </template>