Commit graph

449 commits

Author SHA1 Message Date
Damien Elmes
ad47b68255 add Jest for TS unit tests
@hgiesel the reason no files were being found is because Jest ignores
symlinks by default. The Bazel example includes a patch we can use
to work around it, and Jest plan to add symlink support in a future
update.

https://github.com/bazelbuild/rules_nodejs/blob/stable/examples/jest/patches/jest-haste-map%2B24.9.0.patch

https://github.com/facebook/jest/pull/9351
2021-03-28 19:41:20 +10:00
Henrik Giesel
ac46f6cb27 Utilize ts/tsconfig.js from ts/{editor,html-filter} 2021-03-28 19:41:20 +10:00
Henrik Giesel
d346ae6feb No need to explicitly import from index 2021-03-28 19:41:20 +10:00
Henrik Giesel
722adec915 Satisfy formatter 2021-03-28 19:41:20 +10:00
Henrik Giesel
c99d91c283 Avoid using outerHTML + Fix regression 2021-03-28 19:41:20 +10:00
Henrik Giesel
f432da5af7 Change filter logic in html-filter/element: predicate true, means it stays in 2021-03-28 19:41:20 +10:00
Henrik Giesel
1aefab95f8 Move html-filter into its own directory 2021-03-28 19:41:20 +10:00
Henrik Giesel
127b46d240 Insert break statements into switch 2021-03-28 19:41:20 +10:00
Henrik Giesel
4baa87348e Create htmlFilter{Node,Styling} for better separation of concerns 2021-03-28 19:41:20 +10:00
Henrik Giesel
6822c56e53 Put filterElement logic completely into its own file 2021-03-28 19:41:20 +10:00
Henrik Giesel
a9fa7cd0db Move most of tags allowed to its own file 2021-03-28 19:41:20 +10:00
Henrik Giesel
f4e3a9202f Refactor htmlFilter to use function declarations 2021-03-28 19:41:20 +10:00
Damien Elmes
0edbd3fc4b use relative link to sass file
links relative to workspace root break when invoked from an external
repo
2021-03-28 12:37:21 +10:00
Damien Elmes
3761693be2 add links to pending PRs 2021-03-28 12:32:40 +10:00
Damien Elmes
0b2c3e1c3b fix(esbuild): files not being found when building external repo
An esbuild rule that ran fine in a local repo (eg bazel build //:my_esbuild_rule)
fails when built externally (eg bazel build @other_workspace//:my_esbuild_rule).
By prepending the workspace root to the bin path, the resulting base
URL works correctly in both local and remote repo invocations, allowing
esbuild output to be consumed by a different repo.

This change fixes remote repos in Bazel 4.0.0. 3.7.0 seems to require a
workspace_root.replace("external/", "") call first in order
to get the correct location. So while this patch should not break anything
that was not already broken, it only fixes/adds support for remote repos
in 4.0+.
2021-03-28 11:30:15 +10:00
Damien Elmes
061c7e60fc add esbuild/helpers.bzl in from upstream 2021-03-28 11:12:23 +10:00
Damien Elmes
b8b2be3f9f update $(location ...) in esbuild inject lines 2021-03-28 09:35:46 +10:00
Damien Elmes
7500a2765f support expanding locations in esbuild arguments 2021-03-28 09:35:27 +10:00
Damien Elmes
16632c90df update TS deps 2021-03-27 15:02:02 +10:00
Damien Elmes
125dcee811 remove obsolete comment 2021-03-26 21:47:23 +10:00
Damien Elmes
0006a385e1 allow js to request specific i18n modules
Brings the payload on the congrats page with a non-English language
down from about 150k to 15k
2021-03-26 21:43:36 +10:00
Damien Elmes
5ef9282f9b fix handling of variables that don't match ts naming style 2021-03-26 21:34:24 +10:00
Damien Elmes
00eb89c2ec use singleton + free functions for i18n in ts
This allows for tree shaking, and reduces the congrats page from 150k
with the old enum solution to about 80k.
2021-03-26 20:38:44 +10:00
Damien Elmes
b145b04ddf drop legacy enum from ts/ 2021-03-26 19:26:35 +10:00
Damien Elmes
6cde7ff536 update remaining TR references in ts/ 2021-03-26 19:24:48 +10:00
Damien Elmes
7a7cb7402d update most no-arg TR references in *.svelte 2021-03-26 19:13:30 +10:00
Damien Elmes
1ed1902933 update TR references with args in *.svelte 2021-03-26 19:13:30 +10:00
Damien Elmes
0e50259e6b update TR references with args in *.ts; fix average answer time 2021-03-26 19:10:39 +10:00
Damien Elmes
2ab7a30b7b convert no-arg TR references to method invocations in *.ts 2021-03-26 19:10:27 +10:00
Damien Elmes
efb92d5ee9 generate ts methods for translations 2021-03-26 18:11:58 +10:00
Damien Elmes
0c63a7c8c4 rework translation handling
Instead of generating a fluent.proto file with a giant enum, create
a .json file representing the translations that downstream consumers
can use for code generation.

This enables the generation of a separate method for each translation,
with a docstring that shows the actual text, and any required arguments
listed in the function signature.

The codebase is still using the old enum for now; updating it will need
to come in future commits, and the old enum will need to be kept
around, as add-ons are referencing it.

Other changes:

- move translation code into a separate crate
- store the translations on a per-file/module basis, which will allow
us to avoid sending 1000+ strings on each JS page load in the future
- drop the undocumented support for external .ftl files, that we weren't
using
- duplicate strings in translation files are now checked for at build
time
- fix i18n test failing when run outside Bazel
- drop slog dependency in i18n module
2021-03-26 09:41:32 +10:00
Henrik Giesel
730d75a6c4 Satisfy svelte_check 2021-03-22 15:41:43 +01:00
Henrik Giesel
0a882175e5 Add type signatures to asyncReactive 2021-03-22 15:30:35 +01:00
Henrik Giesel
8bf68ea7ca Satisfy formatter 2021-03-22 15:25:49 +01:00
Henrik Giesel
e973b555f3 Fix asyncReactive detection of loading
- Removed `success` store as it wouldn't work
- We should check for a value in error instead
2021-03-22 15:23:48 +01:00
Henrik Giesel
b52d05431d Partially revert "Make sure RangeBox does not trigger update on stores on creation"
This reverts commit 8232e2f5ed.
2021-03-22 15:11:36 +01:00
Henrik Giesel
12123fc68b Remove assignment to preferencesPromise: getPreferences will only be called once 2021-03-22 04:03:52 +01:00
Henrik Giesel
0368bac9be Move async and asyncReactive to sveltelib
- sveltelib is a lib for component-agnostic svelte utils
2021-03-22 03:06:53 +01:00
Henrik Giesel
c44340e761 Avoid duplicate initial fetching with asyncReactive 2021-03-22 02:58:19 +01:00
Henrik Giesel
8232e2f5ed Make sure RangeBox does not trigger update on stores on creation 2021-03-22 02:50:16 +01:00
Henrik Giesel
8cb7d4a8ad Create search and days writable in GraphsPage to allow browserSearch to work 2021-03-22 02:44:08 +01:00
Henrik Giesel
c7a6665307 Fix syntax error introduced by rebase 2021-03-22 01:44:07 +01:00
Henrik Giesel
1e5bb2f226 Create BrowserSearch component, because we cannot read from stores within slotted content 2021-03-22 01:42:23 +01:00
Henrik Giesel
abdf8a464f Remove pending, and resort to checking for value
- once value is set, it won't be unset
2021-03-22 01:42:23 +01:00
Henrik Giesel
6d2d40472d Use preferencesPromise, as refreshing is handled over stores 2021-03-22 01:42:23 +01:00
Henrik Giesel
4468938dfd Use $-assignments instead of store.set 2021-03-22 01:42:23 +01:00
Henrik Giesel
fbf2c6f6fc Rename search and days to initialSearch and intitialDays in GraphsPage 2021-03-22 01:42:23 +01:00
Henrik Giesel
4ef0b3c977 Get it to work, if you change the input
- there's still an issue on initial load
2021-03-22 01:42:23 +01:00
Henrik Giesel
26d4854502 Compiles with WithGraphData 2021-03-22 01:42:23 +01:00
Henrik Giesel
c6ba8f779e Move Graph-specific html from GraphsPage to Graph.svelte 2021-03-22 01:42:21 +01:00