diff --git a/.github/workflows/update-browserlist.yml b/.github/workflows/update-browserlist.yml index 3e278a67..efbedd1c 100644 --- a/.github/workflows/update-browserlist.yml +++ b/.github/workflows/update-browserlist.yml @@ -4,6 +4,7 @@ on: branches-ignore: - 'develop' - 'master' + - 'renovate/*' jobs: build: runs-on: ubuntu-latest diff --git a/README.md b/README.md index 11f95a6f..f4136f3a 100644 --- a/README.md +++ b/README.md @@ -47,17 +47,20 @@ Then open http://localhost:8000 ## Setup -[Volta](https://volta.sh) is used for managing node and yarn versions. +Below link will help you making a copy of the repository in your local system. -This project is set up using [Yarn](https://classic.yarnpkg.com/en/docs/getting-started): +https://docs.github.com/en/get-started/quickstart/fork-a-repo -``` -yarn install -``` +## Requirements + +- [volta](https://volta.sh/) to manage node versions. +- [Node.js](https://nodejs.org/en/). `volta install node` +- [yarn](https://yarnpkg.com/) package manager. `volta install yarn` ## Development -``` +```sh +yarn install yarn dev -- --open ``` diff --git a/cypress/e2e/actions.spec.ts b/cypress/e2e/actions.spec.ts index d004e81a..1783c00e 100644 --- a/cypress/e2e/actions.spec.ts +++ b/cypress/e2e/actions.spec.ts @@ -1,4 +1,4 @@ -import { verifyFileSize } from './util'; +import { verifyFileSizeGreaterThan } from './util'; describe('Check actions', () => { beforeEach(() => { cy.clearLocalStorage(); @@ -28,20 +28,20 @@ describe('Check actions', () => { cy.clock(new Date(2022, 0, 1).getTime()); cy.get(`#downloadPNG`).click(); - verifyFileSize('diagram', 'png', 21_000); + verifyFileSizeGreaterThan('diagram', 'png', 21_000); cy.get(`#downloadSVG`).click(); - verifyFileSize('diagram', 'svg', 10_000); + verifyFileSizeGreaterThan('diagram', 'svg', 10_000); // Verify downloaded file is different for different diagrams cy.contains('Sample Diagrams').click(); cy.contains('ER').click(); cy.get(`#downloadPNG`).click(); - verifyFileSize('diagram', 'png', 46_000); + verifyFileSizeGreaterThan('diagram', 'png', 46_000); cy.get(`#downloadSVG`).click(); - verifyFileSize('diagram', 'svg', 12_000); + verifyFileSizeGreaterThan('diagram', 'svg', 11_000); cy.clock().invoke('restore'); }); diff --git a/cypress/e2e/util.ts b/cypress/e2e/util.ts index 6aa17ce5..7d6130a0 100644 --- a/cypress/e2e/util.ts +++ b/cypress/e2e/util.ts @@ -10,7 +10,7 @@ export const getEditor = ({ bottom = true, newline = false } = {}) => const downloadsFolder = Cypress.config('downloadsFolder'); -export const verifyFileSize = ( +export const verifyFileSizeGreaterThan = ( fileType: 'history' | 'diagram', extension: string, size: number @@ -21,7 +21,7 @@ export const verifyFileSize = ( cy.verifyDownload(fileName); cy.readFile(filePath, null, { log: false - }).then((buffer) => expect((buffer as ArrayBuffer).byteLength).to.be.gt(size)); + }).then((buffer: ArrayBuffer) => expect(buffer.byteLength).to.be.gt(size)); cy.task('deleteFile', filePath); }; @@ -36,8 +36,8 @@ export const verifyFileSnapshot = ( cy.verifyDownload(fileName); cy.readFile(filePath, null, { log: false - }).then((buffer) => - expect(new TextDecoder('utf-8').decode(buffer as ArrayBuffer)).to.contain(content) + }).then((buffer: ArrayBuffer) => + expect(new TextDecoder('utf-8').decode(buffer)).to.contain(content) ); cy.task('deleteFile', filePath); }; diff --git a/cypress/tsconfig.json b/cypress/tsconfig.json index ec647435..edd14f8b 100644 --- a/cypress/tsconfig.json +++ b/cypress/tsconfig.json @@ -1,7 +1,7 @@ { "compilerOptions": { "allowJs": true, - "types": ["cypress", "cypress-localstorage-commands", "cy-verify-downloads"] + "types": ["cypress", "cypress-localstorage-commands", "cy-verify-downloads", "node"] }, "include": ["**/*.ts"] } diff --git a/package.json b/package.json index 5b43707b..e1cb4747 100644 --- a/package.json +++ b/package.json @@ -24,13 +24,13 @@ "devDependencies": { "@cypress/snapshot": "2.1.7", "@sveltejs/adapter-static": "1.0.0-next.48", - "@sveltejs/kit": "1.0.0-next.563", + "@sveltejs/kit": "1.0.0-next.571", "@testing-library/jest-dom": "5.16.5", "@testing-library/svelte": "3.2.2", "@types/pako": "2.0.0", "@types/uuid": "8.3.4", - "@typescript-eslint/eslint-plugin": "5.44.0", - "@typescript-eslint/parser": "5.44.0", + "@typescript-eslint/eslint-plugin": "5.45.0", + "@typescript-eslint/parser": "5.45.0", "@vitest/ui": "^0.25.3", "autoprefixer": "^10.4.13", "c8": "7.12.0", @@ -39,20 +39,20 @@ "cy-verify-downloads": "0.1.11", "cypress": "11.2.0", "cypress-localstorage-commands": "2.2.1", - "eslint": "8.28.0", + "eslint": "8.29.0", "eslint-config-prettier": "8.5.0", "eslint-plugin-cypress": "2.12.1", "eslint-plugin-es": "4.1.0", "eslint-plugin-no-only-tests": "^3.1.0", "eslint-plugin-postcss-modules": "2.0.0", "eslint-plugin-svelte3": "4.0.0", - "eslint-plugin-tailwindcss": "3.7.0", + "eslint-plugin-tailwindcss": "3.7.1", "eslint-plugin-vitest": "^0.0.20", "esserializer": "1.3.6", "font-awesome": "^4.7.0", "husky": "^8.0.2", "jsdom": "20.0.3", - "lint-staged": "13.0.4", + "lint-staged": "13.1.0", "node-html-parser": "^6.1.4", "postcss": "^8.4.19", "postcss-load-config": "4.0.1", @@ -67,12 +67,12 @@ "vitest": "^0.25.3" }, "dependencies": { - "@mermaid-js/mermaid-mindmap": "9.2.2", + "@mermaid-js/mermaid-mindmap": "9.3.0", "analytics": "0.8.1", "analytics-plugin-plausible": "0.0.6", "daisyui": "2.42.1", "js-base64": "3.7.3", - "mermaid": "9.2.2", + "mermaid": "9.3.0", "moment": "2.29.4", "monaco-editor": "0.34.1", "monaco-mermaid": "1.0.8", diff --git a/src/lib/components/Card/__snapshots__/card.test.ts.snap b/src/lib/components/Card/__snapshots__/card.test.ts.snap deleted file mode 100644 index c23d7e06..00000000 --- a/src/lib/components/Card/__snapshots__/card.test.ts.snap +++ /dev/null @@ -1,3 +0,0 @@ -// Vitest Snapshot v1 - -exports[`card.svelte > mounts 1`] = `"
TabTest
    title1
    title2
