Skip to content

Commit

Permalink
chore: updates sveltekit, atelier & vite
Browse files Browse the repository at this point in the history
  • Loading branch information
feugy committed Dec 18, 2022
1 parent ad79e64 commit de2a4cd
Show file tree
Hide file tree
Showing 18 changed files with 879 additions and 587 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Expand Up @@ -5,4 +5,5 @@ dist/
dist-atelier/
node_modules/
scans/
.vercel/
!.storybook/
4 changes: 3 additions & 1 deletion .prettierignore
@@ -1,6 +1,8 @@
coverage/
dist/
dist-atelier/
node_modules/
scans/
.husky/
.svelte-kit
.svelte-kit
.vercel/
2 changes: 2 additions & 0 deletions TODO.md
Expand Up @@ -74,6 +74,8 @@ AssertionError: expected 2nd "spy" call to have been called with [ 'anima' ]

## Refactor

- vitest@0.25.8: issue when loading peer deps, resolve in [next release](https://github.com/vitest-dev/vitest/pull/2463)
- @urql/core@3.1.1: receiveGameListUpdates subscribtion fails because urql's stringification sends the whole games.graphql file instead of the subscription as a payload. This is because [these lines](https://github.com/urql-graphql/urql/pull/2871/files#diff-425e8fcb48a8df1865f99ca1fb981873c6d0ef33ee3856e18f85a8b449bb81b7R41-R42)
- add tests for web/src/utils/peer-connection
- use node 18 when msw/interceptor will [handle it](https://github.com/mswjs/interceptors/pull/283)
- ts-check all the things!
Expand Down
6 changes: 3 additions & 3 deletions apps/cli/package.json
Expand Up @@ -13,19 +13,19 @@
},
"dependencies": {
"@tabulous/cli": "workspace:^0.0.1",
"@urql/core": "^3.0.5",
"@urql/core": "^3.1.1",
"add": "^2.0.6",
"ajv": "^8.11.2",
"arg": "^5.0.2",
"chalk": "^5.1.2",
"chalk": "^5.2.0",
"chalk-template": "^0.4.0",
"dotenv": "^16.0.3",
"es-main": "^1.2.0",
"fast-jwt": "^2.0.2",
"graphql": "^16.6.0",
"lodash.camelcase": "^4.3.0",
"lodash.kebabcase": "^4.1.1",
"undici": "^5.13.0"
"undici": "^5.14.0"
},
"devDependencies": {
"strip-ansi": "^7.0.1"
Expand Down
2 changes: 1 addition & 1 deletion apps/games/package.json
Expand Up @@ -4,6 +4,6 @@
"description": "Tabulous game descriptors and assets",
"type": "module",
"dependencies": {
"@tabulous/server": "workspace:0.0.1"
"@tabulous/server": "workspace:*"
}
}
6 changes: 3 additions & 3 deletions apps/server/package.json
Expand Up @@ -12,7 +12,7 @@
},
"dependencies": {
"@fastify/cors": "^8.2.0",
"@fastify/static": "^6.5.1",
"@fastify/static": "^6.6.0",
"@fastify/websocket": "^7.1.1",
"@isaacs/ttlcache": "^1.2.1",
"ajv": "^8.11.2",
Expand All @@ -25,8 +25,8 @@
"mercurius": "^11.4.0",
"mqemitter-redis": "^5.0.0",
"pino-pretty": "^9.1.1",
"rxjs": "^7.6.0",
"undici": "^5.13.0"
"rxjs": "^7.8.0",
"undici": "^5.14.0"
},
"devDependencies": {
"nodemon": "^2.0.20",
Expand Down
10 changes: 5 additions & 5 deletions apps/server/src/repositories/catalog-items.js
Expand Up @@ -47,14 +47,14 @@ class CatalogItemRepository extends AbstractRepository {
this.models.push(item)
this.modelsByName.set(name, item)
} catch (err) {
/* c8 ignore start */
// ignore folders with no index.js or invalid symbolic links
// vite-node loader (used for tests) has a different error message than node.js
if (
!err.message.includes(`Cannot find module '${descriptor}'`) &&
!err.message.includes(`Failed to load ${descriptor}`)
) {
// Since recently (https://github.com/vitest-dev/vitest/commit/58ee8e9b6300fd6899072e34feb766805be1593c),
// it can not be tested under vitest because an uncatchable rejection will be thrown
if (!err.message.includes(`Cannot find module '${descriptor}'`)) {
throw new Error(`Failed to load game ${entry.name}: ${err.message}`)
}
/* c8 ignore stop */
}
}
}
Expand Down
8 changes: 5 additions & 3 deletions apps/server/tests/repositories/catalog-items.test.js
Expand Up @@ -54,15 +54,17 @@ describe('Catalog Items repository', () => {
).rejects.toThrow('Failed to connect Catalog Items repository')
})

