Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create utility functions for most used lint rules #3107

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
782 commits
Select commit Hold shift + click to select a range
29b0f1e
update package.json
felixhaeberle Aug 27, 2024
4cb0bef
update editMessage test
felixhaeberle Aug 27, 2024
0f16d67
fix: dependencies
samuelstroschein Aug 27, 2024
5190cdf
update editMessage
felixhaeberle Aug 27, 2024
b43ac2d
update message + variants in single transaction
felixhaeberle Aug 27, 2024
928634d
whitespace
felixhaeberle Aug 27, 2024
6d3b366
update editMessage test
felixhaeberle Aug 27, 2024
611bf9c
feat: set lix.currentAuthor to sign changes
NiklasBuchfink Aug 27, 2024
6c28408
refactor: use kysely recommended types
samuelstroschein Aug 27, 2024
20fae1a
Merge pull request #3081 from opral/samuelstroschein/lix-130-serailiz…
samuelstroschein Aug 27, 2024
c5435b7
Merge branch 'lix-integration' of github.com:opral/monorepo into sher…
felixhaeberle Aug 28, 2024
f551ff4
Merge remote-tracking branch 'origin/lix-integration' into paraglide-…
LorisSigrist Aug 28, 2024
c1d985c
Import from `.experimental.json`
LorisSigrist Aug 28, 2024
b6ebc56
update editMessage command
felixhaeberle Aug 28, 2024
fecc052
update extractMessage command to sdk v2
felixhaeberle Aug 28, 2024
ad49063
update jumpToPosition command to sdk v2
felixhaeberle Aug 28, 2024
2951518
update export of IdeExtensionConfig
felixhaeberle Aug 28, 2024
08a695c
introduce new `meta` property on `InlangPlugin` & deprecate `customApi`
felixhaeberle Aug 28, 2024
38973c7
add `IdeExtensionConfig` type
felixhaeberle Aug 28, 2024
b582f66
Bump version
LorisSigrist Aug 28, 2024
0717887
update types
LorisSigrist Aug 28, 2024
fbdb912
fix: author image
NiklasBuchfink Aug 28, 2024
fab25b2
chore: update created to created_at
NiklasBuchfink Aug 28, 2024
f1b6dde
feat: show author in diffs
NiklasBuchfink Aug 28, 2024
1011670
chore: remove pre tags
NiklasBuchfink Aug 28, 2024
1de71f6
fix: conflict rendering
NiklasBuchfink Aug 28, 2024
161e028
feat: cleanup
NilsJacobsen Aug 28, 2024
f75adc9
feat: setup resolveConflict
NiklasBuchfink Aug 28, 2024
4d7201f
work in progress commit
samuelstroschein Aug 28, 2024
75e973a
fix: wrong type
samuelstroschein Aug 28, 2024
c0997f3
refactor: break up `resolveConflict` into multiple functions
samuelstroschein Aug 28, 2024
0061bf0
refactor: use new `resolveConflictBySelecting`
samuelstroschein Aug 28, 2024
e5b4b7a
Merge pull request #3082 from opral/samuelstroschein/lix-132-unbundle…
samuelstroschein Aug 28, 2024
65f7b4a
fix: polling bug
samuelstroschein Aug 28, 2024
89b073a
Refactor extractMessage command to use simplified state retrieval
felixhaeberle Aug 28, 2024
b0c1e23
Refactor messagePreview command
felixhaeberle Aug 28, 2024
927115f
Refactor error messages for unknown expression and pattern element ty…
felixhaeberle Aug 28, 2024
1be58cc
Refactor messagePreview command to simplify state retrieval and error…
felixhaeberle Aug 28, 2024
d327dc2
Refactor previewLocaleCommand to update TODO
felixhaeberle Aug 28, 2024
6f2fbdc
Refactor linterDiagnostics & create TODO to use lix validation rules
felixhaeberle Aug 28, 2024
2efafac
Refactor contextTooltip to use selectBundleNested and update message …
felixhaeberle Aug 28, 2024
23ab560
Refactor contextTooltip to use bundle instead of message in messagePr…
felixhaeberle Aug 28, 2024
a4eab40
Refactor linterDiagnostics to use selectBundleNested for message retr…
felixhaeberle Aug 28, 2024
b986206
Refactor main.ts to import IdeExtensionConfig from @inlang/sdk2
felixhaeberle Aug 28, 2024
7d8bcb1
update types & install prettier
felixhaeberle Aug 28, 2024
62e6c78
fix: serializing null or undefined
samuelstroschein Aug 29, 2024
e49a558
fix: the id of a draft change can't change
samuelstroschein Aug 29, 2024
f3453b0
improve: better error messages
samuelstroschein Aug 29, 2024
b61fa45
improve: use simulated branch
samuelstroschein Aug 29, 2024
e389801
Merge branch 'lix-integration' of github.com:opral/monorepo into nils…
NilsJacobsen Aug 29, 2024
eeebfb7
chore: update pnpm
NilsJacobsen Aug 29, 2024
f0a470c
Merge pull request #3080 from opral/nilsjacobsen/inlmc-141-refactorin…
NilsJacobsen Aug 29, 2024
5067456
Watch files
LorisSigrist Aug 29, 2024
0153a24
update machine translate command to serve new machine translate
felixhaeberle Aug 29, 2024
3719e86
update machien translate rpc call to use the new message schema
felixhaeberle Aug 29, 2024
1a8caa8
update `createVariant` to include raw `Pattern` insert instead of onl…
felixhaeberle Aug 29, 2024
5831c6a
update `createFileSystemMapper` function with new type for `fs` & add…
felixhaeberle Aug 29, 2024
ddc54a3
Note fs functions in createFileSystemMapper to fix TypeScript errors
felixhaeberle Aug 29, 2024
ff68bce
update tests
felixhaeberle Aug 29, 2024
c797677
Update createMessageWebviewProvider to use BundleNested type for bundles
felixhaeberle Aug 29, 2024
671a3e9
Better registry types
LorisSigrist Aug 29, 2024
4c03965
apply dummy id to telemetry until `project.id` is ready
felixhaeberle Aug 29, 2024
5612257
Merge commit 'f0a470c7a2e10113c716eeb8645a10dc98002c8f' into samuelst…
samuelstroschein Aug 29, 2024
9288719
chore: update pnpm-lock
NiklasBuchfink Aug 29, 2024
7838133
update message handling for new sdk v2 schema
felixhaeberle Aug 29, 2024
27e2ab2
update messageView export
felixhaeberle Aug 29, 2024
950e647
update project tests
felixhaeberle Aug 29, 2024
7a2def2
update query tests
felixhaeberle Aug 29, 2024
80a9224
feat: render changes of historyentry
NiklasBuchfink Aug 29, 2024
03795d8
update prettier deps
felixhaeberle Aug 29, 2024
caca69d
Merge branch 'lix-integration' of github.com:opral/monorepo into sher…
felixhaeberle Aug 29, 2024
1e42cbf
fixing remaining message & query tests that build run through
felixhaeberle Aug 29, 2024
ca00887
complete state
samuelstroschein Aug 29, 2024
84d8bda
expose poll query
samuelstroschein Aug 29, 2024
b8f2702
update readme
samuelstroschein Aug 29, 2024
5312b1d
Merge pull request #3083 from opral/samuelstroschein/mesdk-161-reacti…
samuelstroschein Aug 29, 2024
303f1bf
Rename commands
LorisSigrist Aug 30, 2024
57a14db
Merge remote-tracking branch 'origin/lix-integration' into paraglide-…
LorisSigrist Aug 30, 2024
3d6b534
update lock
felixhaeberle Aug 30, 2024
30acc63
Refactor main.ts to register extension components and handle Inlang e…
felixhaeberle Aug 30, 2024
2decb56
Refactor createMessage.ts to handle baseLocale asynchronously
felixhaeberle Aug 30, 2024
9f49e76
Refactor extractMessageCommand to handle baseLocale and plugin retrie…
felixhaeberle Aug 30, 2024
7599041
Refactor previewLocaleCommand to handle asynchronous retrieval of pro…
felixhaeberle Aug 30, 2024
8976545
Refactor contextTooltip to handle asynchronous retrieval of project s…
felixhaeberle Aug 30, 2024
9b8e5d8
Refactor messagePreview to handle asynchronous retrieval of project s…
felixhaeberle Aug 30, 2024
85f225c
Refactor createErrorNodes to handle asynchronous retrieval of project…
felixhaeberle Aug 30, 2024
729ed61
Refactor getPreviewLocale to handle asynchronous retrieval of project…
felixhaeberle Aug 30, 2024
eed9b2b
Refactor createMessageWebviewProvider to handle asynchronous retrieva…
felixhaeberle Aug 30, 2024
9f607a0
Refactor getWebviewContent to handle asynchronous retrieval of projec…
felixhaeberle Aug 30, 2024
0f6d0f9
Refactor getWebviewContent to handle asynchronous retrieval of projec…
felixhaeberle Aug 30, 2024
d162d6a
feat: improve edit variant actions
NilsJacobsen Aug 30, 2024
1b0951d
Usa `project.settings.get()` asynchronously
LorisSigrist Aug 30, 2024
49d57f9
Move `compilerV2` to `compiler`
LorisSigrist Aug 30, 2024
63b4389
Update `init` command
LorisSigrist Aug 30, 2024
1e58209
stash
LorisSigrist Aug 30, 2024
f4ac90c
Merge remote-tracking branch 'origin/lix-integration' into paraglide-…
LorisSigrist Aug 30, 2024
60faf61
update init command
LorisSigrist Aug 30, 2024
774dcc7
use known-good tsconfigs
LorisSigrist Aug 30, 2024
6ac6bdd
Fix build
LorisSigrist Aug 30, 2024
2303fe4
chore: lock pnpm version
samuelstroschein Aug 30, 2024
9a7ef48
chore: allow major updates
samuelstroschein Aug 30, 2024
47d79ba
chore: pin major version of pnpm
samuelstroschein Aug 30, 2024
65330a6
chore: delete list projects
samuelstroschein Aug 30, 2024
4c1c6ad
chore: forgot to remove deleted function from index
samuelstroschein Aug 30, 2024
ea6c913
feat: add foreign keys
samuelstroschein Aug 30, 2024
30601e2
Merge pull request #3084 from opral/mesdk-178-implement-foreign-key-c…
samuelstroschein Aug 30, 2024
881b9af
refactor: default values
samuelstroschein Aug 30, 2024
bb0792c
Merge pull request #3085 from opral/mesdk-199-add-default-values
samuelstroschein Aug 30, 2024
70cd7c9
refactor: `bundleId` -> `humandId`
samuelstroschein Aug 30, 2024
79053af
Merge pull request #3086 from opral/mesdk-197-remove-generatestablebu…
samuelstroschein Aug 30, 2024
1f42df9
add chevron to historyentry
NiklasBuchfink Aug 30, 2024
5c4a759
add unique constraint to file.path
samuelstroschein Aug 30, 2024
7ff982c
Merge branch 'lix-integration' of https://github.com/opral/monorepo i…
samuelstroschein Aug 30, 2024
6fe1e0e
chore: remove console.log
NiklasBuchfink Sep 2, 2024
05a0a10
add missing export
samuelstroschein Sep 2, 2024
e670f70
Merge branch 'lix-integration' of https://github.com/opral/monorepo i…
samuelstroschein Sep 2, 2024
f0bb5d2
fix: only show variant changes in history
NiklasBuchfink Sep 2, 2024
7cb3509
update tests
felixhaeberle Sep 2, 2024
993f4d5
Merge branch 'lix-integration' of github.com:opral/monorepo into lix-…
felixhaeberle Sep 2, 2024
30fe02a
fix: variant display after unbundling of inlang-bundle
NiklasBuchfink Sep 2, 2024
f6329a6
fix: variant display on conflict page
NiklasBuchfink Sep 2, 2024
10bdfb5
chore: remove console.logs
NiklasBuchfink Sep 2, 2024
f19d37a
try to fix extractMessage
felixhaeberle Sep 2, 2024
46efb36
Merge branch 'lix-integration' of github.com:opral/monorepo into lix-…
felixhaeberle Sep 2, 2024
33e6558
fix: deployment by updating engine requirements
NiklasBuchfink Sep 2, 2024
dd6a82c
update more tests
felixhaeberle Sep 2, 2024
699df44
Merge branch 'lix-integration' of github.com:opral/monorepo into lix-…
felixhaeberle Sep 2, 2024
03f11ce
chore: fix type import
samuelstroschein Sep 2, 2024
3545f05
update working tests
felixhaeberle Sep 2, 2024
d0a1f0b
update message tests working
felixhaeberle Sep 2, 2024
889964b
update previewLocaleCommand test works
felixhaeberle Sep 2, 2024
45c14cb
update editMessageCommand test to work
felixhaeberle Sep 2, 2024
80e0386
fix settingsView test working
felixhaeberle Sep 2, 2024
3604a27
remove log
felixhaeberle Sep 2, 2024
d6daeac
update more tests & remove _import in favor of transpileToCjs
felixhaeberle Sep 2, 2024
fec19ca
update lock & tests
felixhaeberle Sep 3, 2024
6965732
chore: fix typo in variable
NilsJacobsen Sep 3, 2024
c33c5c7
chore: fix create Message in sdk2
NilsJacobsen Sep 3, 2024
420e762
chore: update lockfile
samuelstroschein Sep 3, 2024
ec80be3
Merge commit '420e7628f8048c7be97b9c9666b12cca94d8d05c' into lix-inte…
samuelstroschein Sep 3, 2024
5fcd0d5
chore: fix lock files
samuelstroschein Sep 3, 2024
f6b369f
feat: add themed example
NilsJacobsen Sep 4, 2024
c760128
Merge branch 'lix-integration' of github.com:opral/monorepo into lix-…
NilsJacobsen Sep 4, 2024
777bb30
fix: type imports in bundle component
NilsJacobsen Sep 4, 2024
2044e51
chore: update createMessage.test.ts
felixhaeberle Sep 4, 2024
0899585
refactor: remove outdated lix-js/fs dependency
samuelstroschein Sep 4, 2024
aaed8c8
Merge pull request #3088 from opral/parjs-209-remove-lix-fs-from-depe…
samuelstroschein Sep 4, 2024
5961adc
chore: add missing dependency
samuelstroschein Sep 4, 2024
e31a376
chore: update vitest
samuelstroschein Sep 4, 2024
347c8c6
fix: compiling variants
samuelstroschein Sep 4, 2024
c0308b0
Merge pull request #3089 from opral:parjs-214-verify-compiling-of-mes…
samuelstroschein Sep 4, 2024
e947524
update project set & project loading for sdk v2
felixhaeberle Sep 5, 2024
ca5da9a
chore: re-export lix sdk from inlang sdk
samuelstroschein Sep 5, 2024
5be8b49
Merge pull request #3090 from opral:mesdk-206-re-export-lix-sdk-from-…
samuelstroschein Sep 5, 2024
bccf029
fix: createBundle type
samuelstroschein Sep 5, 2024
3996f02
Merge pull request #3091 from opral:mesdk-201-fix-type-issue-with-cre…
samuelstroschein Sep 5, 2024
9d5d9dc
add: id generation for new projects
samuelstroschein Sep 5, 2024
9785c15
add: backwards compatible id generation
samuelstroschein Sep 5, 2024
4572267
Merge pull request #3092 from opral:mesdk-169-project-id-generation
samuelstroschein Sep 5, 2024
75fe4be
chore: add try catch
samuelstroschein Sep 5, 2024
e6bcca8
add: env variable service
samuelstroschein Sep 5, 2024
8609ca4
add: telemetry service
samuelstroschein Sep 5, 2024
012f025
fix: backwards compatibility with lint rules
samuelstroschein Sep 5, 2024
013659d
Merge pull request #3094 from opral:mesdk-212-dont-import-legacy-mess…
samuelstroschein Sep 5, 2024
bc287db
refactor: contain schema logic in `initDb`
samuelstroschein Sep 6, 2024
0a10b9c
Merge branch 'lix-integration' of https://github.com/opral/monorepo i…
samuelstroschein Sep 6, 2024
c632865
add: caching of plugins
samuelstroschein Sep 6, 2024
e71cb1b
chore: remove unused error
samuelstroschein Sep 6, 2024
0cb2f8a
Merge pull request #3095 from opral:mesdk-168-caching-of-modulesplugins
samuelstroschein Sep 6, 2024
f365c40
chore: fix build script
samuelstroschein Sep 6, 2024
187d01b
chore: remove app version from telemetry
samuelstroschein Sep 6, 2024
f304d07
Merge pull request #3093 from opral/mesdk-208-telemetry-inlang-sdk-v2
samuelstroschein Sep 6, 2024
6bcbd00
update project
felixhaeberle Sep 6, 2024
74b902e
Merge branch 'lix-integration' of github.com:opral/monorepo into lix-…
felixhaeberle Sep 6, 2024
5f4e831
add: sentry
samuelstroschein Sep 6, 2024
5f5e09c
chore: add source maps for sentry
samuelstroschein Sep 6, 2024
20cf3ee
Merge remote-tracking branch 'origin/lix-integration' into mesdk-209-…
samuelstroschein Sep 6, 2024
fbc2cd8
Merge pull request #3096 from opral:mesdk-209-set-up-sentry
samuelstroschein Sep 6, 2024
92a8bf7
chore: fix undefined env variables
samuelstroschein Sep 6, 2024
72bfd74
fix: NewVariant type
samuelstroschein Sep 6, 2024
e577a17
refactor: machine translate with support for variants
samuelstroschein Sep 6, 2024
5175993
Merge pull request #3097 from opral:mesdk-195-machine-translate-rpc-w…
samuelstroschein Sep 6, 2024
9b97457
fix: sherlock loading a project
samuelstroschein Sep 6, 2024
25307de
fix: subscribing
samuelstroschein Sep 6, 2024
85b444c
chore: remove unused import
samuelstroschein Sep 6, 2024
a8bbd90
test: add test for error subscriptions
samuelstroschein Sep 6, 2024
0766ce7
chore: remove unused import
samuelstroschein Sep 6, 2024
2e43157
add: legacy import of locale modules
samuelstroschein Sep 6, 2024
a22fbc8
improve: show import errors
samuelstroschein Sep 6, 2024
a0be4cc
Merge pull request #3098 from opral:mesdk-214-loadprojectfromdirector…
samuelstroschein Sep 6, 2024
72b0f3e
fix: plugin api type maybepromise
samuelstroschein Sep 7, 2024
d932e7f
fix: invalid relative paths
samuelstroschein Sep 7, 2024
7669552
chore: enable subscription for message
samuelstroschein Sep 7, 2024
e344bd4
chore: fix await
samuelstroschein Sep 7, 2024
8dec57d
refactor: don't require plugin key
samuelstroschein Sep 7, 2024
b5419e0
chore: move sentry source maps to prepublish
samuelstroschein Sep 7, 2024
988aa28
fix: mapped fs with aboslute paths
samuelstroschein Sep 7, 2024
a59f6ef
test: add missing argument
samuelstroschein Sep 7, 2024
02458ff
Merge pull request #3099 from opral/mesdk-217-fix-cwd-bug-with-plugin…
samuelstroschein Sep 7, 2024
2c4b57f
add: file.metadata
samuelstroschein Sep 9, 2024
1b46c0d
fix: json serialize
samuelstroschein Sep 9, 2024
ea16032
fix: serialization of json in update queries
samuelstroschein Sep 9, 2024
2905bbe
Revert "fix: json serialize"
samuelstroschein Sep 9, 2024
9d02d4a
Merge commit 'ea160327da87881ba695fe38576a5b8766deb340' into mesdk-17…
samuelstroschein Sep 9, 2024
3738f05
improve: add defensive programming
samuelstroschein Sep 9, 2024
f2024e7
improve: remove the plugin key from export files
samuelstroschein Sep 9, 2024
f149006
chore: export withAbsolutePaths for `saveProjectToDirectory`
samuelstroschein Sep 9, 2024
8e83d96
add: save project to directory
samuelstroschein Sep 9, 2024
899fb5e
Merge pull request #3101 from opral/mesdk-176-add-saveprojectfileasdi…
samuelstroschein Sep 9, 2024
d02db04
fix: map the plugin key
samuelstroschein Sep 9, 2024
2a840e9
refactor: remove `project.settled()` from public api
samuelstroschein Sep 9, 2024
9134037
Merge pull request #3102 from opral/mesdk-218-remove-projectsettled
samuelstroschein Sep 9, 2024
132c7bd
fix tests for now
felixhaeberle Sep 9, 2024
e881b29
update messages display for sherlock
felixhaeberle Sep 9, 2024
c25b967
update settings
felixhaeberle Sep 9, 2024
8f07489
remove console.log
felixhaeberle Sep 9, 2024
44d6d0d
update project loading & remove logs
felixhaeberle Sep 9, 2024
f027136
refactor: use jsonb
samuelstroschein Sep 9, 2024
6f37baf
refactor: don't serialize json properties
samuelstroschein Sep 9, 2024
07a0701
chore: delete old file
samuelstroschein Sep 9, 2024
face759
Merge pull request #3103 from opral/mesdk-173-jsonb-instead-of-text-f…
samuelstroschein Sep 10, 2024
bf133bd
chore: remove @inlang/telemetry from dependencies
samuelstroschein Sep 10, 2024
8a38417
chore: remove @inlang/telemetry from dependencies
samuelstroschein Sep 10, 2024
ff31303
chore: remove @inlang/telemetry from dependencies
samuelstroschein Sep 10, 2024
3231a6c
chore: remove @inlang/telemetry and @inlang/env-variables from depend…
samuelstroschein Sep 10, 2024
4f4314d
chore: remove unsued telemetry
samuelstroschein Sep 10, 2024
3b5b01b
chore: remove unused dependency
samuelstroschein Sep 10, 2024
8f5de70
refactor: use vite's env feature
samuelstroschein Sep 10, 2024
3c5d70c
chore: FINK-82 remove deprecated queryHelper
NiklasBuchfink Sep 10, 2024
b88a4b8
update types
felixhaeberle Sep 10, 2024
c51d4fd
Merge branch 'lix-integration' of github.com:opral/monorepo into lix-…
felixhaeberle Sep 10, 2024
684dffc
update FileSystem types for better readability
felixhaeberle Sep 10, 2024
0a4bd92
export Filesystem type from createFileSystemMapper
felixhaeberle Sep 10, 2024
7bc2afe
rework `createNewProjectHandler` & export `saveProjectToDirectory`
felixhaeberle Sep 10, 2024
f37fa7d
Merge pull request #3105 from opral/sherl-95-refactor-createnewprojec…
felixhaeberle Sep 10, 2024
67e5727
update message tab tests
felixhaeberle Sep 10, 2024
a10f1b8
remove git specifics
felixhaeberle Sep 10, 2024
f1c486b
update deps
felixhaeberle Sep 10, 2024
6e3dda2
update main
felixhaeberle Sep 10, 2024
48dbe2d
update machineTranslate
felixhaeberle Sep 10, 2024
b746bf0
hide open in fink for now until we have lix host
felixhaeberle Sep 10, 2024
17b4505
rework file system mapper
felixhaeberle Sep 10, 2024
225cd05
rework new project handler with path
felixhaeberle Sep 10, 2024
9357566
hide open in fink for now until we have lix host
felixhaeberle Sep 10, 2024
7ddd27c
update closest inlang project utility
felixhaeberle Sep 10, 2024
4c5bcdf
update project path deriving & display
felixhaeberle Sep 10, 2024
f43b54f
remove ninja cross-sell
felixhaeberle Sep 10, 2024
a7cd7b0
update recommendation for removed ninja cross-sell
felixhaeberle Sep 10, 2024
2bce435
Merge pull request #3106 from opral/sherl-107-remove-outdated-depende…
felixhaeberle Sep 10, 2024
c91cfca
create lint rules to replace missing inlang sdk / lix functionality
felixhaeberle Sep 10, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 1 addition & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"autoAttachChildProcesses": true,
"skipFiles": ["<node_internals>/**", "**/node_modules/**"],
"program": "${workspaceRoot}/node_modules/vitest/vitest.mjs",
"args": ["dev", "--singleThread=true", "${relativeFile}"],
"args": ["run", "--singleThread=true", "--testTimeout=2000000000", "${relativeFile}"],
"smartStep": true,
"console": "integratedTerminal"
},
Expand All @@ -49,7 +49,6 @@
// change this path to specify what folder should be opened upon running this configuration
"${workspaceFolder}/inlang/development-projects/inlang-nextjs"
],
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/**/*.js",
"${workspaceFolder}/**/*.ts",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
],
"plugin.inlang.i18next": {
"pathPattern": {
"client-page": "./../../app/i18n/locales/{languageTag}/client-page.json",
"footer": "./../../app/i18n/locales/{languageTag}/footer.json",
"second-page": "./../../app/i18n/locales/{languageTag}/second-page.json",
"translation": "./../../app/i18n/locales/{languageTag}/translation.json"
"client-page": "./../app/i18n/locales/{languageTag}/client-page.json",
"footer": "./../app/i18n/locales/{languageTag}/footer.json",
"second-page": "./../app/i18n/locales/{languageTag}/second-page.json",
"translation": "./../app/i18n/locales/{languageTag}/translation.json"
}
},
"experimental": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,21 @@
{
"$schema": "https://inlang.com/schema/project-settings",
"sourceLanguageTag": "en",
"languageTags": [
"en",
"de",
"cz"
],
"modules": [
"./../../source-code/plugins/i18next/dist/index.js",
"./../../source-code/message-lint-rules/emptyPattern/dist/index.js",
"./../../source-code/message-lint-rules/identicalPattern/dist/index.js",
"./../../source-code/message-lint-rules/missingTranslation/dist/index.js",
"./../../source-code/message-lint-rules/messageWithoutSource/dist/index.js"
],
"plugin.inlang.i18next": {
"pathPattern": {
"client-page": "./app/i18n/locales/{languageTag}/client-page.json",
"footer": "./app/i18n/locales/{languageTag}/footer.json",
"second-page": "./app/i18n/locales/{languageTag}/second-page.json",
"translation": "./app/i18n/locales/{languageTag}/translation.json"
},
"variableReferencePattern": [
"{{",
"}}"
]
}
}
"$schema": "https://inlang.com/schema/project-settings",
"sourceLanguageTag": "en",
"languageTags": ["en", "de", "cz"],
"modules": [
"../../source-code/plugins/i18next/dist/index.js",
"../../source-code/message-lint-rules/emptyPattern/dist/index.js",
"../../source-code/message-lint-rules/identicalPattern/dist/index.js",
"../../source-code/message-lint-rules/missingTranslation/dist/index.js",
"../../source-code/message-lint-rules/messageWithoutSource/dist/index.js"
],
"plugin.inlang.i18next": {
"pathPattern": {
"client-page": "./app/i18n/locales/{languageTag}/client-page.json",
"footer": "./app/i18n/locales/{languageTag}/footer.json",
"second-page": "./app/i18n/locales/{languageTag}/second-page.json",
"translation": "./app/i18n/locales/{languageTag}/translation.json"
},
"variableReferencePattern": ["{{", "}}"]
}
}
14 changes: 14 additions & 0 deletions inlang/development-projects/sdk-importer/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { loadProjectFromDirectoryInMemory, selectBundleNested } from "@inlang/sdk2"
import icu1Importer from "@inlang/plugin-icu1"
import fs from "node:fs/promises"
import path from "node:path"

