mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
![]() Protobuf 3.15 introduced support for marking scalar fields like uint32 as optional, and all of our tooling appears to support it now. This allows us to use simple optional/null checks in our Rust/ TypeScript code, without having to resort to an inner message. I had to apply a minor patch to protobufjs to get this working with the json-module output; this has also been submitted upstream: https://github.com/protobufjs/protobuf.js/pull/1693 I've modified CardStatsResponse as an example of the new syntax. One thing to note: while the Rust and TypeScript bindings use optional/ null fields, as that is the norm in those languages, Google's Python bindings are not very Pythonic. Referencing an optional field that is missing will yield the default value, and a separate HasField() call is required, eg: ``` >>> from anki.stats_pb2 import CardStatsResponse as R ... msg = R.FromString(b"") ... print(msg.first_review) ... print(msg.HasField("first_review")) 0 False ``` |
||
---|---|---|
.. | ||
card-info | ||
change-notetype | ||
components | ||
congrats | ||
deck-options | ||
domlib | ||
editable | ||
editor | ||
graphs | ||
html-filter | ||
lib | ||
patches | ||
reviewer | ||
sql_format | ||
svelte | ||
sveltelib | ||
.eslintrc.js | ||
.gitignore | ||
BUILD.bazel | ||
compile_sass.bzl | ||
copy.bzl | ||
esbuild.bzl | ||
eslint.bzl | ||
format.sh | ||
generate_page.bzl | ||
jest.bzl | ||
jest.config.js | ||
licenses.json | ||
page.html | ||
prettier.bzl | ||
proto.bzl | ||
protobuf-no-long.js | ||
protobuf.bzl | ||
README.md | ||
tsconfig.json | ||
typescript.bzl | ||
update-licenses.sh | ||
update.sh | ||
vendor.bzl | ||
yarn.sh |
Anki's TypeScript and Sass dependencies. Some TS/JS code is also stored separately in ../qt/aqt/data/web/.
To update all dependencies:
./update.sh
To add a new dev dependency, use something like:
./add.sh -D @rollup/plugin-alias