it('throws an invalid game descriptor', async () => {
// Since recently (https://github.com/vitest-dev/vitest/commit/58ee8e9b6300fd6899072e34feb766805be1593c),
// it can not be tested under vitest because an uncatchable rejection will be thrown
it.skip('throws an invalid game descriptor', async () => {
await expect(
catalogItems.connect({
path: join('tests', 'fixtures', 'broken-games')
})
).rejects.toThrow(`Failed to load invalid-package`)
).rejects.toThrow(`Failed to load game broken`)
})

it('handles an folder without game descriptors', async () => {
it.skip('handles an folder without game descriptors', async () => {
await catalogItems.connect({ path: join('tests', 'fixtures') })
expect(await catalogItems.list()).toEqual({
total: 0,
Expand Down
4 changes: 2 additions & 2 deletions apps/server/tests/services/auth/github.test.js
Expand Up @@ -88,7 +88,7 @@ describe('Github authentication service', () => {
return { access_token: token }
})
githubApiMock.intercept({ path: '/user' }).reply(200, req => {
userInvoked(req.headers.authorization)
userInvoked(req.headers.Authorization)
return user
})
const state = githubAuth.storeFinalLocation(location)
Expand Down Expand Up @@ -151,7 +151,7 @@ describe('Github authentication service', () => {
return { access_token: token }
})
githubApiMock.intercept({ path: '/user' }).reply(500, req => {
userInvoked(req.headers.authorization)
userInvoked(req.headers.Authorization)
return 'server error'
})
const state = githubAuth.storeFinalLocation(location)
Expand Down
42 changes: 21 additions & 21 deletions apps/web/package.json
Expand Up @@ -16,30 +16,30 @@
"test:integration:run": "playwright test"
},
"devDependencies": {
"@atelier-wb/svelte": "^0.9.0",
"@atelier-wb/toolshot": "^0.9.0",
"@atelier-wb/vite-plugin-atelier": "^0.9.0",
"@babylonjs/core": "^5.35.1",
"@babylonjs/inspector": "^5.35.1",
"@babylonjs/loaders": "^5.35.1",
"@atelier-wb/svelte": "^0.10.1",
"@atelier-wb/toolshot": "^0.10.1",
"@atelier-wb/vite-plugin-atelier": "^0.10.2",
"@babylonjs/core": "^5.38.0",
"@babylonjs/inspector": "^5.38.0",
"@babylonjs/loaders": "^5.38.0",
"@fastify/cors": "^8.2.0",
"@fastify/static": "^6.5.1",
"@fastify/static": "^6.6.0",
"@fastify/websocket": "^7.1.1",
"@playwright/test": "^1.28.1",
"@playwright/test": "^1.29.0",
"@rollup/plugin-graphql": "^2.0.2",
"@rollup/plugin-yaml": "^4.0.1",
"@sveltejs/adapter-vercel": "^1.0.0-next.84",
"@sveltejs/kit": "^1.0.0-next.571",
"@sveltejs/vite-plugin-svelte": "^1.4.0",
"@sveltejs/adapter-vercel": "^1.0.0",
"@sveltejs/kit": "^1.0.1",
"@sveltejs/vite-plugin-svelte": "^2.0.2",
"@testing-library/dom": "^8.19.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/svelte": "^3.2.2",
"@testing-library/user-event": "^14.4.3",
"@urql/core": "^3.0.5",
"@vitejs/plugin-basic-ssl": "^0.1.2",
"@urql/core": "3.1.0",
"@vitejs/plugin-basic-ssl": "^1.0.1",
"autoprefixer": "^10.4.13",
"babylonjs-gltf2interface": "^5.37.0",
"chalk": "^5.1.2",
"babylonjs-gltf2interface": "^5.38.0",
"chalk": "^5.2.0",
"chalk-template": "^0.4.0",
"cookie": "^0.5.0",
"dotenv": "^16.0.3",
Expand All @@ -57,21 +57,21 @@
"jsdom": "^20.0.3",
"material-design-icons-iconfont": "^6.7.0",
"ms": "^3.0.0-canary.1",
"msw": "^0.49.1",
"postcss": "^8.4.19",
"msw": "^0.49.2",
"postcss": "^8.4.20",
"postcss-import": "^15.0.1",
"postcss-nested": "^6.0.0",
"rfdc": "^1.3.0",
"rollup-plugin-svelte-svg": "^1.0.0-beta.6",
"rxjs": "^7.6.0",
"svelte": "^3.53.1",
"rxjs": "^7.8.0",
"svelte": "^3.55.0",
"svelte-htm": "^1.2.0",
"svelte-intl": "^1.1.4",
"svelte-markdown": "^0.2.3",
"svelte-portal": "^2.2.0",
"v8-to-istanbul": "^9.0.1",
"vite": "^3.2.4",
"vite-plugin-windicss": "^1.8.8",
"vite": "^4.0.1",
"vite-plugin-windicss": "^1.8.10",
"webrtc-adapter": "^8.2.0",
"whatwg-fetch": "^3.6.2",
"wonka": "^6.1.2"
Expand Down
4 changes: 3 additions & 1 deletion apps/web/src/app.html
Expand Up @@ -8,6 +8,8 @@
%sveltekit.head%
</head>

<body>%sveltekit.body%</body>
<body>
%sveltekit.body%
</body>

</html>
Expand Up @@ -2,7 +2,7 @@
import { Dropdown } from '@src/components'
import { gameAssetsUrl } from '@src/utils'
import { _, locale } from 'svelte-intl'
import { findViolations } from './utils'
export let name
Expand All @@ -21,7 +21,7 @@
// when defauling to first option, mutates values
$: if (!value && options.length) {
handleSelection({ detail: options[0] })
setTimeout(() => handleSelection({ detail: options[0] }), 0)
}
function handleSelection({ detail }) {
Expand Down
72 changes: 72 additions & 0 deletions apps/web/tests/components/__snapshots__/Button.tools.shot
@@ -1,5 +1,59 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Empty 1`] = `undefined`;

exports[`Multiple entries 1`] = `
<ol
class="s-x5nEMCoiqeIy"
>
<li
class="s-x5nEMCoiqeIy"
>
<a
class="s-x5nEMCoiqeIy"
href="/"
>
home
</a>
</li>

<li
class="s-x5nEMCoiqeIy"
>
&gt;
</li>

<li
class="s-x5nEMCoiqeIy"
>
<a
class="s-x5nEMCoiqeIy"
href="/account"
>
account
</a>
</li>

<li
class="s-x5nEMCoiqeIy"
>
&gt;
</li>

<li
class="s-x5nEMCoiqeIy"
>
<a
class="s-x5nEMCoiqeIy"
>
details
</a>
</li>


</ol>
`;

exports[`Primary image icon only 1`] = `
<button
class="s-NMyTiX1zi6rz"
Expand Down Expand Up @@ -159,6 +213,24 @@ exports[`Secondary with text and icon 1`] = `
</button>
`;

exports[`Single entry 1`] = `
<ol
class="s-x5nEMCoiqeIy"
>
<li
class="s-x5nEMCoiqeIy"
>
<a
class="s-x5nEMCoiqeIy"
>
home
</a>
</li>


</ol>
`;

exports[`Transparent with text 1`] = `
<button
class="transparent s-NMyTiX1zi6rz"
Expand Down
4 changes: 3 additions & 1 deletion apps/web/tests/routes/(auth)/game/[gameid]/FPSViewer.test.js
Expand Up @@ -7,9 +7,11 @@ import { tick } from 'svelte'
import html from 'svelte-htm'
import { beforeEach, describe, expect, it, vi } from 'vitest'

vi.mock('@src/stores/game-engine', () => {
vi.mock('@src/stores/game-engine', async () => {
const { BehaviorSubject, Subject } = require('rxjs')
const gameEngine = await vi.importActual('@src/stores/game-engine')
return {
...gameEngine,
fps: new BehaviorSubject(),
engine: new BehaviorSubject(),
action: new Subject()
Expand Down

0 comments on commit de2a4cd

Please sign in to comment.