const project = await loadProjectFromDirectoryInMemory({
providePlugins: [icu1Importer],
path: path.join(process.cwd(), "project.inlang"),
fs: fs,
})

// get bundles
const bundles = await selectBundleNested(project.db).selectAll().execute()
console.log(JSON.stringify(bundles, undefined, 2))
3 changes: 3 additions & 0 deletions inlang/development-projects/sdk-importer/messages/de.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"likes": "Du hast {count, plural, one {einen Like} other {{count} Likes}}"
}
3 changes: 3 additions & 0 deletions inlang/development-projects/sdk-importer/messages/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"likes": "You have {count, plural, one {einen Like} other {{count} Likes}}"
}
10 changes: 10 additions & 0 deletions inlang/development-projects/sdk-importer/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"name": "sdk2-importer",
"version": "0.0.1",
"private": true,
"type": "module",
"dependencies": {
"@inlang/sdk2": "workspace:*",
"@inlang/plugin-icu1": "workspace:*"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"baseLocale": "en",
"locales": ["en", "de"],
"modules": ["local:@inlang/icu1-importer"],
"plugin.inlang.icu-messageformat-1": {
"pathPattern": "./messages/{locale}.json"
}
}
9 changes: 9 additions & 0 deletions inlang/development-projects/sdk-importer/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"compilerOptions": {
"module": "ESNext",
"moduleResolution": "Bundler",
"target": "ESNext",
"checkJs": true,
"allowJs": true
}
}
50 changes: 50 additions & 0 deletions inlang/source-code/bundle-component/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "@inlang/bundle-component",
"type": "module",
"version": "0.0.1",
"publishConfig": {
"access": "public"
},
"description": "",
"exports": {
".": "./dist/index.js"
},
"scripts": {
"dev": "tsc --watch",
"build": "tsc",
"test": "tsc --noEmit && vitest run --passWithNoTests --coverage",
"format": "prettier --write **/*.ts",
"storybook": "storybook dev -p 6006"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@nx/storybook": "^18.0.4",
"@storybook/addon-essentials": "^7.6.16",
"@storybook/addon-links": "^7.6.16",
"@storybook/blocks": "^7.6.16",
"@storybook/web-components": "^7.6.16",
"@storybook/web-components-vite": "^7.6.16",
"@types/chroma-js": "^2.4.4",
"@vitest/coverage-v8": "^0.33.0",
"esbuild": "^0.20.0",
"lit": "^3.1.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"storybook": "^7.6.16",
"vitest": "0.33.0"
},
"dependencies": {
"@inlang/sdk2": "workspace:^",
"@lexical/plain-text": "^0.16.1",
"@lexical/utils": "^0.16.1",
"@lit/task": "^1.0.0",
"@shoelace-style/shoelace": "2.14.0",
"@sinclair/typebox": "0.31.28",
"@storybook/preview-api": "^8.2.9",
"chroma-js": "^2.4.2",
"lexical": "^0.16.1",
"typescript": "^5.5.4"
}
}
26 changes: 26 additions & 0 deletions inlang/source-code/bundle-component/src/helper/event.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//generalized event dispatcher

