Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
hugocxl committed Dec 15, 2023
1 parent 8922784 commit 6894361
Show file tree
Hide file tree
Showing 6 changed files with 479 additions and 722 deletions.
14 changes: 5 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,12 @@
"postversion": "git push && git push --tags"
},
"dependencies": {
"@legendapp/state": "^1",
"@legendapp/state": "^2",
"chalk": "^5",
"client-only": "^0",
"next": "^14",
"outdent": "^0",
"react": "^18",
"react-dom": "^18",
"server-only": "^0"
"react-dom": "^18"
},
"devDependencies": {
"@changesets/changelog-github": "^0",
Expand All @@ -51,14 +49,12 @@
"@typescript-eslint/parser": "^6",
"@vitest/coverage-v8": "^0.34.6",
"eslint": "^8",
"eslint-config-next": "^13",
"eslint-config-prettier": "^9",
"husky": "^8",
"lint-staged": "^14",
"lint-staged": "^15",
"prettier": "^3",
"rimraf": "^5",
"tsup": "^7",
"tsup": "^8",
"typescript": "^5",
"vitest": "^0"
"vitest": "^1"
}
}
4 changes: 2 additions & 2 deletions packages/generator/__tests__/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ describe('generate', () => {
expect(output).toMatchInlineSnapshot(`
[
"{
\\"test1\\": \\"value1\\"
"test1": "value1"
}",
"{
\\"test2\\": \\"value2\\"
"test2": "value2"
}",
]
`)
Expand Down
4 changes: 3 additions & 1 deletion packages/react/src/setup.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
// Depedencies
import { observable } from '@legendapp/state'
import { ObservablePersistLocalStorage } from '@legendapp/state/persist-plugins/local-storage'

// Global configuration
import {
configureObservablePersistence,
persistObservable
Expand All @@ -27,7 +29,7 @@ export const setup$ = observable<Setup>()
export const setup = ({ defaultLocale, ...options }: SetupOptions) => {
if (options.persist) {
configureObservablePersistence({
persistLocal: ObservablePersistLocalStorage
pluginLocal: ObservablePersistLocalStorage
})
persistObservable(setup$, {
local: 'locale'
Expand Down
8 changes: 4 additions & 4 deletions packages/ts/__test__/create-ts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ describe('createTs', () => {
world!`

expect(output1).toMatchInlineSnapshot(
'"{\\"id\\":\\"dQxGBP\\",\\"rawMessage\\":\\"Hello world!\\",\\"variables\\":[]}"'
`"{"id":"dQxGBP","rawMessage":"Hello world!","variables":[]}"`
)
expect(output2).toMatchInlineSnapshot(
'"{\\"id\\":\\"gOngMQ\\",\\"rawMessage\\":\\"Hello ${var}!\\",\\"variables\\":[\\"world\\"]}"'
`"{"id":"gOngMQ","rawMessage":"Hello \${var}!","variables":["world"]}"`
)
expect(output3).toMatchInlineSnapshot(
'"{\\"id\\":\\"dQxGBP\\",\\"rawMessage\\":\\"Hello world!\\",\\"variables\\":[]}"'
`"{"id":"dQxGBP","rawMessage":"Hello world!","variables":[]}"`
)
})
test('should create a ts function that admits arguments', () => {
Expand All @@ -34,7 +34,7 @@ describe('createTs', () => {
const output = ts({ context: 'test' })`Hello world!`

expect(output).toMatchInlineSnapshot(
'"{\\"context\\":\\"test\\",\\"id\\":\\"dQxGBP\\",\\"rawMessage\\":\\"Hello world!\\",\\"variables\\":[]}"'
`"{"context":"test","id":"dQxGBP","rawMessage":"Hello world!","variables":[]}"`
)
})
})
10 changes: 5 additions & 5 deletions packages/utils/__tests__/stringify.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ describe('stringify', () => {

expect(output).toMatchInlineSnapshot(`
"{
\\"a\\": 1,
\\"b\\": 2,
\\"c\\": {
\\"d\\": 3,
\\"e\\": 4
"a": 1,
"b": 2,
"c": {
"d": 3,
"e": 4
}
}"
`)
Expand Down
Loading

0 comments on commit 6894361

Please sign in to comment.