"`; diff --git a/src/lib/components/Card/card.test.ts b/src/lib/components/Card/card.test.ts index 36698822..8fd16961 100644 --- a/src/lib/components/Card/card.test.ts +++ b/src/lib/components/Card/card.test.ts @@ -19,6 +19,5 @@ describe('card.svelte', () => { expect(container).toHaveTextContent('title1'); expect(container).toHaveTextContent('title2'); expect(container).not.toHaveTextContent('title3'); - expect(container.innerHTML).toMatchSnapshot(); }); }); diff --git a/src/routes/edit/+page.svelte b/src/routes/edit/+page.svelte index ae92d28d..c96c305b 100644 --- a/src/routes/edit/+page.svelte +++ b/src/routes/edit/+page.svelte @@ -54,11 +54,12 @@ }; let docURL = docURLBase; let activeTabID = 'code'; + let docKey = ''; stateStore.subscribe(({ code, editorMode }: ValidatedState) => { activeTabID = editorMode; const codeTypeMatch = /([\S]+)[\s\n]/.exec(code); if (codeTypeMatch && codeTypeMatch.length > 1) { - const docKey = codeTypeMatch[1]; + docKey = codeTypeMatch[1]; const docConfig = docMap[docKey] ?? { code: '' }; docURL = docURLBase + (docConfig[editorMode] ?? docConfig.code ?? ''); } @@ -133,7 +134,9 @@ on:click={syncDiagram}> {/if} -