mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-22 12:18:07 +00:00
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
This commit is contained in:
1 parent
ec46571ef5
commit
d142283c3e
4 files changed
+36
-3
No files matched your search
@@ -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:
|
||||
|
||||
```
|
||||
|
||||
@@ -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"
|
||||
}
|
||||
}
|
||||
@@ -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:
|
||||
|
||||
@@ -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"))
|
||||
|
||||
Reference in new issue
Block a user