@zenuml/core 3.26.0 → 3.27.1

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.
@@ -1,4 +1,4 @@
1
- import { o as c, c as e, a as o } from "./core.16f7d885.js";
1
+ import { o as c, c as e, a as o } from "./core.c9db17d9.js";
2
2
  const s = {
3
3
  xmlns: "http://www.w3.org/2000/svg",
4
4
  viewBox: "0 0 1024 1024"
@@ -20,4 +20,4 @@ export {
20
20
  _ as default,
21
21
  l as render
22
22
  };
23
- //# sourceMappingURL=zoom-in.9db8778e.js.map
23
+ //# sourceMappingURL=zoom-in.3c16bf7b.js.map
@@ -1,4 +1,4 @@
1
- import { o as t, c, a as o } from "./core.16f7d885.js";
1
+ import { o as t, c, a as o } from "./core.c9db17d9.js";
2
2
  const e = {
3
3
  xmlns: "http://www.w3.org/2000/svg",
4
4
  viewBox: "0 0 1024 1024"
@@ -20,4 +20,4 @@ export {
20
20
  h as default,
21
21
  s as render
22
22
  };
23
- //# sourceMappingURL=zoom-out.57ea6bf4.js.map
23
+ //# sourceMappingURL=zoom-out.1816940f.js.map
package/index.html CHANGED
@@ -115,7 +115,7 @@
115
115
  timer = setTimeout(() => {
116
116
  const theme =
117
117
  localStorage.getItem(`${location.hostname}-zenuml-theme`) ||
118
- "theme-idle-afternoon";
118
+ "theme-default";
119
119
  window.zenUml
120
120
  .render(cm.getValue(), {
121
121
  theme,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenuml/core",
3
- "version": "3.26.0",
3
+ "version": "3.27.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -32,7 +32,8 @@
32
32
  "git:branch:safe-delete": "echo '> git log --graph --left-right --cherry --oneline another-branch...main'",
33
33
  "git:forget": "git rm -r --cached . && git add . && git commit -m \"Forget all ignored files\"",
34
34
  "test:specs": "echo \"Error: test:specs is not supported\"",
35
- "prepare": "husky install"
35
+ "prepare": "husky install",
36
+ "publish": "pnpm build && npm publish"
36
37
  },
37
38
  "main": "./dist/zenuml.js",
38
39
  "module": "./dist/zenuml.esm.mjs",
@@ -0,0 +1,121 @@
1
+ #!/usr/bin/env node
2
+ const fs = require("fs");
3
+ const { execSync } = require("child_process");
4
+ const path = require("path");
5
+
6
+ const getCurrentVersion = () => {
7
+ try {
8
+ const pkg = require("../package.json");
9
+ const npmVersion = execSync(`npm view ${pkg.name} version`, {
10
+ stdio: ["pipe", "pipe", "pipe"],
11
+ })
12
+ .toString()
13
+ .trim();
14
+ console.log(`Latest version on npm: ${npmVersion}`);
15
+ return npmVersion;
16
+ } catch (error) {
17
+ console.error(
18
+ "Failed to get npm version. Please ensure you have npm registry access.",
19
+ );
20
+ console.error("Error:", error.message);
21
+ process.exit(1);
22
+ }
23
+ };
24
+
25
+ const getCommitMessages = (currentVersion) => {
26
+ try {
27
+ // Try to fetch tags first
28
+ try {
29
+ execSync("git fetch --tags");
30
+ } catch (e) {
31
+ console.log("Warning: Could not fetch tags:", e.message);
32
+ }
33
+
34
+ // Get commits since the last version tag
35
+ const messages = execSync(
36
+ `git log v${currentVersion}..HEAD --pretty=format:%s%n%b`,
37
+ ).toString();
38
+ console.log("\nCommit messages since", `v${currentVersion}:`);
39
+ console.log(messages || "(no commits)");
40
+ return messages;
41
+ } catch (e) {
42
+ console.log(
43
+ "Warning: Could not get commits since last version, falling back to recent commits",
44
+ );
45
+ // Fallback to recent commits if tag not found
46
+ const messages = execSync("git log -10 --pretty=format:%s%n%b").toString();
47
+ console.log("\nRecent commit messages:");
48
+ console.log(messages || "(no commits)");
49
+ return messages;
50
+ }
51
+ };
52
+
53
+ const determineVersionBump = (messages) => {
54
+ const lines = messages.split("\n").filter(Boolean);
55
+ if (
56
+ lines.some((msg) => msg.includes("BREAKING CHANGE") || msg.includes("!:"))
57
+ ) {
58
+ return "major";
59
+ }
60
+ if (lines.some((msg) => msg.toLowerCase().startsWith("feat"))) {
61
+ return "minor";
62
+ }
63
+ return "patch";
64
+ };
65
+
66
+ const getNewVersion = (currentVersion, bump) => {
67
+ const [major, minor, patch] = currentVersion.split(".").map(Number);
68
+ switch (bump) {
69
+ case "major":
70
+ return `${major + 1}.0.0`;
71
+ case "minor":
72
+ return `${major}.${minor + 1}.0`;
73
+ case "patch":
74
+ return `${major}.${minor}.${patch + 1}`;
75
+ default:
76
+ throw new Error(`Invalid version bump type: ${bump}`);
77
+ }
78
+ };
79
+
80
+ const run = async () => {
81
+ const dryRun = process.argv.includes("--dry-run");
82
+ if (dryRun) {
83
+ console.log("DRY RUN: No changes will be made\n");
84
+ }
85
+
86
+ const currentVersion = getCurrentVersion();
87
+ console.log(`Current version: ${currentVersion}`);
88
+
89
+ const messages = getCommitMessages(currentVersion);
90
+ const versionBump = determineVersionBump(messages);
91
+ console.log(`\nDetermined version bump: ${versionBump}`);
92
+
93
+ const newVersion = getNewVersion(currentVersion, versionBump);
94
+ console.log(`New version will be: ${newVersion}`);
95
+
96
+ if (!dryRun) {
97
+ // Update package.json
98
+ const pkg = require("../package.json");
99
+ pkg.version = newVersion;
100
+ fs.writeFileSync(
101
+ path.join(__dirname, "../package.json"),
102
+ JSON.stringify(pkg, null, 2) + "\n",
103
+ );
104
+
105
+ // Create git tag
106
+ execSync(`git tag v${newVersion}`);
107
+ console.log(`\nCreated git tag: v${newVersion}`);
108
+
109
+ // Set output for GitHub Actions
110
+ if (process.env.GITHUB_ACTIONS) {
111
+ fs.appendFileSync(process.env.GITHUB_OUTPUT, `version=v${newVersion}\n`);
112
+ }
113
+ } else {
114
+ console.log("\nDRY RUN: No changes were made");
115
+ }
116
+ };
117
+
118
+ run().catch((err) => {
119
+ console.error("Error:", err.message);
120
+ process.exit(1);
121
+ });
package/vite.config.js CHANGED
@@ -3,6 +3,7 @@ import { defineConfig } from "vite";
3
3
  import createVuePlugin from "@vitejs/plugin-vue";
4
4
  import { execSync } from "child_process";
5
5
  import svgLoader from "vite-svg-loader";
6
+ import { readFileSync } from "fs";
6
7
 
7
8
  process.env.VITE_APP_GIT_HASH = process.env.DOCKER
8
9
  ? ""
@@ -11,6 +12,11 @@ process.env.VITE_APP_GIT_BRANCH = process.env.DOCKER
11
12
  ? ""
12
13
  : execSync("git branch --show-current").toString().trim();
13
14
 
15
+ // Read version from package.json
16
+ const packageJson = JSON.parse(
17
+ readFileSync(resolve(__dirname, "package.json"), "utf-8"),
18
+ );
19
+
14
20
  function getCypressHtmlFiles() {
15
21
  const cypressFolder = resolve(__dirname, "cy");
16
22
  const strings = execSync(`find ${cypressFolder} -name '*.html'`)
@@ -49,6 +55,11 @@ export default defineConfig(({ mode }) => ({
49
55
  }),
50
56
  svgLoader(),
51
57
  ],
58
+ define: {
59
+ "process.env.NODE_ENV": JSON.stringify(mode),
60
+ "process.env.VITE_BUILD_TIME": JSON.stringify(new Date().toISOString()),
61
+ "process.env.VITE_VERSION": JSON.stringify(packageJson.version),
62
+ },
52
63
  test: {
53
64
  // used by vitest: https://vitest.dev/guide/#configuring-vitest
54
65
  environment: "jsdom",
@@ -4,6 +4,12 @@ import { defineConfig } from "vite";
4
4
  import createVuePlugin from "@vitejs/plugin-vue";
5
5
  import cssInjectedByJsPlugin from "vite-plugin-css-injected-by-js";
6
6
  import svgLoader from "vite-svg-loader";
7
+ import { readFileSync } from "fs";
8
+
9
+ // Read version from package.json
10
+ const packageJson = JSON.parse(
11
+ readFileSync(resolve(__dirname, "package.json"), "utf-8"),
12
+ );
7
13
 
8
14
  export default defineConfig({
9
15
  build: {
@@ -57,5 +63,6 @@ export default defineConfig({
57
63
  ],
58
64
  define: {
59
65
  "process.env.NODE_ENV": '"production"',
66
+ "process.env.VITE_VERSION": JSON.stringify(packageJson.version),
60
67
  },
61
68
  });