From d142283c3edacd70798e78d079de8abef56079ea Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Wed, 11 Nov 2026 13:47:04 +0000 Subject: [PATCH] types: typescript is a development dependency (#8124) * ci: a change of the types package.json releases the types * types: typescript is a development dependency, not installed with the types --- docs/contributing/RELEASES.md | 4 ++++ .../types/typescript/package.json | 2 +- scripts/ci/packages_release.py | 14 ++++++++++++-- scripts/ci/test_packages_release.py | 19 +++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/docs/contributing/RELEASES.md b/docs/contributing/RELEASES.md index f627f424d6..d7e7599fbc 100644 --- a/docs/contributing/RELEASES.md +++ b/docs/contributing/RELEASES.md @@ -16,6 +16,10 @@ Add-on sources: - `packages/simplex-chat-nodejs/cpp/` - `node-addon-api` version in `devDependencies` of `packages/simplex-chat-nodejs/package.json` +Types sources, compared with the previous library release of the branch: +- `packages/simplex-chat-client/types/typescript/src/` +- `packages/simplex-chat-client/types/typescript/package.json`, except `version` and `simplexChatCore`, which a library release writes + Release states in simplex-chat-libs: ``` diff --git a/packages/simplex-chat-client/types/typescript/package.json b/packages/simplex-chat-client/types/typescript/package.json index 5cb9b957f4..1f7da2e61f 100644 --- a/packages/simplex-chat-client/types/typescript/package.json +++ b/packages/simplex-chat-client/types/typescript/package.json @@ -37,7 +37,7 @@ "url": "https://github.com/simplex-chat/simplex-chat/issues" }, "homepage": "https://github.com/simplex-chat/simplex-chat/tree/stable/packages/simplex-chat-client/types/typescript#readme", - "dependencies": { + "devDependencies": { "typescript": "^5.9.2" } } diff --git a/scripts/ci/packages_release.py b/scripts/ci/packages_release.py index ba1efd81eb..842432daab 100644 --- a/scripts/ci/packages_release.py +++ b/scripts/ci/packages_release.py @@ -94,6 +94,7 @@ SCOPE_CHANGES = { CABAL_FILE = "simplex-chat.cabal" CABAL_VERSION = re.compile(r"^(version:\s*)(\S+)", re.M) TYPES_SOURCES = [f"{TYPES_DIR}/src"] +TYPES_RELEASE_FIELDS = ["version", "simplexChatCore"] TYPES_README = f"{TYPES_DIR}/README.md" TYPES_README_CORE = re.compile(r"^SimpleX Chat core: .*$", re.M) PYTHON_TYPES_SOURCES = [f"{PYTHON_DIR}/src/simplex_chat/types"] @@ -710,10 +711,19 @@ def npm_package(directory: str, releases: dict) -> Package: ) +def types_manifest(commit: str) -> dict: + """package.json of the types at the commit, without the fields that core-release writes.""" + types = json.loads(git("show", f"{commit}:{TYPES_DIR}/package.json")) + return {key: value for key, value in types.items() if key not in TYPES_RELEASE_FIELDS} + + def types_changed(releases: dict, branch: str) -> bool: - """Whether the types sources differ from those of the previous core release on the branch.""" + """Whether the types sources or their package.json differ from those of the previous core release on the branch.""" previous = previous_core_commit(releases, branch) - return previous is None or changed_since(fetch_commit(previous), TYPES_SOURCES) + if previous is None: + return True + fetch_commit(previous) + return changed_since(previous, TYPES_SOURCES) or types_manifest(previous) != types_manifest("HEAD") def types_problem(version: str, releases: dict, branch: str) -> str | None: diff --git a/scripts/ci/test_packages_release.py b/scripts/ci/test_packages_release.py index 7fd918a6c8..8c8a5c054a 100644 --- a/scripts/ci/test_packages_release.py +++ b/scripts/ci/test_packages_release.py @@ -889,6 +889,25 @@ class CoreReleaseTest(GitRepoTest): self.assertIn("version: 7.1.0.12\n", self.read(CABAL_FILE)) self.assertEqual((self.types()["version"], self.types()["simplexChatCore"]), ("0.12.1", "7.1.0.11")) + def test_changed_types_manifest_gets_a_new_version_for_the_core(self): + types = self.types() + self.write(f"{TYPES_DIR}/package.json", json.dumps({**types, "dependencies": {"typescript": "^5.9.2"}}, indent=2) + "\n") + self.commit("types with a runtime dependency") + self.releases = {"core": {"master": {"7.1.0.11": self.head()}}} + self.write(f"{TYPES_DIR}/package.json", json.dumps({**types, "devDependencies": {"typescript": "^5.9.2"}}, indent=2) + "\n") + self.commit("types dependency moved") + self.release("7.1.0.12") + self.assertEqual((self.types()["version"], self.types()["simplexChatCore"]), ("0.12.2", "7.1.0.12")) + self.assertIn("SimpleX Chat core: 7.1.0.12\n", self.read(TYPES_README)) + + def test_release_fields_and_layout_of_the_types_manifest_are_not_a_types_change(self): + reordered = {"simplexChatCore": "7.1.0.12", "version": "0.12.5", "name": "@simplex-chat/types"} + self.write(f"{TYPES_DIR}/package.json", json.dumps(reordered)) + self.commit("release fields and layout") + self.release("7.1.0.12") + self.assertEqual(self.types(), reordered) + self.assertIn("SimpleX Chat core: 7.1.0.11\n", self.read(TYPES_README)) + def test_requested_types_version_wins(self): self.release("7.1.0.12", "7.1.0-beta.6.1") self.assertEqual((self.types()["version"], self.types()["simplexChatCore"]), ("7.1.0-beta.6.1", "7.1.0.12"))