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 5359258440..d527601e86 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -10,6 +10,9 @@ concurrency: group: ${{ github.workflow }}-${{ github.event.number || github.ref }} cancel-in-progress: true +env: + NX_CLOUD_AUTH_TOKEN: ${{ secrets.NX_CLOUD_AUTH_TOKEN }} + jobs: main: name: Nx Cloud - Main Job @@ -20,9 +23,10 @@ jobs: number-of-agents: 2 parallel-commands: | pnpm exec nx-cloud record -- pnpm exec nx format:check + pnpm e2e:ci 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 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 diff --git a/.github/workflows/sonarcloud.yml b/.github/workflows/sonarcloud.yml deleted file mode 100644 index f40abe6ca6..0000000000 --- a/.github/workflows/sonarcloud.yml +++ /dev/null @@ -1,68 +0,0 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. - -# This workflow helps you trigger a SonarCloud analysis of your code and populates -# GitHub Code Scanning alerts with the vulnerabilities found. -# Free for open source project. - -# 1. Login to SonarCloud.io using your GitHub account - -# 2. Import your project on SonarCloud -# * Add your GitHub organization first, then add your repository as a new project. -# * Please note that many languages are eligible for automatic analysis, -# which means that the analysis will start automatically without the need to set up GitHub Actions. -# * This behavior can be changed in Administration > Analysis Method. -# -# 3. Follow the SonarCloud in-product tutorial -# * a. Copy/paste the Project Key and the Organization Key into the args parameter below -# (You'll find this information in SonarCloud. Click on "Information" at the bottom left) -# -# * b. Generate a new token and add it to your Github repository's secrets using the name SONAR_TOKEN -# (On SonarCloud, click on your avatar on top-right > My account > Security -# or go directly to https://sonarcloud.io/account/security/) - -# Feel free to take a look at our documentation (https://docs.sonarcloud.io/getting-started/github/) -# or reach out to our community forum if you need some help (https://community.sonarsource.com/c/help/sc/9) - -name: SonarCloud analysis - -on: - push: - branches: [ "develop", master ] - pull_request: - branches: [ "develop" ] - workflow_dispatch: - -permissions: - pull-requests: read # allows SonarCloud to decorate PRs with analysis results - -jobs: - Analysis: - runs-on: ubuntu-latest - - steps: - - name: Analyze with SonarCloud - - # You can pin the exact commit or the version. - # uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 - uses: SonarSource/sonarcloud-github-action@de2e56b42aa84d0b1c5b622644ac17e505c9a049 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} # Generate a token on Sonarcloud.io, add it to the secrets of this repo with the name SONAR_TOKEN (Settings > Secrets > Actions > add new repository secret) - with: - # Additional arguments for the sonarcloud scanner - args: - # Unique keys of your project and organization. You can find them in SonarCloud > Information (bottom-left menu) - # mandatory - -Dsonar.projectKey=toeverything_AFFiNE - -Dsonar.organization=toeverything - # Comma-separated paths to directories containing main source files. - #-Dsonar.sources= # optional, default is project base directory - # When you need the analysis to take place in a directory other than the one from which it was launched - #-Dsonar.projectBaseDir= # optional, default is . - # Comma-separated paths to directories containing test source files. - #-Dsonar.tests= # optional. For more info about Code Coverage, please refer to https://docs.sonarcloud.io/enriching/test-coverage/overview/ - # Adds more detail to both client and server-side analysis logs, activating DEBUG mode for the scanner, and adding client-side environment variables and system properties to the server-side log of analysis report processing. - #-Dsonar.verbose= # optional, default is false 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..1b442e1dad --- /dev/null +++ b/apps/ligo-virgo-e2e/cypress.config.ts @@ -0,0 +1,17 @@ +import { defineConfig } from 'cypress'; + +module.exports = defineConfig({ + 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..4362b3e26b --- /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('Doc'); +export const getBoard = () => cy.contains('Board'); 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