Skip to content

Commit

Permalink
fix: update deps (#214)
Browse files Browse the repository at this point in the history
* fix: deps and code

* fix: remove hooks that slow down development
  • Loading branch information
spaenleh authored Jan 14, 2025
1 parent 440a869 commit 914bef4
Show file tree
Hide file tree
Showing 13 changed files with 2,288 additions and 3,206 deletions.
3 changes: 0 additions & 3 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn commitlint --edit ${1}
8 changes: 0 additions & 8 deletions .husky/post-checkout

This file was deleted.

7 changes: 0 additions & 7 deletions .husky/post-commit
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
#!/bin/sh

# skip hook when in CI
[ -n "$CI" ] && exit 0

. "$(dirname "$0")/_/husky.sh"

git status
4 changes: 0 additions & 4 deletions .husky/post-merge

This file was deleted.

7 changes: 0 additions & 7 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
#!/bin/sh

# skip hook when in CI
[ -n "$CI" ] && exit 0

. "$(dirname "$0")/_/husky.sh"

yarn prettier:check && yarn lint && yarn test
3 changes: 0 additions & 3 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn lint && yarn build
4 changes: 2 additions & 2 deletions cypress/fixtures/appData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const MOCK_APP_DATA: AppData = {
},
},
},
member: CURRENT_MEMBER,
account: CURRENT_MEMBER,
creator: CURRENT_MEMBER,
item: MOCK_SERVER_ITEM,
createdAt: new Date('2020-01-01').toISOString(),
Expand All @@ -44,7 +44,7 @@ export const MOCK_STUDENT_APP_DATA: AppData = {
},
},
},
member: MEMBERS.BOB,
account: MEMBERS.BOB,
creator: MEMBERS.BOB,
item: MOCK_SERVER_ITEM,
createdAt: new Date('2020-01-01').toISOString(),
Expand Down
5 changes: 3 additions & 2 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/// <reference types="../../src/window" />
import { Database, LocalContext } from '@graasp/apps-query-client';
import { Database } from '@graasp/apps-query-client';
import { LocalContext } from '@graasp/sdk';

