diff --git a/.github/env/.env.e2e b/.github/env/.env.e2e new file mode 100644 index 0000000000..0c627a684c --- /dev/null +++ b/.github/env/.env.e2e @@ -0,0 +1,2 @@ +NX_LOCAL=true +NX_E2E=true \ No newline at end of file diff --git a/.env.local-dev b/.github/env/.env.local-dev similarity index 100% rename from .env.local-dev rename to .github/env/.env.local-dev diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e1a982e4f1..a49efb4d99 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -2,27 +2,33 @@ name: standard check on: push: - branches: [master] + branches: [ "develop", "master" ] pull_request: - branches: [master] + branches: [ "develop", "master" ] + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true jobs: main: name: Nx Cloud - Main Job - uses: nrwl/ci/.github/workflows/nx-cloud-main.yml@v0.6 + uses: ./.github/workflows/nx-cloud-main.yml secrets: inherit with: - main-branch-name: master - number-of-agents: 3 + main-branch-name: develop +# number-of-agents: 2 parallel-commands: | pnpm exec nx-cloud record -- pnpm exec nx format:check - parallel-commands-on-agents: | - pnpm exec nx affected --target=lint --parallel=3 --exclude=components-common,keck,theme - pnpm exec nx affected --target=build --parallel=3 + pnpm e2e:ci ${{ github.ref == 'refs/heads/develop' && '--record' || '' }} + pnpm exec nx affected --target=lint --parallel=2 --exclude=components-common,keck,theme + pnpm exec nx affected --target=build --parallel=2 +# parallel-commands-on-agents: | +# pnpm exec nx affected --target=lint --parallel=2 --exclude=components-common,keck,theme +# pnpm exec nx affected --target=build --parallel=2 - agents: - name: Nx Cloud - Agents - uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.6 - secrets: inherit - with: - number-of-agents: 3 +# agents: +# name: Nx Cloud - Agents +# uses: nrwl/ci/.github/workflows/nx-cloud-agents.yml@v0.6 +# with: +# number-of-agents: 2 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000..75ff3a8010 --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,72 @@ +# For most projects, this workflow file will not need changing; you simply need +# to commit it to your repository. +# +# You may wish to alter this file to override the set of languages analyzed, +# or to provide custom queries or build logic. +# +# ******** NOTE ******** +# We have attempted to detect the languages in your repository. Please check +# the `language` matrix defined below to confirm you have the correct set of +# supported CodeQL languages. +# +name: "CodeQL" + +on: + push: + branches: [ "develop", master ] + pull_request: + # The branches below must be a subset of the branches above + branches: [ "develop" ] + schedule: + - cron: '27 1 * * 0' + +jobs: + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write + + strategy: + fail-fast: false + matrix: + language: [ 'javascript' ] + # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] + # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + + # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs + # queries: security-extended,security-and-quality + + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v2 + + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun + + # If the Autobuild fails above, remove it and uncomment the following three lines. + # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance. + + # - run: | + # echo "Run, Build Application using script" + # ./location_of_script_within_repo/buildscript.sh + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 diff --git a/.github/workflows/nx-cloud-main.yml b/.github/workflows/nx-cloud-main.yml new file mode 100644 index 0000000000..31fca0fc67 --- /dev/null +++ b/.github/workflows/nx-cloud-main.yml @@ -0,0 +1,300 @@ +name: Nx Cloud Main + +on: + workflow_call: + secrets: + NX_CLOUD_ACCESS_TOKEN: + required: false + NX_CLOUD_AUTH_TOKEN: + required: false + NX_CYPRESS_KEY: + required: false + inputs: + number-of-agents: + required: false + type: number + environment-variables: + required: false + type: string + init-commands: + required: false + type: string + final-commands: + required: false + type: string + parallel-commands: + required: false + type: string + parallel-commands-on-agents: + required: false + type: string + node-version: + required: false + type: string + yarn-version: + required: false + type: string + npm-version: + required: false + type: string + pnpm-version: + required: false + type: string + install-commands: + required: false + type: string + main-branch-name: + required: false + type: string + default: main + runs-on: + required: false + type: string + default: ubuntu-latest + # We needed this input in order to be able to configure out integration tests for this repo, it is not documented + # so as to not cause confusion/add noise, but technically any consumer of the workflow can use it if they want to. + working-directory: + required: false + type: string + +env: + NX_CLOUD_DISTRIBUTED_EXECUTION: true + NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: ${{ inputs.number-of-agents }} + NX_BRANCH: ${{ github.event.number || github.ref_name }} + NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }} + NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} + CYPRESS_RECORD_KEY: ${{ secrets.NX_CYPRESS_KEY }} + +jobs: + main: + runs-on: ${{ inputs.runs-on }} + # The name of the job which will invoke this one is expected to be "Nx Cloud - Main Job", and whatever we call this will be appended + # to that one after a forward slash, so we keep this one intentionally short to produce "Nx Cloud - Main Job / Run" in the Github UI + name: Run + defaults: + run: + working-directory: ${{ inputs.working-directory || github.workspace }} + # Specify shell to help normalize across different operating systems + shell: bash + steps: + - uses: actions/checkout@v2 + name: Checkout [Pull Request] + if: ${{ github.event_name == 'pull_request' }} + with: + # By default, PRs will be checked-out based on the Merge Commit, but we want the actual branch HEAD. + ref: ${{ github.event.pull_request.head.sha }} + # We need to fetch all branches and commits so that Nx affected has a base to compare against. + fetch-depth: 0 + + - uses: actions/checkout@v2 + name: Checkout [Default Branch] + if: ${{ github.event_name != 'pull_request' }} + with: + # We need to fetch all branches and commits so that Nx affected has a base to compare against. + fetch-depth: 0 + + - name: Derive appropriate SHAs for base and head for `nx affected` commands + uses: nrwl/nx-set-shas@v2 + with: + main-branch-name: ${{ inputs.main-branch-name }} + + - name: Detect package manager + id: package_manager + shell: bash + run: | + echo "::set-output name=name::$([[ -f ./yarn.lock ]] && echo "yarn" || ([[ -f ./pnpm-lock.yaml ]] && echo "pnpm") || echo "npm")" + # Set node/npm/yarn versions using volta, with optional overrides provided by the consumer + - uses: volta-cli/action@fdf4cf319494429a105efaa71d0e5ec67f338c6e + with: + node-version: "${{ inputs.node-version }}" + npm-version: "${{ inputs.npm-version }}" + yarn-version: "${{ inputs.yarn-version }}" + + # Install pnpm with exact version provided by consumer or fallback to latest + - name: Install PNPM + if: steps.package_manager.outputs.name == 'pnpm' + uses: pnpm/action-setup@v2.2.1 + with: + version: ${{ inputs.pnpm-version || 'latest' }} + + - name: Print node/npm/yarn versions + id: versions + run: | + node_ver=$( node --version ) + yarn_ver=$( yarn --version || true ) + pnpm_ver=$( pnpm --version || true ) + echo "Node: ${node_ver:1}" + echo "NPM: $( npm --version )" + if [[ $yarn_ver != '' ]]; then echo "Yarn: $yarn_ver"; fi + if [[ $pnpm_ver != '' ]]; then echo "PNPM: $pnpm_ver"; fi + echo "::set-output name=node_version::${node_ver:1}" + - name: Use the node_modules cache if available [npm] + if: steps.package_manager.outputs.name == 'npm' + uses: actions/cache@v2 + with: + path: ~/.npm + key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}- + - name: Use the node_modules cache if available [pnpm] + if: steps.package_manager.outputs.name == 'pnpm' + uses: actions/cache@v2 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}- + - name: Get yarn cache directory path + if: steps.package_manager.outputs.name == 'yarn' + id: yarn-cache-dir-path + run: echo "::set-output name=dir::$(yarn cache dir)" + + - name: Use the node_modules cache if available [yarn] + if: steps.package_manager.outputs.name == 'yarn' + uses: actions/cache@v2 + with: + path: ${{ steps.yarn-cache-dir-path.outputs.dir }} + key: ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-node-${{ steps.versions.outputs.node_version }}-yarn- + - name: Process environment-variables + if: ${{ inputs.environment-variables != '' }} + uses: actions/github-script@v6 + env: + ENV_VARS: ${{ inputs.environment-variables }} + with: + script: | + const { appendFileSync } = require('fs'); + // trim spaces and escape quotes + const cleanStr = str => str + .trim() + .replaceAll(/`/g, "\`"); + // parse variable to correct type + const parseStr = str => + str === 'true' || str === 'TRUE' + ? true + : str === 'false' || str === 'FALSE' + ? false + : isNaN(str) + ? str + : parseFloat(str); + const varsStr = process.env.ENV_VARS || ''; + const vars = varsStr + .split('\n') + .map(variable => variable.trim()) + .filter(variable => variable.indexOf('=') > 0) + .map(variable => ({ + name: cleanStr(variable.split('=')[0]), + value: cleanStr(variable.slice(variable.indexOf('=') + 1)) + })); + for (const v of vars) { + console.log(`Appending environment variable \`${v.name}\` with value \`${v.value}\` to ${process.env.GITHUB_ENV}`); + appendFileSync(process.env.GITHUB_ENV, `${v.name}=${parseStr(v.value)}\n`); + } + - name: Run any configured install-commands + if: ${{ inputs.install-commands != '' }} + run: | + ${{ inputs.install-commands }} + - name: Install dependencies + if: ${{ inputs.install-commands == '' }} + run: | + if [ "${{ steps.package_manager.outputs.name == 'yarn' }}" == "true" ]; then + echo "Running yarn install --frozen-lockfile" + yarn install --frozen-lockfile + elif [ "${{ steps.package_manager.outputs.name == 'pnpm' }}" == "true" ]; then + echo "Running pnpm install --frozen-lockfile" + pnpm install --frozen-lockfile + else + echo "Running npm ci" + npm ci + fi + # An unfortunate side-effect of the way reusable workflows work is that by the time they are pulled into the "caller" + # repo, they are effectively completely embedded in that context. This means that we cannot reference any files which + # are local to this repo which defines the workflow, and we therefore need to work around this by embedding the contents + # of the shell utilities for executing commands into the workflow directly. + - name: Create command utils + uses: actions/github-script@v6 + with: + script: | + const { writeFileSync } = require('fs'); + const runCommandsInParallelScript = ` + # Extract the provided commands from the stringified JSON array. + IFS=$'\n' read -d '' -a userCommands < <((jq -c -r '.[]') <<<"$1") + # Invoke the provided commands in parallel and collect their exit codes. + pids=() + for userCommand in "\${userCommands[@]}"; do + eval "$userCommand" & pids+=($!) + done + # If any one of the invoked commands exited with a non-zero exit code, exit the whole thing with code 1. + for pid in \${pids[*]}; do + if ! wait $pid; then + exit 1 + fi + done + # All the invoked commands must have exited with code zero. + exit 0 + `; + writeFileSync('./.github/workflows/run-commands-in-parallel.sh', runCommandsInParallelScript); + - name: Prepare command utils + # We need to escape the workspace path to be consistent cross-platform: https://github.com/actions/runner/issues/1066 + run: chmod +x ${GITHUB_WORKSPACE//\\//}/.github/workflows/run-commands-in-parallel.sh + + - name: Initialize the Nx Cloud distributed CI run + run: npx nx-cloud start-ci-run + + # The good thing about the multi-line string input for sequential commands is that we can simply forward it on as is to the bash shell and it will behave + # how we want it to in terms of quote escaping, variable assignment etc + - name: Run any configured init-commands sequentially + if: ${{ inputs.init-commands != '' }} + run: | + ${{ inputs.init-commands }} + - name: Process parallel commands configuration + uses: actions/github-script@v6 + id: parallel_commands_config + env: + PARALLEL_COMMANDS: ${{ inputs.parallel-commands }} + PARALLEL_COMMANDS_ON_AGENTS: ${{ inputs.parallel-commands-on-agents }} + with: + # For the ones configured for main, explicitly set NX_CLOUD_DISTRIBUTED_EXECUTION to false, taking into account commands chained with && + # within the strings. In order to properly escape single quotes we need to do some manual replacing and escaping so that the commands + # are forwarded onto the run-commands-in-parallel.sh script appropriately. + script: | + const parallelCommandsOnMainStr = process.env.PARALLEL_COMMANDS || ''; + const parallelCommandsOnAgentsStr = process.env.PARALLEL_COMMANDS_ON_AGENTS || ''; + const parallelCommandsOnMain = parallelCommandsOnMainStr + .split('\n') + .map(command => command.trim()) + .filter(command => command.length > 0) + .map(s => s.replace(/'/g, '%27')); + const parallelCommandsOnAgents = parallelCommandsOnAgentsStr + .split('\n') + .map(command => command.trim()) + .filter(command => command.length > 0) + .map(s => s.replace(/'/g, '%27')); + const formattedArrayOfCommands = [ + ...parallelCommandsOnMain.map(s => s + .split(' && ') + .map(s => `NX_CLOUD_DISTRIBUTED_EXECUTION=false ${s}`) + .join(' && ') + ), + ...parallelCommandsOnAgents, + ]; + const stringifiedEncodedArrayOfCommands = JSON.stringify(formattedArrayOfCommands) + .replace(/%27/g, "'\\''"); + return stringifiedEncodedArrayOfCommands + result-encoding: string + + - name: Run any configured parallel commands on main and agent jobs + # We need to escape the workspace path to be consistent cross-platform: https://github.com/actions/runner/issues/1066 + run: ${GITHUB_WORKSPACE//\\//}/.github/workflows/run-commands-in-parallel.sh '${{ steps.parallel_commands_config.outputs.result }}' + + # The good thing about the multi-line string input for sequential commands is that we can simply forward it on as is to the bash shell and it will behave + # how we want it to in terms of quote escaping, variable assignment etc + - name: Run any configured final-commands sequentially + if: ${{ inputs.final-commands != '' }} + run: | + ${{ inputs.final-commands }} + - name: Stop all running agents for this CI run + # It's important that we always run this step, otherwise in the case of any failures in preceding non-Nx steps, the agents will keep running and waste billable minutes + if: ${{ always() }} + run: npx nx-cloud stop-all-agents \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index 2c3dd39eb0..c3d35c66ff 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,6 +12,7 @@ "cssmodule", "datasource", "fflate", + "fstore", "groq", "howpublished", "immer", diff --git a/README.md b/README.md index 26d85580e3..666d76fabc 100644 --- a/README.md +++ b/README.md @@ -91,11 +91,11 @@ Affine is fully built with web technologies so that consistency and accessibilit # Documentation -AFFiNE is not yet ready for production use. To install, you may check how to build or depoly the AFFiNE in [quick-start](https://affine.gitbook.io/affine/basic-documentation/contribute-to-affine/quick-start). For the full documentation, please view it [here](https://affine.gitbook.io/affine/). +AFFiNE is not yet ready for production use. To install, you may check how to build or deploy the AFFiNE in [quick-start](https://affine.gitbook.io/affine/basic-documentation/contribute-to-affine/quick-start). For the full documentation, please view it [here](https://affine.gitbook.io/affine/). ## Getting Started with development -Please view the path Contribute-to-AFFiNE/Software-Contributions/Quick-Start in documentation. +Please view the path Contribute-to-AFFiNE/Software-Contributions/Quick-Start in the documentation. # Roadmap @@ -129,25 +129,25 @@ That's why we are making AFFiNE. Some of the most important features are: - An always good-to-read, structured docs-form page is the best for your notes, but a boundless doodle surface is better for collaboration and creativity. - Atomic - The basic element of affine are blocks, not pages. - - Blocks can be directly reuse and synced between pages. - - Pages and blocks are searched and organized on the basis of connected graphs, not tree-like paths. + - Blocks can be directly reused and synced between pages. + - Pages and blocks are searched and organized based on connected graphs, not tree-like paths. - Dual-link and semantic search are fully supported. - Collaborative and privacy-first - Data is always stored locally by default - CRDTs are applied so that peer-to-peer collaboration is possible. -We really appreciate the idea of Monday, airtable and notion database. They inspired what we think is right for task management. But we don't like the repeated works -- we don't want to set a todo easily with markdown but end up re-write it again in kanban or other databases. +We really appreciate the idea of Monday, Airtable and Notion databases. They inspired what we think is right for task management. But we don't like the repeated works -- we don't want to set a todo easily with markdown but end up re-write it again in kanban or other databases. With AFFiNE, every block group has infinite views, for you to keep your single source of truth. We would like to give special thanks to the innovators and pioneers who greatly inspired us: - Quip & Notion -- that docs can be organized as blocks -- Taskade & Monday -- brillant multi-demensional tables +- Taskade & Monday -- brilliant multi-dimensional tables - Height & Linear -- beautiful task management tool We would also like to give thanks to open-source projects that make affine possible: -- [Yjs](https://github.com/yjs/yjs) & [Yrs](https://github.com/y-crdt/y-crdt) -- Fundamental support of CRDTs for our implements on state management and data sync. +- [Yjs](https://github.com/yjs/yjs) & [Yrs](https://github.com/y-crdt/y-crdt) -- Fundamental support of CRDTs for our implementation on state management and data sync. - [React](https://github.com/facebook/react) -- View layer support and web GUI framework. - [Rust](https://github.com/rust-lang/rust) -- High performance language that extends the ability and availability of our real-time backend, JWST. - [Fossil](https://www2.fossil-scm.org/home/doc/trunk/www/index.wiki) -- Source code management tool made with CRDTs which inspired our design on block data structure. @@ -155,7 +155,7 @@ We would also like to give thanks to open-source projects that make affine possi - [Jotai](https://github.com/pmndrs/jotai) -- Minimal state management tool for frontend. - [Tldraw](https://github.com/tldraw/tldraw) -- Excellent drawing board. - [MUI](https://github.com/mui/material-ui) -- Our most used graphic UI component library. -- Other [dependancies](https://github.com/toeverything/AFFiNE/network/dependencies) +- Other [dependencies](https://github.com/toeverything/AFFiNE/network/dependencies) Thanks a lot to the community for providing such powerful and simple libraries, so that we can focus more on the implementation of the product logic, and we hope that in the future our projects will also provide a more easy-to-use knowledge base for everyone. diff --git a/apps/keck/package.json b/apps/keck/package.json index d0cc69ceed..d960ea7694 100644 --- a/apps/keck/package.json +++ b/apps/keck/package.json @@ -5,15 +5,15 @@ "author": "DarkSky ", "main": "jest.config.ts", "dependencies": { - "authing-js-sdk": "^4.23.33", - "firebase-admin": "^11.0.0", - "lib0": "^0.2.51", - "lru-cache": "^7.13.0", + "authing-js-sdk": "^4.23.35", + "firebase-admin": "^11.0.1", + "lib0": "^0.2.52", + "lru-cache": "^7.13.2", "nanoid": "^4.0.0", "readable-stream": "^4.1.0", - "ws": "^8.8.0", + "ws": "^8.8.1", "y-protocols": "^1.0.5", - "yjs": "^13.5.39" + "yjs": "^13.5.41" }, "devDependencies": { "@types/readable-stream": "^2.3.13", diff --git a/apps/ligo-virgo-e2e/.eslintrc.json b/apps/ligo-virgo-e2e/.eslintrc.json new file mode 100644 index 0000000000..84a4be82b5 --- /dev/null +++ b/apps/ligo-virgo-e2e/.eslintrc.json @@ -0,0 +1,17 @@ +{ + "extends": ["plugin:cypress/recommended", "../../.eslintrc.json"], + "ignorePatterns": ["!**/*"], + "overrides": [ + { + "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], + "rules": {} + }, + { + "files": ["src/plugins/index.js"], + "rules": { + "@typescript-eslint/no-var-requires": "off", + "no-undef": "off" + } + } + ] +} diff --git a/apps/ligo-virgo-e2e/cypress.config.ts b/apps/ligo-virgo-e2e/cypress.config.ts new file mode 100644 index 0000000000..46bcce8903 --- /dev/null +++ b/apps/ligo-virgo-e2e/cypress.config.ts @@ -0,0 +1,18 @@ +import { defineConfig } from 'cypress'; + +module.exports = defineConfig({ + projectId: 'r1wrqr', + e2e: { + supportFile: './src/support/index.ts', + specPattern: './src/integration', + setupNodeEvents(on, config) { + // implement node event listeners here + }, + }, + fileServerFolder: '.', + fixturesFolder: './src/fixtures', + video: false, + // videosFolder: '../../dist/cypress/apps/ligo-virgo-e2e/videos', + screenshotsFolder: '../../dist/cypress/apps/ligo-virgo-e2e/screenshots', + chromeWebSecurity: false, +}); diff --git a/apps/ligo-virgo-e2e/project.json b/apps/ligo-virgo-e2e/project.json new file mode 100644 index 0000000000..3ddcf56e1c --- /dev/null +++ b/apps/ligo-virgo-e2e/project.json @@ -0,0 +1,28 @@ +{ + "$schema": "../../node_modules/nx/schemas/project-schema.json", + "sourceRoot": "apps/ligo-virgo-e2e/src", + "projectType": "application", + "targets": { + "e2e": { + "executor": "@nrwl/cypress:cypress", + "options": { + "cypressConfig": "apps/ligo-virgo-e2e/cypress.config.ts", + "devServerTarget": "ligo-virgo:serve" + }, + "configurations": { + "production": { + "devServerTarget": "ligo-virgo:serve:production" + } + } + }, + "lint": { + "executor": "@nrwl/linter:eslint", + "outputs": ["{options.outputFile}"], + "options": { + "lintFilePatterns": ["apps/ligo-virgo-e2e/**/*.{js,ts}"] + } + } + }, + "tags": [], + "implicitDependencies": ["ligo-virgo"] +} diff --git a/apps/ligo-virgo-e2e/src/fixtures/example.json b/apps/ligo-virgo-e2e/src/fixtures/example.json new file mode 100644 index 0000000000..b132a94fea --- /dev/null +++ b/apps/ligo-virgo-e2e/src/fixtures/example.json @@ -0,0 +1,4 @@ +{ + "name": "Using fixtures to represent data", + "email": "hello@cypress.io" +} diff --git a/apps/ligo-virgo-e2e/src/integration/app.spec.ts b/apps/ligo-virgo-e2e/src/integration/app.spec.ts new file mode 100644 index 0000000000..651bf215f2 --- /dev/null +++ b/apps/ligo-virgo-e2e/src/integration/app.spec.ts @@ -0,0 +1,14 @@ +import { getTitle, getBoard } from '../support/app.po'; + +describe('ligo-virgo', () => { + beforeEach(() => cy.visit('/')); + + it('basic load check', () => { + getTitle().contains('Get Started with AFFiNE'); + + cy.get('.block_container').contains('The Essentials'); + + getBoard().click(); + cy.get('.tl-inner-div').contains('Graduating'); + }); +}); diff --git a/apps/ligo-virgo-e2e/src/support/app.po.ts b/apps/ligo-virgo-e2e/src/support/app.po.ts new file mode 100644 index 0000000000..c2c78ef1f5 --- /dev/null +++ b/apps/ligo-virgo-e2e/src/support/app.po.ts @@ -0,0 +1,3 @@ +export const getTitle = () => cy.get('span[title]'); +export const getDoc = () => cy.contains('Paper'); +export const getBoard = () => cy.contains('Edgeless'); diff --git a/apps/ligo-virgo-e2e/src/support/commands.ts b/apps/ligo-virgo-e2e/src/support/commands.ts new file mode 100644 index 0000000000..4200179bac --- /dev/null +++ b/apps/ligo-virgo-e2e/src/support/commands.ts @@ -0,0 +1,33 @@ +// *********************************************** +// This example commands.js shows you how to +// create various custom commands and overwrite +// existing commands. +// +// For more comprehensive examples of custom +// commands please read more here: +// https://on.cypress.io/custom-commands +// *********************************************** + +// eslint-disable-next-line @typescript-eslint/no-namespace +declare namespace Cypress { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + interface Chainable { + login(email: string, password: string): void; + } +} +// +// -- This is a parent command -- +Cypress.Commands.add('login', (email, password) => { + console.log('Custom command example: Login', email, password); +}); +// +// -- This is a child command -- +// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... }) +// +// +// -- This is a dual command -- +// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... }) +// +// +// -- This will overwrite an existing command -- +// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... }) diff --git a/apps/ligo-virgo-e2e/src/support/index.ts b/apps/ligo-virgo-e2e/src/support/index.ts new file mode 100644 index 0000000000..3d469a6b6c --- /dev/null +++ b/apps/ligo-virgo-e2e/src/support/index.ts @@ -0,0 +1,17 @@ +// *********************************************************** +// This example support/index.js is processed and +// loaded automatically before your test files. +// +// This is a great place to put global configuration and +// behavior that modifies Cypress. +// +// You can change the location of this file or turn off +// automatically serving support files with the +// 'supportFile' configuration option. +// +// You can read more here: +// https://on.cypress.io/configuration +// *********************************************************** + +// Import commands.js using ES2015 syntax: +import './commands'; diff --git a/apps/ligo-virgo-e2e/tsconfig.json b/apps/ligo-virgo-e2e/tsconfig.json new file mode 100644 index 0000000000..e20e2ba6e4 --- /dev/null +++ b/apps/ligo-virgo-e2e/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "sourceMap": false, + "outDir": "../../dist/out-tsc", + "allowJs": true, + "types": ["cypress", "node"] + }, + "include": ["src/**/*.ts", "src/**/*.js"] +} diff --git a/apps/ligo-virgo/package.json b/apps/ligo-virgo/package.json index 54c68924c5..5bb0d78eaa 100644 --- a/apps/ligo-virgo/package.json +++ b/apps/ligo-virgo/package.json @@ -13,8 +13,8 @@ "@mui/icons-material": "^5.8.4" }, "devDependencies": { - "firebase": "^9.8.4", + "firebase": "^9.9.2", "mini-css-extract-plugin": "^2.6.1", - "webpack": "^5.73.0" + "webpack": "^5.74.0" } } diff --git a/apps/ligo-virgo/project.json b/apps/ligo-virgo/project.json index ad3444c4a4..8412a6e16a 100644 --- a/apps/ligo-virgo/project.json +++ b/apps/ligo-virgo/project.json @@ -48,7 +48,8 @@ "configurations": { "production": { "buildTarget": "ligo-virgo:build:production", - "hmr": false + "hmr": false, + "open": false } } }, diff --git a/apps/ligo-virgo/src/index.html b/apps/ligo-virgo/src/index.html index a5b9fda47a..2d1ed8fb85 100644 --- a/apps/ligo-virgo/src/index.html +++ b/apps/ligo-virgo/src/index.html @@ -4,7 +4,7 @@ - + AFFiNE - All In One Workos