import type { Bundle, Message, Variant } from "@inlang/sdk2"

export type DispatchChangeInterface = {
type: "Bundle" | "Message" | "Variant"
operation: "create" | "update" | "delete"
newData: Bundle | Message | Variant | undefined
meta?: Record<string, any>
}

export const createChangeEvent = (props: DispatchChangeInterface) => {
const onChangeEvent = new CustomEvent("change", {
bubbles: true,
composed: true,
detail: {
argument: {
type: props.type,
operation: props.operation,
newData: props.newData,
meta: props.meta,
},
},
})
return onChangeEvent
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const overridePrimitiveColors = () => {
const appendCSSProperties = (
colorShades: Record<number, string>,
primitive: string,
element: HTMLElement
element: Element
) => {
let textContent = Object.entries(colorShades)
.map(([index, shade]) => `--sl-color-${primitive}-${index}: ${shade} !important;`)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { describe, expect, it } from "vitest"
import patternToString from "./patternToString.js"
import type { Pattern } from "@inlang/sdk2"

describe("patternToString", () => {
it("Should transform pattern to string", () => {
const pattern: Pattern = [
{
type: "text",
value: "Hello, ",
},
{
type: "expression",
arg: {
type: "variable",
name: "name",
},
},
{
type: "text",
value: "!",
},
]

const text = patternToString({ pattern })

const correspondingText = "Hello, {{name}}!"

expect(text).toStrictEqual(correspondingText)
})
})
32 changes: 32 additions & 0 deletions inlang/source-code/bundle-component/src/helper/patternToString.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { Pattern } from "@inlang/sdk2"

/**
* MVP version of the function
*
* Converts a pattern to a string.
* @param props.pattern The pattern to convert to a string.
* @returns The pattern as a string.
*
* @example
* patternToString({ pattern: [{ value: "Hello" }, { type: "expression", arg: { type: "variable", name: "name" } }] }) -> "Hello {{name}}"
*/

const patternToString = (props: { pattern: Pattern }): string => {
if (!props.pattern) {
return ""
}
return props.pattern
.map((p) => {
if ("value" in p) {
return p.value
// @ts-ignore
} else if (p.type === "expression" && p.arg.type === "variable") {
// @ts-ignore
return `{{${p.arg.name}}}`
}
return ""
})
.join("")
}

export default patternToString
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { describe, expect, it } from "vitest"
import stringToPattern from "./stringToPattern.js"
import type { Pattern } from "@inlang/sdk2"

describe("stringToPattern", () => {
it("Should transform string to pattern", () => {
const text = "Hello, {{name}}!"

const pattern = stringToPattern({ text })

const correspondingPattern: Pattern = [
{
type: "text",
value: "Hello, ",
},
{
type: "expression",
arg: {
type: "variable",
name: "name",
},
},
{
type: "text",
value: "!",
},
]
expect(pattern).toStrictEqual(correspondingPattern)
})
})
52 changes: 52 additions & 0 deletions inlang/source-code/bundle-component/src/helper/stringToPattern.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import type { Pattern } from "@inlang/sdk2"

/**
* MVP version of the function
*
* Converts a string to a pattern.
* @param props.text The text to convert to a pattern.
* @returns The pattern of the text.
*
* @example
* stringToPattern({ text: "Hello {{name}}" }) -> [{ value: "Hello" }, { type: "expression", arg: { type: "variable", name: "name" } }]
*/

const stringToPattern = (props: { text: string }): Pattern => {
const pattern: Pattern = []
const regex = /{{(.*?)}}/g
let lastIndex = 0
let match

while ((match = regex.exec(props.text)) !== null) {
// Add text node for text before the variable
if (match.index > lastIndex) {
pattern.push({
type: "text",
value: props.text.slice(lastIndex, match.index),
})
}
// Add variable node
if (match[1]) {
pattern.push({
type: "expression",
arg: {
type: "variable",
name: match[1],
},
})
lastIndex = regex.lastIndex
}
}

// Add remaining text node after the last variable
if (lastIndex < props.text.length) {
pattern.push({
type: "text",
value: props.text.slice(lastIndex),
})
}

return pattern
}

export default stringToPattern
9 changes: 9 additions & 0 deletions inlang/source-code/bundle-component/src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
//main components
export { default as InlangBundle } from "./stories/inlang-bundle.js"
export { default as InlangMessage } from "./stories/message/inlang-message.js"
export { default as InlangVariant } from "./stories/variant/inlang-variant.js"
export { default as InlangPatternEditor } from "./stories/pattern-editor/inlang-pattern-editor.js"

//modals & actions
export { default as InlangBundleAction } from "./stories/actions/bundle-action/inlang-bundle-action.js"
export { default as InlangAddSelector } from "./stories/actions/add-selector/inlang-add-selector.js"
4 changes: 4 additions & 0 deletions inlang/source-code/bundle-component/src/inlang-bundle.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { Meta, Primary, Controls, Story, Canvas, ArgTypes, Source } from '@storybook/blocks';
import * as InlangBundle from './stories/inlang-bundle.stories';

# Inlang Bundle
Loading
Loading