diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile deleted file mode 100644 index d261fd54c..000000000 --- a/.devcontainer/Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -# See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/typescript-node/.devcontainer/base.Dockerfile - -# [Choice] Node.js version: 14, 12, 10 -ARG VARIANT="14-buster" -FROM mcr.microsoft.com/vscode/devcontainers/typescript-node:0-${VARIANT} - -RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg -RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null - -RUN apt-get update && DEBIAN_FRONTEND=non-interactive apt-get install gh jq -y \ No newline at end of file diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json deleted file mode 100644 index d59b9dd88..000000000 --- a/.devcontainer/devcontainer.json +++ /dev/null @@ -1,29 +0,0 @@ -// For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: -// https://github.com/microsoft/vscode-dev-containers/tree/v0.158.0/containers/typescript-node -{ - "name": "Node.js & TypeScript", - "build": { - "dockerfile": "Dockerfile", - // Update 'VARIANT' to pick a Node version: 10, 12, 14 - "args": { - "VARIANT": "14" - } - }, - - // Set *default* container specific settings.json values on container create. - "settings": { - "terminal.integrated.shell.linux": "/bin/bash" - }, - - // Add the IDs of extensions you want installed when the container is created. - "extensions": ["dbaeumer.vscode-eslint", "esbenp.prettier-vscode"], - - // Use 'forwardPorts' to make a list of ports inside the container available locally. - "forwardPorts": [9009], - - // Use 'postCreateCommand' to run commands after the container is created. - "postCreateCommand": "./.devcontainer/run.sh", - - // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. - "remoteUser": "node" -} diff --git a/.github/workflows/beta.js.yml b/.github/workflows/beta.js.yml deleted file mode 100644 index 601dd44fa..000000000 --- a/.github/workflows/beta.js.yml +++ /dev/null @@ -1,68 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Beta CI - -on: - push: - tags: - - "v*-*" - -jobs: - publish-core: - defaults: - run: - working-directory: ./packages/core - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - name: Build - run: npm install && npm run build - working-directory: . - - uses: JS-DevTools/npm-publish@v1 - with: - token: ${{ secrets.NPM_TOKEN }} - access: public - tag: beta - package: ./packages/core/package.json - publish-cells: - defaults: - run: - working-directory: ./packages/cells - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - name: Build - run: npm install && npm run build - working-directory: . - - uses: JS-DevTools/npm-publish@v1 - with: - token: ${{ secrets.NPM_TOKEN }} - access: public - tag: beta - package: ./packages/cells/package.json - publish-source: - defaults: - run: - working-directory: ./packages/source - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - name: Bootstrap - run: npm install && npm run build - working-directory: . - - uses: JS-DevTools/npm-publish@v1 - with: - token: ${{ secrets.NPM_TOKEN }} - access: public - tag: beta - package: ./packages/source/package.json diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 930984d43..000000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,36 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Build - -on: push - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js 16 - uses: actions/setup-node@v1 - with: - node-version: 16 - - run: npm install - - run: npm run build - - run: npm run test -- --coverage - - run: npm run test-source - - run: npm run test-projects - - name: Coveralls - uses: coverallsapp/github-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - path-to-lcov: ./packages/core/coverage/lcov.info - base-path: ./packages/core - test-react-18: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - run: npm install - - run: npm run test-18 diff --git a/.github/workflows/release.js.yml b/.github/workflows/release.js.yml deleted file mode 100644 index 0babc82a0..000000000 --- a/.github/workflows/release.js.yml +++ /dev/null @@ -1,66 +0,0 @@ -# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node -# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions - -name: Release CI - -on: - push: - tags: - - "v*" - - "!v*-*" - -jobs: - publish-core: - defaults: - run: - working-directory: ./packages/core - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - name: Bootstrap - run: npm install && npm run build - working-directory: . - - uses: JS-DevTools/npm-publish@v1 - with: - token: ${{ secrets.NPM_TOKEN }} - access: public - package: ./packages/core/package.json - publish-cells: - defaults: - run: - working-directory: ./packages/cells - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - name: Bootstrap - run: npm install && npm run build - working-directory: . - - uses: JS-DevTools/npm-publish@v1 - with: - token: ${{ secrets.NPM_TOKEN }} - access: public - package: ./packages/cells/package.json - publish-source: - defaults: - run: - working-directory: ./packages/source - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v1 - - uses: actions/setup-node@v1 - with: - node-version: 16 - - name: Bootstrap - run: npm install && npm run build - working-directory: . - - uses: JS-DevTools/npm-publish@v1 - with: - token: ${{ secrets.NPM_TOKEN }} - access: public - package: ./packages/source/package.json diff --git a/.github/workflows/storybook.js.yml b/.github/workflows/storybook.js.yml deleted file mode 100644 index 83a6d4df1..000000000 --- a/.github/workflows/storybook.js.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Storybook Build and Deploy -on: - push: - branches: ["main"] - paths: ["packages/core/**", "packages/cells/**", "packages/source/**"] -jobs: - build-and-deploy: - runs-on: ubuntu-latest - steps: - - name: Checkout 🛎️ - uses: actions/checkout@v2.3.1 - with: - persist-credentials: false - - uses: actions/setup-node@v1 - with: - node-version: 16 - - name: Install and Build 🔧 - run: | - npm install - npm run build-storybook - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@3.6.2 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH: gh-pages - FOLDER: storybook-build - CLEAN: true - TARGET_FOLDER: docs diff --git a/.gitignore b/.gitignore index 44c33dea5..092b76dcb 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,10 @@ node_modules* .idea .cache pubsub-debug.log -storybook-build/ +public/ coverage/ *.tsbuildinfo -**/docs/* \ No newline at end of file +**/docs/* +/test-results/ +/playwright-report/ +/playwright/.cache/ diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 000000000..714e76b64 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,169 @@ +variables: + npm_config_cache: "$CI_PROJECT_DIR/.npm" + NPM_CONFIG_USERCONFIG: "${ADOBE_NPMRC_V7}" + +default: + image: "docker-wf-dev.dr-uw2.adobeitc.com/core-platform/gitlab-runner-node16:latest" + before_script: + - git config --global user.name $JARVIS_NAME + - git config --global user.email $JARVIS_EMAIL + - npm ci + cache: + key: "$CI_COMMIT_REF_SLUG" + paths: + - .cache + policy: pull + +stages: + - build + - validate + - review + - publish + +warm_cache: + stage: .pre + interruptible: true + cache: + key: "$CI_COMMIT_REF_SLUG" + paths: + - .cache + policy: pull-push + script: + - echo "Warmed cache for further jobs. Yay!" + rules: + - if: $CI_MERGE_REQUEST_ID + - when: never + +.build-job-template: &build_job_definition + stage: build + interruptible: true + rules: + - if: $CI_MERGE_REQUEST_ID + when: on_success + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH + when: on_success + - when: never + +build: + <<: *build_job_definition + script: + - npm run build + artifacts: + paths: + - packages/core/dist/ + - packages/cells/dist/ + - packages/source/dist/ + +pages: + stage: "publish" + script: + - npm run build-storybook + - 'echo "Deploying storybook to GitLab pages..."' + rules: + - if: $CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH + +.test-job-template: &test_job_definition + needs: ["warm_cache"] + stage: validate + interruptible: true + rules: + - if: $CI_MERGE_REQUEST_ID + - when: never + +lint: + <<: *test_job_definition + script: + - npm run lint + +test: + <<: *test_job_definition + script: + - npm run test --ci --no-interactive + +test-18: + <<: *test_job_definition + script: + - npm run test-18 --ci --no-interactive + +test-e2e: + <<: *test_job_definition + image: "mcr.microsoft.com/playwright:v1.35.1-focal" + script: + - npm run test:e2e + artifacts: + when: always + paths: + - test-results + - playwright-report + expire_in: 2 day + +build-storybook: + stage: validate + script: + - npm run build-storybook + artifacts: + paths: + - public + rules: + - if: $CI_MERGE_REQUEST_ID + - when: never + +review: + stage: review + script: + - ./deploy/deploy.sh + environment: + name: review/$CI_COMMIT_REF_NAME + url: http://phoenix.workfront.tech/review/$CI_PROJECT_ID/$CI_COMMIT_REF_NAME/index.html + on_stop: stop_review + needs: + - job: build-storybook + optional: true + dependencies: + - build-storybook + rules: + - if: $CI_MERGE_REQUEST_ID + - when: never + allow_failure: true + +stop_review: + stage: review + script: + - ./deploy/cleanup-review.sh + environment: + name: review/$CI_COMMIT_REF_NAME + action: stop + dependencies: [] + rules: + - if: $CI_MERGE_REQUEST_ID + when: manual + allow_failure: true + +publish: + stage: publish + needs: + - job: build + artifacts: true + interruptible: false + rules: + - if: "$CI_COMMIT_REF_NAME == $CI_DEFAULT_BRANCH && $CI_MERGE_REQUEST_IID == null" + when: on_success + - when: never + script: + - git remote set-url origin git@${CI_SERVER_HOST}:${CI_PROJECT_PATH} + - git checkout -B ${CI_COMMIT_REF_NAME} + - npm install standard-version -g + - 'standard-version --bumpFiles package.json package-lock.json ./packages/*/package.json --no-verify --releaseCommitMessageFormat "chore: {{currentTag}}"' + - npm publish --workspaces + - git push --follow-tags origin ${CI_COMMIT_REF_NAME} -o ci.skip + +include: + - project: "devtools/reusable-jobs" + ref: main + file: "/templates/jobs/commitlint.yml" + +commitlint: + stage: .pre + extends: .commitlint + before_script: + - "" diff --git a/.husky/pre-commit b/.husky/pre-commit new file mode 100755 index 000000000..c387ad146 --- /dev/null +++ b/.husky/pre-commit @@ -0,0 +1,6 @@ +#!/usr/bin/env sh +. "$(dirname -- "$0")/_/husky.sh" + +npm run lint +npm run format +npm run test --onlyChanged diff --git a/.npmrc b/.npmrc index e9ee3cb4d..521a9f7c0 100644 --- a/.npmrc +++ b/.npmrc @@ -1 +1 @@ -legacy-peer-deps=true \ No newline at end of file +legacy-peer-deps=true diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 000000000..c06ce541a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,11 @@ +.idea/ +dist/ +coverage/ +.yarn +.nyc_output/ +node_modules/ +npm-debug.log +yarn-error.log +test_results*.xml +*.iml +public/ \ No newline at end of file diff --git a/.storybook/assets/image-40x40.jpg b/.storybook/assets/image-40x40.jpg new file mode 100644 index 000000000..87b4ca16e Binary files /dev/null and b/.storybook/assets/image-40x40.jpg differ diff --git a/.storybook/assets/image-900x900.jpg b/.storybook/assets/image-900x900.jpg new file mode 100644 index 000000000..43a04b6ee Binary files /dev/null and b/.storybook/assets/image-900x900.jpg differ diff --git a/.storybook/main.js b/.storybook/main.js index 48c5c36d6..73decc57a 100644 --- a/.storybook/main.js +++ b/.storybook/main.js @@ -3,6 +3,7 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin"); module.exports = { stories: ["../**/src/**/*.stories.tsx"], addons: ["@storybook/addon-controls"], + staticDirs: [{ from: "./assets/", to: "/assets" }], core: { builder: "webpack5", }, diff --git a/.storybook/manager.js b/.storybook/manager.js index 17d3de9cb..7049bcb4e 100644 --- a/.storybook/manager.js +++ b/.storybook/manager.js @@ -4,8 +4,6 @@ import { themes, create } from "@storybook/theming"; const glideTheme = create({ base: "dark", brandTitle: "Glide Data Grid", - brandUrl: "https://grid.glideapps.com", - brandImage: "https://res.cloudinary.com/glide/image/upload/c_scale,w_45/v1634058004/glidehq/glide-transparent.png", }); addons.setConfig({ diff --git a/.storybook/preview-body.html b/.storybook/preview-body.html index a60dadff6..02c89ff17 100644 --- a/.storybook/preview-body.html +++ b/.storybook/preview-body.html @@ -1 +1 @@ -
\ No newline at end of file +
diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html index f84c3ee41..13285513d 100644 --- a/.storybook/preview-head.html +++ b/.storybook/preview-head.html @@ -1,6 +1,6 @@ - - - + + + + + S Alert 18 N + + `; + }, + info: () => { + return ` + + + + S InfoOutline 18 N + + `; + }, + }} + onCellContextMenu={(_, e) => e.preventDefault()} + onCellEdited={setCellValue} + onColumnResize={onColumnResize} + rows={1000} + /> + + ); +}; +(HeaderSorting as any).parameters = { + options: { + showPanel: false, + }, +}; + export const CustomHeaderIcons: React.VFC = () => { const { cols, getCellContent, onColumnResize, setCellValue } = useAllMockedKinds(); @@ -2389,100 +2766,6 @@ export const RightElement: React.VFC = () => { }, }; -let num: number = 1; -function rand(): number { - return (num = (num * 16_807) % 2_147_483_647); -} - -export const RapidUpdates: React.VFC = () => { - const { cols, getCellContent, setCellValueRaw, getCellsForSelection } = useMockDataGenerator(100); - - const ref = React.useRef(null); - - const countRef = React.useRef(0); - const displayCountRef = React.useRef(null); - - React.useEffect(() => { - let rafID = 0; - - const sendUpdate = () => { - const cells: { - cell: Item; - }[] = []; - const now = performance.now(); - for (let x = 0; x < 5000; x++) { - const col = Math.max(10, rand() % 100); - const row = rand() % 10_000; - - setCellValueRaw([col, row], { - kind: GridCellKind.Text, - data: x.toString(), - displayData: `${x}k`, - themeOverride: - x % 5 !== 0 - ? { - bgCell: "#f2fff4", - textDark: "#00d41c", - } - : { - bgCell: "#fff6f6", - textDark: "#d40000", - }, - allowOverlay: true, - lastUpdated: now, - }); - cells.push({ cell: [col, row] }); - } - countRef.current += 5000; - if (displayCountRef.current !== null) { - displayCountRef.current.textContent = `${countRef.current}`; - } - - ref.current?.updateCells(cells); - - rafID = window.requestAnimationFrame(sendUpdate); - }; - - sendUpdate(); - - return () => { - cancelAnimationFrame(rafID); - }; - }, [setCellValueRaw]); - - return ( - - - Data grid can support many thousands of updates per seconds. The data grid can easily update - data faster than a human can read it, more importantly the faster the data grid can update, the - more time your code can spend doing more valuable work. - - - Updates processed: We could do this faster but we wrote a - really crappy data store for this demo which is actually slowing down the data grid. - - - }> - - - ); -}; -(RapidUpdates as any).parameters = { - options: { - showPanel: false, - }, -}; - export const CopySupport: React.VFC = () => { const { cols, getCellContent, onColumnResize, setCellValue, getCellsForSelection } = useMockDataGenerator( 10, @@ -2501,7 +2784,13 @@ export const CopySupport: React.VFC = () => { The data is copied into a format ready to be pasted into Excel or Google Sheets