import { CURRENT_MEMBER, MEMBERS } from '../fixtures/members';
import { MOCK_SERVER_ITEM } from '../fixtures/mockItem';
Expand All @@ -26,7 +27,7 @@ Cypress.Commands.add('setUpApi', (database, appContext, errors) => {
win.indexedDB.deleteDatabase('graasp-app-cypress');
// eslint-disable-next-line no-param-reassign
win.appContext = {
memberId: CURRENT_MEMBER.id,
accountId: CURRENT_MEMBER.id,
itemId: MOCK_SERVER_ITEM.id,
apiHost: Cypress.env('VITE_API_HOST'),
...appContext,
Expand Down
83 changes: 41 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,16 @@
},
"type": "module",
"dependencies": {
"@emotion/react": "11.11.4",
"@emotion/styled": "11.11.5",
"@graasp/apps-query-client": "3.4.15",
"@emotion/react": "11.14.0",
"@emotion/styled": "11.14.0",
"@graasp/apps-query-client": "3.7.3",
"@graasp/sdk": "^5.6.0",
"@graasp/ui": "4.19.3",
"@mui/icons-material": "5.15.20",
"@mui/lab": "5.0.0-alpha.170",
"@mui/material": "5.15.20",
"@sentry/react": "~8.36.0",
"@graasp/stylis-plugin-rtl": "^2.2.0",
"@graasp/ui": "5.4.7",
"@mui/icons-material": "6.3.1",
"@mui/lab": "6.0.0-beta.22",
"@mui/material": "6.3.1",
"@sentry/react": "~8.48.0",
"@tanstack/react-query": "4.36.1",
"@uppy/core": "3.13.0",
"@uppy/dashboard": "3.9.0",
Expand All @@ -33,21 +34,22 @@
"@uppy/progress-bar": "3.1.1",
"@uppy/react": "3.4.0",
"@uppy/xhr-upload": "3.6.7",
"date-fns": "^4.1.0",
"file-saver": "~2.0.5",
"i18next": "~23.11.5",
"i18next": "~24.2.1",
"jszip": "~3.10.1",
"lodash.isobject": "~3.0.2",
"lodash.isstring": "~4.0.1",
"qs": "6.12.1",
"lucide-react": "^0.471.0",
"qs": "6.13.1",
"react": "18.3.1",
"react-dom": "18.3.1",
"react-i18next": "14.1.2",
"react-router-dom": "6.24.0",
"react-toastify": "10.0.5",
"stylis-plugin-rtl": "^2.1.1",
"tss-react": "4.9.10",
"uuid": "^10.0.0",
"vitest": "^1.6.0"
"react-i18next": "14.1.3",
"react-router-dom": "6.28.1",
"react-toastify": "11.0.2",
"tss-react": "4.9.14",
"uuid": "^11.0.5",
"vitest": "^2.1.8"
},
"scripts": {
"dev": "yarn vite",
Expand All @@ -73,28 +75,28 @@
"cov:report": "open ./coverage/lcov-report/index.html"
},
"devDependencies": {
"@commitlint/cli": "19.3.0",
"@commitlint/config-conventional": "19.2.2",
"@cypress/code-coverage": "3.12.39",
"@commitlint/cli": "19.6.1",
"@commitlint/config-conventional": "19.6.0",
"@cypress/code-coverage": "3.13.10",
"@cypress/instrument-cra": "1.4.0",
"@tanstack/react-query-devtools": "4.36.1",
"@trivago/prettier-plugin-sort-imports": "4.3.0",
"@trivago/prettier-plugin-sort-imports": "5.2.1",
"@types/file-saver": "^2.0.7",
"@types/i18n": "0.13.12",
"@types/jest": "^29.5.12",
"@types/jest": "^29.5.14",
"@types/lodash.isobject": "3.0.9",
"@types/lodash.isstring": "4.0.9",
"@types/node": "^20.14.9",
"@types/react": "18.3.3",
"@types/react-dom": "18.3.0",
"@types/node": "^22.10.5",
"@types/react": "18.3.18",
"@types/react-dom": "18.3.5",
"@types/uuid": "^10.0.0",
"@typescript-eslint/eslint-plugin": "7.14.1",
"@typescript-eslint/parser": "7.14.1",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/browser": "^1.6.0",
"concurrently": "8.2.2",
"@typescript-eslint/eslint-plugin": "8.19.1",
"@typescript-eslint/parser": "8.19.1",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/browser": "^2.1.8",
"concurrently": "9.1.2",
"cross-env": "7.0.3",
"cypress": "13.12.0",
"cypress": "13.17.0",
"cypress-file-upload": "5.0.8",
"env-cmd": "10.1.0",
"eslint": "^8.57.0",
Expand All @@ -109,16 +111,16 @@
"eslint-plugin-prettier": "5.1.3",
"eslint-plugin-react": "7.34.3",
"eslint-plugin-react-hooks": "~4.6.2",
"husky": "~9.0.11",
"npm-run-all2": "6.2.0",
"nyc": "17.0.0",
"prettier": "3.3.2",
"husky": "~9.1.7",
"npm-run-all2": "6.2.6",
"nyc": "17.1.0",
"prettier": "3.4.2",
"standard-version": "9.5.0",
"typescript": "5.5.2",
"vite": "^5.3.1",
"vite-plugin-checker": "^0.6.4",
"typescript": "5.7.3",
"vite": "^6.0.7",
"vite-plugin-checker": "^0.8.0",
"vite-plugin-istanbul": "^6.0.2",
"wait-on": "7.2.0"
"wait-on": "8.0.2"
},
"release": {
"analyzeCommits": "conventional"
Expand All @@ -129,9 +131,6 @@
"not ie <= 11",
"not op_mini all"
],
"resolutions": {
"@graasp/sdk": "3.4.1"
},
"packageManager": "yarn@4.3.1",
"nyc": {
"all": true,
Expand Down
14 changes: 5 additions & 9 deletions src/components/common/AppDataRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,21 @@ const AppDataRow = ({
}: AppDataRowProps): JSX.Element => {
const { t } = useTranslation();
const context = useLocalContext();
const { permission, memberId } = context;
const { permission, accountId } = context;
const {
member: { id: dataMemberId },
account: { id: dataMemberId },
visibility,
} = data;

const username = member?.name || t('Anonymous');
const username = member?.name ?? t('Anonymous');

const renderActions = (): JSX.Element[] => {
// const { visibility } = data;
const actions: JSX.Element[] = [];
// show if app data is from authenticated member
// or if has at least write permission
if (
dataMemberId === memberId ||
PermissionLevelCompare.gte(
permission as PermissionLevel,
PermissionLevel.Write,
)
dataMemberId === accountId ||
PermissionLevelCompare.gte(permission, PermissionLevel.Write)
) {
actions.push(<FileDownloadButton data={data} key="download" />);
actions.push(<DeleteAppDataButton data={data} key="delete" />);
Expand Down
2 changes: 1 addition & 1 deletion src/components/common/AppDataTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ const AppDataTable: FC<AppDataTableProps> = ({ showMember }) => {
key={a.id}
data={a}
showMember={showMember}
member={members.find(({ id }) => id === a.member.id)}
member={members.find(({ id }) => id === a.account.id)}
/>
))
)}
Expand Down
21 changes: 14 additions & 7 deletions src/data/db.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import type { Database, LocalContext } from '@graasp/apps-query-client';
import type { Database } from '@graasp/apps-query-client';
import {
AccountType,
AppDataVisibility,
AppItemType,
CompleteMember,
Context,
ItemType,
MemberType,
LocalContext,
PermissionLevel,
} from '@graasp/sdk';

Expand All @@ -19,18 +20,20 @@ export const mockContext: LocalContext = {
permission: PermissionLevel.Admin,
context: Context.Builder,
itemId: '1234-1234-123456-8123-123456',
memberId: 'mock-member-id',
accountId: 'mock-member-id',
};

export const mockMembers: CompleteMember[] = [
{
id: mockContext.memberId || '',
id: mockContext.accountId || '',
name: 'current-member',
email: 'current@graasp.org',
extra: {},
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
type: MemberType.Individual,
type: AccountType.Individual,
enableSaveActions: true,
isValidated: true,
},
{
id: 'mock-member-id-2',
Expand All @@ -39,7 +42,9 @@ export const mockMembers: CompleteMember[] = [
extra: {},
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
type: MemberType.Individual,
type: AccountType.Individual,
enableSaveActions: true,
isValidated: true,
},
];

Expand All @@ -58,6 +63,7 @@ const mockItem: AppItemType = {
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString(),
type: ItemType.APP,
lang: 'en',
};

const now = new Date().toISOString();
Expand All @@ -75,12 +81,13 @@ const buildDatabase = (members?: CompleteMember[]): Database => ({
createdAt: now,
updatedAt: now,
creator: mockMembers[0],
member: mockMembers[0],
account: mockMembers[0],
item: mockItem,
visibility: AppDataVisibility.Member,
},
],
appActions: [],
uploadedFiles: [],
members: members ?? mockMembers,
appSettings: [],
items: [mockItem],
Expand Down
Loading

0 comments on commit 914bef4

Please sign in to comment.